]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5547 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 26 Jun 2013 15:47:40 +0000 (10:47 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 26 Jun 2013 15:47:40 +0000 (10:47 -0500)
src/include/switch_core_media.h
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c
src/switch_core_media.c

index 624d3bddd0f1cc2d9125588218d3f01182f8bb85..844a1bbb76878fab6ee3611b9c14e91ac8def223 100644 (file)
@@ -73,7 +73,6 @@ typedef enum {
        SCMF_DISABLE_HOLD,
        SCMF_RENEG_ON_HOLD,
        SCMF_RENEG_ON_REINVITE,
-       SCMF_T38_PASSTHRU,
        SCMF_LIBERAL_DTMF,
        SCMF_SUPPRESS_CNG,
        SCMF_DISABLE_RTP_AUTOADJ,
index 49247f5c9bbf3616123684414052c47bd090e192..90e8dad19e0175152d4fc4b37b65bd0553e67d16 100644 (file)
@@ -234,6 +234,7 @@ typedef enum {
        PFLAG_MESSAGE_QUERY_ON_REGISTER,
        PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER,
        PFLAG_MANUAL_REDIRECT,
+       PFLAG_T38_PASSTHRU,
        PFLAG_AUTO_NAT,
        PFLAG_SIPCOMPACT,
        PFLAG_PRESENCE_PRIVACY,
index b14b852e161dfb74588fce15ab3b26ad4af67e9d..e9f5b9fea44598c43d089915d1a865218ef7b7f9 100644 (file)
@@ -3834,9 +3834,9 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
                                                }
                                        } else if (!strcasecmp(var, "t38-passthru")) {
                                                if (switch_true(val)) {
-                                                       sofia_set_media_flag(profile, SCMF_T38_PASSTHRU);
+                                                       sofia_set_pflag(profile, PFLAG_T38_PASSTHRU);
                                                } else {
-                                                       sofia_clear_media_flag(profile, SCMF_T38_PASSTHRU);
+                                                       sofia_clear_pflag(profile, PFLAG_T38_PASSTHRU);
                                                }
                                        } else if (!strcasecmp(var, "presence-disable-early")) {
                                                if (switch_true(val)) {
@@ -5306,7 +5306,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
                }
                
                if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
-                       switch_media_handle_clear_media_flag(tech_pvt->media_handle, SCMF_T38_PASSTHRU);
+                       switch_channel_clear_flag(tech_pvt->channel, CF_T38_PASSTHRU);
                        has_t38 = 0;
                }
 
@@ -5330,7 +5330,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
 
                if (status > 199 && (switch_channel_test_flag(channel, CF_PROXY_MODE) || 
                                                         switch_channel_test_flag(channel, CF_PROXY_MEDIA) || 
-                                                        (switch_media_handle_test_media_flag(tech_pvt->media_handle, SCMF_T38_PASSTHRU) && (has_t38 || status > 299)))) {
+                                                        (switch_channel_test_flag(tech_pvt->channel, CF_T38_PASSTHRU) && (has_t38 || status > 299)))) {
 
                        if (sofia_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
                                sofia_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
@@ -5350,7 +5350,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
                                        
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n", status, phrase);
 
-                                       if (status == 491 && (switch_media_handle_test_media_flag(tech_pvt->media_handle, SCMF_T38_PASSTHRU) ||
+                                       if (status == 491 && (switch_channel_test_flag(tech_pvt->channel, CF_T38_PASSTHRU) ||
                                                                                  switch_channel_test_flag(channel, CF_PROXY_MODE))) {
                                                nua_respond(other_tech_pvt->nh, SIP_491_REQUEST_PENDING, TAG_END());
                                                switch_core_session_rwunlock(other_session);
@@ -5358,12 +5358,12 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
                                        } else if (status > 299) {
                                                switch_channel_set_private(channel, "t38_options", NULL);
                                                switch_channel_set_private(other_channel, "t38_options", NULL);
-                                               switch_media_handle_clear_media_flag(tech_pvt->media_handle, SCMF_T38_PASSTHRU);
-                                               switch_media_handle_clear_media_flag(other_tech_pvt->media_handle, SCMF_T38_PASSTHRU);
+                                               switch_channel_clear_flag(tech_pvt->channel, CF_T38_PASSTHRU);
+                                               switch_channel_clear_flag(other_tech_pvt->channel, CF_T38_PASSTHRU);
                                                switch_channel_clear_app_flag_key("T38", tech_pvt->channel, CF_APP_T38);
                                                switch_channel_clear_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_REQ);
                                                switch_channel_set_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_FAIL);
-                                       } else if (status == 200 && switch_media_handle_test_media_flag(tech_pvt->media_handle, SCMF_T38_PASSTHRU) && has_t38 && sip->sip_payload && sip->sip_payload->pl_data) {
+                                       } else if (status == 200 && switch_channel_test_flag(tech_pvt->channel, CF_T38_PASSTHRU) && has_t38 && sip->sip_payload && sip->sip_payload->pl_data) {
                                                switch_t38_options_t *t38_options = switch_core_media_extract_t38_options(session, sip->sip_payload->pl_data);
                                                
                                                if (!t38_options) {
@@ -5384,14 +5384,14 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
                                        msg->numeric_arg = status;
                                        msg->string_arg = switch_core_session_strdup(other_session, phrase);
 
-                                       if (status == 200 && switch_media_handle_test_media_flag(tech_pvt->media_handle, SCMF_T38_PASSTHRU) && has_t38) {
+                                       if (status == 200 && switch_channel_test_flag(tech_pvt->channel, CF_T38_PASSTHRU) && has_t38) {
                                                msg->pointer_arg = switch_core_session_strdup(other_session, "t38");
                                        } else if (r_sdp) {
                                                msg->pointer_arg = switch_core_session_strdup(other_session, r_sdp);
                                                msg->pointer_arg_size = strlen(r_sdp);
                                        }
                                        
-                                       if (status == 200 && switch_media_handle_test_media_flag(tech_pvt->media_handle, SCMF_T38_PASSTHRU) && has_t38) {
+                                       if (status == 200 && switch_channel_test_flag(tech_pvt->channel, CF_T38_PASSTHRU) && has_t38) {
                                                if (switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO) && 
                                                        switch_core_media_ready(other_tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO)) {
                                                        switch_channel_clear_flag(tech_pvt->channel, CF_NOTIMER_DURING_BRIDGE);
index 2e35ab3a5bf86adb352cfe1a9e1fed8936bc7738..fccc577fa835d617bd24c6ec96e9741d9bf6b3b5 100644 (file)
@@ -133,7 +133,9 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
                switch_channel_set_flag(tech_pvt->channel, CF_RTP_NOTIMER_DURING_BRIDGE);
        }
 
-
+       if (sofia_test_pflag(tech_pvt->profile, PFLAG_T38_PASSTHRU)) {
+               switch_channel_set_flag(tech_pvt->channel, CF_T38_PASSTHRU);
+       }
        
        switch_core_media_check_dtmf_type(session);
        switch_channel_set_cap(tech_pvt->channel, CC_MEDIA_ACK);
index 346eddc4b275240761219c30e6bbef4c3b4a7902..9270b0b7290cbf439621d36761e38c01237b68bf 100644 (file)
@@ -2494,7 +2494,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                goto done;
                        } else {
                                const char *var = switch_channel_get_variable(channel, "t38_passthru");
-                               int pass = switch_media_handle_test_media_flag(smh, SCMF_T38_PASSTHRU);
+                               int pass = switch_channel_test_flag(smh->session->channel, CF_T38_PASSTHRU);
 
 
                                if (switch_channel_test_app_flag_key("T38", session->channel, CF_APP_T38)) {
@@ -2509,7 +2509,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        }
                                }
 
-                               if ((pass == 2 && switch_media_handle_test_media_flag(smh, SCMF_T38_PASSTHRU)) 
+                               if ((pass == 2 && switch_channel_test_flag(smh->session->channel, CF_T38_PASSTHRU)) 
                                        || !switch_channel_test_flag(session->channel, CF_REINVITE) ||
                                        
                                        switch_channel_test_flag(session->channel, CF_PROXY_MODE) || 
@@ -2572,9 +2572,9 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
 
                                        switch_core_media_copy_t38_options(t38_options, other_session);
 
-                                       switch_media_handle_set_media_flag(smh, SCMF_T38_PASSTHRU);
-                                       switch_media_handle_set_media_flag(other_session->media_handle, SCMF_T38_PASSTHRU);
-
+                                       switch_channel_set_flag(smh->session->channel, CF_T38_PASSTHRU);
+                                       switch_channel_set_flag(other_session->channel, CF_T38_PASSTHRU);
+                                       
                                        msg = switch_core_session_alloc(other_session, sizeof(*msg));
                                        msg->message_id = SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA;
                                        msg->from = __FILE__;