]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
pass1
authorAnthony Minessale <anthm@freeswitch.org>
Sat, 22 Dec 2012 00:06:09 +0000 (18:06 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 1 Apr 2013 02:27:14 +0000 (21:27 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/rtp.c
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_media.c

index 209ae2577bddc423ae110c50b0842522c3c42bdc..e4a2d6a5ee930db45d948159dbbd7f06d1ec6e34 100644 (file)
@@ -77,15 +77,15 @@ static switch_status_t sofia_on_init(switch_core_session_t *session)
 
        switch_assert(tech_pvt != NULL);
 
-       tech_pvt->read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN;
+
        switch_mutex_lock(tech_pvt->sofia_mutex);
 
 
-       sofia_glue_check_dtmf_type(tech_pvt);
+       switch_core_media_check_dtmf_type(session);
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA INIT\n", switch_channel_get_name(channel));
        if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
-               sofia_media_tech_absorb_sdp(tech_pvt);
+               switch_core_media_absorb_sdp(session);
        }
 
        if (switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING) || switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING_BRIDGE)) {
@@ -302,19 +302,8 @@ char *generate_pai_str(private_object_t *tech_pvt)
 static stfu_instance_t *sofia_get_jb(switch_core_session_t *session, switch_media_type_t type)
 {
        private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
-       switch_rtp_t *rtp;
-       
-       if (type == SWITCH_MEDIA_TYPE_AUDIO) {
-               rtp = tech_pvt->rtp_session;
-       } else {
-               rtp = tech_pvt->video_rtp_session;
-       }
 
-       if (rtp && switch_rtp_ready(rtp)) {
-               return switch_rtp_get_jitter_buffer(rtp);
-       }
-       
-       return NULL;
+       return switch_core_media_get_jb(tech_pvt->session, type);
 }
 
 /* map QSIG cause codes to SIP from RFC4497 section 8.4.1 */
@@ -402,30 +391,13 @@ switch_status_t sofia_on_destroy(switch_core_session_t *session)
                        switch_mutex_unlock(tech_pvt->profile->flag_mutex);
                }
 
-               if (switch_core_codec_ready(&tech_pvt->read_codec)) {
-                       switch_core_codec_destroy(&tech_pvt->read_codec);
-               }
-
-               if (switch_core_codec_ready(&tech_pvt->write_codec)) {
-                       switch_core_codec_destroy(&tech_pvt->write_codec);
-               }
-
-               if (switch_core_codec_ready(&tech_pvt->video_read_codec)) {
-                       switch_core_codec_destroy(&tech_pvt->video_read_codec);
-               }
-
-               if (switch_core_codec_ready(&tech_pvt->video_write_codec)) {
-                       switch_core_codec_destroy(&tech_pvt->video_write_codec);
-               }
-
-               switch_core_session_unset_read_codec(session);
-               switch_core_session_unset_write_codec(session);
 
                switch_mutex_lock(tech_pvt->profile->flag_mutex);
                tech_pvt->profile->inuse--;
                switch_mutex_unlock(tech_pvt->profile->flag_mutex);
 
-               sofia_glue_deactivate_rtp(tech_pvt);
+               switch_media_handle_destroy(session);
+
 
                if (sofia_test_pflag(tech_pvt->profile, PFLAG_DESTROY) && !tech_pvt->profile->inuse) {
                        sofia_profile_destroy(tech_pvt->profile);
@@ -695,19 +667,19 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
        if (switch_channel_test_flag(channel, CF_CONFERENCE)) {
                tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;isfocus", tech_pvt->reply_contact);
        }
-
+       //switch_core_media_set_local_sdp
        if(sofia_test_flag(tech_pvt, TFLAG_3PCC_INVITE)) {
                // SNARK: complete hack to get final ack sent when a 3pcc invite has been passed from the other leg in bypass_media mode.
                // This code handles the pass_indication sent after the 3pcc ack is received by the other leg in the is_3pcc && is_proxy case below.
                // Is there a better place to hang this...?
                b_sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE);
-               sofia_media_tech_set_local_sdp(tech_pvt, b_sdp, SWITCH_TRUE);
+               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");
                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),
-                       SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                       SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
                        SOATAG_REUSE_REJECTED(1),
                        SOATAG_RTP_SELECT(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
                        TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)),
@@ -729,10 +701,10 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
        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) {
-               sofia_media_tech_set_local_sdp(tech_pvt, b_sdp, SWITCH_TRUE);
+               switch_core_media_set_local_sdp(session, b_sdp, SWITCH_TRUE);
 
                if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
-                       sofia_media_tech_patch_sdp(tech_pvt);
+                       switch_core_media_patch_sdp(tech_pvt->session);
                        if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
                                return SWITCH_STATUS_FALSE;
                        }
@@ -742,16 +714,16 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                if (is_3pcc) {
 
                        if(!is_proxy) {
-                       tech_pvt->num_codecs = 0;
-                       sofia_media_tech_prepare_codecs(tech_pvt);
-                       tech_pvt->local_sdp_str = NULL;
-                       sofia_glue_tech_choose_port(tech_pvt, 0);
-                       sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+                       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, NULL, 0, NULL, 0);
                        } else {
-                               sofia_media_tech_set_local_sdp(tech_pvt, b_sdp, SWITCH_TRUE);
+                               switch_core_media_set_local_sdp(session, b_sdp, SWITCH_TRUE);
 
                                if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
-                                       sofia_media_tech_patch_sdp(tech_pvt);
+                                       switch_core_media_patch_sdp(tech_pvt->session);
                                        if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
                                                return SWITCH_STATUS_FALSE;
                                        }
@@ -765,7 +737,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                                        nua_respond(tech_pvt->nh, SIP_200_OK,
                                                                TAG_IF(is_proxy, NUTAG_AUTOANSWER(0)),
                                                                SIPTAG_CONTACT_STR(tech_pvt->profile->url),
-                                                               SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                                                               SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
                                                                TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
                                                                SOATAG_REUSE_REJECTED(1), TAG_IF(is_proxy, SOATAG_RTP_SELECT(1)),
                                                                SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
@@ -779,7 +751,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                                                                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->local_sdp_str),
+                                                               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());
                                }
@@ -811,7 +783,8 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                        return SWITCH_STATUS_SUCCESS;
                }
 
-               if ((is_proxy && !b_sdp) || sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
+               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) {
                        sofia_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
 
                        if (is_proxy) {
@@ -822,8 +795,8 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
 
                        if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) {
                                const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
-                               tech_pvt->num_codecs = 0;
-                               sofia_media_tech_prepare_codecs(tech_pvt);
+
+                               switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
 
                                if (sofia_media_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
                                        switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
@@ -835,20 +808,20 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                        }
                }
 
-               if ((status = sofia_glue_tech_choose_port(tech_pvt, 0)) != SWITCH_STATUS_SUCCESS) {
+               if ((status = switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0)) != SWITCH_STATUS_SUCCESS) {
                        switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                        return status;
                }
 
-               sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+               switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 0);
                if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
                        switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                }
 
                if (tech_pvt->nh) {
-                       if (tech_pvt->local_sdp_str) {
+                       if (tech_pvt->mparams.local_sdp_str) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Local SDP %s:\n%s\n", switch_channel_get_name(channel),
-                                                                 tech_pvt->local_sdp_str);
+                                                                 tech_pvt->mparams.local_sdp_str);
                        }
                }
        }
@@ -876,12 +849,12 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                cid = generate_pai_str(tech_pvt);
 
 
-               if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) && tech_pvt->early_sdp) {
+               if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) && tech_pvt->mparams.early_sdp) {
                        char *a, *b;
                        
                        /* start at the s= line to avoid some devices who update the o= between messages */
-                       a = strstr(tech_pvt->early_sdp, "s=");
-                       b = strstr(tech_pvt->local_sdp_str, "s=");
+                       a = strstr(tech_pvt->mparams.early_sdp, "s=");
+                       b = strstr(tech_pvt->mparams.local_sdp_str, "s=");
 
                        if (!a || !b || strcmp(a, b)) {
 
@@ -910,7 +883,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                                                NUTAG_SESSION_REFRESHER(tech_pvt->session_refresher),
                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
                                                SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
-                                               SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                                               SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
                                                SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
                                                TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)),
                                                TAG_IF(is_proxy, SOATAG_RTP_SELECT(1)),
@@ -929,7 +902,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
                                                SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
                                                SIPTAG_CONTENT_TYPE_STR("application/sdp"),
-                                               SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str),
+                                               SIPTAG_PAYLOAD_STR(tech_pvt->mparams.local_sdp_str),
                                                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());
@@ -951,7 +924,7 @@ static switch_status_t sofia_read_video_frame(switch_core_session_t *session, sw
                return SWITCH_STATUS_FALSE;
        }
 #if 0
-       while (!(tech_pvt->video_read_codec.implementation && switch_rtp_ready(tech_pvt->video_rtp_session) && !switch_channel_test_flag(channel, CF_REQ_MEDIA))) {
+       while (!(tech_pvt->video_read_codec.implementation && switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_VIDEO) && !switch_channel_test_flag(channel, CF_REQ_MEDIA))) {
                switch_ivr_parse_all_messages(tech_pvt->session);
                
                if (--sanity && switch_channel_ready(channel)) {
@@ -974,7 +947,7 @@ static switch_status_t sofia_write_video_frame(switch_core_session_t *session, s
        switch_assert(tech_pvt != NULL);
 
 #if 0
-       while (!(tech_pvt->video_read_codec.implementation && switch_rtp_ready(tech_pvt->video_rtp_session))) {
+       while (!(tech_pvt->video_read_codec.implementation && switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_VIDEO))) {
                if (switch_channel_ready(channel)) {
                        switch_yield(10000);
                } else {
@@ -995,8 +968,11 @@ static switch_status_t sofia_write_video_frame(switch_core_session_t *session, s
                return SWITCH_STATUS_SUCCESS;
        }
 
-       return switch_core_media_write_frame(session, frame, flags, stream_id, SWITCH_MEDIA_TYPE_VIDEO);
-       
+       if (switch_core_media_write_frame(session, frame, flags, stream_id, SWITCH_MEDIA_TYPE_VIDEO)) {
+               return SWITCH_STATUS_SUCCESS;
+       }
+
+       return SWITCH_STATUS_FALSE;
 }
 
 static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
@@ -1004,7 +980,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
        private_object_t *tech_pvt = switch_core_session_get_private(session);
        switch_channel_t *channel = switch_core_session_get_channel(session);
        uint32_t sanity = 1000;
-       switch_rtcp_frame_t rtcp_frame;
+       switch_status_t status = SWITCH_STATUS_FALSE;
 
        switch_assert(tech_pvt != NULL);
 
@@ -1017,7 +993,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
                return SWITCH_STATUS_FALSE;
        }
 
-       while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session) && !switch_channel_test_flag(channel, CF_REQ_MEDIA))) {
+       while (!(switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO) && !switch_channel_test_flag(channel, CF_REQ_MEDIA))) {
                switch_ivr_parse_all_messages(tech_pvt->session);
                if (--sanity && switch_channel_up(channel)) {
                        switch_yield(10000);
@@ -1027,304 +1003,18 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
                }
        }
 
-       tech_pvt->read_frame.datalen = 0;
+
        sofia_set_flag_locked(tech_pvt, TFLAG_READING);
 
-       if (sofia_test_flag(tech_pvt, TFLAG_HUP) || sofia_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation ||
-               !switch_core_codec_ready(&tech_pvt->read_codec)) {
+       if (sofia_test_flag(tech_pvt, TFLAG_HUP) || sofia_test_flag(tech_pvt, TFLAG_BYE)) {
                return SWITCH_STATUS_FALSE;
        }
 
-       if (sofia_test_flag(tech_pvt, TFLAG_IO)) {
-               switch_status_t status;
-
-               if (!sofia_test_flag(tech_pvt, TFLAG_RTP)) {
-                       return SWITCH_STATUS_GENERR;
-               }
-
-               switch_assert(tech_pvt->rtp_session != NULL);
-               tech_pvt->read_frame.datalen = 0;
-
-
-               if (sofia_test_flag(tech_pvt, TFLAG_SIMPLIFY) && sofia_test_flag(tech_pvt, TFLAG_GOT_ACK)) {
-                       if (sofia_glue_tech_simplify(tech_pvt)) {
-                               sofia_clear_flag(tech_pvt, TFLAG_SIMPLIFY);
-                       }
-               }
-
-               while (sofia_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->read_frame.datalen == 0) {
-                       tech_pvt->read_frame.flags = SFF_NONE;
-
-                       status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame, flags);
-                       
-                       if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
-                               if (status == SWITCH_STATUS_TIMEOUT) {
-
-                                       if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
-                                               switch_core_media_toggle_hold(session, 0);
-                                               sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
-                                               switch_channel_clear_flag(channel, CF_LEG_HOLDING);
-                                       }
-                                       
-                                       if (switch_channel_get_variable(tech_pvt->channel, "execute_on_media_timeout")) {
-                                               *frame = &tech_pvt->read_frame;
-                                               switch_set_flag((*frame), SFF_CNG);
-                                               (*frame)->datalen = tech_pvt->read_impl.encoded_bytes_per_packet;
-                                               memset((*frame)->data, 0, (*frame)->datalen);
-                                               switch_channel_execute_on(tech_pvt->channel, "execute_on_media_timeout");
-                                               return SWITCH_STATUS_SUCCESS;
-                                       }
-
-
-                                       switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_MEDIA_TIMEOUT);
-                               }
-                               return status;
-                       }
-
-                       /* Try to read an RTCP frame, if successful raise an event */
-                       if (switch_rtcp_zerocopy_read_frame(tech_pvt->rtp_session, &rtcp_frame) == SWITCH_STATUS_SUCCESS) {
-                               switch_event_t *event;
-
-                               if (switch_event_create(&event, SWITCH_EVENT_RECV_RTCP_MESSAGE) == SWITCH_STATUS_SUCCESS) {
-                                       char value[30];
-                                       char header[50];
-                                       int i;
-
-                                       char *uuid = switch_core_session_get_uuid(session);
-                                       if (uuid) {
-                                               switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(session));
-                                       }
-
-                                       snprintf(value, sizeof(value), "%.8x", rtcp_frame.ssrc);
-                                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SSRC", value);
-
-                                       snprintf(value, sizeof(value), "%u", rtcp_frame.ntp_msw);
-                                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "NTP-Most-Significant-Word", value);
-
-                                       snprintf(value, sizeof(value), "%u", rtcp_frame.ntp_lsw);
-                                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "NTP-Least-Significant-Word", value);
-
-                                       snprintf(value, sizeof(value), "%u", rtcp_frame.timestamp);
-                                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "RTP-Timestamp", value);
-
-                                       snprintf(value, sizeof(value), "%u", rtcp_frame.packet_count);
-                                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Sender-Packet-Count", value);
-
-                                       snprintf(value, sizeof(value), "%u", rtcp_frame.octect_count);
-                                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Octect-Packet-Count", value);
-
-                                       snprintf(value, sizeof(value), "%" SWITCH_SIZE_T_FMT, tech_pvt->read_frame.timestamp);
-                                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Last-RTP-Timestamp", value);
-
-                                       snprintf(value, sizeof(value), "%u", tech_pvt->read_frame.rate);
-                                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "RTP-Rate", value);
-
-                                       snprintf(value, sizeof(value), "%" SWITCH_TIME_T_FMT, switch_time_now());
-                                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Capture-Time", value);
-
-                                        // Add sources info
-                                       for (i = 0; i < rtcp_frame.report_count; i++) {
-                                               snprintf(header, sizeof(header), "Source%u-SSRC", i);
-                                               snprintf(value, sizeof(value), "%.8x", rtcp_frame.reports[i].ssrc);
-                                               switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value);
-                                               snprintf(header, sizeof(header), "Source%u-Fraction", i);
-                                               snprintf(value, sizeof(value), "%u", rtcp_frame.reports[i].fraction);
-                                               switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value);
-                                               snprintf(header, sizeof(header), "Source%u-Lost", i);
-                                               snprintf(value, sizeof(value), "%u", rtcp_frame.reports[i].lost);
-                                               switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value);
-                                               snprintf(header, sizeof(header), "Source%u-Highest-Sequence-Number-Received", i);
-                                               snprintf(value, sizeof(value), "%u", rtcp_frame.reports[i].highest_sequence_number_received);
-                                               switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value);
-                                               snprintf(header, sizeof(header), "Source%u-Jitter", i);
-                                               snprintf(value, sizeof(value), "%u", rtcp_frame.reports[i].jitter);
-                                               switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value);
-                                               snprintf(header, sizeof(header), "Source%u-LSR", i);
-                                               snprintf(value, sizeof(value), "%u", rtcp_frame.reports[i].lsr);
-                                               switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value);
-                                               snprintf(header, sizeof(header), "Source%u-DLSR", i);
-                                               snprintf(value, sizeof(value), "%u", rtcp_frame.reports[i].dlsr);
-                                               switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value);
-                                       }
-
-                                       switch_event_fire(&event);
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "Dispatched RTCP event\n");
-                               }
-                       }
-
-                       /* Fast PASS! */
-                       if (switch_test_flag((&tech_pvt->read_frame), SFF_PROXY_PACKET)) {
-                               sofia_clear_flag_locked(tech_pvt, TFLAG_READING);
-                               *frame = &tech_pvt->read_frame;
-                               return SWITCH_STATUS_SUCCESS;
-                       }
-
-                       if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) {
-                               switch_dtmf_t dtmf = { 0 };
-                               switch_rtp_dequeue_dtmf(tech_pvt->rtp_session, &dtmf);
-                               switch_channel_queue_dtmf(channel, &dtmf);
-                       }
-
-                       if (tech_pvt->read_frame.datalen > 0) {
-                               uint32_t bytes = 0;
-                               int frames = 1;
-
-                               if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
-                                       if (!tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) {
-                                               *frame = NULL;
-                                               return SWITCH_STATUS_GENERR;
-                                       }
-
-                                       if ((tech_pvt->read_frame.datalen % 10) == 0 &&
-                                               sofia_test_media_flag(tech_pvt->profile, SCMF_AUTOFIX_TIMING) && tech_pvt->check_frames < MAX_CODEC_CHECK_FRAMES) {
-                                               tech_pvt->check_frames++;
-
-                                               if (!tech_pvt->read_impl.encoded_bytes_per_packet) {
-                                                       tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
-                                                       goto skip;
-                                               }
-
-                                               if (tech_pvt->last_ts && tech_pvt->read_frame.datalen != tech_pvt->read_impl.encoded_bytes_per_packet) {
-                                                       uint32_t codec_ms = (int) (tech_pvt->read_frame.timestamp -
-                                                                                                          tech_pvt->last_ts) / (tech_pvt->read_impl.samples_per_second / 1000);
-
-                                                       if ((codec_ms % 10) != 0 || codec_ms > tech_pvt->read_impl.samples_per_packet * 10) {
-                                                               tech_pvt->last_ts = 0;
-                                                               goto skip;
-                                                       }
-
-
-                                                       if (tech_pvt->last_codec_ms && tech_pvt->last_codec_ms == codec_ms) {
-                                                               tech_pvt->mismatch_count++;
-                                                       }
-
-                                                       tech_pvt->last_codec_ms = codec_ms;
-
-                                                       if (tech_pvt->mismatch_count > MAX_MISMATCH_FRAMES) {
-                                                               if (switch_rtp_ready(tech_pvt->rtp_session) && codec_ms != tech_pvt->codec_ms) {
-                                                                       const char *val;
-                                                                       int rtp_timeout_sec = 0;
-                                                                       int rtp_hold_timeout_sec = 0;
-
-                                                                       if (codec_ms > 120) {   /* yeah right */
-                                                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
-                                                                                                                 "Your phone is trying to send timestamps that suggest an increment of %dms per packet\n"
-                                                                                                                 "That seems hard to believe so I am going to go on ahead and um ignore that, mmkay?\n",
-                                                                                                                 (int) codec_ms);
-                                                                               tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
-                                                                               goto skip;
-                                                                       }
-
-                                                                       tech_pvt->read_frame.datalen = 0;
-
-                                                                       if (codec_ms != tech_pvt->codec_ms) {
-                                                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
-                                                                                                                 "Asynchronous PTIME not supported, changing our end from %d to %d\n",
-                                                                                                                 (int) tech_pvt->codec_ms,
-                                                                                                                 (int) codec_ms
-                                                                                                                 );
-
-                                                                               switch_channel_set_variable_printf(channel, "sip_h_X-Broken-PTIME", "Adv=%d;Sent=%d",
-                                                                                                                                                  (int) tech_pvt->codec_ms, (int) codec_ms);
-
-                                                                               tech_pvt->codec_ms = codec_ms;
-                                                                       }
-
-                                                                       if (switch_core_media_set_codec(tech_pvt->session, 2, tech_pvt->profile->codec_flags) != SWITCH_STATUS_SUCCESS) {
-                                                                               *frame = NULL;
-                                                                               return SWITCH_STATUS_GENERR;
-                                                                       }
-
-                                                                       if ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_timeout_sec"))) {
-                                                                               int v = atoi(val);
-                                                                               if (v >= 0) {
-                                                                                       rtp_timeout_sec = v;
-                                                                               }
-                                                                       }
-
-                                                                       if ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_hold_timeout_sec"))) {
-                                                                               int v = atoi(val);
-                                                                               if (v >= 0) {
-                                                                                       rtp_hold_timeout_sec = v;
-                                                                               }
-                                                                       }
-
-                                                                       if (rtp_timeout_sec) {
-                                                                               tech_pvt->max_missed_packets = (tech_pvt->read_impl.samples_per_second * rtp_timeout_sec) /
-                                                                                       tech_pvt->read_impl.samples_per_packet;
-
-                                                                               switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
-                                                                               if (!rtp_hold_timeout_sec) {
-                                                                                       rtp_hold_timeout_sec = rtp_timeout_sec * 10;
-                                                                               }
-                                                                       }
-
-                                                                       if (rtp_hold_timeout_sec) {
-                                                                               tech_pvt->max_missed_hold_packets = (tech_pvt->read_impl.samples_per_second * rtp_hold_timeout_sec) /
-                                                                                       tech_pvt->read_impl.samples_per_packet;
-                                                                       }
-
-
-                                                                       tech_pvt->check_frames = 0;
-                                                                       tech_pvt->last_ts = 0;
-
-                                                                       /* inform them of the codec they are actually sending */
-#if 0
-                                                                       if (++tech_pvt->codec_reinvites > 2) {
-                                                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
-                                                                                                                 "Ok, some devices *cough* X-lite *cough*\n"
-                                                                                                                 "seem to continue to lie over and over again so I guess we'll\n"
-                                                                                                                 "leave well-enough alone and let them lie\n");
-                                                                       } else {
-                                                                               sofia_glue_do_invite(session);
-                                                                       }
-#endif
-                                                                       *frame = &tech_pvt->read_frame;
-                                                                       switch_set_flag((*frame), SFF_CNG);
-                                                                       (*frame)->datalen = tech_pvt->read_impl.encoded_bytes_per_packet;
-                                                                       memset((*frame)->data, 0, (*frame)->datalen);
-                                                                       return SWITCH_STATUS_SUCCESS;
-                                                               }
-
-                                                       }
-
-                                               } else {
-                                                       tech_pvt->mismatch_count = 0;
-                                               }
-
-                                               tech_pvt->last_ts = tech_pvt->read_frame.timestamp;
-
-
-                                       } else {
-                                               tech_pvt->mismatch_count = 0;
-                                               tech_pvt->last_ts = 0;
-                                       }
-                                 skip:
-
-                                       if ((bytes = tech_pvt->read_impl.encoded_bytes_per_packet)) {
-                                               frames = (tech_pvt->read_frame.datalen / bytes);
-                                       }
-                                       tech_pvt->read_frame.samples = (int) (frames * tech_pvt->read_impl.samples_per_packet);
-
-                                       if (tech_pvt->read_frame.datalen == 0) {
-                                               continue;
-                                       }
-                               }
-                               break;
-                       }
-               }
-       }
+       status = switch_core_media_read_frame(session, frame, flags, stream_id, SWITCH_MEDIA_TYPE_AUDIO);
 
        sofia_clear_flag_locked(tech_pvt, TFLAG_READING);
 
-       if (tech_pvt->read_frame.datalen == 0) {
-               *frame = NULL;
-               return SWITCH_STATUS_GENERR;
-       }
-
-       *frame = &tech_pvt->read_frame;
-
-       return SWITCH_STATUS_SUCCESS;
+       return status;
 }
 
 static switch_status_t sofia_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
@@ -1332,11 +1022,10 @@ static switch_status_t sofia_write_frame(switch_core_session_t *session, switch_
        private_object_t *tech_pvt = switch_core_session_get_private(session);
        switch_channel_t *channel = switch_core_session_get_channel(session);
        switch_status_t status = SWITCH_STATUS_SUCCESS;
-       int bytes = 0, samples = 0, frames = 0;
 
        switch_assert(tech_pvt != NULL);
 
-       while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session) && !switch_channel_test_flag(channel, CF_REQ_MEDIA))) {
+       while (!(switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO) && !switch_channel_test_flag(channel, CF_REQ_MEDIA))) {
                if (switch_channel_ready(channel)) {
                        switch_yield(10000);
                } else {
@@ -1344,14 +1033,12 @@ static switch_status_t sofia_write_frame(switch_core_session_t *session, switch_
                }
        }
 
-       if (!tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) {
-               return SWITCH_STATUS_GENERR;
-       }
 
        if (sofia_test_flag(tech_pvt, TFLAG_HUP)) {
                return SWITCH_STATUS_FALSE;
        }
 
+#if 0
        if (!sofia_test_flag(tech_pvt, TFLAG_RTP)) {
                return SWITCH_STATUS_GENERR;
        }
@@ -1359,26 +1046,18 @@ static switch_status_t sofia_write_frame(switch_core_session_t *session, switch_
        if (!sofia_test_flag(tech_pvt, TFLAG_IO)) {
                return SWITCH_STATUS_SUCCESS;
        }
+#endif
 
-       if (sofia_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) {
+       if (sofia_test_flag(tech_pvt, TFLAG_BYE)) {
                return SWITCH_STATUS_FALSE;
        }
 
        sofia_set_flag_locked(tech_pvt, TFLAG_WRITING);
 
-       if (!switch_test_flag(frame, SFF_CNG) && !switch_test_flag(frame, SFF_PROXY_PACKET)) {
-               if (tech_pvt->read_impl.encoded_bytes_per_packet) {
-                       bytes = tech_pvt->read_impl.encoded_bytes_per_packet;
-                       frames = ((int) frame->datalen / bytes);
-               } else
-                       frames = 1;
-
-               samples = frames * tech_pvt->read_impl.samples_per_packet;
+       if (switch_core_media_write_frame(session, frame, flags, stream_id, SWITCH_MEDIA_TYPE_AUDIO)) {
+               status = SWITCH_STATUS_SUCCESS;
        }
 
-       tech_pvt->timestamp_send += samples;
-       switch_rtp_write_frame(tech_pvt->rtp_session, frame);
-
        sofia_clear_flag_locked(tech_pvt, TFLAG_WRITING);
        return status;
 }
@@ -1393,11 +1072,11 @@ static switch_status_t sofia_kill_channel(switch_core_session_t *session, int si
 
        switch (sig) {
        case SWITCH_SIG_BREAK:
-               if (switch_rtp_ready(tech_pvt->rtp_session)) {
-                       switch_rtp_break(tech_pvt->rtp_session);
+               if (switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO)) {
+                       switch_core_media_break(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO);
                }
-               if (switch_rtp_ready(tech_pvt->video_rtp_session)) {
-                       switch_rtp_break(tech_pvt->video_rtp_session);
+               if (switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_VIDEO)) {
+                       switch_core_media_break(tech_pvt->session, SWITCH_MEDIA_TYPE_VIDEO);
                }
                break;
        case SWITCH_SIG_KILL:
@@ -1405,11 +1084,11 @@ static switch_status_t sofia_kill_channel(switch_core_session_t *session, int si
                sofia_clear_flag_locked(tech_pvt, TFLAG_IO);
                sofia_set_flag_locked(tech_pvt, TFLAG_HUP);
 
-               if (switch_rtp_ready(tech_pvt->rtp_session)) {
-                       switch_rtp_kill_socket(tech_pvt->rtp_session);
+               if (switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO)) {
+                       switch_core_media_kill_socket(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO);
                }
-               if (switch_rtp_ready(tech_pvt->video_rtp_session)) {
-                       switch_rtp_kill_socket(tech_pvt->video_rtp_session);
+               if (switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_VIDEO)) {
+                       switch_core_media_kill_socket(tech_pvt->session, SWITCH_MEDIA_TYPE_VIDEO);
                }
                break;
        }
@@ -1417,44 +1096,6 @@ static switch_status_t sofia_kill_channel(switch_core_session_t *session, int si
 }
 
 
-static void start_udptl(private_object_t *tech_pvt, switch_t38_options_t *t38_options)
-{
-
-       if (switch_rtp_ready(tech_pvt->rtp_session)) {
-               char *remote_host = switch_rtp_get_remote_host(tech_pvt->rtp_session);
-               switch_port_t remote_port = switch_rtp_get_remote_port(tech_pvt->rtp_session);
-               const char *err, *val;
-
-               sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE);
-               switch_rtp_udptl_mode(tech_pvt->rtp_session);
-
-               if (!t38_options || !t38_options->remote_ip) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "No remote address\n");
-                       return;
-               }
-
-               if (remote_host && remote_port && remote_port == t38_options->remote_port && !strcmp(remote_host, t38_options->remote_ip)) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Remote address:port [%s:%d] has not changed.\n",
-                                                         t38_options->remote_ip, t38_options->remote_port);
-                       return;
-               }
-
-               if (switch_rtp_set_remote_address(tech_pvt->rtp_session, t38_options->remote_ip,
-                                                                                 t38_options->remote_port, 0, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "IMAGE UDPTL REPORTS ERROR: [%s]\n", err);
-               } else {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "IMAGE UDPTL CHANGING DEST TO: [%s:%d]\n",
-                                                         t38_options->remote_ip, t38_options->remote_port);
-                       if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
-                               !((val = switch_channel_get_variable(tech_pvt->channel, "disable_udptl_auto_adjust")) && switch_true(val))) {
-                               /* Reactivate the NAT buster flag. */
-                               switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
-                       }
-               }
-       }
-}
-
-
 static switch_status_t sofia_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
 {
        private_object_t *tech_pvt;
@@ -1464,21 +1105,22 @@ static switch_status_t sofia_send_dtmf(switch_core_session_t *session, const swi
        tech_pvt = (private_object_t *) switch_core_session_get_private(session);
        switch_assert(tech_pvt != NULL);
 
-       if (sofia_test_flag(tech_pvt, TFLAG_DROP_DTMF)) {
+       if (switch_channel_test_flag(tech_pvt->channel, CF_DROP_DTMF)) {
                return SWITCH_STATUS_SUCCESS;
        }
 
-       dtmf_type = tech_pvt->dtmf_type;
+       dtmf_type = tech_pvt->mparams.dtmf_type;
 
        /* We only can send INFO when we have no media */
-       if (!tech_pvt->rtp_session || !switch_channel_media_ready(tech_pvt->channel) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE)) {
+       if (!switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO) || 
+               !switch_channel_media_ready(tech_pvt->channel) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE)) {
                dtmf_type = DTMF_INFO;
        }
 
        switch (dtmf_type) {
        case DTMF_2833:
                {
-                       return switch_rtp_queue_rfc2833(tech_pvt->rtp_session, dtmf);
+                       return switch_core_media_queue_rfc2833(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, dtmf);
                }
        case DTMF_INFO:
                {
@@ -1535,191 +1177,25 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
        case SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH:
        case SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC:
                break;
-
-       case SWITCH_MESSAGE_INDICATE_PROXY_MEDIA:
+       case SWITCH_MESSAGE_INDICATE_MEDIA_RENEG:
                {
-                       if (switch_rtp_ready(tech_pvt->rtp_session)) {
-                               if (msg->numeric_arg) {
-                                       switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA);
-                               } else {
-                                       switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA);
-                               }
+                       if (msg->string_arg) {
+                               sofia_set_pflag(tech_pvt->profile, PFLAG_RENEG_ON_REINVITE);
+                               sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA);
                        }
-               }
-               break;
-
-       case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER:
-               {
-                       if (switch_rtp_ready(tech_pvt->rtp_session)) {
-                               int len = 0, maxlen = 0, qlen = 0, maxqlen = 50, max_drift = 0;
-
-                               if (msg->string_arg) {
-                                       char *p, *q;
-                                       const char *s;
-
-                                       if (!strcasecmp(msg->string_arg, "pause")) {
-                                               switch_rtp_pause_jitter_buffer(tech_pvt->rtp_session, SWITCH_TRUE);
-                                               goto end;
-                                       } else if (!strcasecmp(msg->string_arg, "resume")) {
-                                               switch_rtp_pause_jitter_buffer(tech_pvt->rtp_session, SWITCH_FALSE);
-                                               goto end;
-                                       } else if (!strncasecmp(msg->string_arg, "debug:", 6)) {
-                                               s = msg->string_arg + 6;
-                                               if (s && !strcmp(s, "off")) {
-                                                       s = NULL;
-                                               }
-                                               status = switch_rtp_debug_jitter_buffer(tech_pvt->rtp_session, s);
-                                               goto end;
-                                       }
-
-                                       
-                                       if ((len = atoi(msg->string_arg))) {
-                                               qlen = len / (tech_pvt->read_impl.microseconds_per_packet / 1000);
-                                               if (qlen < 1) {
-                                                       qlen = 3;
-                                               }
-                                       }
-                                       
-                                       if (qlen) {
-                                               if ((p = strchr(msg->string_arg, ':'))) {
-                                                       p++;
-                                                       maxlen = atol(p);
-                                                       if ((q = strchr(p, ':'))) {
-                                                               q++;
-                                                               max_drift = abs(atol(q));
-                                                       }
-                                               }
-                                       }
-
 
-                                       if (maxlen) {
-                                               maxqlen = maxlen / (tech_pvt->read_impl.microseconds_per_packet / 1000);
-                                       }
-                               }
-
-                               if (qlen) {
-                                       if (maxqlen < qlen) {
-                                               maxqlen = qlen * 5;
-                                       }
-                                       if (switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen, maxqlen,
-                                                                                                                 tech_pvt->read_impl.samples_per_packet, 
-                                                                                                                 tech_pvt->read_impl.samples_per_second, max_drift) == SWITCH_STATUS_SUCCESS) {
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), 
-                                                                                 SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames) (%d max drift)\n", 
-                                                                                 len, qlen, maxqlen, max_drift);
-                                               switch_channel_set_flag(tech_pvt->channel, CF_JITTERBUFFER);
-                                               if (!switch_false(switch_channel_get_variable(tech_pvt->channel, "sip_jitter_buffer_plc"))) {
-                                                       switch_channel_set_flag(tech_pvt->channel, CF_JITTERBUFFER_PLC);
-                                               }
-                                       } else {
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), 
-                                                                                 SWITCH_LOG_WARNING, "Error Setting Jitterbuffer to %dms (%d frames)\n", len, qlen);
-                                       }
-                                       
-                               } else {
-                                       switch_rtp_deactivate_jitter_buffer(tech_pvt->rtp_session);
-                               }
-                       }
+                       sofia_glue_do_invite(session);
                }
                break;
-       case SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO:
-               {
-                       if (switch_rtp_ready(tech_pvt->rtp_session) && !zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) {
-                               int32_t flags = 0;
-                               if (!strcasecmp(msg->string_array_arg[0], "read")) {
-                                       flags |= SWITCH_RTP_FLAG_DEBUG_RTP_READ;
-                               } else if (!strcasecmp(msg->string_array_arg[0], "write")) {
-                                       flags |= SWITCH_RTP_FLAG_DEBUG_RTP_WRITE;
-                               } else if (!strcasecmp(msg->string_array_arg[0], "both")) {
-                                       flags |= SWITCH_RTP_FLAG_DEBUG_RTP_READ | SWITCH_RTP_FLAG_DEBUG_RTP_WRITE;
-                               }
-
-                               if (flags) {
-                                       if (switch_true(msg->string_array_arg[1])) {
-                                               switch_rtp_set_flag(tech_pvt->rtp_session, flags);
-                                       } else {
-                                               switch_rtp_clear_flag(tech_pvt->rtp_session, flags);
-                                       }
-                               } else {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Options\n");
-                               }
-                       }
-               }
-               status = SWITCH_STATUS_FALSE;
-               goto end;
-       case SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY:
-               if (tech_pvt->rtp_session && switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833)) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Pass 2833 mode may not work on a transcoded call.\n");
-               }
-               goto end;
-
        case SWITCH_MESSAGE_INDICATE_BRIDGE:
-               {
-
                        switch_channel_set_variable(channel, SOFIA_REPLACES_HEADER, NULL);
-
-                       if (switch_true(switch_channel_get_variable(tech_pvt->channel, "sip_auto_simplify"))) {
+                       
+                       if (switch_true(switch_channel_get_variable(channel, "sip_auto_simplify"))) {
                                sofia_set_flag(tech_pvt, TFLAG_SIMPLIFY);
                        }
 
-                       
-                       if (switch_rtp_ready(tech_pvt->rtp_session)) {
-                               const char *val;
-                               int ok = 0;
-                               
-                               if (!(val = switch_channel_get_variable(tech_pvt->channel, "sip_jitter_buffer_during_bridge")) || switch_false(val)) {
-                                       if (switch_channel_test_flag(tech_pvt->channel, CF_JITTERBUFFER) && switch_channel_test_cap_partner(tech_pvt->channel, CC_FS_RTP)) {
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
-                                                                                 "%s PAUSE Jitterbuffer\n", switch_channel_get_name(channel));                                 
-                                               switch_rtp_pause_jitter_buffer(tech_pvt->rtp_session, SWITCH_TRUE);
-                                               sofia_set_flag(tech_pvt, TFLAG_JB_PAUSED);
-                                       }
-                               }
-                               
-                               if (sofia_test_flag(tech_pvt, TFLAG_PASS_RFC2833) && switch_channel_test_flag_partner(channel, CF_FS_RTP)) {
-                                       switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
-                                                                         "%s activate passthru 2833 mode.\n", switch_channel_get_name(channel));
-                               }
-
-
-                               if ((val = switch_channel_get_variable(channel, "rtp_notimer_during_bridge"))) {
-                                       ok = switch_true(val);
-                               } else {
-                                       ok = sofia_test_pflag(tech_pvt->profile, PFLAG_RTP_NOTIMER_DURING_BRIDGE);
-                               }
-
-                               if (ok && !switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) {
-                                       ok = 0;
-                               }
-
-                               if (ok) {
-                                       switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
-                                       switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
-                                       sofia_set_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE);
-                               }
 
-                               if (ok && sofia_test_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE)) {
-                                       /* these are not compat */
-                                       ok = 0;
-                               } else {
-                                       if ((val = switch_channel_get_variable(channel, "rtp_autoflush_during_bridge"))) {
-                                               ok = switch_true(val);
-                                       } else {
-                                               ok = sofia_test_pflag(tech_pvt->profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
-                                       }
-                               }
-                               
-                               if (ok) {
-                                       rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_STICK);
-                                       sofia_set_flag(tech_pvt, TFLAG_AUTOFLUSH_DURING_BRIDGE);
-                               } else {
-                                       rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_ONCE);
-                               }
-                               
-                       }
-               }
-               goto end;
+               break;
        case SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE:
                {
                        const char *event = switch_channel_get_variable(channel, "sip_blind_transfer_event");
@@ -1742,49 +1218,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 
                }
                goto end;
-       case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
-               if (switch_rtp_ready(tech_pvt->rtp_session)) {
-                       
-                       if (sofia_test_flag(tech_pvt, TFLAG_JB_PAUSED)) {
-                               sofia_clear_flag(tech_pvt, TFLAG_JB_PAUSED);
-                               if (switch_channel_test_flag(tech_pvt->channel, CF_JITTERBUFFER)) {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
-                                                                         "%s RESUME Jitterbuffer\n", switch_channel_get_name(channel));                                        
-                                       switch_rtp_pause_jitter_buffer(tech_pvt->rtp_session, SWITCH_FALSE);
-                               }
-                       }
-                       
-
-                       if (switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833)) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s deactivate passthru 2833 mode.\n",
-                                                                 switch_channel_get_name(channel));
-                               switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
-                       }
-                       
-                       if (sofia_test_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE)) {
-                               if (!switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_UDPTL) && 
-                                       !switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
-                                       switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
-                                       switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
-                               }
-                               sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE);
-                       }
-
-                       if (sofia_test_flag(tech_pvt, TFLAG_AUTOFLUSH_DURING_BRIDGE)) {
-                               rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_UNSTICK);
-                               sofia_clear_flag(tech_pvt, TFLAG_AUTOFLUSH_DURING_BRIDGE);
-                       } else {
-                               rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_ONCE);
-                       }
-
-               }
-               goto end;
-       case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
-               if (switch_rtp_ready(tech_pvt->rtp_session)) {
-                       rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_ONCE);
-               }
-               goto end;
-
        case SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS:
                if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
                        sofia_clear_flag(tech_pvt, TFLAG_EARLY_MEDIA);
@@ -1822,8 +1255,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                        }
 
                        if (sofia_test_media_flag(tech_pvt->profile, SCMF_AUTOFIX_TIMING)) {
-                               tech_pvt->check_frames = 0;
-                               tech_pvt->last_ts = 0;
+                               switch_core_media_reset_autofix_timing(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO);
                        }
                }
                break;
@@ -1841,43 +1273,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 
        switch (msg->message_id) {
 
-       case SWITCH_MESSAGE_INDICATE_MEDIA_RENEG:
-               {
-                       switch_core_session_t *nsession;
-                       
-                       if (msg->string_arg) {
-                               switch_channel_set_variable(channel, "absolute_codec_string", NULL);
-                               if (*msg->string_arg == '=') {
-                                       switch_channel_set_variable(channel, "codec_string", msg->string_arg);
-                               } else {
-                                       switch_channel_set_variable_printf(channel, "codec_string", "=%s%s%s,%s", 
-                                                                                                          tech_pvt->video_rm_encoding ? tech_pvt->video_rm_encoding : "",
-                                                                                                          tech_pvt->video_rm_encoding ? "," : "",
-                                                                                                          tech_pvt->rm_encoding, msg->string_arg);                                     
-                               }
-
-
-                               tech_pvt->num_codecs = 0;
-                               tech_pvt->rm_encoding = NULL;
-                               tech_pvt->video_rm_encoding = NULL;
-                               switch_channel_clear_flag(tech_pvt->channel, CF_VIDEO_POSSIBLE);
-                               sofia_media_tech_prepare_codecs(tech_pvt);
-                               switch_core_media_check_video_codecs(tech_pvt->session);
-                               sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
-                               sofia_set_pflag(tech_pvt->profile, PFLAG_RENEG_ON_REINVITE);
-                               sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA);
-                       }
-                       
-                       sofia_glue_do_invite(session);
-
-                       if (msg->numeric_arg && switch_core_session_get_partner(session, &nsession) == SWITCH_STATUS_SUCCESS) {
-                               msg->numeric_arg = 0;
-                               switch_core_session_receive_message(nsession, msg);
-                               switch_core_session_rwunlock(nsession);
-                       }
-
-               }
-               break;
        case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
                {
                        const char *pl = "<media_control><vc_primitive><to_encoder><picture_fast_update/></to_encoder></vc_primitive></media_control>";
@@ -1896,21 +1291,21 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                        ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
                        port = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE);
                        if (ip && port) {
-                               sofia_media_set_local_sdp(tech_pvt, ip, (switch_port_t)atoi(port), msg->string_arg, 1);
+                               switch_core_media_gen_local_sdp(session, ip, (switch_port_t)atoi(port), msg->string_arg, 1);
                        }
 
                        if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
                                if (sofia_use_soa(tech_pvt)) {
                                        nua_respond(tech_pvt->nh, SIP_200_OK,
                                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-                                                               SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                                                               SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
                                                                SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), 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->reply_contact),
-                                                               SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str), TAG_END());
+                                                               SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech_pvt->mparams.local_sdp_str), TAG_END());
                                }
                                switch_channel_mark_answered(channel);
                        }
@@ -1918,90 +1313,30 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                break;
        case SWITCH_MESSAGE_INDICATE_NOMEDIA:
                {
-                       const char *uuid;
-                       switch_core_session_t *other_session;
-                       switch_channel_t *other_channel;
-                       const char *ip = NULL, *port = NULL;
-
-                       switch_channel_set_flag(channel, CF_PROXY_MODE);
-                       if (tech_pvt->rm_encoding) {
-                               tech_pvt->rm_encoding = NULL;
-                       }
-                       sofia_media_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
-
-                       if ((uuid = switch_channel_get_partner_uuid(channel))
-                               && (other_session = switch_core_session_locate(uuid))) {
-                               other_channel = switch_core_session_get_channel(other_session);
-                               ip = switch_channel_get_variable(other_channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
-                               port = switch_channel_get_variable(other_channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE);
-                               switch_core_session_rwunlock(other_session);
-                               if (ip && port) {
-                                       sofia_media_set_local_sdp(tech_pvt, ip, (switch_port_t)atoi(port), NULL, 1);
-                               }
-                       }
-
-
-                       if (!tech_pvt->local_sdp_str) {
-                               sofia_media_tech_absorb_sdp(tech_pvt);
-                       }
-
                        sofia_glue_do_invite(session);
                }
                break;
 
-       case SWITCH_MESSAGE_INDICATE_AUDIO_DATA:
-               {
-                       if (switch_rtp_ready(tech_pvt->rtp_session)) {
-                               if (msg->numeric_arg) {
-                                       if (switch_channel_test_flag(tech_pvt->channel, CF_JITTERBUFFER)) {
-                                               switch_rtp_pause_jitter_buffer(tech_pvt->rtp_session, SWITCH_TRUE);
-                                               sofia_set_flag(tech_pvt, TFLAG_JB_PAUSED);
-                                       }
-
-                                       rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_UNSTICK);
-                                       
-                               } else {
-                                       if (sofia_test_flag(tech_pvt, TFLAG_JB_PAUSED)) {
-                                               sofia_clear_flag(tech_pvt, TFLAG_JB_PAUSED);
-                                               if (switch_channel_test_flag(tech_pvt->channel, CF_JITTERBUFFER)) {
-                                                       switch_rtp_pause_jitter_buffer(tech_pvt->rtp_session, SWITCH_FALSE);
-                                               }
-                                       }
-                               }
-                       }
-               }
-               break;
        case SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT:
                {
                        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);
-                       sofia_media_tech_set_local_sdp(tech_pvt, msg->string_arg, SWITCH_TRUE);
+                       switch_core_media_set_local_sdp(session, msg->string_arg, SWITCH_TRUE);
 
-                       if(zstr(tech_pvt->local_sdp_str)) {
+                       if(zstr(tech_pvt->mparams.local_sdp_str)) {
                                sofia_set_flag(tech_pvt, TFLAG_3PCC_INVITE);
                        }
-
+                               
                        sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
-
+                       
                        if (!switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
                                switch_channel_set_flag(channel, CF_REQ_MEDIA);
                        }
                        sofia_glue_do_invite(session);
+
                }
                break;
 
-       case SWITCH_MESSAGE_INDICATE_UDPTL_MODE:
-               {
-                       switch_t38_options_t *t38_options = switch_channel_get_private(tech_pvt->channel, "t38_options");
-
-                       if (!t38_options) {
-                               nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
-                               goto end_lock;
-                       }
-
-                       start_udptl(tech_pvt, t38_options);
-
-               }
        case SWITCH_MESSAGE_INDICATE_T38_DESCRIPTION:
                {
                        switch_t38_options_t *t38_options = switch_channel_get_private(tech_pvt->channel, "t38_options");
@@ -2011,9 +1346,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                goto end_lock;
                        }
 
-                       start_udptl(tech_pvt, t38_options);
+                       switch_core_media_start_udptl(tech_pvt->session, t38_options);
 
-                       sofia_glue_set_udptl_image_sdp(tech_pvt, t38_options, msg->numeric_arg);
+                       switch_core_media_set_image_sdp(tech_pvt->session, t38_options, msg->numeric_arg);
 
                        if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
                                char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_RESPONSE_HEADER_PREFIX);
@@ -2022,7 +1357,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                                                NUTAG_AUTOANSWER(0),
                                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
                                                                SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
-                                                               SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                                                               SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
                                                                SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(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 {
@@ -2032,7 +1367,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
                                                                SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
                                                                SIPTAG_CONTENT_TYPE_STR("application/sdp"),
-                                                               SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str), TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
+                                                               SIPTAG_PAYLOAD_STR(tech_pvt->mparams.local_sdp_str), TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
                                }
                                switch_safe_free(extra_headers);
                                sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
@@ -2045,7 +1380,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                        switch_t38_options_t *t38_options = switch_channel_get_private(tech_pvt->channel, "t38_options");
 
                        if (t38_options) {
-                               sofia_glue_set_udptl_image_sdp(tech_pvt, t38_options, msg->numeric_arg);
+                               switch_core_media_set_image_sdp(tech_pvt->session, t38_options, msg->numeric_arg);
 
                                if (!switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
                                        switch_channel_set_flag(channel, CF_REQ_MEDIA);
@@ -2065,14 +1400,14 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                        uint32_t send_invite = 1;
 
                        switch_channel_clear_flag(channel, CF_PROXY_MODE);
-                       sofia_media_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
+                       switch_core_media_set_local_sdp(session, NULL, SWITCH_FALSE);
 
                        if (!(switch_channel_test_flag(channel, CF_ANSWERED) || switch_channel_test_flag(channel, CF_EARLY_MEDIA))) {
                                if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) {
                                        const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
 
-                                       tech_pvt->num_codecs = 0;
-                                       sofia_media_tech_prepare_codecs(tech_pvt);
+
+                                       switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
                                        if (sofia_media_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
                                                switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
                                                status = SWITCH_STATUS_FALSE;
@@ -2082,14 +1417,14 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                }
                        }
 
-                       if (!switch_rtp_ready(tech_pvt->rtp_session)) {
-                               sofia_media_tech_prepare_codecs(tech_pvt);
-                               if ((status = sofia_glue_tech_choose_port(tech_pvt, 0)) != SWITCH_STATUS_SUCCESS) {
+                       if (!switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO)) {
+                               switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_FALSE);
+                               if ((status = switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0)) != SWITCH_STATUS_SUCCESS) {
                                        switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                                        goto end_lock;
                                }
                        }
-                       sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
+                       switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 1);
 
                        if (send_invite) {
                                if (!switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
@@ -2585,23 +1920,23 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                                        if (!strcasecmp(sdp, "t38")) {
                                                                switch_t38_options_t *t38_options = switch_channel_get_private(tech_pvt->channel, "t38_options");
                                                                if (t38_options) {
-                                                                       sofia_glue_set_udptl_image_sdp(tech_pvt, t38_options, 0);
-                                                                       if (switch_rtp_ready(tech_pvt->rtp_session)) {
-                                                                               sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE);
-                                                                               switch_rtp_udptl_mode(tech_pvt->rtp_session);
+                                                                       switch_core_media_set_image_sdp(tech_pvt->session, t38_options, 0);
+                                                                       if (switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO)) {
+                                                                               switch_channel_clear_flag(tech_pvt->channel, CF_NOTIMER_DURING_BRIDGE);
+                                                                               switch_core_media_udptl_mode(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO);
                                                                        }
                                                                }
                                                        } else {
-                                                               sofia_media_tech_set_local_sdp(tech_pvt, sdp, SWITCH_TRUE);
+                                                               switch_core_media_set_local_sdp(session, sdp, SWITCH_TRUE);
                                                        }
 
                                                        if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
-                                                               sofia_media_tech_patch_sdp(tech_pvt);
-                                                               sofia_glue_tech_proxy_remote_addr(tech_pvt, NULL);
+                                                               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->local_sdp_str),
+                                                                                       SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
                                                                                        SOATAG_REUSE_REJECTED(1),
                                                                                        SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
                                                                                        TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
@@ -2609,7 +1944,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                                                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->local_sdp_str),
+                                                                                       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)) {
@@ -2716,11 +2051,11 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
                                        const char *sdp = NULL;
                                        if ((sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE))) {
-                                               sofia_media_tech_set_local_sdp(tech_pvt, sdp, SWITCH_TRUE);
+                                               switch_core_media_set_local_sdp(session, sdp, SWITCH_TRUE);
                                        }
                                        if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 
-                                               sofia_media_tech_patch_sdp(tech_pvt);
+                                               switch_core_media_patch_sdp(tech_pvt->session);
 
                                                if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
                                                        status = SWITCH_STATUS_FALSE;
@@ -2728,13 +2063,14 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                                }
                                        }
                                } else {
-                                       if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
+                                       if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || 
+                                               switch_core_media_codec_chosen(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO) != SWITCH_STATUS_SUCCESS) {
                                                sofia_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
                                                if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) {
                                                        const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
 
-                                                       tech_pvt->num_codecs = 0;
-                                                       sofia_media_tech_prepare_codecs(tech_pvt);
+
+                                                       switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
                                                        if (zstr(r_sdp) || sofia_media_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
                                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
                                                                                                  "CODEC NEGOTIATION ERROR.  SDP:\n%s\n", r_sdp ? r_sdp : "NO SDP!");
@@ -2748,16 +2084,16 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 
                                        switch_channel_check_zrtp(tech_pvt->channel);
 
-                                       if ((status = sofia_glue_tech_choose_port(tech_pvt, 0)) != SWITCH_STATUS_SUCCESS) {
+                                       if ((status = switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0)) != SWITCH_STATUS_SUCCESS) {
                                                switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                                                goto end_lock;
                                        }
-                                       sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+                                       switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 0);
                                        if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
                                                switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                                        }
-                                       if (tech_pvt->local_sdp_str) {
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Ring SDP:\n%s\n", tech_pvt->local_sdp_str);
+                                       if (tech_pvt->mparams.local_sdp_str) {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Ring SDP:\n%s\n", tech_pvt->mparams.local_sdp_str);
                                        }
                                }
                                switch_channel_mark_pre_answered(channel);
@@ -2778,14 +2114,14 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                        
 
                                        if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) &&
-                                               tech_pvt->early_sdp && strcmp(tech_pvt->early_sdp, tech_pvt->local_sdp_str)) {
+                                               tech_pvt->mparams.early_sdp && strcmp(tech_pvt->mparams.early_sdp, tech_pvt->mparams.local_sdp_str)) {
                                                /* The SIP RFC for SOA forbids sending a 183 with one sdp then a 200 with another but it won't do us much good unless 
                                                   we do so in this case we will abandon the SOA rules and go rogue.
                                                 */
                                                sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA);
                                        }
 
-                                       tech_pvt->early_sdp = switch_core_session_strdup(tech_pvt->session, tech_pvt->local_sdp_str);
+                                       tech_pvt->mparams.early_sdp = switch_core_session_strdup(tech_pvt->session, tech_pvt->mparams.local_sdp_str);
 
                                        if (sofia_use_soa(tech_pvt)) {
                                                nua_respond(tech_pvt->nh,
@@ -2797,8 +2133,8 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                                                        SOATAG_REUSE_REJECTED(1),
                                                                        SOATAG_ORDERED_USER(1),
                                                                        SOATAG_RTP_SELECT(1),
-                                                                       SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
-                                                                       SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"),
+                                                                       SOATAG_ADDRESS(tech_pvt->mparams.adv_sdp_audio_ip),
+                                                                       SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"),
                                                                        TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
                                                                        TAG_IF(!zstr(extra_header), SIPTAG_HEADER_STR(extra_header)),
                                                                        TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
@@ -2812,7 +2148,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                                                        TAG_IF(cid, SIPTAG_HEADER_STR(cid)),
                                                                        SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
                                                                        SIPTAG_CONTENT_TYPE_STR("application/sdp"),
-                                                                       SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str),
+                                                                       SIPTAG_PAYLOAD_STR(tech_pvt->mparams.local_sdp_str),
                                                                        TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
                                                                        TAG_IF(!zstr(extra_header), SIPTAG_HEADER_STR(extra_header)),
                                                                        TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
@@ -2823,6 +2159,17 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                        }
                }
                break;
+
+       case SWITCH_MESSAGE_INDICATE_UDPTL_MODE:
+               {
+                       switch_t38_options_t *t38_options = switch_channel_get_private(channel, "t38_options");
+                       
+                       if (!t38_options) {
+                               nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
+                       }
+               }
+               break;
+
        default:
                break;
        }
@@ -3171,8 +2518,6 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
                                        stream->write_function(stream, "ZRTP-PASSTHRU    \t%s\n", sofia_test_flag(profile, TFLAG_ZRTP_PASSTHRU) ? "true" : "false");
                                        stream->write_function(stream, "AGGRESSIVENAT    \t%s\n",
                                                                                   sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false");
-                                       stream->write_function(stream, "STUN-ENABLED     \t%s\n", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
-                                       stream->write_function(stream, "STUN-AUTO-DISABLE\t%s\n", sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
                                        if (profile->user_agent_filter) {
                                                stream->write_function(stream, "USER-AGENT-FILTER\t%s\n", switch_str_nil(profile->user_agent_filter));
                                        }
@@ -3450,10 +2795,6 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
                                        stream->write_function(stream, "    <zrtp-passthru>%s</zrtp-passthru>\n", sofia_test_flag(profile, TFLAG_ZRTP_PASSTHRU) ? "true" : "false");
                                        stream->write_function(stream, "    <aggressive-nat>%s</aggressive-nat>\n",
                                                                                   sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false");
-                                       stream->write_function(stream, "    <stun-enabled>%s</stun-enabled>\n",
-                                                                                  sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
-                                       stream->write_function(stream, "    <stun-auto-disable>%s</stun-auto-disable>\n",
-                                                                                  sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
                                        stream->write_function(stream, "    <user-agent-filter>%s</user-agent-filter>\n", switch_str_nil(profile->user_agent_filter));
                                        stream->write_function(stream, "    <max-registrations-per-extension>%d</max-registrations-per-extension>\n",
                                                                                   profile->max_registrations_perext);
@@ -3648,37 +2989,6 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
                goto done;
        }
 
-       if (!strcasecmp(argv[1], "stun-auto-disable")) {
-               if (argv[2]) {
-                       int is_true = switch_true(argv[2]);
-                       if (is_true) {
-                               sofia_set_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
-                       } else {
-                               sofia_clear_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
-                       }
-               }
-
-               stream->write_function(stream, "+OK stun-auto-disable=%s", sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
-
-               goto done;
-       }
-
-       if (!strcasecmp(argv[1], "stun-enabled")) {
-               if (argv[2]) {
-                       int is_true = switch_true(argv[2]);
-                       if (is_true) {
-                               sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
-                       } else {
-                               sofia_clear_pflag(profile, PFLAG_STUN_ENABLED);
-                       }
-               }
-
-               stream->write_function(stream, "+OK stun-enabled=%s", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
-
-               goto done;
-       }
-
-
        if (!strcasecmp(argv[1], "rescan")) {
 
                switch_xml_reload(&err);
@@ -4804,12 +4114,12 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
                        switch_url_decode(remote_host);
                }
                if (!zstr(remote_host)) {
-                       switch_split_user_domain(remote_host, NULL, &tech_pvt->remote_ip);
+                       switch_split_user_domain(remote_host, NULL, &tech_pvt->mparams.remote_ip);
                }
        } 
 
-       if (zstr(tech_pvt->remote_ip)) {
-               switch_split_user_domain(switch_core_session_strdup(nsession, tech_pvt->dest), NULL, &tech_pvt->remote_ip);
+       if (zstr(tech_pvt->mparams.remote_ip)) {
+               switch_split_user_domain(switch_core_session_strdup(nsession, tech_pvt->dest), NULL, &tech_pvt->mparams.remote_ip);
        }
 
        if (dest_to) {
@@ -4994,18 +4304,8 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
                        }
                }
 
-               if (switch_channel_test_flag(o_channel, CF_PROXY_MEDIA)) {
-                       const char *r_sdp = switch_channel_get_variable(o_channel, SWITCH_R_SDP_VARIABLE);
+               switch_core_media_check_outgoing_proxy(session);
 
-                       if (switch_stristr("m=video", r_sdp)) {
-                               sofia_glue_tech_choose_video_port(tech_pvt, 1);
-                               tech_pvt->video_rm_encoding = "PROXY-VID";
-                               tech_pvt->video_rm_rate = 90000;
-                               tech_pvt->video_codec_ms = 0;
-                               switch_channel_set_flag(tech_pvt->channel, CF_VIDEO);
-                               switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_POSSIBLE);
-                       }
-               }
        }
 
        goto done;
index 03d10a8705f866d6230df1aa2e95bc16d8a7cb2a..0faf8ae91424cb8edb3f248e6b2a85ed8ba3d395 100644 (file)
@@ -573,7 +573,7 @@ struct sofia_profile {
        switch_core_media_flag_t media_flags[SCMF_MAX];
        unsigned int mflags;
        unsigned int ndlb;
-       unsigned int mdlb;
+       unsigned int mndlb;
        uint32_t max_calls;
        uint32_t nonce_ttl;
        nua_t *nua;
index 46c69df20d6e8fd163e8999348f087fe9bf2b4d7..1376b32b44a902020fe419f379d08fb75130a01c 100644 (file)
@@ -200,7 +200,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
     tech_pvt->local_address = switch_core_session_strdup(*new_session, local_addr);
     tech_pvt->local_port = local_port;
     tech_pvt->remote_address = switch_core_session_strdup(*new_session, remote_addr);
-    tech_pvt->remote_port = remote_port;
+    tech-pvt->mparams->remote_port = remote_port;
     tech_pvt->ptime = ptime;
     tech_pvt->agreed_pt = pt;
     tech_pvt->dtmf_type = DTMF_2833; /* XXX */
index ebd14049c0446bf36f9fd89a8c177a18b6dc2832..ffb89fe0204396c377a37417a6594d8563ec624e 100644 (file)
@@ -4861,9 +4861,9 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
                        caller_profile->network_addr = switch_core_strdup(caller_profile->pool, network_ip);
                }
 
-               tech_pvt->last_sdp_str = NULL;
+               tech-pvt->mparams->last_sdp_str = NULL;
                if (!sofia_use_soa(tech_pvt) && sip->sip_payload && sip->sip_payload->pl_data) {
-                       tech_pvt->last_sdp_str = switch_core_session_strdup(session, sip->sip_payload->pl_data);
+                       tech-pvt->mparams->last_sdp_str = switch_core_session_strdup(session, sip->sip_payload->pl_data);
                }
 
 
@@ -5200,8 +5200,8 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
 
                                        if (sip->sip_payload && sip->sip_payload->pl_data &&
                                                sip->sip_content_type && sip->sip_content_type->c_subtype && switch_stristr("sdp", sip->sip_content_type->c_subtype)) {
-                                               tech_pvt->remote_sdp_str = switch_core_session_strdup(tech_pvt->session, sip->sip_payload->pl_data);
-                                               r_sdp = tech_pvt->remote_sdp_str;
+                                               tech-pvt->mparams->remote_sdp_str = switch_core_session_strdup(tech_pvt->session, sip->sip_payload->pl_data);
+                                               r_sdp = tech-pvt->mparams->remote_sdp_str;
                                                sofia_glue_tech_proxy_remote_addr(tech_pvt, NULL);
                                        }
                                        
@@ -5543,8 +5543,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                }
        }
 
-       if (status > 100 && status < 300 && tech_pvt && !sofia_use_soa(tech_pvt) && !r_sdp && tech_pvt->last_sdp_str) {
-               r_sdp = tech_pvt->last_sdp_str;
+       if (status > 100 && status < 300 && tech_pvt && !sofia_use_soa(tech_pvt) && !r_sdp && tech-pvt->mparams->last_sdp_str) {
+               r_sdp = tech-pvt->mparams->last_sdp_str;
        }
 
        if ((channel && (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA))) ||
@@ -5599,12 +5599,12 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
 
                if (r_sdp) {
 
-                       if (!(profile->mndlb & SM_NDLB_ALLOW_NONDUP_SDP) || (!zstr(tech_pvt->remote_sdp_str) && !strcmp(tech_pvt->remote_sdp_str, r_sdp))) {
+                       if (!(profile->mndlb & SM_NDLB_ALLOW_NONDUP_SDP) || (!zstr(tech-pvt->mparams->remote_sdp_str) && !strcmp(tech-pvt->mparams->remote_sdp_str, r_sdp))) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Duplicate SDP\n%s\n", r_sdp);
                                is_dup_sdp = 1;
                        } else {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote SDP:\n%s\n", r_sdp);
-                               tech_pvt->remote_sdp_str = switch_core_session_strdup(session, r_sdp);
+                               tech-pvt->mparams->remote_sdp_str = switch_core_session_strdup(session, r_sdp);
                                switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp);
 
                                if ((sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND)) {
@@ -5909,7 +5909,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                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->local_sdp_str),
+                                                                               SOATAG_USER_SDP_STR(tech-pvt->mparams->local_sdp_str),
                                                                                SOATAG_REUSE_REJECTED(1),
                                                                                SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
                                                                                TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
@@ -5917,7 +5917,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                        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->local_sdp_str), TAG_END());
+                                                                               SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech-pvt->mparams->local_sdp_str), TAG_END());
                                                }
                                        }
                                } else if (sofia_test_pflag(profile, PFLAG_3PCC_PROXY)) {
@@ -6025,7 +6025,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                                if (sofia_use_soa(tech_pvt)) {
                                                                        nua_respond(tech_pvt->nh, SIP_200_OK,
                                                                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-                                                                                               SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                                                                                               SOATAG_USER_SDP_STR(tech-pvt->mparams->local_sdp_str),
                                                                                                SOATAG_REUSE_REJECTED(1),
                                                                                                SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
                                                                                                TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
@@ -6033,7 +6033,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                                        nua_respond(tech_pvt->nh, SIP_200_OK,
                                                                                                NUTAG_MEDIA_ENABLE(0),
                                                                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-                                                                                               SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str), TAG_END());
+                                                                                               SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech-pvt->mparams->local_sdp_str), TAG_END());
                                                                }
 
                                                                switch_channel_set_flag(channel, CF_PROXY_MODE);
@@ -6150,7 +6150,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                        if (sofia_use_soa(tech_pvt)) {
                                                nua_respond(tech_pvt->nh, SIP_200_OK,
                                                                        SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-                                                                       SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                                                                       SOATAG_USER_SDP_STR(tech-pvt->mparams->local_sdp_str),
                                                                        SOATAG_REUSE_REJECTED(1),
                                                                        SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
                                                                        TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
@@ -6158,7 +6158,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                nua_respond(tech_pvt->nh, SIP_200_OK,
                                                                        NUTAG_MEDIA_ENABLE(0),
                                                                        SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-                                                                       SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str), TAG_END());
+                                                                       SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech-pvt->mparams->local_sdp_str), TAG_END());
                                        }
                                        if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_REINVITE) == SWITCH_STATUS_SUCCESS) {
                                                switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(session));
@@ -7805,8 +7805,8 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
 
 
        
-       tech_pvt->remote_ip = switch_core_session_strdup(session, network_ip);
-       tech_pvt->remote_port = network_port;
+       tech-pvt->mparams->remote_ip = switch_core_session_strdup(session, network_ip);
+       tech-pvt->mparams->remote_port = network_port;
 
        channel = tech_pvt->channel = switch_core_session_get_channel(session);
 
@@ -7827,7 +7827,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
 
        if (sip->sip_contact && sip->sip_contact->m_url) {
                char tmp[35] = "";
-               const char *ipv6 = strchr(tech_pvt->remote_ip, ':');
+               const char *ipv6 = strchr(tech-pvt->mparams->remote_ip, ':');
 
                transport = sofia_glue_url2transport(sip->sip_contact->m_url);
 
@@ -7835,10 +7835,10 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
                        switch_core_session_sprintf(session,
                                                                                "sip:%s@%s%s%s:%d;transport=%s",
                                                                                sip->sip_contact->m_url->url_user,
-                                                                               ipv6 ? "[" : "", tech_pvt->remote_ip, ipv6 ? "]" : "", tech_pvt->remote_port, sofia_glue_transport2str(transport));
+                                                                               ipv6 ? "[" : "", tech-pvt->mparams->remote_ip, ipv6 ? "]" : "", tech-pvt->mparams->remote_port, sofia_glue_transport2str(transport));
 
-               switch_channel_set_variable(channel, "sip_received_ip", tech_pvt->remote_ip);
-               snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_port);
+               switch_channel_set_variable(channel, "sip_received_ip", tech-pvt->mparams->remote_ip);
+               snprintf(tmp, sizeof(tmp), "%d", tech-pvt->mparams->remote_port);
                switch_channel_set_variable(channel, "sip_received_port", tmp);
        }
 
@@ -8039,7 +8039,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
                                                                                        "sip:%s@%s%s%s:%d;transport=%s",
                                                                                        user, ipv6 ? "[" : "", host, ipv6 ? "]" : "", port, sofia_glue_transport2str(transport));
 
-                       if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) {
+                       if (sofia_glue_check_nat(profile, tech-pvt->mparams->remote_ip)) {
                                url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url;
                                check_nat = 1;
                        } else {
@@ -8079,7 +8079,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
 
                } else {
                        const char *url = NULL;
-                       if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) {
+                       if (sofia_glue_check_nat(profile, tech-pvt->mparams->remote_ip)) {
                                url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url;
                        } else {
                                url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url;
@@ -8101,7 +8101,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
                }
        }
 
-       if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) {
+       if (sofia_glue_check_nat(profile, tech-pvt->mparams->remote_ip)) {
                tech_pvt->user_via = sofia_glue_create_external_via(session, profile, tech_pvt->transport);
                nua_set_hparams(tech_pvt->nh, SIPTAG_VIA_STR(tech_pvt->user_via), TAG_END());
        }
index 767400f4d4d02addad136d73fb75a145bc00b0f0..c20194277dea3bb098ef70a165d9f429cf33bc78 100644 (file)
@@ -173,7 +173,7 @@ void sofia_glue_set_udptl_image_sdp(private_object_t *tech_pvt, switch_t38_optio
 
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "%s image media sdp:\n%s\n",
-                                         switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_str);
+                                         switch_channel_get_name(tech_pvt->channel), tech-pvt->mparams->local_sdp_str);
 
 
 }
@@ -222,7 +222,7 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
 
        tech_pvt->profile = profile;
 
-       tech_pvt->rtpip = switch_core_session_strdup(session, profile->rtpip[profile->rtpip_next++]);
+       tech-pvt->mparams->rtpip = switch_core_session_strdup(session, profile->rtpip[profile->rtpip_next++]);
        if (profile->rtpip_next >= profile->rtpip_index) {
                profile->rtpip_next = 0;
        }
@@ -769,7 +769,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                return status;
        }
 
-       if (!switch_channel_get_private(tech_pvt->channel, "t38_options") || zstr(tech_pvt->local_sdp_str)) {
+       if (!switch_channel_get_private(tech_pvt->channel, "t38_options") || zstr(tech-pvt->mparams->local_sdp_str)) {
                sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
        }
 
@@ -816,7 +816,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
 
                        sipip = tech_pvt->profile->sipip;
 
-                       if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+                       if (!zstr(tech-pvt->mparams->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech-pvt->mparams->remote_ip)) {
                                sipip = tech_pvt->profile->extsipip;
                        }
 
@@ -856,7 +856,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                }
 
                if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT)) {
-                       if (!zstr(tech_pvt->remote_ip) && !zstr(tech_pvt->profile->extsipip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+                       if (!zstr(tech-pvt->mparams->remote_ip) && !zstr(tech_pvt->profile->extsipip) && sofia_glue_check_nat(tech_pvt->profile, tech-pvt->mparams->remote_ip)) {
                                rpid_domain = tech_pvt->profile->extsipip;
                        } else {
                                rpid_domain = tech_pvt->profile->sipip;
@@ -890,7 +890,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                        }
                }
 
-               if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+               if (!zstr(tech-pvt->mparams->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech-pvt->mparams->remote_ip)) {
                        tech_pvt->user_via = sofia_glue_create_external_via(session, tech_pvt->profile, tech_pvt->transport);
                }
 
@@ -905,7 +905,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                                char *ip_addr = tech_pvt->profile->sipip;
                                char *ipv6;
 
-                               if ( !zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip ) ) {
+                               if ( !zstr(tech-pvt->mparams->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech-pvt->mparams->remote_ip ) ) {
                                        ip_addr = tech_pvt->profile->extsipip;
                                }
 
@@ -922,7 +922,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                                if (sofia_glue_transport_has_tls(tech_pvt->transport)) {
                                        tech_pvt->invite_contact = tech_pvt->profile->tls_url;
                                } else {
-                                       if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+                                       if (!zstr(tech-pvt->mparams->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech-pvt->mparams->remote_ip)) {
                                                tech_pvt->invite_contact = tech_pvt->profile->public_url;
                                        } else {
                                                tech_pvt->invite_contact = tech_pvt->profile->url;
@@ -1231,7 +1231,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                tech_pvt->nh->nh_has_invite = 1;
        }
 
-       if ((mp = sofia_media_get_multipart(session, SOFIA_MULTIPART_PREFIX, tech_pvt->local_sdp_str, &mp_type))) {
+       if ((mp = sofia_media_get_multipart(session, SOFIA_MULTIPART_PREFIX, tech-pvt->mparams->local_sdp_str, &mp_type))) {
                sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA);
        }
 
@@ -1241,16 +1241,16 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                tech_pvt->session_refresher = nua_no_refresher;
        }
 
-       if (tech_pvt->local_sdp_str) {
+       if (tech-pvt->mparams->local_sdp_str) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG,
-                                                 "Local SDP:\n%s\n", tech_pvt->local_sdp_str);
+                                                 "Local SDP:\n%s\n", tech-pvt->mparams->local_sdp_str);
        }
 
        if (sofia_use_soa(tech_pvt)) {
                nua_invite(tech_pvt->nh,
                                   NUTAG_AUTOANSWER(0),
-                                  //TAG_IF(zstr(tech_pvt->local_sdp_str), NUTAG_AUTOACK(0)),
-                                  //TAG_IF(!zstr(tech_pvt->local_sdp_str), NUTAG_AUTOACK(1)),
+                                  //TAG_IF(zstr(tech-pvt->mparams->local_sdp_str), NUTAG_AUTOACK(0)),
+                                  //TAG_IF(!zstr(tech-pvt->mparams->local_sdp_str), NUTAG_AUTOACK(1)),
                                   // The code above is breaking things...... grrr WE need this because we handle our own acks and there are 3pcc cases in there too
                                   NUTAG_AUTOACK(0),
                                   NUTAG_SESSION_TIMER(tech_pvt->session_timeout),
@@ -1274,16 +1274,16 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                                   TAG_IF(!zstr(route), SIPTAG_ROUTE_STR(route)),
                                   TAG_IF(tech_pvt->profile->minimum_session_expires, NUTAG_MIN_SE(tech_pvt->profile->minimum_session_expires)),
                                   TAG_IF(cseq, SIPTAG_CSEQ(cseq)),
-                                  TAG_IF(zstr(tech_pvt->local_sdp_str), SIPTAG_PAYLOAD_STR("")),
-                                  TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip)),
-                                  TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str)),
-                                  TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_REUSE_REJECTED(1)),
-                                  TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_ORDERED_USER(1)),
-                                  TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE)),
-                                  TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL)),
+                                  TAG_IF(zstr(tech-pvt->mparams->local_sdp_str), SIPTAG_PAYLOAD_STR("")),
+                                  TAG_IF(!zstr(tech-pvt->mparams->local_sdp_str), SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip)),
+                                  TAG_IF(!zstr(tech-pvt->mparams->local_sdp_str), SOATAG_USER_SDP_STR(tech-pvt->mparams->local_sdp_str)),
+                                  TAG_IF(!zstr(tech-pvt->mparams->local_sdp_str), SOATAG_REUSE_REJECTED(1)),
+                                  TAG_IF(!zstr(tech-pvt->mparams->local_sdp_str), SOATAG_ORDERED_USER(1)),
+                                  TAG_IF(!zstr(tech-pvt->mparams->local_sdp_str), SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE)),
+                                  TAG_IF(!zstr(tech-pvt->mparams->local_sdp_str), SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL)),
                                   TAG_IF(rep, SIPTAG_REPLACES_STR(rep)),
                                   TAG_IF(!require_timer, NUTAG_TIMER_AUTOREQUIRE(0)),
-                                  TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_HOLD(holdstr)), TAG_END());
+                                  TAG_IF(!zstr(tech-pvt->mparams->local_sdp_str), SOATAG_HOLD(holdstr)), TAG_END());
        } else {
                nua_invite(tech_pvt->nh,
                                   NUTAG_AUTOANSWER(0),
@@ -1312,7 +1312,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                                   TAG_IF(cseq, SIPTAG_CSEQ(cseq)),
                                   NUTAG_MEDIA_ENABLE(0),
                                   SIPTAG_CONTENT_TYPE_STR(mp_type ? mp_type : "application/sdp"),
-                                  SIPTAG_PAYLOAD_STR(mp ? mp : tech_pvt->local_sdp_str), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), SOATAG_HOLD(holdstr), TAG_END());
+                                  SIPTAG_PAYLOAD_STR(mp ? mp : tech-pvt->mparams->local_sdp_str), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), SOATAG_HOLD(holdstr), TAG_END());
        }
 
        sofia_glue_free_destination(dst);
@@ -1334,7 +1334,7 @@ void sofia_glue_do_xfer_invite(switch_core_session_t *session)
        switch_mutex_lock(tech_pvt->sofia_mutex);
        caller_profile = switch_channel_get_caller_profile(channel);
 
-       if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+       if (!zstr(tech-pvt->mparams->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech-pvt->mparams->remote_ip)) {
                sipip = tech_pvt->profile->extsipip;
                contact_url = tech_pvt->profile->public_url;
        } else {
@@ -1357,7 +1357,7 @@ void sofia_glue_do_xfer_invite(switch_core_session_t *session)
                                   SIPTAG_CONTACT_STR(contact_url),
                                   TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
                                   SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
-                                  SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                                  SOATAG_USER_SDP_STR(tech-pvt->mparams->local_sdp_str),
                                   SOATAG_REUSE_REJECTED(1),
                                   SOATAG_ORDERED_USER(1),
                                   SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE), SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), TAG_END());
@@ -1430,11 +1430,11 @@ void sofia_glue_deactivate_rtp(private_object_t *tech_pvt)
        if (tech_pvt->video_rtp_session) {
                switch_rtp_destroy(&tech_pvt->video_rtp_session);
        } else if (tech_pvt->local_sdp_video_port) {
-               switch_rtp_release_port(tech_pvt->rtpip, tech_pvt->local_sdp_video_port);
+               switch_rtp_release_port(tech-pvt->mparams->rtpip, tech_pvt->local_sdp_video_port);
        }
 
 
-       if (tech_pvt->local_sdp_video_port > 0 && !zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+       if (tech_pvt->local_sdp_video_port > 0 && !zstr(tech-pvt->mparams->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech-pvt->mparams->remote_ip)) {
                switch_nat_del_mapping((switch_port_t) tech_pvt->local_sdp_video_port, SWITCH_NAT_UDP);
                switch_nat_del_mapping((switch_port_t) tech_pvt->local_sdp_video_port + 1, SWITCH_NAT_UDP);
        }
@@ -1443,10 +1443,10 @@ void sofia_glue_deactivate_rtp(private_object_t *tech_pvt)
        if (tech_pvt->rtp_session) {
                switch_rtp_destroy(&tech_pvt->rtp_session);
        } else if (tech_pvt->local_sdp_audio_port) {
-               switch_rtp_release_port(tech_pvt->rtpip, tech_pvt->local_sdp_audio_port);
+               switch_rtp_release_port(tech-pvt->mparams->rtpip, tech_pvt->local_sdp_audio_port);
        }
 
-       if (tech_pvt->local_sdp_audio_port > 0 && !zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+       if (tech_pvt->local_sdp_audio_port > 0 && !zstr(tech-pvt->mparams->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech-pvt->mparams->remote_ip)) {
                switch_nat_del_mapping((switch_port_t) tech_pvt->local_sdp_audio_port, SWITCH_NAT_UDP);
                switch_nat_del_mapping((switch_port_t) tech_pvt->local_sdp_audio_port + 1, SWITCH_NAT_UDP);
        }
@@ -1903,8 +1903,8 @@ int sofia_recover_callback(switch_core_session_t *session)
        switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
        switch_mutex_init(&tech_pvt->sofia_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
 
-       tech_pvt->remote_ip = (char *) switch_channel_get_variable(channel, "sip_network_ip");
-       tech_pvt->remote_port = atoi(switch_str_nil(switch_channel_get_variable(channel, "sip_network_port")));
+       tech-pvt->mparams->remote_ip = (char *) switch_channel_get_variable(channel, "sip_network_ip");
+       tech-pvt->mparams->remote_port = atoi(switch_str_nil(switch_channel_get_variable(channel, "sip_network_port")));
        tech_pvt->caller_profile = switch_channel_get_caller_profile(channel);
 
        if ((tmp = switch_channel_get_variable(tech_pvt->channel, "sip_2833_send_payload"))) {
@@ -1963,11 +1963,11 @@ int sofia_recover_callback(switch_core_session_t *session)
        switch_core_session_get_recovery_crypto_key(session, SWITCH_MEDIA_TYPE_VIDEO, "srtp_remote_video_crypto_key");
 
        if ((tmp = switch_channel_get_variable(channel, "sip_local_sdp_str"))) {
-               tech_pvt->local_sdp_str = switch_core_session_strdup(session, tmp);
+               tech-pvt->mparams->local_sdp_str = switch_core_session_strdup(session, tmp);
        }
 
        if ((tmp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE))) {
-               tech_pvt->remote_sdp_str = switch_core_session_strdup(session, tmp);
+               tech-pvt->mparams->remote_sdp_str = switch_core_session_strdup(session, tmp);
        }
 
        switch_channel_set_variable(channel, "sip_invite_call_id", switch_channel_get_variable(channel, "sip_call_id"));
@@ -2018,12 +2018,12 @@ int sofia_recover_callback(switch_core_session_t *session)
                        
                        switch_core_media_set_codec(tech_pvt->session, 1, tech_pvt->profile->codec_flags);
 
-                       tech_pvt->adv_sdp_audio_ip = tech_pvt->extrtpip = (char *) ip;
+                       tech_pvt->adv_sdp_audio_ip = tech-pvt->mparams->extrtpip = (char *) ip;
                        tech_pvt->adv_sdp_audio_port = tech_pvt->local_sdp_audio_port = (switch_port_t)atoi(port);
 
                        if (!zstr(ip)) {
                                tech_pvt->local_sdp_audio_ip = switch_core_session_strdup(session, ip);
-                               tech_pvt->rtpip = tech_pvt->local_sdp_audio_ip;
+                               tech-pvt->mparams->rtpip = tech_pvt->local_sdp_audio_ip;
                        }
 
                        if (!zstr(a_ip)) {
index 6b66806b80b0552187cdbfa51ce004965c7169af..7fb6ada3d7136bb80f70e533d2c74f82d5fe2469 100644 (file)
@@ -521,14 +521,14 @@ void sofia_media_tech_patch_sdp(private_object_t *tech_pvt)
        char *new_sdp;
        int bad = 0;
 
-       if (zstr(tech_pvt->local_sdp_str)) {
+       if (zstr(tech-pvt->mparams->local_sdp_str)) {
                return;
        }
 
-       len = strlen(tech_pvt->local_sdp_str) * 2;
+       len = strlen(tech-pvt->mparams->local_sdp_str) * 2;
 
        if (switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) &&
-               (switch_stristr("sendonly", tech_pvt->local_sdp_str) || switch_stristr("0.0.0.0", tech_pvt->local_sdp_str))) {
+               (switch_stristr("sendonly", tech-pvt->mparams->local_sdp_str) || switch_stristr("0.0.0.0", tech-pvt->mparams->local_sdp_str))) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Skip patch on hold SDP\n");
                return;
        }
@@ -548,7 +548,7 @@ void sofia_media_tech_patch_sdp(private_object_t *tech_pvt)
        switch_snprintf(port_buf, sizeof(port_buf), "%u", tech_pvt->adv_sdp_audio_port);
 
 
-       p = tech_pvt->local_sdp_str;
+       p = tech-pvt->mparams->local_sdp_str;
        q = new_sdp;
        pe = p + strlen(p);
        qe = q + len - 1;
@@ -775,13 +775,13 @@ void sofia_media_tech_patch_sdp(private_object_t *tech_pvt)
 
        if (!has_ip && !has_audio) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "%s SDP has no audio in it.\n%s\n",
-                                                 switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_str);
+                                                 switch_channel_get_name(tech_pvt->channel), tech-pvt->mparams->local_sdp_str);
                return;
        }
 
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "%s Patched SDP\n---\n%s\n+++\n%s\n",
-                                         switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_str, new_sdp);
+                                         switch_channel_get_name(tech_pvt->channel), tech-pvt->mparams->local_sdp_str, new_sdp);
 
        sofia_media_tech_set_local_sdp(tech_pvt, new_sdp, SWITCH_FALSE);