diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-12-09 19:55:01 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-12-09 19:55:01 +0000 |
commit | bf79f622861c420ae1124e031d470f2762dea24c (patch) | |
tree | aba0dff96c3c1cc73c40a0810d4e465ad2b79d31 /channel.c | |
parent | 142bac4e015be63e64c808f82c3f6f23ebb659ae (diff) |
Make music on hold truly optional (bug #2998)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4411 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rwxr-xr-x | channel.c | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -24,6 +24,7 @@ #include <asterisk/sched.h> #include <asterisk/options.h> #include <asterisk/channel.h> +#include <asterisk/musiconhold.h> #include <asterisk/channel_pvt.h> #include <asterisk/logger.h> #include <asterisk/say.h> @@ -2959,3 +2960,40 @@ unsigned int ast_get_group(char *s) } return group; } + + +static int (*ast_moh_start_ptr)(struct ast_channel *, char *) = NULL; +static void (*ast_moh_stop_ptr)(struct ast_channel *) = NULL; + + +void ast_install_music_functions(int (*start_ptr)(struct ast_channel *, char *), + void (*stop_ptr)(struct ast_channel *)) +{ + ast_moh_start_ptr = start_ptr; + ast_moh_stop_ptr = stop_ptr; +} + +void ast_uninstall_music_functions(void) +{ + ast_moh_start_ptr = NULL; + ast_moh_stop_ptr = NULL; +} + +/*! Turn on/off music on hold on a given channel */ + +int ast_moh_start(struct ast_channel *chan, char *mclass) +{ + if(ast_moh_start_ptr) + return ast_moh_start_ptr(chan, mclass); + + if (option_verbose > 2) + ast_verbose(VERBOSE_PREFIX_3 "Music class %s requested but no musiconhold loaded.\n", mclass ? mclass : "default"); + + return 0; +} + +void ast_moh_stop(struct ast_channel *chan) +{ + if(ast_moh_stop_ptr) + ast_moh_stop_ptr(chan); +} |