Skip to content

Commit

Permalink
Merge "app_voicemail: Remove MessageExists and MESSAGE_EXISTS()"
Browse files Browse the repository at this point in the history
  • Loading branch information
Friendly Automation authored and Gerrit Code Review committed Jan 22, 2020
2 parents b073b43 + f09cf4d commit 95c6fbe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 141 deletions.
150 changes: 9 additions & 141 deletions apps/app_voicemail.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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";

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions doc/UPGRADE-staging/vm_deprecated_removals.txt
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 95c6fbe

Please sign in to comment.