Newer
Older
void ast_install_music_functions(int (*start_ptr)(struct ast_channel *, char *),
Mark Spencer
committed
void (*stop_ptr)(struct ast_channel *),
void (*cleanup_ptr)(struct ast_channel *)
)
{
ast_moh_start_ptr = start_ptr;
ast_moh_stop_ptr = stop_ptr;
Mark Spencer
committed
ast_moh_cleanup_ptr = cleanup_ptr;
}
void ast_uninstall_music_functions(void)
{
ast_moh_start_ptr = NULL;
ast_moh_stop_ptr = NULL;
Mark Spencer
committed
ast_moh_cleanup_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);
}
Mark Spencer
committed
void ast_moh_cleanup(struct ast_channel *chan)
{
if(ast_moh_cleanup_ptr)
ast_moh_cleanup_ptr(chan);
}
void ast_channels_init(void)
{
ast_cli_register(&cli_show_channeltypes);
}