]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
only pass 2833 while bridged and while bridged to another channel that uses our RTP...
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 23 Apr 2009 13:15:03 +0000 (13:15 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 23 Apr 2009 13:15:03 +0000 (13:15 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13131 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_channel.h
src/include/switch_types.h
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia_glue.c
src/switch_channel.c

index f70abba5fc9bfa26e8ba025ae3d328946d9ae7f4..9c35f1f19860c56185d696e96395f649de3fac94 100644 (file)
@@ -301,6 +301,8 @@ SWITCH_DECLARE(switch_bool_t) switch_channel_set_flag_partner(switch_channel_t *
 */
 SWITCH_DECLARE(switch_bool_t) switch_channel_clear_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag);
 
+SWITCH_DECLARE(uint32_t) switch_channel_test_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag);
+
 /*!
   \brief Set given flag(s) on a given channel to be applied on the next state change
   \param channel channel on which to set flag(s)
index 78bf3a096df53dff5817bd845973f35b080cfc94..660040f17810946b61566dab5b4a4614a4f37ffc 100644 (file)
@@ -883,6 +883,7 @@ typedef enum {
        CF_PAUSE_BUGS,
        CF_DIVERT_EVENTS,
        CF_BLOCK_STATE,
+       CF_FS_RTP,
        /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
        CF_FLAG_MAX
 } switch_channel_flag_t;
index 99ed6a740bb1c1cdcfd2a0a184af7d1f8b4fe6e9..de696f70aabaf361e2e4e555048d60db52392f9c 100644 (file)
@@ -1024,11 +1024,20 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 
        case SWITCH_MESSAGE_INDICATE_BRIDGE:
                if (switch_rtp_ready(tech_pvt->rtp_session)) {
+                       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_LOG, SWITCH_LOG_DEBUG, "%s activate passthru 2833 mode.\n", switch_channel_get_name(channel));
+                       }
+                       
                        rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_STICK);
                }
                goto end;
        case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
                if (switch_rtp_ready(tech_pvt->rtp_session)) {
+                       if (switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833)) {
+                               switch_log_printf(SWITCH_CHANNEL_LOG, 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);
+                       }
                        rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_UNSTICK);
                }
                goto end;
index c1048bde6a77f283cba4e51b0f447a8259f75dd3..b306a6799c172441945cb8ac583168065a868d11 100644 (file)
@@ -233,6 +233,7 @@ typedef enum {
        TFLAG_PROXY_MEDIA,
        TFLAG_HOLD_LOCK,
        TFLAG_3PCC_HAS_ACK,
+       TFLAG_PASS_RFC2833,
 
        /* No new flags below this line */
        TFLAG_MAX
index bfd4cc2bc4f49a3df7368cc051622ceeb79fc088..e2a6ac7abdb56fa7a2fd1075b0361b753ff58cbc 100644 (file)
@@ -2106,7 +2106,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
 
        if (sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_RFC2833)
                || ((val = switch_channel_get_variable(tech_pvt->channel, "pass_rfc2833")) && switch_true(val))) {
-               flags |= SWITCH_RTP_FLAG_PASS_RFC2833;
+               sofia_set_flag(tech_pvt, TFLAG_PASS_RFC2833);
        }
 
 
@@ -2219,6 +2219,8 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
                uint8_t vad_out = sofia_test_flag(tech_pvt, TFLAG_VAD_OUT) ? 1 : 0;
                uint8_t inb = sofia_test_flag(tech_pvt, TFLAG_OUTBOUND) ? 0 : 1;
                uint32_t stun_ping = 0;
+
+               switch_channel_set_flag(tech_pvt->channel, CF_FS_RTP);
                
                if ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_enable_vad_in")) && switch_true(val)) {
                        vad_in = 1;
index a6d1f182bbd91a3dc8d5b4dc4e6e5e057f121ee6..b1beb3a55ed081b0880b3f8e0cd8c31fd78cff0c 100644 (file)
@@ -719,6 +719,24 @@ SWITCH_DECLARE(switch_bool_t) switch_channel_set_flag_partner(switch_channel_t *
        return SWITCH_FALSE;
 }
 
+SWITCH_DECLARE(uint32_t) switch_channel_test_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag)
+{
+       const char *uuid;
+       int r = 0;
+       
+       switch_assert(channel != NULL);
+
+       if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+               switch_core_session_t *session;
+               if ((session = switch_core_session_locate(uuid))) {
+                       r = switch_channel_test_flag(switch_core_session_get_channel(session), flag);
+                       switch_core_session_rwunlock(session);
+               }
+       }
+
+       return r;
+}
+
 SWITCH_DECLARE(switch_bool_t) switch_channel_clear_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag)
 {
        const char *uuid;