[asterisk-commits] oej: branch oej/rana-moh-queue-transfer-1.8 r393119 - in /team/oej/rana-moh-q...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jun 28 04:52:22 CDT 2013
Author: oej
Date: Fri Jun 28 04:52:17 2013
New Revision: 393119
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393119
Log:
Adding API for getting the musicclass for a channel that have music on hold.
Modified:
team/oej/rana-moh-queue-transfer-1.8/include/asterisk/musiconhold.h
team/oej/rana-moh-queue-transfer-1.8/main/channel.c
team/oej/rana-moh-queue-transfer-1.8/res/res_musiconhold.c
Modified: team/oej/rana-moh-queue-transfer-1.8/include/asterisk/musiconhold.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/rana-moh-queue-transfer-1.8/include/asterisk/musiconhold.h?view=diff&rev=393119&r1=393118&r2=393119
==============================================================================
--- team/oej/rana-moh-queue-transfer-1.8/include/asterisk/musiconhold.h (original)
+++ team/oej/rana-moh-queue-transfer-1.8/include/asterisk/musiconhold.h Fri Jun 28 04:52:17 2013
@@ -44,8 +44,12 @@
/*! Turn off music on hold on a given channel */
void ast_moh_stop(struct ast_channel *chan);
+/*! Query for the musicclass if MOH is active on a given channel */
+char * ast_moh_query(struct ast_channel *chan);
+
void ast_install_music_functions(int (*start_ptr)(struct ast_channel *, const char *, const char *),
void (*stop_ptr)(struct ast_channel *),
+ char * (*query_ptr)(struct ast_channel *),
void (*cleanup_ptr)(struct ast_channel *));
void ast_uninstall_music_functions(void);
Modified: team/oej/rana-moh-queue-transfer-1.8/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/rana-moh-queue-transfer-1.8/main/channel.c?view=diff&rev=393119&r1=393118&r2=393119
==============================================================================
--- team/oej/rana-moh-queue-transfer-1.8/main/channel.c (original)
+++ team/oej/rana-moh-queue-transfer-1.8/main/channel.c Fri Jun 28 04:52:17 2013
@@ -7939,14 +7939,17 @@
static int (*ast_moh_start_ptr)(struct ast_channel *, const char *, const char *) = NULL;
static void (*ast_moh_stop_ptr)(struct ast_channel *) = NULL;
+static char * (*ast_moh_query_ptr)(struct ast_channel *) = NULL;
static void (*ast_moh_cleanup_ptr)(struct ast_channel *) = NULL;
void ast_install_music_functions(int (*start_ptr)(struct ast_channel *, const char *, const char *),
void (*stop_ptr)(struct ast_channel *),
+ char * (*query_ptr)(struct ast_channel *),
void (*cleanup_ptr)(struct ast_channel *))
{
ast_moh_start_ptr = start_ptr;
ast_moh_stop_ptr = stop_ptr;
+ ast_moh_query_ptr = query_ptr;
ast_moh_cleanup_ptr = cleanup_ptr;
}
@@ -7954,6 +7957,7 @@
{
ast_moh_start_ptr = NULL;
ast_moh_stop_ptr = NULL;
+ ast_moh_query_ptr = NULL;
ast_moh_cleanup_ptr = NULL;
}
@@ -7973,6 +7977,15 @@
{
if (ast_moh_stop_ptr)
ast_moh_stop_ptr(chan);
+}
+
+/*! \brief Ask for the musicclass if there's moh active on this channel */
+char *ast_moh_query(struct ast_channel *chan)
+{
+ if (ast_moh_query_ptr) {
+ return ast_moh_query_ptr(chan);
+ }
+ return NULL;
}
void ast_moh_cleanup(struct ast_channel *chan)
Modified: team/oej/rana-moh-queue-transfer-1.8/res/res_musiconhold.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/rana-moh-queue-transfer-1.8/res/res_musiconhold.c?view=diff&rev=393119&r1=393118&r2=393119
==============================================================================
--- team/oej/rana-moh-queue-transfer-1.8/res/res_musiconhold.c (original)
+++ team/oej/rana-moh-queue-transfer-1.8/res/res_musiconhold.c Fri Jun 28 04:52:17 2013
@@ -1540,6 +1540,24 @@
return res;
}
+static char *local_ast_moh_query(struct ast_channel *chan)
+{
+ struct moh_files_state *state;
+
+ if (!chan) {
+ return NULL;
+ }
+ ast_channel_lock(chan);
+ ast_channel_unlock(chan);
+ if (chan->music_state) {
+ state = chan->music_state;
+ if (state->class) {
+ return state->class->name;
+ }
+ }
+ return NULL;
+}
+
static void local_ast_moh_stop(struct ast_channel *chan)
{
ast_clear_flag(chan, AST_FLAG_MOH);
@@ -1917,6 +1935,7 @@
"disabling music on hold.\n");
} else {
ast_install_music_functions(local_ast_moh_start, local_ast_moh_stop,
+ local_ast_moh_query,
local_ast_moh_cleanup);
}
@@ -1938,7 +1957,8 @@
static int reload(void)
{
if (load_moh_classes(1)) {
- ast_install_music_functions(local_ast_moh_start, local_ast_moh_stop,
+ ast_install_music_functions(local_ast_moh_start, local_ast_moh_stop,
+ local_ast_moh_query,
local_ast_moh_cleanup);
}
More information about the asterisk-commits
mailing list