]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make rtp timeout 10 times longer than specified value when the call is on hold
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 31 Oct 2007 17:30:50 +0000 (17:30 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 31 Oct 2007 17:30:50 +0000 (17:30 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6101 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia_glue.c

index 6458cbdcae2555abc5cae525a832bbc62013a69a..e46150c666ad33bc9cd9e12008059834ff7c5cc1 100644 (file)
@@ -342,6 +342,7 @@ struct private_object {
        sip_contact_t *contact;
        uint32_t owner_id;
        uint32_t session_id;
+       uint32_t max_missed_packets;
        /** VIDEO **/
        switch_frame_t video_read_frame;
        switch_codec_t video_read_codec;
index fde08516a725b54cbf33071d8f905b350fd82ecc..0664d7e4a9335d0e10c0bff57b43aa3b1f553479 100644 (file)
@@ -1071,11 +1071,10 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
                }
                
                if (rtp_timeout_sec) {
-                       uint32_t packets;
-                       packets = (tech_pvt->read_codec.implementation->samples_per_second * rtp_timeout_sec) / 
+                       tech_pvt->max_missed_packets = (tech_pvt->read_codec.implementation->samples_per_second * rtp_timeout_sec) / 
                                tech_pvt->read_codec.implementation->samples_per_frame;
                        
-                       switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, packets);
+                       switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
                }
 
                if (tech_pvt->te) {
@@ -1228,6 +1227,9 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
                if (!switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
                        char *stream;
                        switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+                       if (tech_pvt->max_missed_packets) {
+                               switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets * 10);
+                       }
                        if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
                                stream = tech_pvt->profile->hold_music;
                        }
@@ -1238,6 +1240,9 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
        } else {
                if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
                        switch_channel_clear_flag_partner(tech_pvt->channel, CF_BROADCAST);
+                       if (tech_pvt->max_missed_packets) {
+                               switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
+                       }
                        switch_channel_set_flag_partner(tech_pvt->channel, CF_BREAK);
                        switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
                }