From f09cf4da4479221815357f021ad0f9f4d7acf461 Mon Sep 17 00:00:00 2001 From: Sean Bright <sean.bright@gmail.com> Date: Thu, 16 Jan 2020 16:29:25 -0500 Subject: [PATCH] app_voicemail: Remove MessageExists and MESSAGE_EXISTS() * The MailboxExists dialplan application was deprecated on 2006-09-26 in Asterisk 1.6.0 (commit ec83b111831fe865753f5b1c382ab73750685e50) * The MAILBOX_EXISTS dialplan function was deprecated on 2011-12-06 in Asterisk 11.0.0 (commit fd64bb66f94f1a7bb47e17319512b14e522353ec) Change-Id: I71cfc9d7b9217a37b802f4cc6ef2d57900b7398f --- apps/app_voicemail.c | 150 ++---------------- .../vm_deprecated_removals.txt | 7 + 2 files changed, 16 insertions(+), 141 deletions(-) create mode 100644 doc/UPGRADE-staging/vm_deprecated_removals.txt diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index cf944fd159..1b607e495b 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -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"; @@ -12691,78 +12640,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; @@ -12844,11 +12721,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, @@ -15140,13 +15012,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"); @@ -15269,13 +15139,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); diff --git a/doc/UPGRADE-staging/vm_deprecated_removals.txt b/doc/UPGRADE-staging/vm_deprecated_removals.txt new file mode 100644 index 0000000000..684a012b61 --- /dev/null +++ b/doc/UPGRADE-staging/vm_deprecated_removals.txt @@ -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. -- GitLab