]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9060: [mod_sofia] correct issues with hold and broken soa negotiations after perfo...
authorAnthony Minessale <anthm@freeswitch.org>
Sat, 16 Apr 2016 00:35:00 +0000 (19:35 -0500)
committerMichael Jerris <mike@jerris.com>
Fri, 22 Apr 2016 17:26:13 +0000 (12:26 -0500)
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 3bf5b4968d2e5de7ae84ebb0a6f56ab024933d9f..bc20ac2968bc49a55c11b6ce4489d744604553e8 100644 (file)
@@ -1510,10 +1510,13 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 
                        switch_channel_clear_flag(tech_pvt->channel, CF_MEDIA_ACK);
                        switch_channel_set_flag(tech_pvt->channel, CF_REQ_MEDIA);
-                       
-                       nua_invite(tech_pvt->nh, NUTAG_MEDIA_ENABLE(0),
+
+                       sofia_glue_clear_soa(session, SWITCH_TRUE);
+
+                       nua_invite(tech_pvt->nh,
+                                          NUTAG_MEDIA_ENABLE(0),
                                           TAG_IF(msg->string_arg, SIPTAG_CONTENT_TYPE_STR("application/sdp")), 
-                                          TAG_IF(msg->string_arg, SIPTAG_PAYLOAD_STR(msg->string_arg)), 
+                                          SIPTAG_PAYLOAD_STR(msg->string_arg),
                                           TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
                        
                        switch_safe_free(extra_headers);
@@ -1523,10 +1526,13 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                {
                        char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_HEADER_PREFIX);
 
+                       sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA);
+
                        switch_channel_clear_flag(tech_pvt->channel, CF_MEDIA_ACK);
                        switch_channel_clear_flag(tech_pvt->channel, CF_MEDIA_SET);
                        switch_channel_set_flag(tech_pvt->channel, CF_REQ_MEDIA);
 
+                       sofia_glue_clear_soa(session, SWITCH_TRUE);
 
                        nua_invite(tech_pvt->nh, NUTAG_MEDIA_ENABLE(0), SIPTAG_PAYLOAD_STR(""), 
                                           TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
@@ -2078,19 +2084,13 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                                                switch_core_media_patch_sdp(tech_pvt->session);
                                                                switch_core_media_proxy_remote_addr(session, NULL);
                                                        }
-                                                       if (sofia_use_soa(tech_pvt)) {
-                                                               nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-                                                                                       SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
-                                                                                       SOATAG_REUSE_REJECTED(1),
-                                                                                       SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
-                                                                                       TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
-                                                       } else {
-                                                               nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-                                                                                       NUTAG_MEDIA_ENABLE(0),
-                                                                                       SIPTAG_CONTENT_TYPE_STR("application/sdp"),
-                                                                                       SIPTAG_PAYLOAD_STR(tech_pvt->mparams.local_sdp_str),
-                                                                                       TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
-                                                       }
+
+                                                       nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+                                                                               NUTAG_MEDIA_ENABLE(0),
+                                                                               SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+                                                                               SIPTAG_PAYLOAD_STR(tech_pvt->mparams.local_sdp_str),
+                                                                               TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
+
                                                        if (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC)) {
                                                                /* Unlock the session signal to allow the ack to make it in */
                                                                // Maybe we should timeout?
index 19ce2d711a7399d8ae17adcd88897b6013bee565..9a4dca3147b6d730b3cd207f32e9d93805e9ee02 100644 (file)
@@ -1205,6 +1205,8 @@ void sofia_reg_check_socket(sofia_profile_t *profile, const char *call_id, const
 void sofia_reg_close_handles(sofia_profile_t *profile);
 
 void write_csta_xml_chunk(switch_event_t *event, switch_stream_handle_t stream, const char *csta_event, char *fwd_type);
+void sofia_glue_clear_soa(switch_core_session_t *session, switch_bool_t partner);
+
 /* For Emacs:
  * Local Variables:
  * mode:c
index f86b79fd1a1858c4b31345a53732f6896c2face7..f2f458ffec465173a1cc7f227963cfde5fc8fc46 100644 (file)
@@ -7375,11 +7375,13 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
 
                        nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END());
                        goto done;
-               } else if (r_sdp && !sofia_use_soa(tech_pvt)) {
+                       
+                       /* } else if (0 && r_sdp && !sofia_use_soa(tech_pvt)) {
                        nua_respond(tech_pvt->nh, SIP_200_OK,
                                                NUTAG_MEDIA_ENABLE(0),
                                                SIPTAG_CONTACT_STR(tech_pvt->profile->url),
                                                SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech_pvt->mparams.local_sdp_str), TAG_END());
+                       */
                } else {
                        ss_state = nua_callstate_completed;
                        goto state_process;
index 010098f07ca7e6d05ab76cba6c84035721498fd5..eaad00a2a199a1f320da09f929e2101e893df189 100644 (file)
@@ -3087,6 +3087,24 @@ void sofia_event_fire(sofia_profile_t *profile, switch_event_t **event)
        *event = NULL;
 }
 
+void sofia_glue_clear_soa(switch_core_session_t *session, switch_bool_t partner)
+{
+       switch_core_session_t *other_session;
+       struct private_object *tech_pvt = switch_core_session_get_private(session);
+
+       sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA);
+
+       if (partner && switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
+               if (switch_core_session_compare(session, other_session)) {
+                       struct private_object *other_tech_pvt = switch_core_session_get_private(other_session);
+                       
+                       sofia_clear_flag(other_tech_pvt, TFLAG_ENABLE_SOA);
+               }
+               switch_core_session_rwunlock(other_session);
+       }
+
+}
+
 
 /* For Emacs:
  * Local Variables: