From 86e8ab5ed47bccf0ee80acfd711eb81b0991522c Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Fri, 20 Jun 2014 17:06:42 +0000 Subject: 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 --- apps/app_chanspy.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'apps/app_chanspy.c') diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 306e6e84b..47f755e5f 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -864,6 +864,15 @@ static struct ast_autochan *next_channel(struct ast_channel_iterator *iter, return NULL; } +static int spy_sayname(struct ast_channel *chan, const char *mailbox, const char *context) +{ + char *mailbox_id; + + mailbox_id = ast_alloca(strlen(mailbox) + strlen(context) + 2); + sprintf(mailbox_id, "%s@%s", mailbox, context); /* Safe */ + return ast_app_sayname(chan, mailbox_id); +} + static int common_exec(struct ast_channel *chan, struct ast_flags *flags, int volfactor, const int fd, struct spy_dtmf_options *user_options, const char *mygroup, const char *myenforced, const char *spec, const char *exten, @@ -1078,8 +1087,9 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags, if (ast_test_flag(flags, OPTION_NAME)) { const char *local_context = S_OR(name_context, "default"); const char *local_mailbox = S_OR(mailbox, ptr); + if (local_mailbox) { - res = ast_app_sayname(chan, local_mailbox, local_context); + res = spy_sayname(chan, local_mailbox, local_context); } else { res = -1; } -- cgit v1.2.3