mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 11:58:40 +00:00
Remove global symbol requirement from app_voicemail.
This uses the existing "function installation" stuff that already existed for other functions, like getting message counts. (closes issue AST-807) (issue AST-901) (issue AST-908) Review: https://reviewboard.asterisk.org/r/1965/ git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.11@368962 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
206
main/app.c
206
main/app.c
@@ -274,13 +274,83 @@ static int (*ast_inboxcount2_func)(const char *mailbox, int *urgentmsgs, int *ne
|
||||
static int (*ast_sayname_func)(struct ast_channel *chan, const char *mailbox, const char *context) = NULL;
|
||||
static int (*ast_messagecount_func)(const char *context, const char *mailbox, const char *folder) = NULL;
|
||||
static int (*ast_copy_recording_to_vm_func)(struct ast_vm_recording_data *vm_rec_data) = NULL;
|
||||
static const char *(*ast_vm_index_to_foldername_func)(int id) = NULL;
|
||||
static struct ast_vm_mailbox_snapshot *(*ast_vm_mailbox_snapshot_create_func)(const char *mailbox,
|
||||
const char *context,
|
||||
const char *folder,
|
||||
int descending,
|
||||
enum ast_vm_snapshot_sort_val sort_val,
|
||||
int combine_INBOX_and_OLD) = NULL;
|
||||
static struct ast_vm_mailbox_snapshot *(*ast_vm_mailbox_snapshot_destroy_func)(struct ast_vm_mailbox_snapshot *mailbox_snapshot) = NULL;
|
||||
static int (*ast_vm_msg_move_func)(const char *mailbox,
|
||||
const char *context,
|
||||
size_t num_msgs,
|
||||
const char *oldfolder,
|
||||
int *old_msg_ids,
|
||||
const char *newfolder,
|
||||
int *new_msg_ids) = NULL;
|
||||
static int (*ast_vm_msg_remove_func)(const char *mailbox,
|
||||
const char *context,
|
||||
size_t num_msgs,
|
||||
const char *folder,
|
||||
int *msgs) = NULL;
|
||||
static int (*ast_vm_msg_forward_func)(const char *from_mailbox,
|
||||
const char *from_context,
|
||||
const char *from_folder,
|
||||
const char *to_mailbox,
|
||||
const char *to_context,
|
||||
const char *to_folder,
|
||||
size_t num_msgs,
|
||||
int *msg_ids,
|
||||
int delete_old) = NULL;
|
||||
static int (*ast_vm_msg_play_func)(struct ast_channel *chan,
|
||||
const char *mailbox,
|
||||
const char *context,
|
||||
const char *folder,
|
||||
const char *msg_num,
|
||||
ast_vm_msg_play_cb cb) = NULL;
|
||||
|
||||
void ast_install_vm_functions(int (*has_voicemail_func)(const char *mailbox, const char *folder),
|
||||
int (*inboxcount_func)(const char *mailbox, int *newmsgs, int *oldmsgs),
|
||||
int (*inboxcount2_func)(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs),
|
||||
int (*messagecount_func)(const char *context, const char *mailbox, const char *folder),
|
||||
int (*sayname_func)(struct ast_channel *chan, const char *mailbox, const char *context),
|
||||
int (*copy_recording_to_vm_func)(struct ast_vm_recording_data *vm_rec_data))
|
||||
int (*copy_recording_to_vm_func)(struct ast_vm_recording_data *vm_rec_data),
|
||||
const char *vm_index_to_foldername_func(int id),
|
||||
struct ast_vm_mailbox_snapshot *(*vm_mailbox_snapshot_create_func)(const char *mailbox,
|
||||
const char *context,
|
||||
const char *folder,
|
||||
int descending,
|
||||
enum ast_vm_snapshot_sort_val sort_val,
|
||||
int combine_INBOX_and_OLD),
|
||||
struct ast_vm_mailbox_snapshot *(*vm_mailbox_snapshot_destroy_func)(struct ast_vm_mailbox_snapshot *mailbox_snapshot),
|
||||
int (*vm_msg_move_func)(const char *mailbox,
|
||||
const char *context,
|
||||
size_t num_msgs,
|
||||
const char *oldfolder,
|
||||
int *old_msg_ids,
|
||||
const char *newfolder,
|
||||
int *new_msg_ids),
|
||||
int (*vm_msg_remove_func)(const char *mailbox,
|
||||
const char *context,
|
||||
size_t num_msgs,
|
||||
const char *folder,
|
||||
int *msgs),
|
||||
int (*vm_msg_forward_func)(const char *from_mailbox,
|
||||
const char *from_context,
|
||||
const char *from_folder,
|
||||
const char *to_mailbox,
|
||||
const char *to_context,
|
||||
const char *to_folder,
|
||||
size_t num_msgs,
|
||||
int *msg_ids,
|
||||
int delete_old),
|
||||
int (*vm_msg_play_func)(struct ast_channel *chan,
|
||||
const char *mailbox,
|
||||
const char *context,
|
||||
const char *folder,
|
||||
const char *msg_num,
|
||||
ast_vm_msg_play_cb cb))
|
||||
{
|
||||
ast_has_voicemail_func = has_voicemail_func;
|
||||
ast_inboxcount_func = inboxcount_func;
|
||||
@@ -288,6 +358,13 @@ void ast_install_vm_functions(int (*has_voicemail_func)(const char *mailbox, con
|
||||
ast_messagecount_func = messagecount_func;
|
||||
ast_sayname_func = sayname_func;
|
||||
ast_copy_recording_to_vm_func = copy_recording_to_vm_func;
|
||||
ast_vm_index_to_foldername_func = vm_index_to_foldername_func;
|
||||
ast_vm_mailbox_snapshot_create_func = vm_mailbox_snapshot_create_func;
|
||||
ast_vm_mailbox_snapshot_destroy_func = vm_mailbox_snapshot_destroy_func;
|
||||
ast_vm_msg_move_func = vm_msg_move_func;
|
||||
ast_vm_msg_remove_func = vm_msg_remove_func;
|
||||
ast_vm_msg_forward_func = vm_msg_forward_func;
|
||||
ast_vm_msg_play_func = vm_msg_play_func;
|
||||
}
|
||||
|
||||
void ast_uninstall_vm_functions(void)
|
||||
@@ -298,8 +375,33 @@ void ast_uninstall_vm_functions(void)
|
||||
ast_messagecount_func = NULL;
|
||||
ast_sayname_func = NULL;
|
||||
ast_copy_recording_to_vm_func = NULL;
|
||||
ast_vm_index_to_foldername_func = NULL;
|
||||
ast_vm_mailbox_snapshot_create_func = NULL;
|
||||
ast_vm_mailbox_snapshot_destroy_func = NULL;
|
||||
ast_vm_msg_move_func = NULL;
|
||||
ast_vm_msg_remove_func = NULL;
|
||||
ast_vm_msg_forward_func = NULL;
|
||||
ast_vm_msg_play_func = NULL;
|
||||
}
|
||||
|
||||
#ifdef TEST_FRAMEWORK
|
||||
int (*ast_vm_test_create_user_func)(const char *context, const char *mailbox) = NULL;
|
||||
int (*ast_vm_test_destroy_user_func)(const char *context, const char *mailbox) = NULL;
|
||||
|
||||
void ast_install_vm_test_functions(int (*vm_test_create_user_func)(const char *context, const char *mailbox),
|
||||
int (*vm_test_destroy_user_func)(const char *context, const char *mailbox))
|
||||
{
|
||||
ast_vm_test_create_user_func = vm_test_create_user_func;
|
||||
ast_vm_test_destroy_user_func = vm_test_destroy_user_func;
|
||||
}
|
||||
|
||||
void ast_uninstall_vm_test_functions(void)
|
||||
{
|
||||
ast_vm_test_create_user_func = NULL;
|
||||
ast_vm_test_destroy_user_func = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
int ast_app_has_voicemail(const char *mailbox, const char *folder)
|
||||
{
|
||||
static int warned = 0;
|
||||
@@ -402,6 +504,108 @@ int ast_app_messagecount(const char *context, const char *mailbox, const char *f
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *ast_vm_index_to_foldername(int id)
|
||||
{
|
||||
if (ast_vm_index_to_foldername_func) {
|
||||
return ast_vm_index_to_foldername_func(id);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct ast_vm_mailbox_snapshot *ast_vm_mailbox_snapshot_create(const char *mailbox,
|
||||
const char *context,
|
||||
const char *folder,
|
||||
int descending,
|
||||
enum ast_vm_snapshot_sort_val sort_val,
|
||||
int combine_INBOX_and_OLD)
|
||||
{
|
||||
if (ast_vm_mailbox_snapshot_create_func) {
|
||||
return ast_vm_mailbox_snapshot_create_func(mailbox, context, folder, descending, sort_val, combine_INBOX_and_OLD);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct ast_vm_mailbox_snapshot *ast_vm_mailbox_snapshot_destroy(struct ast_vm_mailbox_snapshot *mailbox_snapshot)
|
||||
{
|
||||
if (ast_vm_mailbox_snapshot_destroy_func) {
|
||||
return ast_vm_mailbox_snapshot_destroy_func(mailbox_snapshot);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int ast_vm_msg_move(const char *mailbox,
|
||||
const char *context,
|
||||
size_t num_msgs,
|
||||
const char *oldfolder,
|
||||
int *old_msg_ids,
|
||||
const char *newfolder,
|
||||
int *new_msg_ids)
|
||||
{
|
||||
if (ast_vm_msg_move_func) {
|
||||
return ast_vm_msg_move_func(mailbox, context, num_msgs, oldfolder, old_msg_ids, newfolder, new_msg_ids);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ast_vm_msg_remove(const char *mailbox,
|
||||
const char *context,
|
||||
size_t num_msgs,
|
||||
const char *folder,
|
||||
int *msgs)
|
||||
{
|
||||
if (ast_vm_msg_remove_func) {
|
||||
return ast_vm_msg_remove_func(mailbox, context, num_msgs, folder, msgs);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ast_vm_msg_forward(const char *from_mailbox,
|
||||
const char *from_context,
|
||||
const char *from_folder,
|
||||
const char *to_mailbox,
|
||||
const char *to_context,
|
||||
const char *to_folder,
|
||||
size_t num_msgs,
|
||||
int *msg_ids,
|
||||
int delete_old)
|
||||
{
|
||||
if (ast_vm_msg_forward_func) {
|
||||
return ast_vm_msg_forward_func(from_mailbox, from_context, from_folder, to_mailbox, to_context, to_folder, num_msgs, msg_ids, delete_old);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ast_vm_msg_play(struct ast_channel *chan,
|
||||
const char *mailbox,
|
||||
const char *context,
|
||||
const char *folder,
|
||||
const char *msg_num,
|
||||
ast_vm_msg_play_cb cb)
|
||||
{
|
||||
if (ast_vm_msg_play_func) {
|
||||
return ast_vm_msg_play_func(chan, mailbox, context, folder, msg_num, cb);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef TEST_FRAMEWORK
|
||||
int ast_vm_test_create_user(const char *context, const char *mailbox)
|
||||
{
|
||||
if (ast_vm_test_create_user_func) {
|
||||
return ast_vm_test_create_user_func(context, mailbox);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ast_vm_test_destroy_user(const char *context, const char *mailbox)
|
||||
{
|
||||
if (ast_vm_test_destroy_user_func) {
|
||||
return ast_vm_test_destroy_user_func(context, mailbox);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, const char *digits, int between, unsigned int duration)
|
||||
{
|
||||
const char *ptr;
|
||||
|
||||
Reference in New Issue
Block a user