[Freeswitch-svn] [commit] r6003 - in freeswitch/trunk: conf src src/mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Fri Oct 19 17:06:10 EDT 2007


Author: anthm
Date: Fri Oct 19 17:06:09 2007
New Revision: 6003

Modified:
   freeswitch/trunk/conf/sofia.conf.xml
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   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
   freeswitch/trunk/src/switch_core_codec.c

Log:
add some goodies to sofia

Modified: freeswitch/trunk/conf/sofia.conf.xml
==============================================================================
--- freeswitch/trunk/conf/sofia.conf.xml	(original)
+++ freeswitch/trunk/conf/sofia.conf.xml	Fri Oct 19 17:06:09 2007
@@ -56,6 +56,10 @@
 	<param name="sip-ip" value="$${local_ip_v4}"/>
 	<!--enable to use presense and mwi -->
 	<param name="manage-presence" value="true"/>
+	<!--max number of open dialogs in proceeding -->
+	<!--<param name="max-proceeding" value="1000"/>-->
+	<!--session timers for all call to expire after the specified seconds -->
+	<!--<param name="session-timeout" value="120"/>-->
 	<!--<param name="multiple-registrations" value="true"/>-->
 	<!--set to 'greedy' if you want your codec list to take precedence -->
 	<param name="inbound-codec-negotiation" value="generous"/>

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Fri Oct 19 17:06:09 2007
@@ -275,6 +275,8 @@
 	private_object_t *tech_pvt;
 	switch_channel_t *channel = NULL;
 	switch_status_t status;
+	uint32_t session_timeout = 0;
+	char *val;
 
 	assert(session != NULL);
 
@@ -322,7 +324,16 @@
 			}
 		}
 
+
+		if ((val = switch_channel_get_variable(channel, SOFIA_SESSION_TIMEOUT))) {
+			int v_session_timeout = atoi(val);
+			if (v_session_timeout >= 0) {
+				session_timeout = v_session_timeout;
+			}
+		}
+
 		nua_respond(tech_pvt->nh, SIP_200_OK,
+					NUTAG_SESSION_TIMER(session_timeout),
 					SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
 					SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
 
@@ -1064,6 +1075,8 @@
 				stream->write_function(stream, "CODECS     \t%s\n", switch_str_nil(profile->codec_string));
 				stream->write_function(stream, "TEL-EVENT  \t%d\n", profile->te);
 				stream->write_function(stream, "CNG        \t%d\n", profile->cng_pt);
+				stream->write_function(stream, "SESSION-TO \t%d\n", profile->session_timeout);
+				stream->write_function(stream, "MAX-DIALOG \t%d\n", profile->max_proceeding);
 				
 
 				stream->write_function(stream, "\nRegistrations:\n%s\n", line);
@@ -1376,7 +1389,7 @@
 		stream->write_function(stream, "%s", usage_string);
 		goto done;
 	}
-
+	
 	if (!strcasecmp(argv[0], "profile")) {
 		func = cmd_profile;
 	} else if (!strcasecmp(argv[0], "status")) {

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	Fri Oct 19 17:06:09 2007
@@ -61,6 +61,7 @@
 typedef struct private_object private_object_t;
 #define NUA_HMAGIC_T sofia_private_t
 
+#define SOFIA_SESSION_TIMEOUT "sofia_session_timeout"
 #define MY_EVENT_REGISTER "sofia::register"
 #define MY_EVENT_EXPIRE "sofia::expire"
 #define MULTICAST_EVENT "multicast::event"
@@ -255,6 +256,8 @@
 	uint32_t inuse;
 	uint32_t soft_max;
 	time_t started;
+	uint32_t session_timeout;
+	uint32_t max_proceeding;
 #ifdef SWITCH_HAVE_ODBC
 	char *odbc_dsn;
 	char *odbc_user;

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	Fri Oct 19 17:06:09 2007
@@ -351,6 +351,8 @@
 				   NUTAG_ALLOW("INFO"),
 				   NUTAG_ALLOW("NOTIFY"),
 				   NUTAG_ALLOW_EVENTS("talk"),
+				   NUTAG_SESSION_TIMER(profile->session_timeout),
+				   NTATAG_MAX_PROCEEDING(profile->max_proceeding),
 				   TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW("PUBLISH")),
 				   //TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW("NOTIFY")),
 				   TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW("SUBSCRIBE")),
@@ -358,7 +360,7 @@
 				   TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("presence")),
 				   TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("presence.winfo")),
 				   TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("message-summary")),
-				   SIPTAG_SUPPORTED_STR("100rel, precondition"), SIPTAG_USER_AGENT_STR(SOFIA_USER_AGENT), TAG_END());
+				   SIPTAG_SUPPORTED_STR("100rel, precondition, timer"), SIPTAG_USER_AGENT_STR(SOFIA_USER_AGENT), TAG_END());
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set params for %s\n", profile->name);
 
@@ -856,6 +858,16 @@
 						profile->timer_name = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "hold-music")) {
 						profile->hold_music = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "session-timeout")) {
+						int v_session_timeout = atoi(val);
+						if (v_session_timeout >= 0) {
+							profile->session_timeout = v_session_timeout;
+						}
+					} else if (!strcasecmp(var, "max-proceeding")) {
+						int v_max_proceeding = atoi(val);
+						if (v_max_proceeding >= 0) {
+							profile->max_proceeding = v_max_proceeding;
+						}
 					} 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	Fri Oct 19 17:06:09 2007
@@ -479,6 +479,8 @@
 	switch_event_header_t *hi;
 	char *extra_headers = NULL;
 	switch_status_t status = SWITCH_STATUS_FALSE;
+	uint32_t session_timeout = 0;
+	char *val;
 	char *rep;
 
 	channel = switch_core_session_get_channel(session);
@@ -623,8 +625,16 @@
 	if (stream.data) {
 		extra_headers = stream.data;
 	}
+	
+	if ((val = switch_channel_get_variable(channel, SOFIA_SESSION_TIMEOUT))) {
+		int v_session_timeout = atoi(val);
+		if (v_session_timeout >= 0) {
+			session_timeout = v_session_timeout;
+		}
+	}
 
 	nua_invite(tech_pvt->nh,
+			   NUTAG_SESSION_TIMER(session_timeout),
 			   TAG_IF(!switch_strlen_zero(rpid), SIPTAG_HEADER_STR(rpid)),
 			   TAG_IF(!switch_strlen_zero(alert_info), SIPTAG_HEADER_STR(alert_info)),
 			   TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),

Modified: freeswitch/trunk/src/switch_core_codec.c
==============================================================================
--- freeswitch/trunk/src/switch_core_codec.c	(original)
+++ freeswitch/trunk/src/switch_core_codec.c	Fri Oct 19 17:06:09 2007
@@ -43,8 +43,10 @@
 	if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
 		switch_channel_event_set_data(session->channel, event);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", "%s", codec->implementation->iananame);
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-rate", "%d", codec->implementation->samples_per_second);
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-actual-read-codec-rate", "%d", codec->implementation->actual_samples_per_second);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-rate", "%d", codec->implementation->actual_samples_per_second);
+		if (codec->implementation->actual_samples_per_second != codec->implementation->samples_per_second) {
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-read-codec-rate", "%d", codec->implementation->samples_per_second);
+		}
 		switch_event_fire(&event);
 	}
 
@@ -70,8 +72,10 @@
 	if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
 		switch_channel_event_set_data(session->channel, event);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-name", "%s", codec->implementation->iananame);
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-rate", "%d", codec->implementation->samples_per_second);
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-actual-write-codec-rate", "%d", codec->implementation->actual_samples_per_second);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-rate", "%d", codec->implementation->actual_samples_per_second);
+		if (codec->implementation->actual_samples_per_second != codec->implementation->samples_per_second) {
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-write-codec-rate", "%d", codec->implementation->actual_samples_per_second);
+		}
 		switch_event_fire(&event);
 	}
 



More information about the Freeswitch-svn mailing list