FS-3688 some more general changes during proxy media
This commit is contained in:
parent
12a1ac9432
commit
4ce8f5e28e
|
@ -1796,7 +1796,10 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
}
|
||||
|
||||
sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
|
||||
switch_channel_set_flag(channel, CF_REQ_MEDIA);
|
||||
|
||||
if (!switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
|
||||
switch_channel_set_flag(channel, CF_REQ_MEDIA);
|
||||
}
|
||||
sofia_glue_do_invite(session);
|
||||
}
|
||||
break;
|
||||
|
@ -1857,7 +1860,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
|
||||
sofia_glue_set_image_sdp(tech_pvt, t38_options, msg->numeric_arg);
|
||||
|
||||
switch_channel_set_flag(channel, CF_REQ_MEDIA);
|
||||
if (!switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
|
||||
switch_channel_set_flag(channel, CF_REQ_MEDIA);
|
||||
}
|
||||
sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
|
||||
sofia_glue_do_invite(session);
|
||||
}
|
||||
|
@ -1895,7 +1900,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
|
||||
|
||||
if (send_invite) {
|
||||
switch_channel_set_flag(channel, CF_REQ_MEDIA);
|
||||
if (!switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
|
||||
switch_channel_set_flag(channel, CF_REQ_MEDIA);
|
||||
}
|
||||
sofia_glue_do_invite(session);
|
||||
} else {
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
|
|
|
@ -1312,10 +1312,6 @@ void sofia_event_callback(nua_event_t event,
|
|||
{
|
||||
sofia_dispatch_event_t *de;
|
||||
|
||||
if (event == nua_r_invite && status >= 900) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch_mutex_lock(profile->flag_mutex);
|
||||
profile->queued_events++;
|
||||
|
@ -4615,6 +4611,14 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
|
|||
switch_caller_profile_t *caller_profile = NULL;
|
||||
int has_t38 = 0;
|
||||
|
||||
switch_channel_clear_flag(channel, CF_REQ_MEDIA);
|
||||
|
||||
if (status >= 900) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s status %d received.\n",
|
||||
switch_channel_get_name(channel), status);
|
||||
return;
|
||||
}
|
||||
|
||||
sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), &network_port);
|
||||
|
||||
switch_channel_set_variable_printf(channel, "sip_local_network_addr", "%s", profile->extsipip ? profile->extsipip : profile->sipip);
|
||||
|
@ -4628,8 +4632,6 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
|
|||
caller_profile->network_addr = switch_core_strdup(caller_profile->pool, network_ip);
|
||||
}
|
||||
|
||||
switch_channel_clear_flag(channel, CF_REQ_MEDIA);
|
||||
|
||||
tech_pvt->last_sdp_str = NULL;
|
||||
if (!sofia_use_soa(tech_pvt) && sip->sip_payload && sip->sip_payload->pl_data) {
|
||||
tech_pvt->last_sdp_str = switch_core_session_strdup(session, sip->sip_payload->pl_data);
|
||||
|
|
|
@ -663,7 +663,11 @@ static switch_status_t audio_bridge_on_exchange_media(switch_core_session_t *ses
|
|||
if (switch_channel_test_flag(channel, CF_INTERCEPT)) {
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_PICKED_OFF);
|
||||
} else {
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
||||
if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_ORIGINATOR_CANCEL);
|
||||
} else {
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1175,10 +1179,25 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
|
|||
switch_channel_test_flag(peer_channel, CF_RING_READY)) {
|
||||
const char *app, *data;
|
||||
|
||||
if (switch_channel_get_state(peer_channel) == CS_CONSUME_MEDIA) {
|
||||
switch_channel_set_state(peer_channel, CS_RESET);
|
||||
switch_channel_wait_for_state(peer_channel, caller_channel, CS_RESET);
|
||||
}
|
||||
|
||||
if (!switch_channel_ready(caller_channel)) {
|
||||
switch_call_cause_t cause = switch_channel_get_cause(caller_channel);
|
||||
|
||||
if (cause) {
|
||||
switch_channel_hangup(peer_channel, cause);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch_channel_set_state(peer_channel, CS_CONSUME_MEDIA);
|
||||
|
||||
switch_channel_set_variable(peer_channel, "call_uuid", switch_core_session_get_uuid(session));
|
||||
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session));
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", switch_core_session_get_uuid(peer_session));
|
||||
|
|
|
@ -3510,6 +3510,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
if (*bleg) {
|
||||
switch_channel_t *bchan = switch_core_session_get_channel(*bleg);
|
||||
|
||||
if (switch_channel_get_state(bchan) == CS_CONSUME_MEDIA) {
|
||||
switch_channel_set_state(bchan, CS_RESET);
|
||||
switch_channel_wait_for_state(bchan, caller_channel, CS_RESET);
|
||||
}
|
||||
|
||||
if (session && caller_channel) {
|
||||
switch_caller_profile_t *cloned_profile, *peer_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(*bleg));
|
||||
|
||||
|
|
Loading…
Reference in New Issue