add vm::maintenance event for mwi change

This commit is contained in:
Michael Jerris 2012-07-02 16:20:10 -04:00
parent 87eeaac629
commit 02c2b532e7
1 changed files with 13 additions and 0 deletions

View File

@ -1815,6 +1815,7 @@ static void update_mwi(vm_profile_t *profile, const char *id, const char *domain
int total_new_urgent_messages = 0;
int total_saved_urgent_messages = 0;
switch_event_t *event;
switch_event_t *message_event;
message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages, &total_new_urgent_messages,
&total_saved_urgent_messages);
@ -1831,6 +1832,18 @@ static void update_mwi(vm_profile_t *profile, const char *id, const char *domain
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)", total_new_messages, total_saved_messages,
total_new_urgent_messages, total_saved_urgent_messages);
switch_event_fire(&event);
switch_event_create_subclass(&message_event, SWITCH_EVENT_CUSTOM, VM_EVENT_MAINT);
switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-Action", "mwi-update");
switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-User", id);
switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-Domain", domain_name);
switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Total-New", "%d", total_new_messages);
switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Total-Saved", "%d", total_saved_messages);
switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Total-New-Urgent", "%d", total_new_urgent_messages);
switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Total-Saved-Urgent", "%d", total_saved_urgent_messages);
switch_event_fire(&message_event);
}