From 02c2b532e7efada029cc06657f70dc24c2164c71 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 2 Jul 2012 16:20:10 -0400 Subject: [PATCH] add vm::maintenance event for mwi change --- src/mod/applications/mod_voicemail/mod_voicemail.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index d3438aacfc..de44945e8e 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -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); }