From 0c09642bf95ba4ec9d2d458b3e2662f16d13d30a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 31 Oct 2007 17:30:50 +0000 Subject: [PATCH] make rtp timeout 10 times longer than specified value when the call is on hold git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6101 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia_glue.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 6458cbdcae..e46150c666 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -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; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index fde08516a7..0664d7e4a9 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -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); }