[Freeswitch-svn] [commit] r7309 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN mikej at freeswitch.org
Sun Jan 20 19:35:33 EST 2008


Author: mikej
Date: Sun Jan 20 19:35:33 2008
New Revision: 7309

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c

Log:
add optional var/param for seperately setting the rtp timeout when on hold

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	Sun Jan 20 19:35:33 2008
@@ -288,6 +288,7 @@
 	uint32_t session_timeout;
 	uint32_t max_proceeding;
 	uint32_t rtp_timeout_sec;
+	uint32_t rtp_hold_timeout_sec;
 	char *odbc_dsn;
 	char *odbc_user;
 	char *odbc_pass;
@@ -374,6 +375,7 @@
 	uint32_t owner_id;
 	uint32_t session_id;
 	uint32_t max_missed_packets;
+	uint32_t max_missed_hold_packets;
 	/** VIDEO **/
 	switch_frame_t video_read_frame;
 	switch_codec_t video_read_codec;

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Sun Jan 20 19:35:33 2008
@@ -1011,6 +1011,11 @@
 						if (v >= 0) {
 							profile->rtp_timeout_sec = v;
 						}
+					} else if (!strcasecmp(var, "rtp-hold-timeout-sec")) {
+						int v = atoi(val);
+						if (v >= 0) {
+							profile->rtp_hold_timeout_sec = v;
+						}
 					} else if (!strcasecmp(var, "manage-presence")) {
 						if (switch_true(val)) {
 							profile->pflags |= PFLAG_PRESENCE;

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	Sun Jan 20 19:35:33 2008
@@ -1226,6 +1226,7 @@
 	switch_status_t status;
 	char tmp[50];
 	uint32_t rtp_timeout_sec = tech_pvt->profile->rtp_timeout_sec;
+	uint32_t rtp_hold_timeout_sec = tech_pvt->profile->rtp_hold_timeout_sec;
 	
 	switch_assert(tech_pvt != NULL);
 
@@ -1370,12 +1371,27 @@
 				rtp_timeout_sec = v;
 			}
 		}
+
+		if ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_hold_timeout_sec"))) {
+			int v = atoi(val);
+			if (v >= 0) {
+				rtp_hold_timeout_sec = v;
+			}
+		}
 		
 		if (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, tech_pvt->max_missed_packets);
+			if (!rtp_hold_timeout_sec) {
+				rtp_hold_timeout_sec = rtp_timeout_sec * 10;
+			}
+		}
+
+		if (rtp_hold_timeout_sec) {
+			tech_pvt->max_missed_hold_packets = (tech_pvt->read_codec.implementation->samples_per_second * rtp_hold_timeout_sec) / 
+				tech_pvt->read_codec.implementation->samples_per_frame;
 		}
 
 		if (tech_pvt->te) {
@@ -1540,7 +1556,7 @@
 			switch_channel_presence(tech_pvt->channel, "unknown", "hold");
 
 			if (tech_pvt->max_missed_packets) {
-				switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets * 10);
+				switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_hold_packets);
 			}
 
 			if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) {



More information about the Freeswitch-svn mailing list