diff options
author | Richard Mudgett <rmudgett@digium.com> | 2013-12-11 19:19:24 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2013-12-11 19:19:24 +0000 |
commit | 8183bba99a38bac11008b5ef1caf265464564e64 (patch) | |
tree | c9adba7c8becb20483dec826f37b743fe49c502d /apps/app_voicemail.c | |
parent | ce423d2ea47501a829711ff957e78729f38925ff (diff) |
app_voicemail: Voicemail callback registration/unregistration function improvements.
* The voicemail registration/unregistration functions now take a struct of
callbacks instead of a lengthy parameter list of callbacks.
* The voicemail registration/unregistration functions now prevent a
competing module from interfering with an already registered callback
supplying module.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403643 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r-- | apps/app_voicemail.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index dca4eceee..dbcd28355 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -14225,6 +14225,25 @@ AST_TEST_DEFINE(test_voicemail_vm_info) } #endif /* defined(TEST_FRAMEWORK) */ +static const struct ast_vm_functions vm_table = { + .module_version = VM_MODULE_VERSION, + .module_name = AST_MODULE, + + .has_voicemail = has_voicemail, + .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, + .mailbox_snapshot_destroy = vm_mailbox_snapshot_destroy, + .msg_move = vm_msg_move, + .msg_remove = vm_msg_remove, + .msg_forward = vm_msg_forward, + .msg_play = vm_msg_play, +}; + static int reload(void) { return load_config(1); @@ -14254,7 +14273,7 @@ static int unload_module(void) res |= AST_TEST_UNREGISTER(test_voicemail_vm_info); #endif ast_cli_unregister_multiple(cli_voicemail, ARRAY_LEN(cli_voicemail)); - ast_uninstall_vm_functions(); + ast_vm_unregister(vm_table.module_name); #ifdef TEST_FRAMEWORK ast_uninstall_vm_test_functions(); #endif @@ -14321,17 +14340,13 @@ static int load_module(void) res |= AST_TEST_REGISTER(test_voicemail_vm_info); #endif + res |= ast_vm_register(&vm_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)); - ast_install_vm_functions(has_voicemail, inboxcount, inboxcount2, messagecount, sayname, msg_create_from_file, - vm_index_to_foldername, - vm_mailbox_snapshot_create, vm_mailbox_snapshot_destroy, - vm_msg_move, vm_msg_remove, vm_msg_forward, vm_msg_play); - #ifdef TEST_FRAMEWORK ast_install_vm_test_functions(vm_test_create_user, vm_test_destroy_user); #endif |