[Freeswitch-svn] [commit] r2025 - in freeswitch/branches/stkn: . conf libs src src/include src/mod/applications/mod_commands

Freeswitch SVN stkn at freeswitch.org
Thu Jul 20 12:00:50 EDT 2006


Author: stkn
Date: Thu Jul 20 12:00:50 2006
New Revision: 2025

Added:
   freeswitch/branches/stkn/libs/portaudio.build.sh
      - copied unchanged from r2024, /freeswitch/trunk/libs/portaudio.build.sh
Modified:
   freeswitch/branches/stkn/Makefile.am
   freeswitch/branches/stkn/Makefile.in
   freeswitch/branches/stkn/conf/freeswitch.xml
   freeswitch/branches/stkn/src/include/switch_core.h
   freeswitch/branches/stkn/src/include/switch_types.h
   freeswitch/branches/stkn/src/mod/applications/mod_commands/mod_commands.c
   freeswitch/branches/stkn/src/switch_channel.c
   freeswitch/branches/stkn/src/switch_core.c
   freeswitch/branches/stkn/src/switch_xml.c

Log:
Merge changes from trunk.

Modified: freeswitch/branches/stkn/Makefile.am
==============================================================================
--- freeswitch/branches/stkn/Makefile.am	(original)
+++ freeswitch/branches/stkn/Makefile.am	Thu Jul 20 12:00:50 2006
@@ -173,6 +173,7 @@
 	@rm -f build/freeswitch.env
 	@./build/addenv.sh build/freeswitch.env PREFIX $(PREFIX)
 	@./build/addenv.sh build/freeswitch.env MAKE $(MAKE)
+	mkdir -p $(PREFIX)
 	./build/buildlib.sh . install sqlite-3.3.5.tar.gz --prefix=$(PREFIX) --disable-tcl --enable-threadsafe
 	./build/buildlib.sh . install apr-1.2.6.tar.gz --prefix=$(PREFIX)
 	./build/buildlib.sh . install apr-util-1.2.6.tar.gz --with-apr=../apr-1.2.6 --prefix=$(PREFIX)

Modified: freeswitch/branches/stkn/Makefile.in
==============================================================================
--- freeswitch/branches/stkn/Makefile.in	(original)
+++ freeswitch/branches/stkn/Makefile.in	Thu Jul 20 12:00:50 2006
@@ -1103,6 +1103,7 @@
 	@rm -f build/freeswitch.env
 	@./build/addenv.sh build/freeswitch.env PREFIX $(PREFIX)
 	@./build/addenv.sh build/freeswitch.env MAKE $(MAKE)
+	mkdir -p $(PREFIX)
 	./build/buildlib.sh . install sqlite-3.3.5.tar.gz --prefix=$(PREFIX) --disable-tcl --enable-threadsafe
 	./build/buildlib.sh . install apr-1.2.6.tar.gz --prefix=$(PREFIX)
 	./build/buildlib.sh . install apr-util-1.2.6.tar.gz --with-apr=../apr-1.2.6 --prefix=$(PREFIX)

Modified: freeswitch/branches/stkn/conf/freeswitch.xml
==============================================================================
--- freeswitch/branches/stkn/conf/freeswitch.xml	(original)
+++ freeswitch/branches/stkn/conf/freeswitch.xml	Thu Jul 20 12:00:50 2006
@@ -28,7 +28,7 @@
         <!-- Endpoints -->
         <load module="mod_exosip"/>
         <!--<load module="mod_iax"/>-->
-        <!-- <load module="mod_portaudio"/> -->
+        <load module="mod_portaudio"/>
         <!-- <load module="mod_woomera"/> -->
         <!-- <load module="mod_wanpipe"/> -->
         <!-- <load module="mod_dingaling"/> -->
@@ -92,7 +92,7 @@
         <!-- <param name="ip" value="1.2.3.4"> -->
         <param name="port" value="4569"/>
         <param name="dialplan" value="XML"/>
-        <param name="codec-prefs" value="PCMU at 20,PCMA,speex,L16"/>
+        <param name="codec-prefs" value="PCMU at 20i,PCMA,speex,L16"/>
         <param name="codec-master" value="us"/>
         <param name="codec-rates" value="8"/>
       </settings>
@@ -132,7 +132,11 @@
         <param name="dtmf-duration" value="100"/>
         <!-- the @20 is optional number of ms you want to use.  Use it only
         if you know the codec supports it -->
-        <param name="codec-prefs" value="PCMU at 20,PCMA at 20"/>
+        <param name="codec-prefs" value="PCMU at 20i,PCMA at 20i"/>
+        <!-- Example to call for speex in wideband 16k mode 
+	you can have up to 2 '@; after the codec name followed by either
+	'i' (interval eg 20i for 20ms) or 'k' (kilohertz eg 16000k for 16khz)-->
+        <!--<param name="codec-prefs" value="SPEEX at 16000k"/>-->
         <!-- Payload number to bind DTMF to-->
         <param name="rfc2833-pt" value="101"/>
         <!-- disable to trade async for more calls -->

Modified: freeswitch/branches/stkn/src/include/switch_core.h
==============================================================================
--- freeswitch/branches/stkn/src/include/switch_core.h	(original)
+++ freeswitch/branches/stkn/src/include/switch_core.h	Thu Jul 20 12:00:50 2006
@@ -121,7 +121,7 @@
   \param new new value (if > 0)
   \return the current session limit
 */
-SWITCH_DECLARE(uint32_t) switch_core_session_limit(uint32_t new);
+SWITCH_DECLARE(uint32_t) switch_core_session_limit(uint32_t new_limit);
 
 /*! 
   \brief Destroy the core

Modified: freeswitch/branches/stkn/src/include/switch_types.h
==============================================================================
--- freeswitch/branches/stkn/src/include/switch_types.h	(original)
+++ freeswitch/branches/stkn/src/include/switch_types.h	Thu Jul 20 12:00:50 2006
@@ -92,7 +92,7 @@
 #define SWITCH_MAX_STATE_HANDLERS 30
 #define SWITCH_TRUE 1
 #define SWITCH_FALSE 0
-#define SWITCH_CORE_QUEUE_LEN 20000
+#define SWITCH_CORE_QUEUE_LEN 100000
 
 typedef enum {
 	SWITCH_XML_SECTION_RESULT = 0,

Modified: freeswitch/branches/stkn/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/applications/mod_commands/mod_commands.c	(original)
+++ freeswitch/branches/stkn/src/mod/applications/mod_commands/mod_commands.c	Thu Jul 20 12:00:50 2006
@@ -184,20 +184,63 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+struct holder {
+	switch_stream_handle_t *stream;
+	char *http;
+	uint32_t count;
+};
+
 static int show_callback(void *pArg, int argc, char **argv, char **columnNames){
-	switch_stream_handle_t *stream = (switch_stream_handle_t *) pArg;
+	struct holder *holder = (struct holder *) pArg;
+	int x;
 
-	stream->write_function(stream, "%s|%s\n", argv[0], argv[1] ? argv[1] : "NULL");
+
+	if (holder->count == 0) {
+		if (holder->http) {
+			holder->stream->write_function(holder->stream, "\n<tr>");
+		}
+
+		for(x = 0; x < argc; x++) {
+			if (holder->http) {
+				holder->stream->write_function(holder->stream, "<td>");
+				holder->stream->write_function(holder->stream, "<b>%s</b>%s", columnNames[x], x == (argc - 1) ? "</td></tr>\n" : "</td><td>");
+			} else {
+				holder->stream->write_function(holder->stream, "%s%s", columnNames[x], x == (argc - 1) ? "\n" : ",");
+			}
+		}
+	} 
+
+	if (holder->http) {
+		holder->stream->write_function(holder->stream, "<tr bgcolor=%s>", holder->count % 2 == 0 ? "eeeeee" : "ffffff");
+	}
+
+	for(x = 0; x < argc; x++) {
+		if (holder->http) {
+			holder->stream->write_function(holder->stream, "<td>");
+			holder->stream->write_function(holder->stream, "%s%s", argv[x], x == (argc - 1) ? "</td></tr>\n" : "</td><td>");
+		} else {
+			holder->stream->write_function(holder->stream, "%s%s", argv[x], x == (argc - 1) ? "\n" : ",");
+		}
+	}
+	
+
+
+
+	holder->count++;
 	return 0;
 }
 
-
 static switch_status_t show_function(char *cmd, switch_stream_handle_t *stream)
 {
 	char sql[1024];
 	char *errmsg;
 	switch_core_db_t *db = switch_core_db_handle();
+	struct holder holder = {0};
 
+	if (stream->event) {
+        holder.http = switch_event_get_header(stream->event, "http-host");
+    } 
+
     if (!cmd) {
         sprintf (sql, "select * from interfaces");
     }
@@ -220,12 +263,26 @@
         return SWITCH_STATUS_SUCCESS;
     }
     
-	switch_core_db_exec(db, sql, show_callback, stream, &errmsg);
+	holder.stream = stream;
+	holder.count = 0;
 
+	if (holder.http) {
+		holder.stream->write_function(holder.stream, "<table cellpadding=1 cellspacing=4 border=1>\n");
+	}
+
+	switch_core_db_exec(db, sql, show_callback, &holder, &errmsg);
+
+	if (holder.http) {
+		holder.stream->write_function(holder.stream, "</table>");
+	}
+
+
 	if (errmsg) {
 		stream->write_function(stream, "SQL ERR [%s]\n",errmsg);
 		switch_core_db_free(errmsg);
 		errmsg = NULL;
+	} else {
+		stream->write_function(stream, "\n%u total.\n", holder.count);
 	}
 
 	switch_core_db_close(db);

Modified: freeswitch/branches/stkn/src/switch_channel.c
==============================================================================
--- freeswitch/branches/stkn/src/switch_channel.c	(original)
+++ freeswitch/branches/stkn/src/switch_channel.c	Thu Jul 20 12:00:50 2006
@@ -593,6 +593,7 @@
 {
 	switch_caller_profile_t *caller_profile, *originator_caller_profile, *originatee_caller_profile;
 	switch_hash_index_t *hi;
+	switch_codec_t *codec;
 	void *val;
 	const void *var;
 	char state_num[25];
@@ -606,7 +607,16 @@
 	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", (char *) state_num);
 	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", switch_channel_get_name(channel));
 	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(channel->session));
-
+	
+	if ((codec = switch_core_session_get_read_codec(channel->session))) {
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Name", codec->implementation->iananame);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Rate", "%u", codec->implementation->samples_per_second);
+	}
+	
+	if ((codec = switch_core_session_get_write_codec(channel->session))) {
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", codec->implementation->iananame);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%u", codec->implementation->samples_per_second);
+	}
 
 	/* Index Caller's Profile */
 	if (caller_profile) {

Modified: freeswitch/branches/stkn/src/switch_core.c
==============================================================================
--- freeswitch/branches/stkn/src/switch_core.c	(original)
+++ freeswitch/branches/stkn/src/switch_core.c	Thu Jul 20 12:00:50 2006
@@ -2730,7 +2730,7 @@
 	uint32_t itterations = 0;
 	uint8_t trans = 0;
 	switch_time_t last_commit = switch_time_now();
-	uint32_t freq = 1000, target = 500, diff = 0;
+	uint32_t freq = 1000, target = 1000, diff = 0;
 	
 	if (!runtime.event_db) {
 		runtime.event_db = switch_core_db_handle();
@@ -2810,7 +2810,7 @@
 
 	switch (event->event_id) {
 	case SWITCH_EVENT_CHANNEL_DESTROY:
-		switch_core_db_mprintf("delete from channels where uuid='%s'", switch_event_get_header(event, "unique-id"));
+		sql = switch_core_db_mprintf("delete from channels where uuid='%s'", switch_event_get_header(event, "unique-id"));
 		break;
 	case SWITCH_EVENT_CHANNEL_CREATE:
 		sql = switch_core_db_mprintf("insert into channels (uuid,created,name,state) values('%q','%q','%q','%q')",
@@ -2821,9 +2821,13 @@
 									 );
 		break;
 	case SWITCH_EVENT_CHANNEL_EXECUTE:
-		sql = switch_core_db_mprintf("update channels set application='%q',application_data='%q' where uuid='%q'",
+		sql = switch_core_db_mprintf("update channels set application='%q',application_data='%q', read_codec='%q',read_rate='%q',write_codec='%q',write_rate='%q' where uuid='%q'",
 									 switch_event_get_header(event, "application"),
 									 switch_event_get_header(event, "application-data"),
+									 switch_event_get_header(event, "channel-read-codec-name"),
+									 switch_event_get_header(event, "channel-read-codec-rate"),
+									 switch_event_get_header(event, "channel-write-codec-name"),
+									 switch_event_get_header(event, "channel-write-codec-rate"),
 									 switch_event_get_header(event, "unique-id")
 									 );
 		break;
@@ -2926,10 +2930,10 @@
 }
 
 
-SWITCH_DECLARE(uint32_t) switch_core_session_limit(uint32_t new)
+SWITCH_DECLARE(uint32_t) switch_core_session_limit(uint32_t new_limit)
 {
-	if (new) {
-		runtime.session_limit = new;
+	if (new_limit) {
+		runtime.session_limit = new_limit;
 	}
 	
 	return runtime.session_limit;
@@ -3018,7 +3022,11 @@
 			"   ip_addr  VARCHAR(255),\n"
 			"   dest  VARCHAR(255),\n"
 			"   application  VARCHAR(255),\n"
-			"   application_data  VARCHAR(255)\n"
+			"   application_data  VARCHAR(255),\n"
+			"   read_codec  VARCHAR(255),\n"
+			"   read_rate  VARCHAR(255),\n"
+			"   write_codec  VARCHAR(255),\n"
+			"   write_rate  VARCHAR(255)\n"
 			");\n";
 		char create_calls_sql[] =
 			"CREATE TABLE calls (\n"

Modified: freeswitch/branches/stkn/src/switch_xml.c
==============================================================================
--- freeswitch/branches/stkn/src/switch_xml.c	(original)
+++ freeswitch/branches/stkn/src/switch_xml.c	Thu Jul 20 12:00:50 2006
@@ -912,7 +912,7 @@
 			switch_set_flag(MAIN_XML_ROOT, SWITCH_XML_ROOT);
 		}
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open XML Root!\n");
+		*err = "Cannot Open XML Root!";
 	}
 
 	if (hasmain) {



More information about the Freeswitch-svn mailing list