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
This commit is contained in:
Anthony Minessale 2007-10-31 17:30:50 +00:00
parent 2f32d01b1c
commit 0c09642bf9
2 changed files with 9 additions and 3 deletions

View 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;

View 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);
}