[asterisk-commits] rmudgett: trunk r387185 - /trunk/channels/chan_unistim.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 1 15:01:44 CDT 2013


Author: rmudgett
Date: Wed May  1 15:01:43 2013
New Revision: 387185

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=387185
Log:
Remove some unnecessary calls to ast_bridged_channel() in chan_unistim.c

Modified:
    trunk/channels/chan_unistim.c

Modified: trunk/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_unistim.c?view=diff&rev=387185&r1=387184&r2=387185
==============================================================================
--- trunk/channels/chan_unistim.c (original)
+++ trunk/channels/chan_unistim.c Wed May  1 15:01:43 2013
@@ -2962,15 +2962,10 @@
 	if (sub->moh) {
 		ast_log(LOG_WARNING, "Transfer with peer already listening music on hold\n");
 	} else {
-		if (ast_bridged_channel(sub->owner)) {
-			ast_moh_start(ast_bridged_channel(sub->owner),
-						  sub->parent->musicclass, NULL);
-			sub->moh = 1;
-			sub->subtype = SUB_THREEWAY;
-		} else {
-			ast_log(LOG_WARNING, "Unable to find peer subchannel for music on hold\n");
-			return;
-		}
+		ast_queue_control_data(sub->owner, AST_CONTROL_HOLD,
+			sub->parent->musicclass, strlen(sub->parent->musicclass) + 1);
+		sub->moh = 1;
+		sub->subtype = SUB_THREEWAY;
 	}
 	sub_start_silence(pte, sub);
 	handle_dial_page(pte);
@@ -2994,7 +2989,7 @@
 		}
 		if (sub->owner) {
 			swap_subs(sub, sub_trans);
-			ast_moh_stop(ast_bridged_channel(sub_trans->owner));
+			ast_queue_control(sub_trans->owner, AST_CONTROL_UNHOLD);
 			sub_trans->moh = 0;
 			sub_trans->subtype = SUB_REAL;
 			sub->subtype = SUB_THREEWAY;
@@ -3502,13 +3497,9 @@
 		break;
 	case KEY_HANGUP:
 		if (sub && sub->owner) {
-			struct ast_channel *bridgepeer = NULL;
-
 			sub_stop_silence(pte, sub);
 			send_tone(pte, 0, 0);
-			if ((bridgepeer = ast_bridged_channel(sub->owner))) {
-				ast_moh_stop(bridgepeer);
-			}
+			ast_queue_control(sub->owner, AST_CONTROL_UNHOLD);
 			sub->moh = 0;
 			sub->subtype = SUB_REAL;
 			pte->state = STATE_CALL;
@@ -3519,7 +3510,7 @@
 			send_led_update(pte, 0x08);
 			send_led_update(pte, 0x10);
 			show_main_page(pte);
-                }
+		}
 		break;
 	case KEY_FAV0:
 	case KEY_FAV1:
@@ -4799,9 +4790,7 @@
 		if (unistimdebug) {
 			ast_verb(0, "Threeway call disconnected, switching to real call\n");
 		}
-		if (ast_bridged_channel(sub_trans->owner)) {
-			ast_moh_stop(ast_bridged_channel(sub_trans->owner));
-		}
+		ast_queue_control(sub_trans->owner, AST_CONTROL_UNHOLD);
 		sub_trans->moh = 0;
 		sub_trans->subtype = SUB_REAL;
 		swap_subs(sub_trans, sub);




More information about the asterisk-commits mailing list