This commit is contained in:
Anthony Minessale 2010-10-25 11:28:02 -05:00
parent 1ef3fc9a1b
commit 1a1881e80c
1 changed files with 17 additions and 13 deletions

View File

@ -717,25 +717,14 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
{
switch_channel_t *channel;
private_t *tech_pvt;
int done = 1;
channel = switch_core_session_get_channel(session);
switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
if (switch_test_flag(tech_pvt, TFLAG_RUNNING_APP)) {
switch_status_t r = SWITCH_STATUS_FALSE;
switch_core_session_t *other_session;
if (switch_core_session_get_partner(session, &other_session)) {
r = switch_core_session_receive_message(other_session, msg);
switch_core_session_rwunlock(other_session);
}
return r;
}
switch (msg->message_id) {
case SWITCH_MESSAGE_INDICATE_ANSWER:
if (tech_pvt->other_channel && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
@ -758,6 +747,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
}
break;
default:
done = 0;
break;
}
@ -768,6 +758,8 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
{
void *pop;
done = 1;
while (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
switch_frame_t *frame = (switch_frame_t *) pop;
switch_frame_free(&frame);
@ -787,6 +779,18 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
}
if (!done && tech_pvt->other_session && switch_test_flag(tech_pvt, TFLAG_RUNNING_APP)) {
switch_status_t r = SWITCH_STATUS_FALSE;
switch_core_session_t *other_session;
if (switch_core_session_get_partner(tech_pvt->other_session, &other_session)) {
r = switch_core_session_receive_message(other_session, msg);
switch_core_session_rwunlock(other_session);
}
return r;
}
return SWITCH_STATUS_SUCCESS;
}