From 3359f04a3f6bf81783be4eed3d1c436cf73c97a9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 14 Sep 2012 16:16:30 -0500 Subject: [PATCH] only use the wait_for_aleg_ack when the call is unanswered --- src/mod/endpoints/mod_sofia/sofia.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 40b1a9778b..0f3d478f69 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6419,19 +6419,22 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, break; case nua_callstate_completing: { - const char *wait_for_ack = switch_channel_get_variable(channel, "sip_wait_for_aleg_ack"); int send_ack = 1; - 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); - sofia_set_flag(other_tech_pvt, TFLAG_PASS_ACK); + if (!switch_channel_test_flag(channel, CF_ANSWERED)) { + const char *wait_for_ack = switch_channel_get_variable(channel, "sip_wait_for_aleg_ack"); + + 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); + sofia_set_flag(other_tech_pvt, TFLAG_PASS_ACK); send_ack = 0; + } + switch_core_session_rwunlock(other_session); } - switch_core_session_rwunlock(other_session); } }