]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
holding_bridge: ensure moh participants get frames 20/920/3
authorJonathan Rose <jrose@digium.com>
Thu, 16 Jul 2015 17:16:25 +0000 (12:16 -0500)
committerJonathan Rose <jrose@digium.com>
Tue, 28 Jul 2015 20:11:48 +0000 (15:11 -0500)
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

bridges/bridge_holding.c
main/channel.c

index 2fd79d09aed9331ecf7b422929c6cd836f9af4b3..0ef5601c1db6485f2f6a96cba3bf8e9e3e0d10e5 100644 (file)
@@ -205,7 +205,11 @@ static void participant_entertainment_start(struct ast_bridge_channel *bridge_ch
        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);
index 57523d71a454e9134465a890fe245a50f1680ddc..3f6e0eef2c94889e6201ec342fdef519331ce57f 100644 (file)
@@ -7404,7 +7404,7 @@ int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *inte
 
        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)