mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-15 17:27:02 +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:
@@ -13669,6 +13669,29 @@ static int sayname(struct ast_channel *chan, const char *mailbox, const char *co
|
||||
return res;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
* \brief Play a recorded user name for the mailbox to the specified channel.
|
||||
*
|
||||
* \param chan Where to play the recorded name file.
|
||||
* \param mailbox_id The mailbox name.
|
||||
*
|
||||
* \retval 0 Name played without interruption
|
||||
* \retval dtmf ASCII value of the DTMF which interrupted playback.
|
||||
* \retval -1 Unable to locate mailbox or hangup occurred.
|
||||
*/
|
||||
static int vm_sayname(struct ast_channel *chan, const char *mailbox_id)
|
||||
{
|
||||
char *context;
|
||||
char *mailbox;
|
||||
|
||||
if (ast_strlen_zero(mailbox_id)
|
||||
|| separate_mailbox(ast_strdupa(mailbox_id), &mailbox, &context)) {
|
||||
return -1;
|
||||
}
|
||||
return sayname(chan, mailbox, context);
|
||||
}
|
||||
|
||||
static void read_password_from_file(const char *secretfn, char *password, int passwordlen) {
|
||||
struct ast_config *pwconf;
|
||||
struct ast_flags config_flags = { 0 };
|
||||
@@ -14286,7 +14309,6 @@ static const struct ast_vm_functions vm_table = {
|
||||
.inboxcount = inboxcount,
|
||||
.inboxcount2 = inboxcount2,
|
||||
.messagecount = messagecount,
|
||||
.sayname = sayname,
|
||||
.copy_recording_to_vm = msg_create_from_file,
|
||||
.index_to_foldername = vm_index_to_foldername,
|
||||
.mailbox_snapshot_create = vm_mailbox_snapshot_create,
|
||||
@@ -14297,6 +14319,13 @@ static const struct ast_vm_functions vm_table = {
|
||||
.msg_play = vm_msg_play,
|
||||
};
|
||||
|
||||
static const struct ast_vm_greeter_functions vm_greeter_table = {
|
||||
.module_version = VM_GREETER_MODULE_VERSION,
|
||||
.module_name = AST_MODULE,
|
||||
|
||||
.sayname = vm_sayname,
|
||||
};
|
||||
|
||||
static int reload(void)
|
||||
{
|
||||
return load_config(1);
|
||||
@@ -14327,6 +14356,7 @@ static int unload_module(void)
|
||||
#endif
|
||||
ast_cli_unregister_multiple(cli_voicemail, ARRAY_LEN(cli_voicemail));
|
||||
ast_vm_unregister(vm_table.module_name);
|
||||
ast_vm_greeter_unregister(vm_greeter_table.module_name);
|
||||
#ifdef TEST_FRAMEWORK
|
||||
ast_uninstall_vm_test_functions();
|
||||
#endif
|
||||
@@ -14394,8 +14424,10 @@ static int load_module(void)
|
||||
#endif
|
||||
|
||||
res |= ast_vm_register(&vm_table);
|
||||
if (res)
|
||||
res |= ast_vm_greeter_register(&vm_greeter_table);
|
||||
if (res) {
|
||||
return res;
|
||||
}
|
||||
|
||||
ast_cli_register_multiple(cli_voicemail, ARRAY_LEN(cli_voicemail));
|
||||
ast_data_register_multiple(vm_data_providers, ARRAY_LEN(vm_data_providers));
|
||||
|
Reference in New Issue
Block a user