Remove some unnecessary calls to ast_bridged_channel() in chan_unistim.c

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@387185 65c4cc65-6c06-0410-ace0-fbb531ad65f3
changes/78/78/1
Richard Mudgett 13 years ago
parent 213834ffd4
commit 5fec9b8d1f

@ -2962,15 +2962,10 @@ static void transfer_call_step1(struct unistimsession *pte)
if (sub->moh) { if (sub->moh) {
ast_log(LOG_WARNING, "Transfer with peer already listening music on hold\n"); ast_log(LOG_WARNING, "Transfer with peer already listening music on hold\n");
} else { } else {
if (ast_bridged_channel(sub->owner)) { ast_queue_control_data(sub->owner, AST_CONTROL_HOLD,
ast_moh_start(ast_bridged_channel(sub->owner), sub->parent->musicclass, strlen(sub->parent->musicclass) + 1);
sub->parent->musicclass, NULL); sub->moh = 1;
sub->moh = 1; sub->subtype = SUB_THREEWAY;
sub->subtype = SUB_THREEWAY;
} else {
ast_log(LOG_WARNING, "Unable to find peer subchannel for music on hold\n");
return;
}
} }
sub_start_silence(pte, sub); sub_start_silence(pte, sub);
handle_dial_page(pte); handle_dial_page(pte);
@ -2994,7 +2989,7 @@ static void transfer_cancel_step2(struct unistimsession *pte)
} }
if (sub->owner) { if (sub->owner) {
swap_subs(sub, sub_trans); 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->moh = 0;
sub_trans->subtype = SUB_REAL; sub_trans->subtype = SUB_REAL;
sub->subtype = SUB_THREEWAY; sub->subtype = SUB_THREEWAY;
@ -3502,13 +3497,9 @@ static void key_dial_page(struct unistimsession *pte, char keycode)
break; break;
case KEY_HANGUP: case KEY_HANGUP:
if (sub && sub->owner) { if (sub && sub->owner) {
struct ast_channel *bridgepeer = NULL;
sub_stop_silence(pte, sub); sub_stop_silence(pte, sub);
send_tone(pte, 0, 0); send_tone(pte, 0, 0);
if ((bridgepeer = ast_bridged_channel(sub->owner))) { ast_queue_control(sub->owner, AST_CONTROL_UNHOLD);
ast_moh_stop(bridgepeer);
}
sub->moh = 0; sub->moh = 0;
sub->subtype = SUB_REAL; sub->subtype = SUB_REAL;
pte->state = STATE_CALL; pte->state = STATE_CALL;
@ -3519,7 +3510,7 @@ static void key_dial_page(struct unistimsession *pte, char keycode)
send_led_update(pte, 0x08); send_led_update(pte, 0x08);
send_led_update(pte, 0x10); send_led_update(pte, 0x10);
show_main_page(pte); show_main_page(pte);
} }
break; break;
case KEY_FAV0: case KEY_FAV0:
case KEY_FAV1: case KEY_FAV1:
@ -4799,9 +4790,7 @@ static int unistim_hangup(struct ast_channel *ast)
if (unistimdebug) { if (unistimdebug) {
ast_verb(0, "Threeway call disconnected, switching to real call\n"); ast_verb(0, "Threeway call disconnected, switching to real call\n");
} }
if (ast_bridged_channel(sub_trans->owner)) { ast_queue_control(sub_trans->owner, AST_CONTROL_UNHOLD);
ast_moh_stop(ast_bridged_channel(sub_trans->owner));
}
sub_trans->moh = 0; sub_trans->moh = 0;
sub_trans->subtype = SUB_REAL; sub_trans->subtype = SUB_REAL;
swap_subs(sub_trans, sub); swap_subs(sub_trans, sub);

Loading…
Cancel
Save