voicemail API callbacks: Extract the sayname API call to its own registerd callback.

* Extract the sayname API call to its own registerd callback.  This allows
the app_directory and app_chanspy applications to say a mailbox owner's
name using an alternate provider when app_voicemail is not available
because you are using res_mwi_external.  app_directory still uses the
voicemail.conf file.

AFS-64 #close
Reported by: Mark Michelson


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2014-06-20 17:06:42 +00:00
parent 577632dec9
commit 86e8ab5ed4
5 changed files with 204 additions and 24 deletions

View File

@@ -26,7 +26,6 @@
*/
/*** MODULEINFO
<depend>app_voicemail</depend>
<support_level>core</support_level>
***/
#include "asterisk.h"
@@ -290,7 +289,13 @@ static int play_mailbox_owner(struct ast_channel *chan, const char *context,
const char *ext, const char *name, struct ast_flags *flags)
{
int res = 0;
if ((res = ast_app_sayname(chan, ext, context)) >= 0) {
char *mailbox_id;
mailbox_id = ast_alloca(strlen(ext) + strlen(context) + 2);
sprintf(mailbox_id, "%s@%s", ext, context); /* Safe */
res = ast_app_sayname(chan, mailbox_id);
if (res >= 0) {
ast_stopstream(chan);
/* If Option 'e' was specified, also read the extension number with the name */
if (ast_test_flag(flags, OPT_SAYEXTENSION)) {