]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6890 #comment please test
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 6 Nov 2014 23:13:02 +0000 (17:13 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 6 Nov 2014 23:13:02 +0000 (17:13 -0600)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c

index 77273fe0397daec9a814176e580d5f0931797c2f..7ccfe9ee748437f626052f3e172c7e1739e3ebfd 100644 (file)
@@ -1591,9 +1591,14 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                cseq = sip_cseq_create(nh->nh_home, callsequence, SIP_METHOD_NOTIFY);
                                nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
                                
-                               from = (char *)switch_channel_get_variable(tech_pvt->channel, "sip_full_to");
-                               to = (char *)switch_channel_get_variable(tech_pvt->channel, "sip_full_from");
-                               
+                               if (tech_pvt->sent_last_invite || !tech_pvt->recv_invites) {
+                                       from = (char *)switch_channel_get_variable(tech_pvt->channel, "sip_full_from");
+                                       to = (char *)switch_channel_get_variable(tech_pvt->channel, "sip_full_to");
+                               } else {
+                                       from = (char *)switch_channel_get_variable(tech_pvt->channel, "sip_full_to");
+                                       to = (char *)switch_channel_get_variable(tech_pvt->channel, "sip_full_from");
+                               }
+
                                nua_info(nh,
                                                 TAG_IF(!zstr(tech_pvt->route_uri), NUTAG_PROXY(tech_pvt->route_uri)),
                                                 TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
index 6e9b70cc449586213b7df48298d37fac4c29ce91..52307a2800431f2d89e545bfc94d58b045d00f59 100644 (file)
@@ -810,6 +810,8 @@ struct private_object {
        time_t last_vid_info;
        uint32_t keepalive;
        uint32_t sent_invites;
+       uint32_t recv_invites;
+       uint8_t sent_last_invite;
 };
 
 
index b0107b200eef9c66d2846845de6dee5378ef8214..44995792f4e49e3bd21342438939138dcfd6abb8 100644 (file)
@@ -6688,6 +6688,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
        case nua_callstate_authenticating:
                break;
        case nua_callstate_calling:
+               tech_pvt->sent_last_invite = 1;
+               tech_pvt->sent_invites++;
                break;
        case nua_callstate_proceeding:
 
@@ -6826,6 +6828,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                }
                goto done;
        case nua_callstate_received:
+               tech_pvt->recv_invites++;
+               tech_pvt->sent_last_invite = 0;
                if (!sofia_test_flag(tech_pvt, TFLAG_SDP)) {
                        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);
index 17edf8935343484fb8ebb522b8267fa624a7e57c..f20f1a1e8c17754f643424474d4321d42ddc2090 100644 (file)
@@ -1233,7 +1233,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                                          switch_channel_get_name(tech_pvt->channel), switch_version_full_human(), 
                                          tech_pvt->mparams.local_sdp_str ? tech_pvt->mparams.local_sdp_str : "NO SDP PRESENT\n");
 
-       tech_pvt->sent_invites++;
+
 
        if (sofia_use_soa(tech_pvt)) {
                nua_invite(tech_pvt->nh,