[asterisk-commits] file: branch file/bridging r107294 - in /team/file/bridging: apps/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 10 20:16:49 CDT 2008


Author: file
Date: Mon Mar 10 20:16:48 2008
New Revision: 107294

URL: http://svn.digium.com/view/asterisk?view=rev&rev=107294
Log:
Make it the responsibility of ConfBridge's feature hook callback to stop/start MOH as needed when entering/exiting the IVR menu.

Modified:
    team/file/bridging/apps/app_confbridge.c
    team/file/bridging/main/bridging.c

Modified: team/file/bridging/apps/app_confbridge.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/apps/app_confbridge.c?view=diff&rev=107294&r1=107293&r2=107294
==============================================================================
--- team/file/bridging/apps/app_confbridge.c (original)
+++ team/file/bridging/apps/app_confbridge.c Mon Mar 10 20:16:48 2008
@@ -276,9 +276,18 @@
 	struct conference_bridge *conference_bridge = conference_bridge_user->conference_bridge;
 	int digit, res = 0, isadmin = ast_test_flag(&conference_bridge_user->flags, OPTION_ADMIN);
 
+	/* See if music on hold is playing */
+	AST_LIST_LOCK(&conference_bridges);
+	if (conference_bridge->users == 1 && ast_test_flag(&conference_bridge_user->flags, OPTION_MUSICONHOLD)) {
+		/* Just us so MOH is probably indeed going, let's stop it */
+		ast_moh_stop(bridge_channel->chan);
+	}
+	AST_LIST_UNLOCK(&conference_bridges);
+
 	/* Try to play back the user menu, if it fails pass this back up so the bridging core will act on it */
 	if (ast_streamfile(bridge_channel->chan, (isadmin ? "conf-adminmenu" : "conf-usermenu"), bridge_channel->chan->language)) {
-		return -1;
+		res = -1;
+		goto finished;
 	}
 
 	/* Wait for them to enter a digit from the user menu options */
@@ -319,6 +328,14 @@
 		res = ast_stream_and_wait(bridge_channel->chan, "conf-errormenu", "");
 	}
 
+ finished:
+	/* See if music on hold needs to be started back up again */
+	AST_LIST_LOCK(&conference_bridges);
+	if (conference_bridge->users == 1 && ast_test_flag(&conference_bridge_user->flags, OPTION_MUSICONHOLD)) {
+		ast_moh_start(bridge_channel->chan, NULL, NULL);
+	}
+	AST_LIST_UNLOCK(&conference_bridges);
+
 	bridge_channel->state = AST_BRIDGE_CHANNEL_STATE_WAIT;
 
 	return res;

Modified: team/file/bridging/main/bridging.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/main/bridging.c?view=diff&rev=107294&r1=107293&r2=107294
==============================================================================
--- team/file/bridging/main/bridging.c (original)
+++ team/file/bridging/main/bridging.c Mon Mar 10 20:16:48 2008
@@ -670,17 +670,9 @@
 	struct ast_bridge_features_hook *hook = NULL;
 	char dtmf[8] = "";
 	int look_for_dtmf = 1;
-	void *generatordata;
-	struct ast_generator *generator;
 
 	/* Don't bother with the bridge anymore, it's not going to go away */
 	ast_mutex_unlock(&bridge->lock);
-
-	/* Store any generator information before gathering DTMF and executing the hook */
-	generatordata = bridge_channel->chan->generatordata;
-	generator = bridge_channel->chan->generator;
-	bridge_channel->chan->generatordata = NULL;
-	bridge_channel->chan->generator = NULL;
 
 	/* The channel is now under our control and we don't really want any begin frames to do our DTMF matching so disable 'em at the core level */
 	ast_set_flag(bridge_channel->chan, AST_FLAG_END_DTMF_ONLY);
@@ -728,10 +720,6 @@
 		ast_bridge_dtmf_stream(bridge, dtmf, bridge_channel->chan);
 		bridge_channel->state = AST_BRIDGE_CHANNEL_STATE_WAIT;
 	}
-
-	/* Restore generator if present */
-	bridge_channel->chan->generatordata = generatordata;
-	bridge_channel->chan->generator = generator;
 
 	/* And back into the groove... */
 	ast_mutex_lock(&bridge->lock);




More information about the asterisk-commits mailing list