diff options
author | Richard Mudgett <rmudgett@digium.com> | 2014-06-20 17:06:42 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2014-06-20 17:06:42 +0000 |
commit | 86e8ab5ed47bccf0ee80acfd711eb81b0991522c (patch) | |
tree | fcd846af640f5a6dd9b91d732907729ae7ccb6a8 /apps/app_chanspy.c | |
parent | 577632dec957bfec258918a381133a3c41411b37 (diff) |
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
Diffstat (limited to 'apps/app_chanspy.c')
-rw-r--r-- | apps/app_chanspy.c | 12 |
1 files changed, 11 insertions, 1 deletions
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; } |