]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix rtp issue
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 5 Apr 2007 19:29:48 +0000 (19:29 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 5 Apr 2007 19:29:48 +0000 (19:29 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4863 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/sofia.conf.xml
src/mod/endpoints/mod_dingaling/mod_dingaling.c
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_rtp.c

index cdf62a51086ced9a2af848eac8e6bfc35108d66b..7ac9707e4ce45f81f8c76caf168526af35817ba7 100644 (file)
@@ -31,6 +31,9 @@
        <param name="rtp-ip" value="auto"/>
        <param name="sip-ip" value="auto"/>
 
+       <!--If you don't want to pass through timestampes from 1 RTP call to another (on a per call basis with rtp_rewrite_timestamps chanvar)-->
+       <!--<param name="rtp-rewrite-timestampes" value="true"/>-->
+
        <!--If you have ODBC support and a working dsn you can use it instead of SQLite-->
        <!--<param name="odbc-dsn" value="dsn:user:pass"/>-->
 
index a9e0c93732434fac2ac5e261514b9cbd11b41ecd..86417556025971d0dce9d3012746d11dda829ed0 100644 (file)
@@ -829,15 +829,13 @@ static int activate_rtp(struct private_object *tech_pvt)
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SETUP RTP %s:%d -> %s:%d\n", tech_pvt->profile->ip,
                                          tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port);
 
-       flags = SWITCH_RTP_FLAG_GOOGLEHACK | SWITCH_RTP_FLAG_AUTOADJ;
+       flags = SWITCH_RTP_FLAG_GOOGLEHACK | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_RAW_WRITE | SWITCH_RTP_FLAG_AUTO_CNG;
        //flags = SWITCH_RTP_FLAG_AUTOADJ;
 
        if (switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
                flags |= SWITCH_RTP_FLAG_USE_TIMER;
        }
 
-       flags |= SWITCH_RTP_FLAG_AUTO_CNG;
-
        if (!(tech_pvt->rtp_session = switch_rtp_new(tech_pvt->profile->ip,
                                                                                                 tech_pvt->local_port,
                                                                                                 tech_pvt->remote_ip,
index 7253e820bf8b4127c0dbe550d22fa473f2eff0c4..b4398a1effdc88045aff6e5333f5eab264aedcf5 100644 (file)
@@ -105,7 +105,8 @@ typedef enum {
        PFLAG_FULL_ID = (1 << 3),
        PFLAG_PRESENCE = (1 << 4),
        PFLAG_PASS_RFC2833 = (1 << 5),
-       PFLAG_DISABLE_TRANSCODING = (1 << 6)
+       PFLAG_DISABLE_TRANSCODING = (1 << 6),
+       PFLAG_REWRITE_TIMESTAMPS = (1 << 7)
 } PFLAGS;
 
 typedef enum {
index cd64e5c13808c0089937bb01a84ef6c6ce39d96a..4bbc08a9e4feca869429c7f5fe73230eace5dbe0 100644 (file)
@@ -547,6 +547,10 @@ switch_status_t config_sofia(int reload)
                                                if (switch_true(val)) {
                                                        profile->pflags |= PFLAG_DISABLE_TRANSCODING;
                                                }
+                                       } else if (!strcasecmp(var, "rtp-rewrite-timestamps")) {
+                                               if (switch_true(val)) {
+                                                       profile->pflags |= PFLAG_REWRITE_TIMESTAMPS;
+                                               }
                                        } else if (!strcasecmp(var, "auth-calls")) {
                                                if (switch_true(val)) {
                                                        profile->pflags |= PFLAG_AUTH_CALLS;
index df2f43fdff5ba5207bad80aa576562d02b36c783..4ee0f69b430bc8893707383d15e689f123879376 100644 (file)
@@ -682,7 +682,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t * tech_pvt)
        bw = tech_pvt->read_codec.implementation->bits_per_second;
        ms = tech_pvt->read_codec.implementation->microseconds_per_frame;
 
-       flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_RAW_WRITE | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT);
+       flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT);
 
        if (switch_test_flag(tech_pvt, TFLAG_BUGGY_2833)) {
                flags |= SWITCH_RTP_FLAG_BUGGY_2833;
@@ -693,6 +693,11 @@ switch_status_t sofia_glue_activate_rtp(private_object_t * tech_pvt)
                flags |= SWITCH_RTP_FLAG_PASS_RFC2833;
        }
 
+       if (!((tech_pvt->profile->pflags & PFLAG_REWRITE_TIMESTAMPS) || 
+                 ((val = switch_channel_get_variable(channel, "rtp_rewrite_timestamps")) && switch_true(val)))) {
+               flags |= SWITCH_RTP_FLAG_RAW_WRITE;
+       }
+
        if (tech_pvt->cng_pt) {
                flags |= SWITCH_RTP_FLAG_AUTO_CNG;
        }
index 157afcf696ad0088fc55fde55271c774680b5a34..128e936e768dc6b8b2982ec497f453f07c3403a6 100644 (file)
@@ -1307,6 +1307,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t data
                        switch_core_timer_check(&rtp_session->timer);
                        rtp_session->last_write_samplecount = rtp_session->timer.samplecount;
                }
+
                switch_socket_sendto(rtp_session->sock, rtp_session->remote_addr, 0, (void *) send_msg, &bytes);
        }
 
@@ -1410,7 +1411,6 @@ SWITCH_DECLARE(int) switch_rtp_write(switch_rtp_t *rtp_session, void *data, uint
 SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_frame_t *frame, uint32_t ts)
 {
        uint8_t fwd = 0;
-       uint8_t packetize = 0;
        void *data;
        uint32_t len;
        switch_payload_t payload;
@@ -1421,7 +1421,6 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
        }
 
        fwd = (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_RAW_WRITE) && switch_test_flag(frame, SFF_RAW_RTP)) ? 1 : 0;
-       packetize = (rtp_session->samples_per_interval > frame->datalen && (frame->payload == rtp_session->payload)) ? 1 : 0;
 
        if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) || !rtp_session->remote_addr) {
                return -1;
@@ -1435,7 +1434,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
                payload = rtp_session->payload;
        }
 
-       if (fwd && !packetize) {
+       if (fwd) {
                data = frame->packet;
                len = frame->packetlen;
        } else {