Merge pull request #878 in FS/freeswitch from bugfix/FS-9214-fix-3pcc-behavior to master
* commit 'b9d31dc9b7edb702cd964a15fad197e122102f85': FS-9214: fix 3pcc behavior Fix callflow issues with 3pcc=true and 3pcc=proxy and interactions with sip_wait_for_aleg_ack removes passthrough of 183 on 3pcc=proxy (that was previously not functioning)
This commit is contained in:
commit
b2e0bdac91
|
@ -646,6 +646,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
|||
const char *val;
|
||||
const char *b_sdp = NULL;
|
||||
int is_proxy = 0;
|
||||
int is_3pcc_proxy = 0;
|
||||
int is_3pcc = 0;
|
||||
char *sticky = NULL;
|
||||
const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full");
|
||||
|
@ -662,7 +663,8 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
|||
b_sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE);
|
||||
switch_core_media_set_local_sdp(session, b_sdp, SWITCH_TRUE);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY nomedia - sending ack\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY nomedia - sending ack, SDP:\n%s\n", tech_pvt->mparams.local_sdp_str);
|
||||
|
||||
nua_ack(tech_pvt->nh,
|
||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
|
||||
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
|
||||
|
@ -685,9 +687,10 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
|||
|
||||
b_sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE);
|
||||
is_proxy = (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA));
|
||||
is_3pcc = (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC));
|
||||
is_3pcc_proxy = (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC));
|
||||
is_3pcc = (!sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC));
|
||||
|
||||
if (b_sdp && is_proxy && !is_3pcc) {
|
||||
if (b_sdp && is_proxy && !is_3pcc_proxy) {
|
||||
switch_core_media_set_local_sdp(session, b_sdp, SWITCH_TRUE);
|
||||
|
||||
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
|
||||
|
@ -698,19 +701,18 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
|||
}
|
||||
} else {
|
||||
/* This if statement check and handles the 3pcc proxy mode */
|
||||
|
||||
if (is_3pcc) {
|
||||
switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
|
||||
tech_pvt->mparams.local_sdp_str = NULL;
|
||||
switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0);
|
||||
switch_core_media_gen_local_sdp(session, SDP_TYPE_RESPONSE, NULL, 0, NULL, 0);
|
||||
} else if (is_3pcc_proxy) {
|
||||
|
||||
if (!(sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY))) {
|
||||
switch_channel_set_flag(channel, CF_3PCC);
|
||||
}
|
||||
|
||||
if (!is_proxy) {
|
||||
switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
|
||||
tech_pvt->mparams.local_sdp_str = NULL;
|
||||
|
||||
switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0);
|
||||
switch_core_media_gen_local_sdp(session, SDP_TYPE_RESPONSE, NULL, 0, NULL, 0);
|
||||
} else {
|
||||
switch_core_media_set_local_sdp(session, b_sdp, SWITCH_TRUE);
|
||||
|
||||
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
|
||||
|
@ -721,9 +723,11 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
|||
}
|
||||
}
|
||||
|
||||
if (is_3pcc || is_3pcc_proxy) {
|
||||
/* Send the 200 OK */
|
||||
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
|
||||
char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_RESPONSE_HEADER_PREFIX);
|
||||
|
||||
if (sofia_use_soa(tech_pvt)) {
|
||||
|
||||
nua_respond(tech_pvt->nh, SIP_200_OK,
|
||||
|
@ -749,10 +753,12 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
|||
SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), TAG_END());
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Sent a 200 OK, waiting for ACK\n");
|
||||
|
||||
switch_safe_free(extra_headers);
|
||||
}
|
||||
|
||||
if (is_3pcc_proxy) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Sent a 200 OK, waiting for ACK\n");
|
||||
/* Unlock the session signal to allow the ack to make it in */
|
||||
// Maybe we should timeout?
|
||||
switch_mutex_unlock(tech_pvt->sofia_mutex);
|
||||
|
@ -764,17 +770,16 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
|||
/* Regain lock on sofia */
|
||||
switch_mutex_lock(tech_pvt->sofia_mutex);
|
||||
|
||||
if(is_proxy) {
|
||||
if (is_proxy) {
|
||||
sofia_clear_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
|
||||
sofia_clear_flag(tech_pvt, TFLAG_3PCC);
|
||||
// This sends the message to the other leg that causes it to call the TFLAG_3PCC_INVITE code at the start of this function.
|
||||
// Is there another message it would be better to hang this on though?
|
||||
switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_ANSWER);
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Done waiting for ACK\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
if ((is_proxy && !b_sdp) || sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) ||
|
||||
switch_core_media_codec_chosen(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO) != SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -1429,8 +1434,21 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
|
||||
case SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT:
|
||||
{
|
||||
|
||||
if (zstr(msg->string_arg)) { /* no sdp requires proxy of ack */
|
||||
switch_core_session_t *other_session;
|
||||
|
||||
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_session_compare(session, other_session)) {
|
||||
private_object_t *other_tech_pvt = switch_core_session_get_private(other_session);
|
||||
sofia_set_flag(other_tech_pvt, TFLAG_PASS_ACK);
|
||||
}
|
||||
switch_core_session_rwunlock(other_session);
|
||||
}
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Sending media re-direct:\n%s\n",
|
||||
switch_channel_get_name(channel), msg->string_arg);
|
||||
switch_channel_get_name(channel), switch_str_nil(msg->string_arg));
|
||||
switch_core_media_set_local_sdp(session, msg->string_arg, SWITCH_TRUE);
|
||||
|
||||
if (zstr(tech_pvt->mparams.local_sdp_str)) {
|
||||
|
@ -2100,6 +2118,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
switch_mutex_unlock(tech_pvt->sofia_mutex);
|
||||
|
||||
while (switch_channel_ready(channel) && !sofia_test_flag(tech_pvt, TFLAG_3PCC_HAS_ACK)) {
|
||||
switch_ivr_parse_all_events(session);
|
||||
switch_cond_next();
|
||||
}
|
||||
|
||||
|
@ -2211,13 +2230,13 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
const char *val = NULL;
|
||||
const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full");
|
||||
const char *b_sdp = NULL;
|
||||
int is_proxy = 0, is_3pcc = 0;
|
||||
int is_proxy = 0, is_3pcc_proxy = 0;
|
||||
int send_sip_code = 183;
|
||||
const char * p_send_sip_msg = sip_183_Session_progress;
|
||||
|
||||
b_sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE);
|
||||
is_proxy = (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA));
|
||||
is_3pcc = (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC));
|
||||
is_3pcc_proxy = (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC));
|
||||
|
||||
// send 180 instead of 183 if variable "early_use_180" is "true"
|
||||
if (switch_true(switch_channel_get_variable(channel, "early_use_180"))) {
|
||||
|
@ -2225,7 +2244,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
p_send_sip_msg = sip_180_Ringing;
|
||||
}
|
||||
|
||||
if (b_sdp && is_proxy && !is_3pcc) {
|
||||
if (b_sdp && is_proxy && !is_3pcc_proxy) {
|
||||
switch_core_media_set_local_sdp(session, b_sdp, SWITCH_TRUE);
|
||||
|
||||
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
|
||||
|
@ -2235,84 +2254,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
goto end_lock;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (is_3pcc) {
|
||||
switch_channel_set_flag(channel, CF_3PCC);
|
||||
|
||||
if(!is_proxy) {
|
||||
switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
|
||||
tech_pvt->mparams.local_sdp_str = NULL;
|
||||
|
||||
switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0);
|
||||
switch_core_session_set_ice(session);
|
||||
switch_core_media_gen_local_sdp(session, SDP_TYPE_REQUEST, NULL , 0, NULL, 0);
|
||||
} else {
|
||||
switch_core_media_set_local_sdp(session, b_sdp, SWITCH_TRUE);
|
||||
|
||||
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
|
||||
switch_core_media_patch_sdp(tech_pvt->session);
|
||||
if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "failed to activate rtp\n");
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
goto end_lock;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Send the 183 */
|
||||
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
|
||||
char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
|
||||
if (sofia_use_soa(tech_pvt)) {
|
||||
|
||||
nua_respond(tech_pvt->nh, send_sip_code, p_send_sip_msg,
|
||||
TAG_IF(is_proxy, NUTAG_AUTOANSWER(0)),
|
||||
SIPTAG_CONTACT_STR(tech_pvt->profile->url),
|
||||
SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
|
||||
TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
|
||||
SOATAG_REUSE_REJECTED(1),
|
||||
SOATAG_RTP_SELECT(1),
|
||||
SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
|
||||
TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
|
||||
TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
|
||||
SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), TAG_END());
|
||||
} else {
|
||||
nua_respond(tech_pvt->nh, send_sip_code, p_send_sip_msg,
|
||||
NUTAG_MEDIA_ENABLE(0),
|
||||
SIPTAG_CONTACT_STR(tech_pvt->profile->url),
|
||||
TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
|
||||
TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
|
||||
SIPTAG_CONTENT_TYPE_STR("application/sdp"),
|
||||
SIPTAG_PAYLOAD_STR(tech_pvt->mparams.local_sdp_str),
|
||||
TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
|
||||
SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), TAG_END());
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Sent a 183 SESSION PROGRESS, waiting for PRACK\n");
|
||||
switch_safe_free(extra_headers);
|
||||
}
|
||||
|
||||
/* Unlock the session signal to allow the ack to make it in */
|
||||
// Maybe we should timeout?
|
||||
switch_mutex_unlock(tech_pvt->sofia_mutex);
|
||||
|
||||
while (switch_channel_ready(channel) && !sofia_test_flag(tech_pvt, TFLAG_3PCC_HAS_ACK)) {
|
||||
switch_cond_next();
|
||||
}
|
||||
|
||||
/* Regain lock on sofia */
|
||||
switch_mutex_lock(tech_pvt->sofia_mutex);
|
||||
|
||||
if(is_proxy || !switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE)) {
|
||||
sofia_clear_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
|
||||
sofia_clear_flag(tech_pvt, TFLAG_3PCC);
|
||||
// This sends the message to the other leg that causes it to call the TFLAG_3PCC_INVITE code at the start of this function.
|
||||
// Is there another message it would be better to hang this on though?
|
||||
switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_ANSWER);
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Done waiting for PRACK\n");
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
goto end_lock;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sofia_test_flag(tech_pvt, TFLAG_ANS) && !sofia_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
|
||||
|
|
|
@ -344,6 +344,7 @@ typedef enum {
|
|||
TFLAG_REINVITED,
|
||||
TFLAG_PASS_ACK,
|
||||
TFLAG_KEEPALIVE,
|
||||
TFLAG_SKIP_EARLY,
|
||||
/* No new flags below this line */
|
||||
TFLAG_MAX
|
||||
} TFLAGS;
|
||||
|
|
|
@ -1279,30 +1279,41 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro
|
|||
switch_safe_free(dup);
|
||||
}
|
||||
|
||||
static void tech_send_ack(nua_handle_t *nh, private_object_t *tech_pvt)
|
||||
static void tech_send_ack(nua_handle_t *nh, private_object_t *tech_pvt, const char *r_sdp)
|
||||
{
|
||||
const char *invite_full_from = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_from");
|
||||
const char *invite_full_to = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_to");
|
||||
|
||||
int soa = sofia_use_soa(tech_pvt);
|
||||
|
||||
if (sofia_test_pflag(tech_pvt->profile, PFLAG_TRACK_CALLS)) {
|
||||
const char *invite_full_via = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_via");
|
||||
const char *invite_route_uri = switch_channel_get_variable(tech_pvt->channel, "sip_invite_route_uri");
|
||||
|
||||
|
||||
nua_ack(nh,
|
||||
TAG_IF(invite_full_from, SIPTAG_FROM_STR(invite_full_from)),
|
||||
TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)),
|
||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
|
||||
TAG_IF((zstr(tech_pvt->user_via) && !zstr(invite_full_via)), SIPTAG_VIA_STR(invite_full_via)),
|
||||
TAG_IF(!zstr(invite_route_uri), SIPTAG_ROUTE_STR(invite_route_uri)),
|
||||
TAG_IF(r_sdp && soa, SOATAG_USER_SDP_STR(r_sdp)),
|
||||
TAG_IF(r_sdp && soa, SOATAG_REUSE_REJECTED(1)),
|
||||
TAG_IF(r_sdp && soa, SOATAG_AUDIO_AUX("cn telephone-event")),
|
||||
TAG_IF(r_sdp && !soa, SIPTAG_CONTENT_TYPE_STR("application/sdp")),
|
||||
TAG_IF(r_sdp && !soa, SIPTAG_PAYLOAD_STR(r_sdp)),
|
||||
TAG_IF(r_sdp && !soa, NUTAG_MEDIA_ENABLE(0)),
|
||||
TAG_END());
|
||||
|
||||
|
||||
} else {
|
||||
nua_ack(nh,
|
||||
TAG_IF(invite_full_from, SIPTAG_FROM_STR(invite_full_from)),
|
||||
TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)),
|
||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
|
||||
TAG_IF(r_sdp && soa, SOATAG_USER_SDP_STR(r_sdp)),
|
||||
TAG_IF(r_sdp && soa, SOATAG_REUSE_REJECTED(1)),
|
||||
TAG_IF(r_sdp && soa, SOATAG_AUDIO_AUX("cn telephone-event")),
|
||||
TAG_IF(r_sdp && !soa, SIPTAG_CONTENT_TYPE_STR("application/sdp")),
|
||||
TAG_IF(r_sdp && !soa, SIPTAG_PAYLOAD_STR(r_sdp)),
|
||||
TAG_IF(r_sdp && !soa, NUTAG_MEDIA_ENABLE(0)),
|
||||
TAG_END());
|
||||
}
|
||||
|
||||
|
@ -1554,6 +1565,25 @@ static void our_sofia_event_callback(nua_event_t event,
|
|||
case nua_i_ack:
|
||||
{
|
||||
if (channel && sip) {
|
||||
const char *r_sdp = NULL;
|
||||
|
||||
if (sofia_test_flag(tech_pvt, TFLAG_PASS_ACK) && sip->sip_payload && sip->sip_payload->pl_data) {
|
||||
r_sdp = sip->sip_payload->pl_data;
|
||||
|
||||
if (tech_pvt->mparams.last_sdp_str) {
|
||||
tech_pvt->mparams.prev_sdp_str = tech_pvt->mparams.last_sdp_str;
|
||||
}
|
||||
tech_pvt->mparams.last_sdp_str = NULL;
|
||||
|
||||
|
||||
if (!zstr(tech_pvt->mparams.prev_sdp_str) && strcmp(tech_pvt->mparams.prev_sdp_str, sip->sip_payload->pl_data)) {
|
||||
switch_channel_set_variable(channel, "sip_reinvite_sdp", sip->sip_payload->pl_data);
|
||||
tech_pvt->mparams.last_sdp_str = switch_core_session_strdup(session, sip->sip_payload->pl_data);
|
||||
} else {
|
||||
tech_pvt->mparams.last_sdp_str = tech_pvt->mparams.prev_sdp_str;
|
||||
}
|
||||
}
|
||||
|
||||
if (sip->sip_to && sip->sip_to->a_tag) {
|
||||
switch_channel_set_variable(channel, "sip_to_tag", sip->sip_to->a_tag);
|
||||
}
|
||||
|
@ -1581,11 +1611,10 @@ static void our_sofia_event_callback(nua_event_t event,
|
|||
|
||||
sofia_clear_flag(tech_pvt, TFLAG_PASS_ACK);
|
||||
|
||||
|
||||
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_session_compare(session, other_session)) {
|
||||
private_object_t *other_tech_pvt = switch_core_session_get_private(other_session);
|
||||
tech_send_ack(other_tech_pvt->nh, other_tech_pvt);
|
||||
tech_send_ack(other_tech_pvt->nh, other_tech_pvt, r_sdp);
|
||||
}
|
||||
switch_core_session_rwunlock(other_session);
|
||||
}
|
||||
|
@ -6072,6 +6101,21 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
|
|||
|
||||
switch_channel_clear_flag(channel, CF_REQ_MEDIA);
|
||||
|
||||
if (status < 200) {
|
||||
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
|
||||
private_object_t *other_tech_pvt = switch_core_session_get_private(other_session);
|
||||
|
||||
if (sofia_test_flag(other_tech_pvt, TFLAG_3PCC)) {
|
||||
sofia_set_flag_locked(tech_pvt, TFLAG_SKIP_EARLY);
|
||||
}
|
||||
switch_core_session_rwunlock(other_session);
|
||||
}
|
||||
|
||||
if (sofia_test_flag(tech_pvt, TFLAG_SKIP_EARLY)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -6436,6 +6480,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
|
|||
(switch_channel_test_flag(tech_pvt->channel, CF_T38_PASSTHRU) && (has_t38 || status > 299)))) {
|
||||
|
||||
if (sofia_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
|
||||
const char *wait_for_ack = switch_channel_get_variable(channel, "sip_wait_for_aleg_ack");
|
||||
sofia_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
|
||||
|
||||
if ((uuid = switch_channel_get_partner_uuid(channel)) && (other_session = switch_core_session_locate(uuid))) {
|
||||
|
@ -6451,7 +6496,22 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
|
|||
switch_core_media_proxy_remote_addr(session, NULL);
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n", status, phrase);
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n%s\n", status, phrase, switch_str_nil(r_sdp));
|
||||
|
||||
if (switch_true(wait_for_ack)) {
|
||||
switch_core_session_t *other_session;
|
||||
|
||||
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_session_compare(session, other_session)) {
|
||||
private_object_t *other_tech_pvt = switch_core_session_get_private(other_session);
|
||||
|
||||
if (!sofia_test_flag(tech_pvt, TFLAG_3PCC) && !sofia_test_flag(other_tech_pvt, TFLAG_3PCC)) {
|
||||
sofia_set_flag(other_tech_pvt, TFLAG_PASS_ACK);
|
||||
}
|
||||
}
|
||||
switch_core_session_rwunlock(other_session);
|
||||
}
|
||||
}
|
||||
|
||||
if (status == 491 && (switch_channel_test_flag(tech_pvt->channel, CF_T38_PASSTHRU) ||
|
||||
switch_channel_test_flag(channel, CF_PROXY_MODE))) {
|
||||
|
@ -6981,6 +7041,11 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
|||
break;
|
||||
case nua_callstate_proceeding:
|
||||
|
||||
if (sofia_test_flag(tech_pvt, TFLAG_SKIP_EARLY)) {
|
||||
sofia_clear_flag_locked(tech_pvt, TFLAG_SKIP_EARLY);
|
||||
goto done;
|
||||
}
|
||||
|
||||
switch (status) {
|
||||
case 180:
|
||||
switch_channel_mark_ring_ready(channel);
|
||||
|
@ -7084,9 +7149,12 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
|||
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_session_compare(session, other_session)) {
|
||||
private_object_t *other_tech_pvt = switch_core_session_get_private(other_session);
|
||||
|
||||
if (!sofia_test_flag(tech_pvt, TFLAG_3PCC) && !sofia_test_flag(other_tech_pvt, TFLAG_3PCC)) {
|
||||
sofia_set_flag(other_tech_pvt, TFLAG_PASS_ACK);
|
||||
send_ack = 0;
|
||||
}
|
||||
}
|
||||
switch_core_session_rwunlock(other_session);
|
||||
}
|
||||
}
|
||||
|
@ -7198,7 +7266,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
|||
}
|
||||
|
||||
if (send_ack) {
|
||||
tech_send_ack(nh, tech_pvt);
|
||||
tech_send_ack(nh, tech_pvt, NULL);
|
||||
} else {
|
||||
ss_state = nua_callstate_ready;
|
||||
goto state_process;
|
||||
|
@ -7421,10 +7489,6 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
|||
switch_channel_mark_pre_answered(channel);
|
||||
sofia_set_flag(tech_pvt, TFLAG_SDP);
|
||||
|
||||
if (sofia_test_flag(tech_pvt, TFLAG_3PCC) && sofia_test_pflag(profile, PFLAG_3PCC_PROXY)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Got my PRACK\n");
|
||||
sofia_set_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
|
||||
}
|
||||
|
||||
match = sofia_media_negotiate_sdp(session, r_sdp, SDP_TYPE_RESPONSE);
|
||||
if (match) {
|
||||
|
|
Loading…
Reference in New Issue