<p>sungtae kim has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7494">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Add new AMI action for app_voicemail<br><br>Currently, to figure out specified voicemail's status, there's only one<br>way to do it, which is use a VoicemailUserEntry AMI message.<br>But it consumed it too much resource(it check everything).<br>So, added new AMI action.<br><br>ASTERISK-27470<br><br>Change-Id: Ie4eba1424a142e5fbd1d9fb1821a3fc1a1e238b7<br>---<br>M apps/app_voicemail.c<br>1 file changed, 129 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/94/7494/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c<br>index d017301..a2c8237 100644<br>--- a/apps/app_voicemail.c<br>+++ b/apps/app_voicemail.c<br>@@ -13258,6 +13258,133 @@<br> return RESULT_SUCCESS;<br> }<br> <br>+static int manager_status_voicemail_user(struct mansession *s, const struct message *m)<br>+{<br>+ struct ast_vm_user *vmu = NULL;<br>+ const char *id = astman_get_header(m, "ActionID");<br>+ char actionid[128];<br>+ struct ast_vm_user svm;<br>+ int new, old;<br>+<br>+ const char *context = astman_get_header(m, "Context");<br>+ const char *mailbox = astman_get_header(m, "Mailbox");<br>+<br>+ if ((ast_strlen_zero(context) || ast_strlen_zero(mailbox))) {<br>+ astman_send_error(s, m, "Need 'Context' and 'Mailbox' parameters.");<br>+ return 0;<br>+ }<br>+<br>+ actionid[0] = '\0';<br>+ if (!ast_strlen_zero(id)) {<br>+ snprintf(actionid, sizeof(actionid), "ActionID: %s\r\n", id);<br>+ }<br>+<br>+ AST_LIST_LOCK(&users);<br>+<br>+ // no any voicemail user<br>+ if (AST_LIST_EMPTY(&users)) {<br>+ astman_send_ack(s, m, "There are no voicemail user currently defined.");<br>+ AST_LIST_UNLOCK(&users);<br>+ return RESULT_SUCCESS;<br>+ }<br>+<br>+ // find user<br>+ memset(&svm, 0, sizeof(svm));<br>+ vmu = find_user(&svm, context, mailbox);<br>+ if (!vmu) {<br>+ // could not find it<br>+ astman_send_ack(s, m, "There are no voicemail user of given info.");<br>+ AST_LIST_UNLOCK(&users);<br>+ return RESULT_SUCCESS;<br>+ }<br>+<br>+ astman_send_listack(s, m, "Voicemail user detail will follow", "start");<br>+<br>+ // get mailbox count<br>+ inboxcount(vmu->mailbox, &new, &old);<br>+<br>+ astman_append(s,<br>+ "Event: VoicemailUserDetail\r\n"<br>+ "%s"<br>+ "VMContext: %s\r\n"<br>+ "VoiceMailbox: %s\r\n"<br>+ "Fullname: %s\r\n"<br>+ "Email: %s\r\n"<br>+ "Pager: %s\r\n"<br>+ "ServerEmail: %s\r\n"<br>+ "FromString: %s\r\n"<br>+ "MailCommand: %s\r\n"<br>+ "Language: %s\r\n"<br>+ "TimeZone: %s\r\n"<br>+ "Callback: %s\r\n"<br>+ "Dialout: %s\r\n"<br>+ "UniqueID: %s\r\n"<br>+ "ExitContext: %s\r\n"<br>+ "SayDurationMinimum: %d\r\n"<br>+ "SayEnvelope: %s\r\n"<br>+ "SayCID: %s\r\n"<br>+ "AttachMessage: %s\r\n"<br>+ "AttachmentFormat: %s\r\n"<br>+ "DeleteMessage: %s\r\n"<br>+ "VolumeGain: %.2f\r\n"<br>+ "CanReview: %s\r\n"<br>+ "CallOperator: %s\r\n"<br>+ "MaxMessageCount: %d\r\n"<br>+ "MaxMessageLength: %d\r\n"<br>+ "NewMessageCount: %d\r\n"<br>+ "OldMessageCount: %d\r\n"<br>+#ifdef IMAP_STORAGE<br>+ "IMAPUser: %s\r\n"<br>+ "IMAPServer: %s\r\n"<br>+ "IMAPPort: %s\r\n"<br>+ "IMAPFlags: %s\r\n"<br>+#endif<br>+ "\r\n",<br>+ actionid,<br>+ vmu->context,<br>+ vmu->mailbox,<br>+ vmu->fullname,<br>+ vmu->email,<br>+ vmu->pager,<br>+ ast_strlen_zero(vmu->serveremail) ? serveremail : vmu->serveremail,<br>+ ast_strlen_zero(vmu->fromstring) ? fromstring : vmu->fromstring,<br>+ mailcmd,<br>+ vmu->language,<br>+ vmu->zonetag,<br>+ vmu->callback,<br>+ vmu->dialout,<br>+ vmu->uniqueid,<br>+ vmu->exit,<br>+ vmu->saydurationm,<br>+ ast_test_flag(vmu, VM_ENVELOPE) ? "Yes" : "No",<br>+ ast_test_flag(vmu, VM_SAYCID) ? "Yes" : "No",<br>+ ast_test_flag(vmu, VM_ATTACH) ? "Yes" : "No",<br>+ vmu->attachfmt,<br>+ ast_test_flag(vmu, VM_DELETE) ? "Yes" : "No",<br>+ vmu->volgain,<br>+ ast_test_flag(vmu, VM_REVIEW) ? "Yes" : "No",<br>+ ast_test_flag(vmu, VM_OPERATOR) ? "Yes" : "No",<br>+ vmu->maxmsg,<br>+ vmu->maxsecs,<br>+ new,<br>+ old<br>+#ifdef IMAP_STORAGE<br>+ ,<br>+ vmu->imapuser,<br>+ vmu->imapserver,<br>+ vmu->imapport,<br>+ vmu->imapflags<br>+#endif<br>+ );<br>+<br>+ astman_send_list_complete_start(s, m, "VoicemailUserDetailComplete", 1);<br>+ astman_send_list_complete_end(s);<br>+<br>+ AST_LIST_UNLOCK(&users);<br>+<br>+ return RESULT_SUCCESS;<br>+}<br>+<br> /*! \brief Manager list voicemail users command */<br> static int manager_list_voicemail_users(struct mansession *s, const struct message *m)<br> {<br>@@ -14891,6 +15018,7 @@<br> res |= ast_custom_function_unregister(&mailbox_exists_acf);<br> res |= ast_custom_function_unregister(&vm_info_acf);<br> res |= ast_manager_unregister("VoicemailUsersList");<br>+ res |= ast_manager_unregister("VoicemailUserStatus");<br> res |= ast_manager_unregister("VoicemailRefresh");<br> #ifdef TEST_FRAMEWORK<br> res |= AST_TEST_UNREGISTER(test_voicemail_vmsayname);<br>@@ -14968,6 +15096,7 @@<br> res |= ast_custom_function_register(&mailbox_exists_acf);<br> res |= ast_custom_function_register(&vm_info_acf);<br> res |= ast_manager_register_xml("VoicemailUsersList", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, manager_list_voicemail_users);<br>+ res |= ast_manager_register_xml("VoicemailUserStatus", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, manager_status_voicemail_user);<br> res |= ast_manager_register_xml("VoicemailRefresh", EVENT_FLAG_USER, manager_voicemail_refresh);<br> #ifdef TEST_FRAMEWORK<br> res |= AST_TEST_REGISTER(test_voicemail_vmsayname);<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7494">change 7494</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/7494"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ie4eba1424a142e5fbd1d9fb1821a3fc1a1e238b7 </div>
<div style="display:none"> Gerrit-Change-Number: 7494 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: sungtae kim <pchero21@gmail.com> </div>