diff -r dd5de3b5fe9a apps/app_voicemail.c
--- a/apps/app_voicemail.c Tue May 22 11:39:29 2012 -0600
+++ b/apps/app_voicemail.c Wed May 23 15:21:35 2012 -0600
@@ -369,6 +369,21 @@
+
+
+ Refresh the voicemail count in a given voicemail box.
+
+
+
+ The mailbox to be refresh. Given as <mailbox>@<context>
+
+
+
+ The main purpose of this function is to inform devices of messages
+ that have been added or removed through some mechanim outside of asterisk
+ so they can update their message waiting indicator.
+
+
***/
#ifdef IMAP_STORAGE
@@ -11714,6 +11729,21 @@
poll_thread = AST_PTHREADT_NULL;
}
+static int manager_refresh_voicemail(struct mansession *s, const struct message *m)
+{
+ int new = 0, old = 0, urgent = 0;
+
+ char *mailbox = astman_get_header(m, "Mailbox");
+ inboxcount2(mailbox, &urgent, &new, &old);
+
+ queue_mwi_event(mailbox, urgent, new, old);
+ run_externnotify(NULL, mailbox, NULL);
+
+ astman_append(s, "Response: Success\r\n\r\n"); /* Properly terminate Manager output */
+
+ return RESULT_SUCCESS;
+}
+
/*! \brief Manager list voicemail users command */
static int manager_list_voicemail_users(struct mansession *s, const struct message *m)
{
@@ -13151,6 +13181,7 @@
res |= ast_unregister_application(sayname_app);
res |= ast_custom_function_unregister(&mailbox_exists_acf);
res |= ast_manager_unregister("VoicemailUsersList");
+ res |= ast_manager_unregister("RefreshVoicemail");
res |= ast_data_unregister(NULL);
#ifdef TEST_FRAMEWORK
res |= AST_TEST_UNREGISTER(test_voicemail_vmsayname);
@@ -13202,6 +13233,7 @@
res |= ast_register_application_xml(sayname_app, vmsayname_exec);
res |= ast_custom_function_register(&mailbox_exists_acf);
res |= ast_manager_register_xml("VoicemailUsersList", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, manager_list_voicemail_users);
+ res |= ast_manager_register_xml("RefreshVoicemail", 0, manager_refresh_voicemail);
#ifdef TEST_FRAMEWORK
res |= AST_TEST_REGISTER(test_voicemail_vmsayname);
res |= AST_TEST_REGISTER(test_voicemail_msgcount);