]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add vm::maintenance event for mwi change
authorMichael Jerris <mike@jerris.com>
Mon, 2 Jul 2012 20:20:10 +0000 (16:20 -0400)
committerMichael Jerris <mike@jerris.com>
Mon, 2 Jul 2012 20:22:36 +0000 (16:22 -0400)
src/mod/applications/mod_voicemail/mod_voicemail.c

index d3438aacfc5a3c901d0f6248b996381a2685f1b1..de44945e8e892f23cbd90fc93e8469337f66f3e9 100644 (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);
 }