]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
in the name of interop
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 12 Oct 2006 20:37:08 +0000 (20:37 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 12 Oct 2006 20:37:08 +0000 (20:37 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3043 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_types.h
src/mod/endpoints/mod_sofia/mod_sofia.c
src/switch_rtp.c

index 692f008b8f21735c15d61858d29a88cd4352553b..4587325201e0fb545ae377851907d1f2b3613f86 100644 (file)
@@ -182,6 +182,7 @@ typedef enum {
        SWITCH_RTP_FLAG_BREAK             - Stop what you are doing and return SWITCH_STATUS_BREAK
        SWITCH_RTP_FLAG_MINI              - Use mini RTP when possible
        SWITCH_RTP_FLAG_DATAWAIT          - Do not return from reads unless there is data even when non blocking
+       SWITCH_RTP_FLAG_BUGGY_2833    - Emulate the bug in cisco equipment to allow interop
 </pre>
  */
 typedef enum {
@@ -196,7 +197,8 @@ typedef enum {
        SWITCH_RTP_FLAG_VAD = (1 << 8),
        SWITCH_RTP_FLAG_BREAK = ( 1 << 9),
        SWITCH_RTP_FLAG_MINI = ( 1 << 10),
-       SWITCH_RTP_FLAG_DATAWAIT = (1 << 11)
+       SWITCH_RTP_FLAG_DATAWAIT = (1 << 11),
+       SWITCH_RTP_FLAG_BUGGY_2833 = (1 << 12)
 } switch_rtp_flag_t;
 
 /*!
index dd0da2a7b36f625565a02b35831dee50446daf54..41a7184252b929065e774260bc8ccfde8e2a431e 100644 (file)
@@ -142,7 +142,8 @@ typedef enum {
        TFLAG_REFER = (1 << 17),
        TFLAG_NOHUP = (1 << 18),
        TFLAG_XFER = (1 << 19),
-       TFLAG_NOMEDIA = (1 << 20)
+       TFLAG_NOMEDIA = (1 << 20),
+       TFLAG_BUGGY_2833 = (1 << 21)
 } TFLAGS;
 
 static struct {
@@ -275,6 +276,7 @@ struct private_object {
        char *key;
        char *xferto;
        char *kick;
+       char *origin;
        unsigned long rm_rate;
        switch_payload_t pt;
        switch_mutex_t *flag_mutex;
@@ -1226,6 +1228,10 @@ static switch_status_t activate_rtp(private_object_t *tech_pvt)
 
        flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_RAW_WRITE | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT);
 
+       if (switch_test_flag(tech_pvt, TFLAG_BUGGY_2833)) {
+               flags |= SWITCH_RTP_FLAG_BUGGY_2833;
+       }
+
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n",
                                          switch_channel_get_name(channel),
                                          tech_pvt->local_sdp_audio_ip,
@@ -1822,6 +1828,13 @@ static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp)
        tech_pvt = switch_core_session_get_private(session);
        assert(tech_pvt != NULL);                                                                                                                               
        
+       if ((tech_pvt->origin = switch_core_session_strdup(session, (char *) sdp->sdp_origin->o_username))) {
+               if (strstr(tech_pvt->origin, "CiscoSystemsSIP-GW-UserAgent")) {
+                       switch_set_flag_locked(tech_pvt, TFLAG_BUGGY_2833);
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Activate Buggy RFC2833 Mode!\n");
+               }
+       }
+
        for (m = sdp->sdp_media; m ; m = m->m_next) {
                if (m->m_type == sdp_media_audio) {
                        sdp_rtpmap_t *map;
index dc4aad8db61ed13911f70c7ac43816e6c419a411..3923bc3085177f1ea5ac8b2561921f34afeff5f8 100644 (file)
@@ -732,7 +732,7 @@ static void do_2833(switch_rtp_t *rtp_session)
                                switch_rtp_write_manual(rtp_session,
                                                                                rtp_session->dtmf_data.out_digit_packet,
                                                                                4,
-                                                                               1,
+                                                                               switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BUGGY_2833) ? 0 : 1,
                                                                                rtp_session->te,
                                                                                rtp_session->dtmf_data.timestamp_dtmf,
                                                                                rtp_session->dtmf_data.out_digit_seq++,