Merge "app_voicemail: Remove MessageExists and MESSAGE_EXISTS()"

pull/18/head
Friendly Automation 5 years ago committed by Gerrit Code Review
commit 95c6fbeae0

@ -246,38 +246,6 @@
<ref type="application">VoiceMail</ref>
</see-also>
</application>
<application name="MailboxExists" language="en_US">
<synopsis>
Check to see if Voicemail mailbox exists.
</synopsis>
<syntax>
<parameter name="mailbox" required="true" argsep="@">
<argument name="mailbox" required="true" />
<argument name="context" />
</parameter>
<parameter name="options">
<para>None options.</para>
</parameter>
</syntax>
<description>
<note><para>DEPRECATED. Use VM_INFO(mailbox[@context],exists) instead.</para></note>
<para>Check to see if the specified <replaceable>mailbox</replaceable> exists. If no voicemail
<replaceable>context</replaceable> is specified, the <literal>default</literal> context
will be used.</para>
<para>This application will set the following channel variable upon completion:</para>
<variablelist>
<variable name="VMBOXEXISTSSTATUS">
<para>This will contain the status of the execution of the MailboxExists application.
Possible values include:</para>
<value name="SUCCESS" />
<value name="FAILED" />
</variable>
</variablelist>
</description>
<see-also>
<ref type="function">VM_INFO</ref>
</see-also>
</application>
<application name="VMAuthenticate" language="en_US">
<synopsis>
Authenticate with Voicemail passwords.
@ -349,24 +317,6 @@
argument to this application. If no context is provided, <literal>default</literal> is assumed.</para>
</description>
</application>
<function name="MAILBOX_EXISTS" language="en_US">
<synopsis>
Tell if a mailbox is configured.
</synopsis>
<syntax argsep="@">
<parameter name="mailbox" required="true" />
<parameter name="context" />
</syntax>
<description>
<note><para>DEPRECATED. Use VM_INFO(mailbox[@context],exists) instead.</para></note>
<para>Returns a boolean of whether the corresponding <replaceable>mailbox</replaceable> exists.
If <replaceable>context</replaceable> is not specified, defaults to the <literal>default</literal>
context.</para>
</description>
<see-also>
<ref type="function">VM_INFO</ref>
</see-also>
</function>
<function name="VM_INFO" language="en_US">
<synopsis>
Returns the selected attribute from a mailbox.
@ -934,13 +884,12 @@ static char userscontext[AST_MAX_EXTENSION] = "default";
static char *addesc = "Comedian Mail";
/* Leave a message */
static char *app = "VoiceMail";
static char *voicemail_app = "VoiceMail";
/* Check mail, control, etc */
static char *app2 = "VoiceMailMain";
static char *voicemailmain_app = "VoiceMailMain";
static char *app3 = "MailboxExists";
static char *app4 = "VMAuthenticate";
static char *vmauthenticate_app = "VMAuthenticate";
static char *playmsg_app = "VoiceMailPlayMsg";
@ -12694,78 +12643,6 @@ AST_TEST_DEFINE(test_voicemail_vmuser)
}
#endif
static int vm_box_exists(struct ast_channel *chan, const char *data)
{
struct ast_vm_user svm, *vmu;
char *context, *box;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(mbox);
AST_APP_ARG(options);
);
static int dep_warning = 0;
if (ast_strlen_zero(data)) {
ast_log(AST_LOG_ERROR, "MailboxExists requires an argument: (vmbox[@context][|options])\n");
return -1;
}
if (!dep_warning) {
dep_warning = 1;
ast_log(AST_LOG_WARNING, "MailboxExists is deprecated. Please use ${VM_INFO(%s,exists)} instead.\n", data);
}
box = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, box);
if (args.options) {
}
if ((context = strchr(args.mbox, '@'))) {
*context = '\0';
context++;
}
memset(&svm, 0, sizeof(svm));
vmu = find_user(&svm, context, args.mbox);
if (vmu) {
pbx_builtin_setvar_helper(chan, "VMBOXEXISTSSTATUS", "SUCCESS");
free_user(vmu);
} else
pbx_builtin_setvar_helper(chan, "VMBOXEXISTSSTATUS", "FAILED");
return 0;
}
static int acf_mailbox_exists(struct ast_channel *chan, const char *cmd, char *args, char *buf, size_t len)
{
struct ast_vm_user svm, *vmu;
AST_DECLARE_APP_ARGS(arg,
AST_APP_ARG(mbox);
AST_APP_ARG(context);
);
static int dep_warning = 0;
AST_NONSTANDARD_APP_ARGS(arg, args, '@');
if (ast_strlen_zero(arg.mbox)) {
ast_log(LOG_ERROR, "MAILBOX_EXISTS requires an argument (<mailbox>[@<context>])\n");
return -1;
}
if (!dep_warning) {
dep_warning = 1;
ast_log(AST_LOG_WARNING, "MAILBOX_EXISTS is deprecated. Please use ${VM_INFO(%s,exists)} instead.\n", args);
}
memset(&svm, 0, sizeof(svm));
vmu = find_user(&svm, ast_strlen_zero(arg.context) ? "default" : arg.context, arg.mbox);
ast_copy_string(buf, vmu ? "1" : "0", len);
free_user(vmu);
return 0;
}
static int acf_vm_info(struct ast_channel *chan, const char *cmd, char *args, char *buf, size_t len)
{
struct ast_vm_user svm;
@ -12847,11 +12724,6 @@ static int acf_vm_info(struct ast_channel *chan, const char *cmd, char *args, ch
return 0;
}
static struct ast_custom_function mailbox_exists_acf = {
.name = "MAILBOX_EXISTS",
.read = acf_mailbox_exists,
};
static struct ast_custom_function vm_info_acf = {
.name = "VM_INFO",
.read = acf_vm_info,
@ -15143,13 +15015,11 @@ static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
res |= ast_unregister_application(app2);
res |= ast_unregister_application(app3);
res |= ast_unregister_application(app4);
res = ast_unregister_application(voicemail_app);
res |= ast_unregister_application(voicemailmain_app);
res |= ast_unregister_application(vmauthenticate_app);
res |= ast_unregister_application(playmsg_app);
res |= ast_unregister_application(sayname_app);
res |= ast_custom_function_unregister(&mailbox_exists_acf);
res |= ast_custom_function_unregister(&vm_info_acf);
res |= ast_manager_unregister("VoicemailUsersList");
res |= ast_manager_unregister("VoicemailUserStatus");
@ -15272,13 +15142,11 @@ static int load_module(void)
return AST_MODULE_LOAD_DECLINE;
}
res = ast_register_application_xml(app, vm_exec);
res |= ast_register_application_xml(app2, vm_execmain);
res |= ast_register_application_xml(app3, vm_box_exists);
res |= ast_register_application_xml(app4, vmauthenticate);
res = ast_register_application_xml(voicemail_app, vm_exec);
res |= ast_register_application_xml(voicemailmain_app, vm_execmain);
res |= ast_register_application_xml(vmauthenticate_app, vmauthenticate);
res |= ast_register_application_xml(playmsg_app, vm_playmsgexec);
res |= ast_register_application_xml(sayname_app, vmsayname_exec);
res |= ast_custom_function_register(&mailbox_exists_acf);
res |= ast_custom_function_register(&vm_info_acf);
res |= ast_manager_register_xml("VoicemailUsersList", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, manager_list_voicemail_users);
res |= ast_manager_register_xml("VoicemailUserStatus", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, manager_status_voicemail_user);

@ -0,0 +1,7 @@
Subject: app_voicemail
Master-Only: True
The MessageExists dialplan application and the MESSAGE_EXISTS dialplan
function were removed. The were deprecated in Asterisk 1.6.0 and
Asterisk 11.0.0 respectively. The VM_INFO() dialplan function is the
supported mechanism to query the status of a given mailbox.
Loading…
Cancel
Save