mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-23 21:19:09 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user