[asterisk-commits] holding bridge: ensure moh participants get frames (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 28 17:05:49 CDT 2015


Mark Michelson has submitted this change and it was merged.

Change subject: holding_bridge: ensure moh participants get frames
......................................................................


holding_bridge: ensure moh participants get frames

Currently, if a blank musiconhold.conf is used, musiconhold will fail
to start for a channel going into a holding bridge with an anticipation
of getting music on hold. That being the case, no frames will be written
to the channel and that can pose a problem for blind transfers in PJSIP
which may rely on frames being written to get past the REFER framehook.
This patch makes holding bridges start a silence generator if starting
music on hold fails and makes it so that if no music on hold functions
are installed that the ast_moh_start function will report a failure so
that consumers of that function will be able to respond appropriately.

ASTERISK-25271 #close

Change-Id: I06f066728604943cba0bb0b39fa7cf658a21cd99
---
M bridges/bridge_holding.c
M main/channel.c
2 files changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, approved
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified



diff --git a/bridges/bridge_holding.c b/bridges/bridge_holding.c
index 2fd79d0..0ef5601 100644
--- a/bridges/bridge_holding.c
+++ b/bridges/bridge_holding.c
@@ -205,7 +205,11 @@
 	switch(hc->idle_mode) {
 	case IDLE_MODE_MOH:
 		moh_class = ast_bridge_channel_get_role_option(bridge_channel, "holding_participant", "moh_class");
-		ast_moh_start(bridge_channel->chan, moh_class, NULL);
+		if (ast_moh_start(bridge_channel->chan, moh_class, NULL)) {
+			ast_log(LOG_WARNING, "Failed to start moh, starting silence generator instead\n");
+			hc->idle_mode = IDLE_MODE_SILENCE;
+			hc->silence_generator = ast_channel_start_silence_generator(bridge_channel->chan);
+		}
 		break;
 	case IDLE_MODE_RINGING:
 		ast_indicate(bridge_channel->chan, AST_CONTROL_RINGING);
diff --git a/main/channel.c b/main/channel.c
index 57523d7..3f6e0ee 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -7404,7 +7404,7 @@
 
 	ast_verb(3, "Music class %s requested but no musiconhold loaded.\n", mclass ? mclass : (interpclass ? interpclass : "default"));
 
-	return 0;
+	return -1;
 }
 
 void ast_moh_stop(struct ast_channel *chan)

-- 
To view, visit https://gerrit.asterisk.org/920
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I06f066728604943cba0bb0b39fa7cf658a21cd99
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Jonathan Rose <jrose at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Jonathan Rose <jrose at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list