]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9854: [mod_sofia] SDP O/A fails to put sdp in messages after certain kinds of...
authorMike Jerris <mike@jerris.com>
Thu, 15 Dec 2016 20:01:54 +0000 (14:01 -0600)
committerMike Jerris <mike@jerris.com>
Thu, 22 Dec 2016 16:32:13 +0000 (11:32 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia.c

index 804611b72bb3002bea1893bd4ec81bcd2591c899..35056346b24f025faaddaa8668fcd62ee9f4d0a3 100644 (file)
@@ -2199,11 +2199,19 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                                                switch_core_media_proxy_remote_addr(session, NULL);
                                                        }
 
-                                                       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_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());
+                                                       }
 
                                                        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 */
index bfd97be62be4c41b0733c942ac82b6a73380e104..c9a00e4fb4890d5801cdafa2838e64a433394461 100644 (file)
@@ -1338,7 +1338,6 @@ static void tech_send_ack(nua_handle_t *nh, private_object_t *tech_pvt, const ch
                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)),
@@ -7347,6 +7346,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                        //switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
                                                        private_object_t *other_tech_pvt = switch_core_session_get_private(other_session);
 
+                                                       sofia_glue_clear_soa(other_session, SWITCH_TRUE);
+
                                                        nua_ack(other_tech_pvt->nh,
                                                                        NUTAG_MEDIA_ENABLE(0),
                                                                        TAG_IF(!zstr(other_tech_pvt->user_via), SIPTAG_VIA_STR(other_tech_pvt->user_via)),
@@ -7660,10 +7661,19 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot find a SDP\n");
                                switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                        } else {
-                               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());
+                               if (sofia_use_soa(tech_pvt)) {
+                                       nua_respond(tech_pvt->nh, SIP_200_OK,
+                                                               SIPTAG_CONTACT_STR(tech_pvt->profile->url),
+                                                               SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
+                                                               SOATAG_REUSE_REJECTED(1),
+                                                               SOATAG_AUDIO_AUX("cn telephone-event"),
+                                                               TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+                               } else {
+                                       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());
+                               }
                        }
 
                        goto done;