[Freeswitch-branches] [commit] r2218 - in freeswitch/branches/stkn: . conf libs mac/xcode mac/xcode/FreeSWITCH.xcodeproj mac/xcode/libs scripts/socket scripts/socket/FreeSWITCH src src/include src/mod/applications/mod_commands src/mod/applications/mod_conference src/mod/applications/mod_dptools src/mod/codecs/mod_g711 src/mod/codecs/mod_l16 src/mod/dialplans/mod_dialplan_xml src/mod/endpoints/mod_dingaling src/mod/endpoints/mod_exosip src/mod/endpoints/mod_portaudio src/mod/event_handlers/mod_cdr src/mod/event_handlers/mod_event_socket src/mod/event_handlers/mod_xmpp_event src/mod/formats/mod_sndfile src/mod/languages/mod_spidermonkey src/mod/xml_int/mod_xml_rpc w32/vsnet w32/vsnet/Tools w32/vsnet/Tools/libsndfile

Freeswitch SVN stkn at freeswitch.org
Tue Aug 1 13:17:59 EDT 2006


Author: stkn
Date: Tue Aug  1 13:17:53 2006
New Revision: 2218

Added:
   freeswitch/branches/stkn/mac/xcode/FreeSWITCH.xcodeproj/
      - copied from r2217, /freeswitch/trunk/mac/xcode/FreeSWITCH.xcodeproj/
   freeswitch/branches/stkn/mac/xcode/FreeSWITCH.xcodeproj/project.pbxproj
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/FreeSWITCH.xcodeproj/project.pbxproj
   freeswitch/branches/stkn/mac/xcode/apr.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/apr.plist
   freeswitch/branches/stkn/mac/xcode/aprutil.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/aprutil.plist
   freeswitch/branches/stkn/mac/xcode/dingaling.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/dingaling.plist
   freeswitch/branches/stkn/mac/xcode/exosip2.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/exosip2.plist
   freeswitch/branches/stkn/mac/xcode/gsm.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/gsm.plist
   freeswitch/branches/stkn/mac/xcode/iax.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/iax.plist
   freeswitch/branches/stkn/mac/xcode/iksemel.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/iksemel.plist
   freeswitch/branches/stkn/mac/xcode/ilbc.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/ilbc.plist
   freeswitch/branches/stkn/mac/xcode/libfreeswitch.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/libfreeswitch.plist
   freeswitch/branches/stkn/mac/xcode/osip2.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/osip2.plist
   freeswitch/branches/stkn/mac/xcode/osipparser2.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/osipparser2.plist
   freeswitch/branches/stkn/mac/xcode/pcre.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/pcre.plist
   freeswitch/branches/stkn/mac/xcode/portaudio.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/portaudio.plist
   freeswitch/branches/stkn/mac/xcode/resample.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/resample.plist
   freeswitch/branches/stkn/mac/xcode/sndfile.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/sndfile.plist
   freeswitch/branches/stkn/mac/xcode/speakup.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/speakup.plist
   freeswitch/branches/stkn/mac/xcode/speex.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/speex.plist
   freeswitch/branches/stkn/mac/xcode/sqlite.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/sqlite.plist
   freeswitch/branches/stkn/mac/xcode/srtp.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/srtp.plist
   freeswitch/branches/stkn/mac/xcode/teletone.plist
      - copied unchanged from r2217, /freeswitch/trunk/mac/xcode/teletone.plist
   freeswitch/branches/stkn/w32/vsnet/Tools/libsndfile/
      - copied from r2217, /freeswitch/trunk/w32/vsnet/Tools/libsndfile/
   freeswitch/branches/stkn/w32/vsnet/Tools/libsndfile/config.h
      - copied unchanged from r2217, /freeswitch/trunk/w32/vsnet/Tools/libsndfile/config.h
   freeswitch/branches/stkn/w32/vsnet/Tools/libsndfile/libsndfile.vcproj
      - copied unchanged from r2217, /freeswitch/trunk/w32/vsnet/Tools/libsndfile/libsndfile.vcproj
   freeswitch/branches/stkn/w32/vsnet/Tools/libsndfile/sndfile.h
      - copied unchanged from r2217, /freeswitch/trunk/w32/vsnet/Tools/libsndfile/sndfile.h
Removed:
   freeswitch/branches/stkn/libs/MD5
   freeswitch/branches/stkn/mac/xcode/libs/
Modified:
   freeswitch/branches/stkn/Makefile.am
   freeswitch/branches/stkn/Makefile.in
   freeswitch/branches/stkn/conf/freeswitch.xml
   freeswitch/branches/stkn/scripts/socket/FreeSWITCH/Client.pm
   freeswitch/branches/stkn/scripts/socket/fs.pl
   freeswitch/branches/stkn/src/include/switch.h
   freeswitch/branches/stkn/src/include/switch_apr.h
   freeswitch/branches/stkn/src/include/switch_core.h
   freeswitch/branches/stkn/src/include/switch_loadable_module.h
   freeswitch/branches/stkn/src/include/switch_module_interfaces.h
   freeswitch/branches/stkn/src/include/switch_types.h
   freeswitch/branches/stkn/src/include/switch_utils.h
   freeswitch/branches/stkn/src/mod/applications/mod_commands/mod_commands.c
   freeswitch/branches/stkn/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/branches/stkn/src/mod/applications/mod_dptools/mod_dptools.c
   freeswitch/branches/stkn/src/mod/codecs/mod_g711/mod_g711.c
   freeswitch/branches/stkn/src/mod/codecs/mod_l16/mod_l16.c
   freeswitch/branches/stkn/src/mod/dialplans/mod_dialplan_xml/Makefile
   freeswitch/branches/stkn/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
   freeswitch/branches/stkn/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/Makefile
   freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/mod_exosip.c
   freeswitch/branches/stkn/src/mod/endpoints/mod_portaudio/mod_portaudio.c
   freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/Makefile
   freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/README
   freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/basecdr.cpp
   freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp
   freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/mysqlcdr.h
   freeswitch/branches/stkn/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
   freeswitch/branches/stkn/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c
   freeswitch/branches/stkn/src/mod/formats/mod_sndfile/Makefile
   freeswitch/branches/stkn/src/mod/formats/mod_sndfile/mod_sndfile.c
   freeswitch/branches/stkn/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
   freeswitch/branches/stkn/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
   freeswitch/branches/stkn/src/switch_console.c
   freeswitch/branches/stkn/src/switch_core.c
   freeswitch/branches/stkn/src/switch_event.c
   freeswitch/branches/stkn/src/switch_ivr.c
   freeswitch/branches/stkn/src/switch_loadable_module.c
   freeswitch/branches/stkn/src/switch_utils.c
   freeswitch/branches/stkn/w32/vsnet/Freeswitch.sln
   freeswitch/branches/stkn/w32/vsnet/GetLibs.vbs
   freeswitch/branches/stkn/w32/vsnet/Tools/   (props changed)

Log:
Merge changes from trunk

Modified: freeswitch/branches/stkn/Makefile.am
==============================================================================
--- freeswitch/branches/stkn/Makefile.am	(original)
+++ freeswitch/branches/stkn/Makefile.am	Tue Aug  1 13:17:53 2006
@@ -140,7 +140,7 @@
 lib_LTLIBRARIES		= libfreeswitch.la
 libfreeswitch_la_CFLAGS	= $(AM_CFLAGS) -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -std=c99 
 libfreeswitch_la_LDFLAGS	= -version-info 1:0:0
-libfreeswitch_la_LIBADD  = -lteletone -lresample -lsrtp -lsqlite3 -lspeakup
+libfreeswitch_la_LIBADD  = -lteletone -lresample -lsrtp -lsqlite3 -lspeakup -lpcre
 nodist_libfreeswitch_la_SOURCES = src/include/switch_version.h
 
 bin_PROGRAMS =	freeswitch
@@ -174,13 +174,14 @@
 	@./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)
+	./build/buildlib.sh . install sqlite-3.3.6.tar.gz --prefix=$(PREFIX) --disable-tcl --enable-threadsafe
+	./build/buildlib.sh . install apr-1.2.7.tar.gz --prefix=$(PREFIX)
+	./build/buildlib.sh . install apr-util-1.2.7.tar.gz --with-apr=../apr-1.2.7 --prefix=$(PREFIX)
 	./build/buildlib.sh . libresample-0.1.3.tgz --prefix=$(PREFIX)
 	./build/buildlib.sh . install libteletone --prefix=$(PREFIX)
 	./build/buildlib.sh . install srtp --prefix=$(PREFIX)
 	./build/buildlib.sh . install libspeakup --prefix=$(PREFIX)
+	./build/buildlib.sh . install pcre-6.4.tar.gz --prefix=$(PREFIX)
 	rm build/freeswitch.env
 
 

Modified: freeswitch/branches/stkn/Makefile.in
==============================================================================
--- freeswitch/branches/stkn/Makefile.in	(original)
+++ freeswitch/branches/stkn/Makefile.in	Tue Aug  1 13:17:53 2006
@@ -356,7 +356,7 @@
 lib_LTLIBRARIES = libfreeswitch.la
 libfreeswitch_la_CFLAGS = $(AM_CFLAGS) -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -std=c99 
 libfreeswitch_la_LDFLAGS = -version-info 1:0:0
-libfreeswitch_la_LIBADD = -lteletone -lresample -lsrtp -lsqlite3 -lspeakup
+libfreeswitch_la_LIBADD = -lteletone -lresample -lsrtp -lsqlite3 -lspeakup -lpcre
 nodist_libfreeswitch_la_SOURCES = src/include/switch_version.h
 bin_SCRIPTS = scripts/fsxs
 freeswitch_SOURCES = src/switch.c\
@@ -1104,13 +1104,14 @@
 	@./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)
+	./build/buildlib.sh . install sqlite-3.3.6.tar.gz --prefix=$(PREFIX) --disable-tcl --enable-threadsafe
+	./build/buildlib.sh . install apr-1.2.7.tar.gz --prefix=$(PREFIX)
+	./build/buildlib.sh . install apr-util-1.2.7.tar.gz --with-apr=../apr-1.2.7 --prefix=$(PREFIX)
 	./build/buildlib.sh . libresample-0.1.3.tgz --prefix=$(PREFIX)
 	./build/buildlib.sh . install libteletone --prefix=$(PREFIX)
 	./build/buildlib.sh . install srtp --prefix=$(PREFIX)
 	./build/buildlib.sh . install libspeakup --prefix=$(PREFIX)
+	./build/buildlib.sh . install pcre-6.4.tar.gz --prefix=$(PREFIX)
 	rm build/freeswitch.env
 
 modules: $(NAME)

Modified: freeswitch/branches/stkn/conf/freeswitch.xml
==============================================================================
--- freeswitch/branches/stkn/conf/freeswitch.xml	(original)
+++ freeswitch/branches/stkn/conf/freeswitch.xml	Tue Aug  1 13:17:53 2006
@@ -368,7 +368,7 @@
     <!-- *NOTE* The special context name 'any' will match any context -->
     <context name="default">
       <extension name="tollfree">
-        <condition field="destination_number" expression="^(18[0{2}8{2}7{2}6{2}]\d{7})">
+        <condition field="destination_number" expression="^(18(0{2}|8{2}|7{2}|6{2})\d{7})$">
           <action application="bridge" data="exosip/$1-freeswitch at voip.trxtel.com"/>
         </condition>
       </extension>

Modified: freeswitch/branches/stkn/scripts/socket/FreeSWITCH/Client.pm
==============================================================================
--- freeswitch/branches/stkn/scripts/socket/FreeSWITCH/Client.pm	(original)
+++ freeswitch/branches/stkn/scripts/socket/FreeSWITCH/Client.pm	Tue Aug  1 13:17:53 2006
@@ -89,7 +89,7 @@
   my ($self,$data) = @_;
   my $s = $self->{_sock};
 
-  print $s $data;
+  print $s $data ;
 }
 
 sub cmd($$$) {
@@ -97,12 +97,26 @@
   my $cmd = shift;
   my $to = shift;
 
-  $self->output($cmd);
+  $self->output($cmd->{command});
+  foreach(keys %{$cmd}) {
+    next if ($_ eq "command");
+    $self->output($cmd->{$_});
+  }
+  $self->output("\n\n");
+
   my $h = $self->readhash($to);
 
   $h;
 }
 
+sub disconnect($) {
+  my $self = shift;
+  $self->{_sock}->shutdown(2);
+  $self->{_sock}->close();
+  undef $self->{_sock};
+  delete $self->{_sock};
+}
+
 sub connect($) {
   my $self = shift;
 
@@ -120,8 +134,7 @@
 
   if ($h->{"content-type"} eq "auth/request") {
     my $pass = $self->{"_password"};
-    $self->output("auth $pass");
-    $h = $self->readhash(undef);
+    $h = $self->cmd({command => "auth $pass"});
   }
 
   if ($h->{'reply-text'} =~ "OK") {

Modified: freeswitch/branches/stkn/scripts/socket/fs.pl
==============================================================================
--- freeswitch/branches/stkn/scripts/socket/fs.pl	(original)
+++ freeswitch/branches/stkn/scripts/socket/fs.pl	Tue Aug  1 13:17:53 2006
@@ -11,21 +11,29 @@
 
 my $log = shift;
 
+$SIG{CHLD} = sub {$fs->disconnect(); die "done"};
+
 if ($log) {
   $pid = fork;
   if (!$pid) {
     my $fs2 = init FreeSWITCH::Client {-password => $password} or die "Error $@";
-    $fs2->cmd("log $log");
+    
+
+    $fs2->cmd({ command => "log $log" });
     while (1) {
       my $reply = $fs2->readhash(undef);
-      
+      if ($reply->{socketerror}) {
+	die "socket error";
+      }
       if ($reply->{body}) {
 	print $reply->{body} . "\n";
       } elsif ($reply->{'reply-text'}) {
 	print $reply->{'reply-text'} . "\n";
       }
     }
+    exit;
   }
+
 }
 
 
@@ -34,8 +42,11 @@
   my $reply;
 
   if ($_) {
-    my $reply = $fs->cmd("api $_");
-      
+    my $reply = $fs->cmd({command => "api $_"});
+    if ($reply->{socketerror}) {
+      $fs2->disconnect();
+      die "socket error";
+    }
     if ($reply->{body}) {
       print $reply->{body};
     } elsif ($reply->{'reply-text'}) {

Modified: freeswitch/branches/stkn/src/include/switch.h
==============================================================================
--- freeswitch/branches/stkn/src/include/switch.h	(original)
+++ freeswitch/branches/stkn/src/include/switch.h	Tue Aug  1 13:17:53 2006
@@ -73,6 +73,7 @@
 #include <switch_stun.h>
 #include <switch_log.h>
 #include <switch_xml.h>
+#include <pcre.h>
 
 
 /** \mainpage FreeSWITCH

Modified: freeswitch/branches/stkn/src/include/switch_apr.h
==============================================================================
--- freeswitch/branches/stkn/src/include/switch_apr.h	(original)
+++ freeswitch/branches/stkn/src/include/switch_apr.h	Tue Aug  1 13:17:53 2006
@@ -656,7 +656,7 @@
 									apr_int32_t flags, 
 									char *buf, 
 									apr_size_t *len);)
-//#define switch_socket_recvfrom apr_socket_recvfrom
+#define switch_socket_recvfrom apr_socket_recvfrom
 
 /**
  * Send a file from an open file descriptor to a socket, along with 

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	Tue Aug  1 13:17:53 2006
@@ -206,7 +206,7 @@
   \return a void pointer to the allocated memory
   \note this memory never goes out of scope until the core is destroyed
 */
-SWITCH_DECLARE(void *) switch_core_permenant_alloc(switch_size_t memory);
+SWITCH_DECLARE(void *) switch_core_permanent_alloc(switch_size_t memory);
 
 /*! 
   \brief Allocate memory directly from a memory pool
@@ -226,11 +226,11 @@
 SWITCH_DECLARE(void *) switch_core_session_alloc(switch_core_session_t *session, switch_size_t memory);
 
 /*! 
-  \brief Copy a string using permenant memory allocation
+  \brief Copy a string using permanent memory allocation
   \param todup the string to duplicate
   \return a pointer to the newly duplicated string
 */
-SWITCH_DECLARE(char *) switch_core_permenant_strdup(char *todup);
+SWITCH_DECLARE(char *) switch_core_permanent_strdup(char *todup);
 
 /*! 
   \brief Copy a string using memory allocation from a session's pool
@@ -865,6 +865,25 @@
   \return SWITCH_STATUS_SUCCESS with cur_pos adjusted to new position
 */
 SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh, unsigned int *cur_pos, int64_t samples, int whence);
+
+/*! 
+  \brief Set metadata to the desired string
+  \param fh the file handle to set data to
+  \param col the enum of the col name
+  \param string the string to add
+  \return SWITCH_STATUS_SUCCESS with cur_pos adjusted to new position
+*/
+SWITCH_DECLARE(switch_status_t) switch_core_file_set_string(switch_file_handle_t *fh, switch_audio_col_t col, const char *string);
+
+/*! 
+  \brief get metadata of the desired string
+  \param fh the file handle to get data from
+  \param col the enum of the col name
+  \param string pointer to the string to fetch
+  \return SWITCH_STATUS_SUCCESS with cur_pos adjusted to new position
+*/
+SWITCH_DECLARE(switch_status_t) switch_core_file_get_string(switch_file_handle_t *fh, switch_audio_col_t col, const char **string);
+
 
 /*! 
   \brief Close an open file handle

Modified: freeswitch/branches/stkn/src/include/switch_loadable_module.h
==============================================================================
--- freeswitch/branches/stkn/src/include/switch_loadable_module.h	(original)
+++ freeswitch/branches/stkn/src/include/switch_loadable_module.h	Tue Aug  1 13:17:53 2006
@@ -191,10 +191,11 @@
   \brief Execute a registered API command
   \param cmd the name of the API command to execute
   \param arg the optional arguement to the command
+  \param session an optional session
   \param stream stream for output
   \return the status returned by the API call
 */
-SWITCH_DECLARE(switch_status_t) switch_api_execute(char *cmd, char *arg, switch_stream_handle_t *stream);
+SWITCH_DECLARE(switch_status_t) switch_api_execute(char *cmd, char *arg, switch_core_session_t *session, switch_stream_handle_t *stream);
 
 
 

Modified: freeswitch/branches/stkn/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/branches/stkn/src/include/switch_module_interfaces.h	(original)
+++ freeswitch/branches/stkn/src/include/switch_module_interfaces.h	Tue Aug  1 13:17:53 2006
@@ -266,6 +266,10 @@
 	switch_status_t (*file_write)(switch_file_handle_t *, void *data, switch_size_t *len);
 	/*! function to seek to a certian position in the file */
 	switch_status_t (*file_seek)(switch_file_handle_t *, unsigned int *cur_pos, int64_t samples, int whence);
+	/*! function to set meta data */
+	switch_status_t (*file_set_string)(switch_file_handle_t *fh, switch_audio_col_t col, const char *string);
+	/*! function to get meta data */
+	switch_status_t (*file_get_string)(switch_file_handle_t *fh, switch_audio_col_t col, const char **string);
 	/*! list of supported file extensions */
 	char **extens;
 	const struct switch_file_interface *next;

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	Tue Aug  1 13:17:53 2006
@@ -94,7 +94,17 @@
 #define SWITCH_FALSE 0
 #define SWITCH_CORE_QUEUE_LEN 100000
 
+
 typedef enum {
+	SWITCH_AUDIO_COL_STR_TITLE                    = 0x01,
+	SWITCH_AUDIO_COL_STR_COPYRIGHT                = 0x02,
+	SWITCH_AUDIO_COL_STR_SOFTWARE                 = 0x03,
+	SWITCH_AUDIO_COL_STR_ARTIST                   = 0x04,
+	SWITCH_AUDIO_COL_STR_COMMENT                  = 0x05,
+	SWITCH_AUDIO_COL_STR_DATE                     = 0x06
+} switch_audio_col_t;
+
+typedef enum {
 	SWITCH_XML_SECTION_RESULT = 0,
 	SWITCH_XML_SECTION_CONFIG = (1 << 0),
 	SWITCH_XML_SECTION_DIRECTORY = (1 << 1),
@@ -543,6 +553,7 @@
 	SWITCH_EVENT_SESSION_CRASH		- Session Crashed
 	SWITCH_EVENT_MODULE_LOAD		- Module was loaded
 	SWITCH_EVENT_DTMF				- DTMF was sent
+	SWITCH_EVENT_MESSAGE			- A Basic Message
     SWITCH_EVENT_ALL				- All events at once
 </pre>
 
@@ -570,6 +581,7 @@
 	SWITCH_EVENT_SESSION_CRASH,
 	SWITCH_EVENT_MODULE_LOAD,
 	SWITCH_EVENT_DTMF,
+	SWITCH_EVENT_MESSAGE,
 	SWITCH_EVENT_ALL
 } switch_event_types_t;
 
@@ -695,7 +707,7 @@
 typedef switch_status_t (*switch_send_dtmf_hook_t)(switch_core_session_t *, char *);
 typedef struct switch_stream_handle switch_stream_handle_t;
 typedef switch_status_t (*switch_stream_handle_write_function_t)(switch_stream_handle_t *handle, char *fmt, ...);
-typedef switch_status_t (*switch_api_function_t)(char *in, switch_stream_handle_t *stream);
+typedef switch_status_t (*switch_api_function_t)(char *in, switch_core_session_t *session, switch_stream_handle_t *stream);
 typedef switch_status_t (*switch_input_callback_function_t)(switch_core_session_t *session,
 															void *input,
 															switch_input_type_t input_type,

Modified: freeswitch/branches/stkn/src/include/switch_utils.h
==============================================================================
--- freeswitch/branches/stkn/src/include/switch_utils.h	(original)
+++ freeswitch/branches/stkn/src/include/switch_utils.h	Tue Aug  1 13:17:53 2006
@@ -61,9 +61,6 @@
 !strcasecmp(expr, "true") ||\
 atoi(expr))) ? SWITCH_TRUE : SWITCH_FALSE
 
-
-SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, int32_t flags, char *buf, switch_size_t *len);
-
 /*!
   \brief Return a printable name of a switch_priority_t
   \param priority the priority to get the name of

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	Tue Aug  1 13:17:53 2006
@@ -35,10 +35,15 @@
 
 static const char modname[] = "mod_commands";
 
-static switch_status_t status_function(char *cmd, switch_stream_handle_t *stream)
+static switch_status_t status_function(char *cmd, switch_core_session_t *session, switch_stream_handle_t *stream)
 {
 	uint8_t html = 0;
 	switch_core_time_duration_t duration;
+
+	if (session) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	switch_core_measure_time(switch_core_uptime(), &duration);
 
 	if (cmd && strstr(cmd, "html")) {
@@ -75,19 +80,27 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t load_function(char *mod, switch_stream_handle_t *stream)
+static switch_status_t load_function(char *mod, switch_core_session_t *session, switch_stream_handle_t *stream)
 {
+
+	if (session) {
+		return SWITCH_STATUS_FALSE;
+	}
 	switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) mod);
-	 stream->write_function(stream, "OK\n");
+	stream->write_function(stream, "OK\n");
 	return SWITCH_STATUS_SUCCESS;
 }
 
 
-static switch_status_t reload_function(char *mod, switch_stream_handle_t *stream)
+static switch_status_t reload_function(char *mod, switch_core_session_t *session, switch_stream_handle_t *stream)
 {
 	const char *err;
 	switch_xml_t xml_root;
 
+	if (session) {
+		return SWITCH_STATUS_FALSE;
+	}
+	
 	if ((xml_root = switch_xml_open_root(1, &err))) {
 		switch_xml_free(xml_root);
 	}
@@ -96,10 +109,14 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t kill_function(char *dest, switch_stream_handle_t *stream)
+static switch_status_t kill_function(char *dest, switch_core_session_t *isession, switch_stream_handle_t *stream)
 {
 	switch_core_session_t *session = NULL;
 
+	if (isession) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if ((session = switch_core_session_locate(dest))) {
 		switch_channel_t *channel = switch_core_session_get_channel(session);
 		switch_core_session_kill_channel(session, SWITCH_SIG_KILL);
@@ -114,11 +131,15 @@
 }
 
 
-static switch_status_t transfer_function(char *cmd, switch_stream_handle_t *stream)
+static switch_status_t transfer_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream)
 {
 	switch_core_session_t *session = NULL;
 	char *argv[4] = {0};
 	int argc = 0;
+
+	if (isession) {
+		return SWITCH_STATUS_FALSE;
+	}
 	
 	argc = switch_separate_string(cmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 
@@ -151,11 +172,15 @@
 
 
 
-static switch_status_t pause_function(char *cmd, switch_stream_handle_t *stream)
+static switch_status_t pause_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream)
 {
 	switch_core_session_t *session = NULL;
 	char *argv[4] = {0};
 	int argc = 0;
+
+	if (isession) {
+		return SWITCH_STATUS_FALSE;
+	}
 	
 	argc = switch_separate_string(cmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 
@@ -230,12 +255,16 @@
 	return 0;
 }
 
-static switch_status_t show_function(char *cmd, switch_stream_handle_t *stream)
+static switch_status_t show_function(char *cmd, switch_core_session_t *session, switch_stream_handle_t *stream)
 {
 	char sql[1024];
 	char *errmsg;
 	switch_core_db_t *db = switch_core_db_handle();
 	struct holder holder = {0};
+
+	if (session) {
+		return SWITCH_STATUS_FALSE;
+	}
 
 	if (stream->event) {
         holder.http = switch_event_get_header(stream->event, "http-host");

Modified: freeswitch/branches/stkn/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/branches/stkn/src/mod/applications/mod_conference/mod_conference.c	Tue Aug  1 13:17:53 2006
@@ -188,7 +188,7 @@
 static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin);
 static switch_status_t conference_say(conference_obj_t *conference, char *text, uint32_t leadin);
 static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim);
-static switch_status_t conf_function(char *buf, switch_stream_handle_t *stream);
+static switch_status_t conf_function(char *buf, switch_core_session_t *session, switch_stream_handle_t *stream);
 static switch_status_t audio_bridge_on_ring(switch_core_session_t *session);
 static switch_status_t conference_outcall(conference_obj_t *conference, switch_core_session_t *session, char *bridgeto, char *cid_name, char *cid_num);
 static void conference_function(switch_core_session_t *session, char *data);
@@ -1232,6 +1232,7 @@
 static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim)
 {
 	conference_member_t *member = NULL;
+
 	switch_mutex_lock(conference->member_mutex);
 
 	for (member = conference->members; member; member = member->next) {
@@ -1264,7 +1265,7 @@
 }
 
 /* API Interface Function */
-static switch_status_t conf_function(char *buf, switch_stream_handle_t *stream)
+static switch_status_t conf_function(char *buf, switch_core_session_t *session, switch_stream_handle_t *stream)
 {
 	char *lbuf = NULL;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -1292,6 +1293,10 @@
 		"conference <confname> dial <endpoint_module_name>/<destination>\n"
 		"conference <confname> transfer <member_id> <conference_name>\n"
 		;
+
+	if (session) {
+		return SWITCH_STATUS_FALSE;
+	}
 
 	if (stream->event) {
 		http = switch_event_get_header(stream->event, "http-host");

Modified: freeswitch/branches/stkn/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/applications/mod_dptools/mod_dptools.c	(original)
+++ freeswitch/branches/stkn/src/mod/applications/mod_dptools/mod_dptools.c	Tue Aug  1 13:17:53 2006
@@ -71,16 +71,66 @@
 	}
 }
 
+static void strftime_function(switch_core_session_t *session, char *data)
+{
+	char *argv[2];
+	int argc;
+	char *lbuf;
+
+	if ((lbuf = switch_core_session_strdup(session, data))&&(argc = switch_separate_string(lbuf, '=', argv, (sizeof(argv) / sizeof(argv[0])))) > 1) {
+		switch_size_t retsize;
+		switch_time_exp_t tm;
+		char date[80] = "";
+		switch_channel_t *channel;
+
+		channel = switch_core_session_get_channel(session);
+		assert(channel != NULL);
+
+		switch_time_exp_lt(&tm, switch_time_now());
+		switch_strftime(date, &retsize, sizeof(date), argv[1], &tm);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", argv[0], date);
+		switch_channel_set_variable(channel, argv[0], date);
+	}
+}
+
+static switch_status_t strftime_api_function(char *fmt, switch_core_session_t *session, switch_stream_handle_t *stream)
+{
+	switch_size_t retsize;
+	switch_time_exp_t tm;
+	char date[80] = "";
+	
+	switch_time_exp_lt(&tm, switch_time_now());
+	switch_strftime(date, &retsize, sizeof(date), fmt, &tm);
+	stream->write_function(stream, date);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_api_interface_t dptools_api_interface = {
+	/*.interface_name */ "strftime",
+	/*.desc */ "strftime",
+	/*.function */ strftime_api_function,
+	/*.next */ NULL
+};
+
 static const switch_application_interface_t set_application_interface = {
 	/*.interface_name */ "set",
 	/*.application_function */ set_function
 };
 
+static const switch_application_interface_t strftime_application_interface = {
+	/*.interface_name */ "strftime",
+	/*.application_function */ strftime_function,
+	NULL,NULL,NULL,
+	&set_application_interface
+
+};
+
 static const switch_application_interface_t sleep_application_interface = {
 	/*.interface_name */ "sleep",
 	/*.application_function */ sleep_function,
 	NULL,NULL,NULL,
-	&set_application_interface
+	&strftime_application_interface
 };
 
 static const switch_loadable_module_interface_t mod_dptools_module_interface = {
@@ -89,7 +139,8 @@
 	/*.timer_interface = */ NULL,
 	/*.dialplan_interface = */ NULL,
 	/*.codec_interface = */ NULL,
-	/*.application_interface */ &sleep_application_interface
+	/*.application_interface */ &sleep_application_interface,
+	/*.api_interface */ &dptools_api_interface
 };
 
 SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)

Modified: freeswitch/branches/stkn/src/mod/codecs/mod_g711/mod_g711.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/codecs/mod_g711/mod_g711.c	(original)
+++ freeswitch/branches/stkn/src/mod/codecs/mod_g711/mod_g711.c	Tue Aug  1 13:17:53 2006
@@ -33,7 +33,7 @@
 #include "g711.h"
 
 
-static const char modname[] = "mod_g711codec";
+static const char modname[] = "mod_g711";
 
 
 static switch_status_t switch_g711u_init(switch_codec_t *codec, switch_codec_flag_t flags,

Modified: freeswitch/branches/stkn/src/mod/codecs/mod_l16/mod_l16.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/codecs/mod_l16/mod_l16.c	(original)
+++ freeswitch/branches/stkn/src/mod/codecs/mod_l16/mod_l16.c	Tue Aug  1 13:17:53 2006
@@ -31,7 +31,7 @@
  */
 #include <switch.h>
 
-static const char modname[] = "mod_rawaudio";
+static const char modname[] = "mod_l16";
 
 
 static switch_status_t switch_raw_init(switch_codec_t *codec, switch_codec_flag_t flags,

Modified: freeswitch/branches/stkn/src/mod/dialplans/mod_dialplan_xml/Makefile
==============================================================================
--- freeswitch/branches/stkn/src/mod/dialplans/mod_dialplan_xml/Makefile	(original)
+++ freeswitch/branches/stkn/src/mod/dialplans/mod_dialplan_xml/Makefile	Tue Aug  1 13:17:53 2006
@@ -1,9 +1,8 @@
-LDFLAGS += -lpcre -L/usr/local/lib
+LDFLAGS += -L/usr/local/lib
 
 all:	depends $(MODNAME).$(DYNAMIC_LIB_EXTEN)
 
 depends:
-	MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install pcre-6.4.tar.gz --prefix=$(PREFIX)
 
 $(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).c
 	$(CC) $(CFLAGS) -fPIC -c $(MODNAME).c -o $(MODNAME).o 

Modified: freeswitch/branches/stkn/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	(original)
+++ freeswitch/branches/stkn/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	Tue Aug  1 13:17:53 2006
@@ -33,8 +33,8 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <pcre.h>
 
+
 static const char modname[] = "mod_dialplan_xml";
 
 #define cleanre(re)	if (re) {\
@@ -122,6 +122,13 @@
 	substituted[y++] = '\0';
 }
 
+typedef enum {
+	BREAK_ON_TRUE,
+	BREAK_ON_FALSE,
+	BREAK_ALWAYS,
+	BREAK_NEVER
+} break_t;
+
 static int parse_exten(switch_core_session_t *session, switch_xml_t xexten, switch_caller_extension_t **extension)
 {
 	switch_xml_t xcond, xaction;
@@ -135,17 +142,50 @@
 
 	for (xcond = switch_xml_child(xexten, "condition"); xcond; xcond = xcond->next) {
 		char *field = NULL;
+		char *do_break_a = NULL;
 		char *expression = NULL;
 		char *field_data = NULL;
+		char retbuf[1024] = "";
 		pcre *re = NULL;
 		int ovector[30];
-
+		break_t do_break_i = BREAK_ON_FALSE;
+		
 		field = (char *) switch_xml_attr(xcond, "field");
+
 		expression = (char *) switch_xml_attr_soft(xcond, "expression");
-		
+
+		if ((do_break_a = (char *) switch_xml_attr(xcond, "break"))) {
+			if (!strcasecmp(do_break_a, "on-true")) {
+				do_break_i = BREAK_ON_TRUE;
+			} else if (!strcasecmp(do_break_a, "on-false")) {
+				do_break_i = BREAK_ON_FALSE;
+			} else if (!strcasecmp(do_break_a, "always")) {
+				do_break_i = BREAK_ALWAYS;
+			} else if (!strcasecmp(do_break_a, "never")) {
+				do_break_i = BREAK_NEVER;
+			}
+		}
+
 		if (field) {
 			if (*field == '$') {
 				field_data = switch_channel_get_variable(channel, field + 1);
+			} else if (*field == '%') {
+				switch_stream_handle_t stream = {0};
+				char *cmd = switch_core_session_strdup(session, field + 1);
+				char *arg;
+				
+				if (cmd) {
+					if ((arg = strchr(cmd, ' '))) {
+						*arg++ = '\0';
+					}
+					stream.data = retbuf;
+					stream.end = stream.data;
+					stream.data_size = sizeof(retbuf);
+					stream.write_function = switch_console_stream_write;
+					if (switch_api_execute(cmd, arg, session, &stream) == SWITCH_STATUS_SUCCESS) {
+						field_data = retbuf;
+					}
+				}
 			} else {
 				field_data = switch_caller_get_field_by_name(caller_profile, field);
 			}
@@ -155,7 +195,27 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "test conditions %s(%s) =~ /%s/\n", field, field_data, expression);
 			if (!(proceed = perform_regex(channel, field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Regex mismatch\n");
-				break;
+
+				for (xaction = switch_xml_child(xcond, "anti-action"); xaction; xaction = xaction->next) {
+					char *application = (char*) switch_xml_attr_soft(xaction, "application");
+					char *data = (char *) switch_xml_attr_soft(xaction, "data");
+
+					if (!*extension) {
+						if ((*extension =
+							 switch_caller_extension_new(session, exten_name, caller_profile->destination_number)) == 0) {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
+							return 0;
+						}
+					}
+					
+					switch_caller_extension_add_application(session, *extension, application, data);
+				}
+
+				if (do_break_i == BREAK_ON_FALSE || do_break_i == BREAK_ALWAYS) {
+					break;
+				} else {
+					continue;
+				}
 			}
 			assert(re != NULL);
 		}
@@ -186,6 +246,10 @@
 		}
 
 		cleanre(re);
+
+		if (do_break_i == BREAK_ON_TRUE || do_break_i == BREAK_ALWAYS) {
+			break;
+		}
 	}
 	return proceed;
 }

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Tue Aug  1 13:17:53 2006
@@ -151,8 +151,8 @@
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string);
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, globals.codec_rates_string);
 
-static switch_status_t dl_login(char *arg, switch_stream_handle_t *stream);
-static switch_status_t dl_logout(char *profile_name, switch_stream_handle_t *stream);
+static switch_status_t dl_login(char *arg, switch_core_session_t *session, switch_stream_handle_t *stream);
+static switch_status_t dl_logout(char *profile_name, switch_core_session_t *session, switch_stream_handle_t *stream);
 static switch_status_t channel_on_init(switch_core_session_t *session);
 static switch_status_t channel_on_hangup(switch_core_session_t *session);
 static switch_status_t channel_on_ring(switch_core_session_t *session);
@@ -1248,10 +1248,14 @@
 	}
 }
 
-static switch_status_t dl_logout(char *profile_name, switch_stream_handle_t *stream)
+static switch_status_t dl_logout(char *profile_name, switch_core_session_t *session, switch_stream_handle_t *stream)
 {
 	struct mdl_profile *profile;
 
+	if (session) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if (!profile_name) {
 		stream->write_function(stream, "NO PROFILE NAME SPECIFIED\n");
 		return SWITCH_STATUS_SUCCESS;
@@ -1267,13 +1271,17 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t dl_login(char *arg, switch_stream_handle_t *stream)
+static switch_status_t dl_login(char *arg, switch_core_session_t *session, switch_stream_handle_t *stream)
 {
 	char *argv[10] = {0};
 	int argc = 0;
 	char *var, *val, *myarg;
 	struct mdl_profile *profile = NULL;
 	int x;
+
+	if (session) {
+		return SWITCH_STATUS_FALSE;
+	}
 
 	if (switch_strlen_zero(arg)) {
 		stream->write_function(stream, "FAIL\n");

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/Makefile
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/Makefile	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/Makefile	Tue Aug  1 13:17:53 2006
@@ -2,7 +2,7 @@
 LDFLAGS += -leXosip2
 OBJS=osip_rfc3264.o
 ifeq ($(OSARCH),Darwin)
-	LINKER=g++
+	LINKER=$(CC)
 else
 	LINKER=$(CC)
 endif

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/mod_exosip.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/mod_exosip.c	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/mod_exosip.c	Tue Aug  1 13:17:53 2006
@@ -2095,7 +2095,7 @@
 	char *errmsg;
 
 	switch_mutex_lock(globals.reg_mutex);
-	snprintf(sql, sizeof(sql), "select url from sip_registrations where expires > 0 and expires < %ld", now);	
+	snprintf(sql, sizeof(sql), "select url from sip_registrations where expires > 0 and expires < %ld", (long) now);	
 	switch_core_db_exec(globals.db, sql, del_callback, NULL, &errmsg);
 
 	if (errmsg) {
@@ -2104,7 +2104,7 @@
 		errmsg = NULL;
 	}
 	
-	snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and expires < %ld", now);
+	snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and expires < %ld", (long) now);
 	switch_core_db_persistant_execute(globals.db, sql, 1);
 	switch_mutex_unlock(globals.reg_mutex);
 }

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_portaudio/mod_portaudio.c	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_portaudio/mod_portaudio.c	Tue Aug  1 13:17:53 2006
@@ -116,11 +116,11 @@
 	 static int dump_info(void);
 	 static switch_status_t load_config(void);
 	 static int get_dev_by_name(char *name, int in);
-	 static switch_status_t place_call(char *dest, switch_stream_handle_t *stream);
-	 static switch_status_t hup_call(char *callid, switch_stream_handle_t *stream);
-	 static switch_status_t call_info(char *callid, switch_stream_handle_t *stream);
-	 static switch_status_t send_dtmf(char *callid, switch_stream_handle_t *stream);
-	 static switch_status_t answer_call(char *callid, switch_stream_handle_t *stream);
+	 static switch_status_t place_call(char *dest, switch_core_session_t *session, switch_stream_handle_t *stream);
+	 static switch_status_t hup_call(char *callid, switch_core_session_t *session, switch_stream_handle_t *stream);
+	 static switch_status_t call_info(char *callid, switch_core_session_t *session, switch_stream_handle_t *stream);
+	 static switch_status_t send_dtmf(char *callid, switch_core_session_t *session, switch_stream_handle_t *stream);
+	 static switch_status_t answer_call(char *callid, switch_core_session_t *session, switch_stream_handle_t *stream);
 
 /* 
    State methods they get called when the state changes to the specific state 
@@ -822,11 +822,15 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-static switch_status_t place_call(char *dest, switch_stream_handle_t *stream)
+static switch_status_t place_call(char *dest, switch_core_session_t *isession, switch_stream_handle_t *stream)
 {
 	switch_core_session_t *session;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
+	if (isession) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if (!dest) {
 		stream->write_function(stream, "Usage: pacall <exten>");
 		return SWITCH_STATUS_FALSE;
@@ -875,12 +879,16 @@
 }
 
 
-static switch_status_t hup_call(char *callid, switch_stream_handle_t *stream)
+static switch_status_t hup_call(char *callid, switch_core_session_t *isession, switch_stream_handle_t *stream)
 {
 	struct private_object *tech_pvt;
 	switch_channel_t *channel = NULL;
 	char tmp[50];
 
+	if (isession) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if (callid && !strcasecmp(callid, "last")) {
 		snprintf(tmp, sizeof(tmp), "%d", globals.call_id - 1);
 		callid = tmp;
@@ -919,12 +927,16 @@
 }
 
 
-static switch_status_t send_dtmf(char *callid, switch_stream_handle_t *stream)
+static switch_status_t send_dtmf(char *callid, switch_core_session_t *session, switch_stream_handle_t *stream)
 {
 	struct private_object *tech_pvt = NULL;
 	switch_channel_t *channel = NULL;
 	char *dtmf;
 
+	if (session) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if ((dtmf = strchr(callid, ' ')) != 0) {
 		*dtmf++ = '\0';
 	} else {
@@ -943,11 +955,15 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t answer_call(char *callid, switch_stream_handle_t *stream)
+static switch_status_t answer_call(char *callid, switch_core_session_t *session, switch_stream_handle_t *stream)
 {
 	struct private_object *tech_pvt = NULL;
 	switch_channel_t *channel = NULL;
 
+	if (session) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if ((tech_pvt = switch_core_hash_find(globals.call_hash, callid)) != 0) {
 		channel = switch_core_session_get_channel(tech_pvt->session);
 		assert(channel != NULL);
@@ -975,11 +991,16 @@
 
 }
 
-static switch_status_t call_info(char *callid, switch_stream_handle_t *stream)
+static switch_status_t call_info(char *callid, switch_core_session_t *session, switch_stream_handle_t *stream)
 {
 	struct private_object *tech_pvt;
 	switch_hash_index_t *hi;
 	void *val;
+
+	if (session) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if (!callid || !strcasecmp(callid, "all")) {
 		for (hi = switch_hash_first(module_pool, globals.call_hash); hi; hi = switch_hash_next(hi)) {
 			switch_hash_this(hi, NULL, NULL, &val);

Modified: freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/Makefile
==============================================================================
--- freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/Makefile	(original)
+++ freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/Makefile	Tue Aug  1 13:17:53 2006
@@ -1,7 +1,7 @@
 LDFLAGS += -I/usr/include/mysql -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lssl -lcrypto
 CFLAGS += -I/usr/include/mysql -L/usr/lib64/mysql 
 CPPCC = g++
-OBJS=cdrcontainer.o basecdr.o baseregistry.o mysqlcdr.o pddcdr.o
+OBJS=cdrcontainer.o basecdr.o baseregistry.o mysqlcdr.o pddcdr.o csvcdr.o
 
 
 all:	depends $(OBJS) $(MODNAME).$(DYNAMIC_LIB_EXTEN)

Modified: freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/README
==============================================================================
--- freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/README	(original)
+++ freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/README	Tue Aug  1 13:17:53 2006
@@ -49,7 +49,7 @@
 
 Class:		MysqlCDR, located in mysqlcdr.h and mysqlcdr.cpp
 Description:	This class logs the call detail record to a MySQL 4.1.x or greater database using prepared
-		statements.  This class is a little more complex than the prior two in that the fixed channel variables are treated as additional columns on the main freeswitchcdr database table for improved normalization of the database.  As such, you need to specify the format of each fixed channel variable as well.  If you do not specify, it will default to a varchar column type, and will not execute if the table schema does not match.  Therefore it is very important to make sure that any fixed channel variables you log exist as columns on the table.  The supplemental channel variables are stored in a separate table using a key / value pair linking to the callid of the call.
+		statements.  This class is a little more complex than the prior two in that the fixed channel variables are treated as additional columns on the main freeswitchcdr database table for improved normalization of the database.  As such, you need to specify the format of each fixed channel variable as well.  If you do not specify, it will default to a varchar column type, and will not execute if the table schema does not match.  Therefore it is very important to make sure that any fixed channel variables you log exist as columns on the table.  The supplemental channel variables are stored in a separate table using a key / value pair linking to the callid of the call.  Recommended to use at least one other logger in conjuction with this one just to be on the safe side, as failover handling of errors to write to the db are not yet implemented, and therefore there is a risk of data loss if the database connection is lost entirely (it will be limited to only those records created at the time of the loss of connection) or some other fatal error is encountered.
 Configuration:	Section: <mysqlcdr>
 		<param name="hostname" value=""/> value is the hostname or IP of the MySQL server (required)
 		<param name="username" value=""/> value is the username to connect to the MySQL server with (required)

Modified: freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/basecdr.cpp
==============================================================================
--- freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/basecdr.cpp	(original)
+++ freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/basecdr.cpp	Tue Aug  1 13:17:53 2006
@@ -59,6 +59,7 @@
 {
 	if(newchannel != 0)
 	{
+		errorstate = 0;
 		memset(clid,0,80);
 		memset(dialplan,0,80);
 		memset(myuuid,0,37);
@@ -84,9 +85,10 @@
 		if(newchannel->callerprofile->caller_id_name != 0)
 		{
 			strncpy(clid,newchannel->callerprofile->caller_id_name,strlen(newchannel->callerprofile->caller_id_name));
-			strncat(clid," ",1);
+			strncat(clid," <",2);
 			if(newchannel->callerprofile->caller_id_number != 0 )
 				strncat(clid,newchannel->callerprofile->caller_id_number,strlen(clid)+strlen(newchannel->callerprofile->caller_id_number));
+			strncat(clid,">",1);
 		}
 		
 		// Get the ANI information if it's set
@@ -100,9 +102,7 @@
 	
 		if(newchannel->callerprofile->network_addr != 0)
 			strncpy(network_addr,newchannel->callerprofile->network_addr,strlen(newchannel->callerprofile->network_addr));
-		
-		switch_console_printf(SWITCH_CHANNEL_LOG, "BaseCDR::BaseCDR(switch_mod_cdr_newchannel*) - Channel caller_profile loaded.\n");
-		
+				
 		originated = newchannel->originate;
 	
 		if(newchannel->originateprofile->uuid != 0)
@@ -146,8 +146,6 @@
 		hangupcause = switch_channel_get_cause(newchannel->channel);
 		hangupcause_text = switch_channel_cause2str(hangupcause);
 	
-		switch_console_printf(SWITCH_CHANNEL_LOG, "BaseCDR::BaseCDR(switch_mod_cdr_newchannel*) - Call state & length calculated.\n");
-		
 		if(newchannel->callerextension != 0)
 			if(newchannel->callerextension->last_application != 0)
 			{
@@ -158,8 +156,6 @@
 			}
 		
 		amaflags=0;
-		
-		switch_console_printf(SWITCH_CHANNEL_LOG, "BaseCDR::BaseCDR(switch_mod_cdr_newchannel*) - Processing completed.\n");
 	}
 }
 

Modified: freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp
==============================================================================
--- freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp	(original)
+++ freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp	Tue Aug  1 13:17:53 2006
@@ -83,10 +83,10 @@
 std::list<std::string> MysqlCDR::chanvars_supp_list;
 std::vector<switch_mod_cdr_sql_types_t> MysqlCDR::chanvars_fixed_types;
 bool MysqlCDR::activated = 0;
-char* MysqlCDR::sql_query = 0;
+char MysqlCDR::sql_query[1024] = "";
 std::string MysqlCDR::tmp_sql_query;
 char MysqlCDR::sql_query_chanvars[100] = "";
-MYSQL* MysqlCDR:: conn = 0;
+MYSQL* MysqlCDR::conn = 0;
 MYSQL_STMT* MysqlCDR::stmt=0;
 MYSQL_STMT* MysqlCDR::stmt_chanvars=0;
 char MysqlCDR::hostname[255] = "";
@@ -208,38 +208,38 @@
 			}
 			
 			tmp_sql_query.append(")");
-			
-			std::vector<char> tempfirstvector(tmp_sql_query.begin(), tmp_sql_query.end());
-			tempfirstvector.push_back('\0');
-			sql_query = &tempfirstvector[0];
 	
 			char tempsql_query_chanvars[] = "INSERT INTO chanvars (callid,varname,varvalue) VALUES(?,?,?)";
 			memset(sql_query_chanvars,0,100);
 			strncpy(sql_query_chanvars,tempsql_query_chanvars,strlen(tempsql_query_chanvars));
 
-			conn = mysql_init(NULL);
-			mysql_options(conn, MYSQL_READ_DEFAULT_FILE, "");
-			if(mysql_real_connect(conn,hostname,username,password,dbname,0,NULL,0) == NULL)
-			{
-				char *error1 = "Cannot connect to MySQL Server.  The error was: ";
-				const char *error2 = mysql_error(conn);
-				strncat(error1,error2,strlen(error2));
-				switch_console_printf(SWITCH_CHANNEL_LOG,error1);
-			}
-			else
-				connectionstate = 1;
+			strncpy(sql_query,tmp_sql_query.c_str(),tmp_sql_query.size());
+			connect_to_database();
+		}
+	}
+}
+
+void MysqlCDR::connect_to_database()
+{
+	conn = mysql_init(NULL);
+	mysql_options(conn, MYSQL_READ_DEFAULT_FILE, "");
+	if(mysql_real_connect(conn,hostname,username,password,dbname,0,NULL,0) == NULL)
+	{
+		const char *error1 = mysql_error(conn);
+		switch_console_printf(SWITCH_CHANNEL_LOG,"Cannot connect to MySQL Server.  The error was: %s\n",error1);
+	}
+	else
+		connectionstate = 1;
 	
-			mysql_autocommit(conn,0);
-			stmt = mysql_stmt_init(conn);
+	mysql_autocommit(conn,0);
+	stmt = mysql_stmt_init(conn);
 		
-			mysql_stmt_prepare(stmt,sql_query,(long unsigned int)strlen(sql_query));
+	mysql_stmt_prepare(stmt,sql_query,(long unsigned int)strlen(sql_query));
 		
-			if(logchanvars)
-			{
-				stmt_chanvars = mysql_stmt_init(conn);
-				mysql_stmt_prepare(stmt_chanvars,sql_query_chanvars,(long unsigned int)strlen(sql_query_chanvars));
-			}
-		}
+	if(logchanvars)
+	{
+		stmt_chanvars = mysql_stmt_init(conn);
+		mysql_stmt_prepare(stmt_chanvars,sql_query_chanvars,(long unsigned int)strlen(sql_query_chanvars));
 	}
 }
 
@@ -390,10 +390,8 @@
 					*x = 0;
 					bool* is_null = new bool;
 					*is_null = 0;
-					std::cout << "CDR_TINY: " << iItr->second << " and its size is " << iItr->second.size() << " bytes." << std::endl << std::endl;
 					if(iItr->second.size() > 0)
 					{
-						std::cout << "Converting iItr->second to type char." << std::endl;
 						std::istringstream istring(iItr->second);
 						istring >> *x;
 					}
@@ -433,75 +431,93 @@
 	bindmetemp = new MYSQL_BIND[bindme.size()];
 	copy(bindme.begin(), bindme.end(), bindmetemp);
 	
-	mysql_stmt_bind_param(stmt,bindmetemp);
-	int bah = mysql_stmt_execute(stmt);
-	switch_console_printf(SWITCH_CHANNEL_LOG,"MysqlCDR::process_record() - Statement executed? Error: %d\n",bah);
-	
-	const char* bah2 = mysql_stmt_error(stmt);
-	switch_console_printf(SWITCH_CHANNEL_LOG,"MySQL encountered error: %s\n",bah2);
-		
-	if(logchanvars && chanvars_supp.size() > 0)
+	for(int mysql_ping_result = -1, count = 0, mysql_stmt_error_code = -1; mysql_ping_result != 0 && count < 5 && mysql_stmt_error_code != 0 ; count++)
 	{
-		long long insertid = mysql_stmt_insert_id(stmt);
-
-		std::map<std::string,std::string>::iterator iItr,iBeg,iEnd;
-		iEnd = chanvars_supp.end();
-		for(iItr = chanvars_supp.begin(); iItr != iEnd; iItr++)
+		mysql_ping_result = mysql_ping(conn);
+		if(mysql_ping_result)
 		{
-			MYSQL_BIND bindme_chanvars[3];
-			memset(bindme_chanvars,0,sizeof(bindme_chanvars));
+			switch(mysql_ping_result)
+			{
+				case CR_SERVER_GONE_ERROR:
+				case CR_SERVER_LOST:
+				{
+					switch_console_printf(SWITCH_CHANNEL_LOG,"We lost connection to the MySQL server.  Trying to reconnect.\n");
+					connect_to_database();
+					break;
+				}
+				default:
+				{
+					switch_console_printf(SWITCH_CHANNEL_LOG,"We have encountered an unknown error when pinging the MySQL server.  Attempting to reconnect anyways.\n");
+					connect_to_database();
+				}
+			}
+		}
+		else
+		{
+			mysql_stmt_bind_param(stmt,bindmetemp);
+			mysql_stmt_error_code = mysql_stmt_execute(stmt);
 			
-			bindme_chanvars[0].buffer_type = MYSQL_TYPE_LONGLONG;
-			bindme_chanvars[0].buffer = &insertid;
+			if(mysql_stmt_error_code != 0)
+			{
+				errorstate = 1;
+				switch_console_printf(SWITCH_CHANNEL_LOG,"MysqlCDR::process_record() - Statement executed? Error: %d\n",mysql_stmt_error_code);
 			
-			std::vector<char> tempfirstvector(iItr->first.begin(), iItr->first.end());
-			tempfirstvector.push_back('\0');
-			char* varname_temp = &tempfirstvector[0];
+				const char* mysql_stmt_error_string = mysql_stmt_error(stmt);
+				switch_console_printf(SWITCH_CHANNEL_LOG,"MySQL encountered error: %s\n",mysql_stmt_error_string);
+			}
+			else
+				errorstate = 0;
+			
+			if(logchanvars && chanvars_supp.size() > 0 && errorstate == 0)
+			{
+				long long insertid = mysql_stmt_insert_id(stmt);
 
-			bindme_chanvars[1].buffer_type = MYSQL_TYPE_VAR_STRING;
-			long unsigned int varname_length = (long unsigned int)(iItr->first.size());
-			bindme_chanvars[1].length = &varname_length;
-			bindme_chanvars[1].buffer_length = varname_length;
-			bindme_chanvars[1].buffer = varname_temp;
+				std::map<std::string,std::string>::iterator iItr,iBeg,iEnd;
+				iEnd = chanvars_supp.end();
+				for(iItr = chanvars_supp.begin(); iItr != iEnd; iItr++)
+				{
+					MYSQL_BIND bindme_chanvars[3];
+					memset(bindme_chanvars,0,sizeof(bindme_chanvars));
 			
-			std::vector<char> tempsecondvector(iItr->second.begin(), iItr->second.end());
-			tempsecondvector.push_back('\0');
-			char* varvalue_temp = &tempsecondvector[0];
+					bindme_chanvars[0].buffer_type = MYSQL_TYPE_LONGLONG;
+					bindme_chanvars[0].buffer = &insertid;
 			
-			bindme_chanvars[2].buffer_type = MYSQL_TYPE_VAR_STRING;
-			if(iItr->second.size() == 0)
-				bindme_chanvars[2].is_null = (my_bool*)1;
-			else
-			{
-				long unsigned int varvalue_length = (long unsigned int)(iItr->second.size());
-				bindme_chanvars[2].length = &varvalue_length;
-				bindme_chanvars[2].buffer_length = varvalue_length;
-				bindme_chanvars[2].buffer = varvalue_temp;
+					std::vector<char> tempfirstvector(iItr->first.begin(), iItr->first.end());
+					tempfirstvector.push_back('\0');
+					char* varname_temp = &tempfirstvector[0];
+
+					bindme_chanvars[1].buffer_type = MYSQL_TYPE_VAR_STRING;
+					long unsigned int varname_length = (long unsigned int)(iItr->first.size());
+					bindme_chanvars[1].length = &varname_length;
+					bindme_chanvars[1].buffer_length = varname_length;
+					bindme_chanvars[1].buffer = varname_temp;
+			
+					std::vector<char> tempsecondvector(iItr->second.begin(), iItr->second.end());
+					tempsecondvector.push_back('\0');
+					char* varvalue_temp = &tempsecondvector[0];
+			
+					bindme_chanvars[2].buffer_type = MYSQL_TYPE_VAR_STRING;
+					if(iItr->second.size() == 0)
+						bindme_chanvars[2].is_null = (my_bool*)1;
+					else
+					{
+						long unsigned int varvalue_length = (long unsigned int)(iItr->second.size());
+						bindme_chanvars[2].length = &varvalue_length;
+						bindme_chanvars[2].buffer_length = varvalue_length;
+						bindme_chanvars[2].buffer = varvalue_temp;
+					}
+			
+					mysql_stmt_bind_param(stmt_chanvars,bindme_chanvars);
+					mysql_stmt_execute(stmt_chanvars);
+				}
 			}
 			
-			mysql_stmt_bind_param(stmt_chanvars,bindme_chanvars);
-			mysql_stmt_execute(stmt_chanvars);
+			if(errorstate == 0)
+				mysql_commit(conn);
+			else
+				mysql_rollback(conn);
 		}
 	}
-	
-	
-	mysql_commit(conn);
-	
-	/* For future use
-	if(!mysql_stmt_execute(stmt))
-	{
-		if(errorstate == TRUE)
-			reprocess_tempdumped_data();
-		mysql_commit(conn);
-		errorstate=FALSE();
-	}
-	else
-	{
-		errorstate = TRUE;
-		mysql_rollback(conn);
-		tempdump_data();
-	}
-	*/
 	
 	delete [] bindmetemp;
 	if(temp_chanvars_holder.size() > 0)

Modified: freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/mysqlcdr.h
==============================================================================
--- freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/mysqlcdr.h	(original)
+++ freeswitch/branches/stkn/src/mod/event_handlers/mod_cdr/mysqlcdr.h	Tue Aug  1 13:17:53 2006
@@ -36,6 +36,7 @@
 #include <list>
 #include <sstream>
 #include <mysql.h>
+#include <errmsg.h>
 
 #ifndef MYSQLCDR
 #define MYSQLCDR
@@ -55,7 +56,7 @@
 
 	private:
 		static bool activated;
-		static char *sql_query;
+		static char sql_query[1024];
 		static std::string tmp_sql_query; // Object must exist to bind the statement, this used for generating the sql
 		static char sql_query_chanvars[100];
 		static MYSQL *conn;
@@ -94,6 +95,7 @@
 		template <typename T> void add_parameter(T& param, enum_field_types type, bool *is_null=0);
 		void add_string_parameter(char* param, long unsigned int& param_length, enum_field_types type, bool* is_null=0);
 		void set_mysql_time(switch_time_exp_t& param, MYSQL_TIME& destination);
+		void connect_to_database();
 };
 
 #endif

Modified: freeswitch/branches/stkn/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	(original)
+++ freeswitch/branches/stkn/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	Tue Aug  1 13:17:53 2006
@@ -114,15 +114,28 @@
 	
 	switch_mutex_lock(listen_list.mutex);
 	for (l = listen_list.listeners; l; l = l->next) {
-		if (switch_test_flag(l, LFLAG_EVENTS) && (l->event_list[(uint8_t)event->event_id] || l->event_list[(uint8_t)SWITCH_EVENT_ALL])) {
+		uint8_t send = 0;
+
+		if (!switch_test_flag(l, LFLAG_EVENTS)) {
+			continue;
+		}
+
+		if (l->event_list[(uint8_t)SWITCH_EVENT_ALL]) {
+			send = 1;
+		} else if ((l->event_list[(uint8_t)event->event_id])) {
 			if (event->event_id != SWITCH_EVENT_CUSTOM || (event->subclass && switch_core_hash_find(l->event_hash, event->subclass->name))) {
-				if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {
-					switch_queue_push(l->event_queue, clone);
-				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
-				}
+				send = 1;
 			}
 		}
+
+		if (send) {
+			if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {
+				switch_queue_push(l->event_queue, clone);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
+			}
+		}
+
 	}
 	switch_mutex_unlock(listen_list.mutex);
 }
@@ -149,7 +162,14 @@
 
 SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
 {
+	listener_t *l;
 
+	switch_mutex_lock(listen_list.mutex);
+	for (l = listen_list.listeners; l; l = l->next) {
+		close_socket(&l->sock);
+	}
+	switch_mutex_unlock(listen_list.mutex);
+
 	close_socket(&listen_list.sock);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -201,8 +221,165 @@
 	}
 }
 
-static void parse_command(listener_t *listener, char *cmd, char *reply, uint32_t reply_len)
+static switch_status_t read_packet(listener_t *listener, switch_event_t **event, uint32_t timeout) 
 {
+	switch_size_t mlen;
+	char mbuf[1024] = "";
+	char buf[1024] = "";
+	switch_size_t len;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	int count = 0, bytes = 0;
+	uint32_t elapsed = 0;
+	time_t start = 0;
+	void *pop;
+	char *ptr;
+	uint8_t crcount = 0;
+
+	*event = NULL;
+	start = time(NULL);
+	ptr = mbuf;
+
+	while(listener->sock) {
+		uint8_t do_sleep = 1;
+		mlen = 1;
+		status = switch_socket_recv(listener->sock, ptr, &mlen);
+
+		if (status != SWITCH_STATUS_BREAK && status != SWITCH_STATUS_SUCCESS) {
+			return status;
+		}
+
+		if (status != SWITCH_STATUS_BREAK && mlen) {
+			bytes++;
+
+			if (*mbuf == '\r' || *mbuf == '\n') { /* bah */
+				ptr = mbuf;
+				continue;
+			}
+
+			if (*ptr == '\n') {
+				crcount++;
+			} else if (*ptr != '\r') {
+				crcount = 0;
+			}
+			ptr++;
+			if (crcount == 2) {
+				char *next;
+				char *cur = mbuf;
+
+				while(cur) {
+					if ((next = strchr(cur, '\r')) || (next = strchr(cur, '\n'))) {
+						while (*next == '\r' || *next == '\n') {
+							next++;
+						}
+					}
+					count++;
+					if (count == 1) {
+						switch_event_create(event, SWITCH_EVENT_MESSAGE);
+						switch_event_add_header(*event, SWITCH_STACK_BOTTOM, "Command", mbuf);
+					} else {
+						char *var, *val;
+						var = mbuf;
+						if ((val = strchr(var, ':'))) {
+							*val++ = '\0';
+							while(*val == ' ') {
+								val++;
+							}
+						} 
+						if (var && val) {
+							switch_event_add_header(*event, SWITCH_STACK_BOTTOM, var, val);
+						}
+					}
+					
+					cur = next;
+				}
+				break;
+			}
+		}
+
+		if (timeout) {
+			elapsed = (uint32_t)(time(NULL) - start);
+			if (elapsed >= timeout) {
+				switch_clear_flag_locked(listener, LFLAG_RUNNING);
+				return SWITCH_STATUS_FALSE;
+			}
+		}
+
+		if (!*mbuf) {
+			if (switch_test_flag(listener, LFLAG_LOG)) {
+				if (switch_queue_trypop(listener->log_queue, &pop) == SWITCH_STATUS_SUCCESS) {
+					char *data = (char *) pop;
+
+
+					if (data) {
+						snprintf(buf, sizeof(buf), "Content-Type: log/data\nContent-Length: %"APR_SSIZE_T_FMT"\n\n", strlen(data));
+						len = strlen(buf) + 1;
+						switch_socket_send(listener->sock, buf, &len);
+						len = strlen(data) + 1;
+						switch_socket_send(listener->sock, data, &len);
+					
+						free(data);
+					}
+					do_sleep = 0;
+				}
+			}
+
+			if (switch_test_flag(listener, LFLAG_EVENTS)) {
+				if (switch_queue_trypop(listener->event_queue, &pop) == SWITCH_STATUS_SUCCESS) {
+					char hbuf[512];
+					switch_event_t *event = (switch_event_t *) pop;
+					char *etype, *packet, *xmlstr = NULL;
+
+					do_sleep = 0;
+					if (listener->format == EVENT_FORMAT_PLAIN) {
+						etype = "plain";
+						switch_event_serialize(event, buf, sizeof(buf), NULL);
+						packet = buf;
+					} else {
+						switch_xml_t xml;
+						etype = "xml";
+
+						if ((xml = switch_event_xmlize(event, NULL))) {
+							xmlstr = switch_xml_toxml(xml);
+							packet = xmlstr;
+							switch_xml_free(xml);
+						} else {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "XML ERROR!\n");
+							continue;
+						}
+					}
+			
+					len = strlen(packet) + 1;
+
+					snprintf(hbuf, sizeof(hbuf), "Content-Length: %"APR_SSIZE_T_FMT"\n" 
+							 "Content-Type: text/event-%s\n"
+							 "\n", len, etype);
+
+					len = strlen(hbuf) + 1;
+					switch_socket_send(listener->sock, hbuf, &len);
+
+					len = strlen(packet) + 1;
+					switch_socket_send(listener->sock, packet, &len);
+
+					if (xmlstr) {
+						free(xmlstr);
+					}
+				}
+			}
+		}
+		if (do_sleep) {
+			switch_yield(1000);
+		}
+	}
+	
+	return status;
+
+}
+
+static switch_status_t parse_command(listener_t *listener, switch_event_t *event, char *reply, uint32_t reply_len)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	char *cmd = switch_event_get_header(event, "command");
+
 	*reply = '\0';
 
 	if (!strncasecmp(cmd, "exit", 4)) {
@@ -252,7 +429,7 @@
 			*arg++ = '\0';
 		}
 		
-		if (switch_api_execute(api_cmd, arg, &stream) == SWITCH_STATUS_SUCCESS) {
+		if (switch_api_execute(api_cmd, arg, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
 			switch_size_t len;
 			char buf[1024];
 
@@ -262,7 +439,7 @@
 			switch_socket_send(listener->sock, buf, &len);
 			len = strlen(listener->retbuf) + 1;
 			switch_socket_send(listener->sock, listener->retbuf, &len);
-			return;
+			return SWITCH_STATUS_SUCCESS;
 		} 
 	} else if (!strncasecmp(cmd, "log", 3)) {
 
@@ -356,10 +533,15 @@
 	} 
 	
  done:
+	if (event) {
+		switch_event_destroy(&event);
+	}
+
 	if (switch_strlen_zero(reply)) {
 		snprintf(reply, reply_len, "-ERR command not found");
 	}
 
+	return status;
 }
 
 static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
@@ -368,9 +550,7 @@
 	char buf[1024];
 	switch_size_t len;
 	switch_status_t status;
-	void *pop;
-	uint32_t elapsed;
-	time_t start = 0;
+	switch_event_t *event;
 	char reply[512] = "";
 
 	assert(listener != NULL);
@@ -386,126 +566,59 @@
 	len = strlen(buf) + 1;
 	switch_socket_send(listener->sock, buf, &len);
 		
-	start = time(NULL);
 
-	while(!switch_test_flag(listener, LFLAG_AUTHED)) {
-		len = sizeof(buf);
-		memset(buf, 0, len);
-		status = switch_socket_recv(listener->sock, buf, &len);
-		if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
-			break;
-		}
-
-		if (len) {
-			parse_command(listener, buf, reply, sizeof(reply));
-			if (!switch_strlen_zero(reply)) {
-				snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
-				len = strlen(buf) + 1;
-				switch_socket_send(listener->sock, buf, &len);
-			}
+	while (!switch_test_flag(listener, LFLAG_AUTHED)) {
+		
+		status = read_packet(listener, &event, 25);
+		if (status != SWITCH_STATUS_SUCCESS) {
 			goto done;
 		}
-		
-		if (status == SWITCH_STATUS_BREAK) {
-			elapsed = (uint32_t)(time(NULL) - start);
-			if (elapsed >= 15) {
-				switch_clear_flag_locked(listener, LFLAG_RUNNING);
-				break;
-			}
-
-			//switch_yield(1000);
+		if (!event) {
 			continue;
 		}
-
+		if (parse_command(listener, event, reply, sizeof(reply)) != SWITCH_STATUS_SUCCESS) {
+			switch_clear_flag_locked(listener, LFLAG_RUNNING);
+			goto done;
+		}
+		if (!switch_strlen_zero(reply)) {
+			snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
+			len = strlen(buf) + 1;
+			switch_socket_send(listener->sock, buf, &len);
+		}
+		break;
 	}
 		
- done:
 
 	while(switch_test_flag(listener, LFLAG_RUNNING) && listen_list.ready) {
-		uint8_t do_sleep = 1;
+		switch_event_t *event;
+
 		len = sizeof(buf);
 		memset(buf, 0, len);
-		status = switch_socket_recv(listener->sock, buf, &len);
+		status = read_packet(listener, &event, 0);
 		
-		if (!len && status != SWITCH_STATUS_BREAK) {
+		if (status != SWITCH_STATUS_SUCCESS) {
 			break;
 		}
-		
-		if (len) {
-			parse_command(listener, buf, reply, sizeof(reply));
-			if (!switch_strlen_zero(reply)) {
-				snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
-				len = strlen(buf) + 1;
-				switch_socket_send(listener->sock, buf, &len);
-			}
+
+		if (!event) {
 			continue;
 		}
 
-		if (switch_test_flag(listener, LFLAG_LOG)) {
-			if (switch_queue_trypop(listener->log_queue, &pop) == SWITCH_STATUS_SUCCESS) {
-				char *data = (char *) pop;
-				if (data) {
-					snprintf(buf, sizeof(buf), "Content-Type: log/data\nContent-Length: %"APR_SSIZE_T_FMT"\n\n", strlen(data));
-					len = strlen(buf) + 1;
-					switch_socket_send(listener->sock, buf, &len);
-					len = strlen(data) + 1;
-					switch_socket_send(listener->sock, data, &len);
-					
-					free(data);
-				}
-				do_sleep = 0;
-			}
+		if (parse_command(listener, event, reply, sizeof(reply)) != SWITCH_STATUS_SUCCESS) {
+			switch_clear_flag_locked(listener, LFLAG_RUNNING);
+			break;
 		}
 
-		if (switch_test_flag(listener, LFLAG_EVENTS)) {
-			if (switch_queue_trypop(listener->event_queue, &pop) == SWITCH_STATUS_SUCCESS) {
-				char hbuf[512];
-				switch_event_t *event = (switch_event_t *) pop;
-				char *etype, *packet, *xmlstr = NULL;
 
-				do_sleep = 0;
-				if (listener->format == EVENT_FORMAT_PLAIN) {
-					etype = "plain";
-					switch_event_serialize(event, buf, sizeof(buf), NULL);
-					packet = buf;
-				} else {
-					switch_xml_t xml;
-					etype = "xml";
-
-					if ((xml = switch_event_xmlize(event, NULL))) {
-						xmlstr = switch_xml_toxml(xml);
-						packet = xmlstr;
-						switch_xml_free(xml);
-					} else {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "XML ERROR!\n");
-						continue;
-					}
-				}
-			
-				len = strlen(packet) + 1;
-
-				snprintf(hbuf, sizeof(hbuf), "Content-Length: %"APR_SSIZE_T_FMT"\n" 
-						 "Content-Type: text/event-%s\n"
-						 "\n", len, etype);
-
-				len = strlen(hbuf) + 1;
-				switch_socket_send(listener->sock, hbuf, &len);
-
-				len = strlen(packet) + 1;
-				switch_socket_send(listener->sock, packet, &len);
-			
-				switch_event_destroy(&event);
-
-				if (xmlstr) {
-					free(xmlstr);
-				}
-			}
+		if (!switch_strlen_zero(reply)) {
+			snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
+			len = strlen(buf) + 1;
+			switch_socket_send(listener->sock, buf, &len);
 		}
-
-		if (do_sleep) {
-			switch_yield(1000);
-		}
+			
 	}
+
+ done:
 
 	remove_listener(listener);
 	close_socket(&listener->sock);

Modified: freeswitch/branches/stkn/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c	(original)
+++ freeswitch/branches/stkn/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c	Tue Aug  1 13:17:53 2006
@@ -240,7 +240,7 @@
 	stream.end = stream.data;
 	stream.data_size = sizeof(retbuf);
 	stream.write_function = switch_console_stream_write;
-	switch_api_execute(cmd, arg, &stream);
+	switch_api_execute(cmd, arg, NULL, &stream);
 
 	return 0;
 }

Modified: freeswitch/branches/stkn/src/mod/formats/mod_sndfile/Makefile
==============================================================================
--- freeswitch/branches/stkn/src/mod/formats/mod_sndfile/Makefile	(original)
+++ freeswitch/branches/stkn/src/mod/formats/mod_sndfile/Makefile	Tue Aug  1 13:17:53 2006
@@ -3,7 +3,7 @@
 all:	depends $(MODNAME).$(DYNAMIC_LIB_EXTEN)
 
 depends:
-	MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install libsndfile-1.0.12.tar.gz --prefix=$(PREFIX)
+	MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install libsndfile-1.0.16.tar.gz --prefix=$(PREFIX)
 
 $(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).c
 	$(CC) $(CFLAGS) -fPIC -c $(MODNAME).c -o $(MODNAME).o 

Modified: freeswitch/branches/stkn/src/mod/formats/mod_sndfile/mod_sndfile.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/formats/mod_sndfile/mod_sndfile.c	(original)
+++ freeswitch/branches/stkn/src/mod/formats/mod_sndfile/mod_sndfile.c	Tue Aug  1 13:17:53 2006
@@ -213,6 +213,26 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+static switch_status_t sndfile_file_set_string(switch_file_handle_t *handle, switch_audio_col_t col, const char *string)
+{
+	sndfile_context *context = handle->private_info;
+
+	return sf_set_string(context->handle, (int)col, string) ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t sndfile_file_get_string(switch_file_handle_t *handle, switch_audio_col_t col, const char **string)
+{
+	sndfile_context *context = handle->private_info;
+	const char *s;
+
+	if ((s = sf_get_string(context->handle, (int)col))) {
+		*string = s;
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	return SWITCH_STATUS_FALSE;
+}
+
 /* Registration */
 
 static char **supported_formats;
@@ -224,6 +244,8 @@
 	/*.file_read */ sndfile_file_read,
 	/*.file_write */ sndfile_file_write,
 	/*.file_seek */ sndfile_file_seek,
+	/*.file_set_string */ sndfile_file_set_string,
+	/*.file_get_string */ sndfile_file_get_string,
 	/*.extens */ NULL,
 	/*.next */ NULL,
 };
@@ -265,7 +287,7 @@
 
 	sfinfo.channels = 1;
 	len = ((major_count + (exlen + 2)) * sizeof(char *));
-	supported_formats = switch_core_permenant_alloc(len);
+	supported_formats = switch_core_permanent_alloc(len);
 
 	len = 0;
 	for (m = 0; m < major_count; m++) {

Modified: freeswitch/branches/stkn/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/branches/stkn/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Tue Aug  1 13:17:53 2006
@@ -1705,12 +1705,15 @@
 				}
 
 			} else {
-				if (switch_core_session_read_frame(session, &read_frame, -1, 0) != SWITCH_STATUS_SUCCESS) {
+				switch_status_t status;
+				status = switch_core_session_read_frame(session, &read_frame, -1, 0);
+				
+				if (!SWITCH_READ_ACCEPTABLE(status)) {
 					break;
 				}
 			}
 			if ((write_frame.datalen = (uint32_t)switch_buffer_read(tto->audio_buffer, fdata, write_frame.codec->implementation->bytes_per_frame)) <= 0) {
-				if (loops > 0) { 
+				if (loops) { 
 					switch_buffer_t *tmp;
 
 					/* Switcharoo*/
@@ -1719,11 +1722,12 @@
 					tto->loop_buffer = tmp;
 					loops--;
 					/* try again */
-					if ((write_frame.datalen = (uint32_t)switch_buffer_read(tto->audio_buffer, fdata, write_frame.codec->implementation->bytes_per_frame)) <= 0) {
+					if ((write_frame.datalen = 
+						 (uint32_t)switch_buffer_read(tto->audio_buffer, fdata, write_frame.codec->implementation->bytes_per_frame)) <= 0) {
 						break;
 					}
 				} else {
-					continue;
+					break;
 				}
 			}
 
@@ -1838,13 +1842,25 @@
 	if (argc > 1) {
 		char *cmd = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
 		char *arg = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+		switch_core_session_t *session = NULL;
 		switch_stream_handle_t stream = {0};
 		char retbuf[2048] = "";
 
+		if (argc > 2) {
+			JSObject *session_obj;
+			struct js_session *jss;
+			if (JS_ValueToObject(cx, argv[2], &session_obj)) {
+				if ((jss = JS_GetPrivate(cx, session_obj))) {
+					session = jss->session;
+				}
+			}
+		}
+		
+		
 		stream.data = retbuf;
 		stream.end = stream.data;
 		stream.data_size = sizeof(retbuf);
-		switch_api_execute(cmd, arg, &stream);
+		switch_api_execute(cmd, arg, session, &stream);
 		stream.write_function = switch_console_stream_write;
 
 		*rval = STRING_TO_JSVAL (JS_NewStringCopyZ(cx, retbuf));
@@ -2203,7 +2219,7 @@
 }
 
 
-static switch_status_t launch_async(char *text, switch_stream_handle_t *stream)
+static switch_status_t launch_async(char *text, switch_core_session_t *session, switch_stream_handle_t *stream)
 {
 
 	if (switch_strlen_zero(text)) {

Modified: freeswitch/branches/stkn/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	(original)
+++ freeswitch/branches/stkn/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	Tue Aug  1 13:17:53 2006
@@ -272,7 +272,7 @@
 	ResponseStatus(r,200);
 	ResponseContentType(r, m);
     ResponseWrite(r);
-	switch_api_execute(command, r->query, &stream);
+	switch_api_execute(command, r->query, NULL, &stream);
 	HTTPWriteEnd(r);
     return TRUE;
 }
@@ -296,7 +296,7 @@
 	stream.end = stream.data;
 	stream.data_size = CMDLEN;
 	stream.write_function = switch_console_stream_write;
-	switch_api_execute(command, arg, &stream);
+	switch_api_execute(command, arg, NULL, &stream);
 
     /* Return our result. */
     val = xmlrpc_build_value(envP, "s", retbuf);

Modified: freeswitch/branches/stkn/src/switch_console.c
==============================================================================
--- freeswitch/branches/stkn/src/switch_console.c	(original)
+++ freeswitch/branches/stkn/src/switch_console.c	Tue Aug  1 13:17:53 2006
@@ -108,7 +108,7 @@
 	stream.end = stream.data;
 	stream.data_size = retlen;
 	stream.write_function = switch_console_stream_write;
-	if (switch_api_execute(cmd, arg, &stream) == SWITCH_STATUS_SUCCESS) {
+	if (switch_api_execute(cmd, arg, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "API CALL [%s(%s)] output:\n%s\n", cmd, arg ? arg : "", retbuf);
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Unknown Command: %s\n", cmd);

Modified: freeswitch/branches/stkn/src/switch_core.c
==============================================================================
--- freeswitch/branches/stkn/src/switch_core.c	(original)
+++ freeswitch/branches/stkn/src/switch_core.c	Tue Aug  1 13:17:53 2006
@@ -543,9 +543,26 @@
 SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh, unsigned int *cur_pos, int64_t samples,
 													int whence)
 {
+	assert(fh != NULL);
 	return fh->file_interface->file_seek(fh, cur_pos, samples, whence);
 }
 
+SWITCH_DECLARE(switch_status_t) switch_core_file_set_string(switch_file_handle_t *fh, switch_audio_col_t col, const char *string)
+{
+	assert(fh != NULL);
+
+	return fh->file_interface->file_set_string(fh, col, string);
+}
+
+SWITCH_DECLARE(switch_status_t) switch_core_file_get_string(switch_file_handle_t *fh, switch_audio_col_t col, const char **string)
+{
+	assert(fh != NULL);
+	
+	return fh->file_interface->file_get_string(fh, col, string);
+
+}
+
+
 SWITCH_DECLARE(switch_status_t) switch_core_file_close(switch_file_handle_t *fh)
 {
 	return fh->file_interface->file_close(fh);
@@ -840,9 +857,9 @@
 }
 
 /* **ONLY** alloc things with these functions that **WILL NOT** need
-   to be freed *EVER* ie this is for *PERMENANT* memory allocation */
+   to be freed *EVER* ie this is for *PERMANENT* memory allocation */
 
-SWITCH_DECLARE(void *) switch_core_permenant_alloc(switch_size_t memory)
+SWITCH_DECLARE(void *) switch_core_permanent_alloc(switch_size_t memory)
 {
 	void *ptr = NULL;
 	assert(runtime.memory_pool != NULL);
@@ -857,7 +874,7 @@
 	return ptr;
 }
 
-SWITCH_DECLARE(char *) switch_core_permenant_strdup(char *todup)
+SWITCH_DECLARE(char *) switch_core_permanent_strdup(char *todup)
 {
 	char *duped = NULL;
 	switch_size_t len;

Modified: freeswitch/branches/stkn/src/switch_event.c
==============================================================================
--- freeswitch/branches/stkn/src/switch_event.c	(original)
+++ freeswitch/branches/stkn/src/switch_event.c	Tue Aug  1 13:17:53 2006
@@ -112,6 +112,7 @@
 	"SESSION_CRASH",
 	"MODULE_LOAD",
 	"DTMF",
+	"MESSAGE",
 	"ALL"
 };
 

Modified: freeswitch/branches/stkn/src/switch_ivr.c
==============================================================================
--- freeswitch/branches/stkn/src/switch_ivr.c	(original)
+++ freeswitch/branches/stkn/src/switch_ivr.c	Tue Aug  1 13:17:53 2006
@@ -214,6 +214,8 @@
 	switch_codec_t codec, *read_codec;
 	char *codec_name;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	char *p;
+	const char *vval;
 
 	if (!fh) {
 		fh = &lfh;
@@ -241,6 +243,41 @@
 
 	switch_channel_answer(channel);
 
+	if ((p = switch_channel_get_variable(channel, "RECORD_TITLE"))) {
+		vval = (const char *) switch_core_session_strdup(session, p);
+		switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_TITLE, vval);
+		switch_channel_set_variable(channel, "RECORD_TITLE", NULL);
+	}
+
+	if ((p = switch_channel_get_variable(channel, "RECORD_COPYRIGHT"))) {
+		vval = (const char *) switch_core_session_strdup(session, p);
+		switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_COPYRIGHT, vval);
+		switch_channel_set_variable(channel, "RECORD_COPYRIGHT", NULL);
+	}
+
+	if ((p = switch_channel_get_variable(channel, "RECORD_SOFTWARE"))) {
+		vval = (const char *) switch_core_session_strdup(session, p);
+		switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_SOFTWARE, vval);
+		switch_channel_set_variable(channel, "RECORD_SOFTWARE", NULL);
+	}
+
+	if ((p = switch_channel_get_variable(channel, "RECORD_ARTIST"))) {
+		vval = (const char *) switch_core_session_strdup(session, p);
+		switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_ARTIST, vval);
+		switch_channel_set_variable(channel, "RECORD_ARTIST", NULL);
+	}
+
+	if ((p = switch_channel_get_variable(channel, "RECORD_COMMENT"))) {
+		vval = (const char *) switch_core_session_strdup(session, p);
+		switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_COMMENT, vval);
+		switch_channel_set_variable(channel, "RECORD_COMMENT", NULL);
+	}
+
+	if ((p = switch_channel_get_variable(channel, "RECORD_DATE"))) {
+		vval = (const char *) switch_core_session_strdup(session, p);
+		switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_DATE, vval);
+		switch_channel_set_variable(channel, "RECORD_DATE", NULL);
+	}
 	
 	codec_name = "L16";
 	if (switch_core_codec_init(&codec,
@@ -333,7 +370,9 @@
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	switch_file_handle_t lfh;
 	switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
-
+	const char *p;
+	char *title = "", *copyright = "", *software = "", *artist = "", *comment = "", *date = "";
+	
 	if (!fh) {
 		fh = &lfh;
 		memset(fh, 0, sizeof(lfh));
@@ -354,8 +393,52 @@
 	write_frame.data = abuf;
 	write_frame.buflen = sizeof(abuf);
 
+	
+	if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_TITLE, &p) == SWITCH_STATUS_SUCCESS) {
+		title = (char *) switch_core_session_strdup(session, (char *)p);
+		switch_channel_set_variable(channel, "RECORD_TITLE", (char *)p);
+	}
+	
+	if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_COPYRIGHT, &p) == SWITCH_STATUS_SUCCESS) {
+		copyright = (char *) switch_core_session_strdup(session, (char *)p);
+		switch_channel_set_variable(channel, "RECORD_COPYRIGHT", (char *)p);
+	}
+	
+	if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_SOFTWARE, &p) == SWITCH_STATUS_SUCCESS) {
+		software = (char *) switch_core_session_strdup(session, (char *)p);
+		switch_channel_set_variable(channel, "RECORD_SOFTWARE", (char *)p);
+	}
+	
+	if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_ARTIST, &p) == SWITCH_STATUS_SUCCESS) {
+		artist = (char *) switch_core_session_strdup(session, (char *)p);
+		switch_channel_set_variable(channel, "RECORD_ARTIST", (char *)p);
+	}
+	
+	if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_COMMENT, &p) == SWITCH_STATUS_SUCCESS) {
+		comment = (char *) switch_core_session_strdup(session, (char *)p);
+		switch_channel_set_variable(channel, "RECORD_COMMENT", (char *)p);
+	}
+	
+	if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_DATE, &p) == SWITCH_STATUS_SUCCESS) {
+		date = (char *) switch_core_session_strdup(session, (char *)p);
+		switch_channel_set_variable(channel, "RECORD_DATE", (char *)p);
+	}
+	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+					  "OPEN FILE %s %uhz %u channels\n"
+					  "TITLE=%s\n"
+					  "COPYRIGHT=%s\n"
+					  "SOFTWARE=%s\n"
+					  "ARTIST=%s\n"
+					  "COMMENT=%s\n"
+					  "DATE=%s\n", file, fh->samplerate, fh->channels,
+					  title,
+					  copyright,
+					  software,
+					  artist,
+					  comment,
+					  date);
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OPEN FILE %s %uhz %u channels\n", file, fh->samplerate, fh->channels);
 
 	interval = read_codec->implementation->microseconds_per_frame / 1000;
 

Modified: freeswitch/branches/stkn/src/switch_loadable_module.c
==============================================================================
--- freeswitch/branches/stkn/src/switch_loadable_module.c	(original)
+++ freeswitch/branches/stkn/src/switch_loadable_module.c	Tue Aug  1 13:17:53 2006
@@ -270,7 +270,7 @@
 			break;
 		}
 
-		if ((module = switch_core_permenant_alloc(sizeof(switch_loadable_module_t))) == 0) {
+		if ((module = switch_core_permanent_alloc(sizeof(switch_loadable_module_t))) == 0) {
 			err = "Could not allocate memory\n";
 			break;
 		}
@@ -283,7 +283,7 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
-	module->filename = switch_core_permenant_strdup(filename);
+	module->filename = switch_core_permanent_strdup(filename);
 	module->module_interface = module_interface;
 	module->switch_module_load = load_func_ptr;
 
@@ -365,7 +365,7 @@
 	const char *err = NULL; 
 	switch_loadable_module_interface_t *module_interface = NULL; 
 
-	if ((module = switch_core_permenant_alloc(sizeof(switch_loadable_module_t))) == 0) { 
+	if ((module = switch_core_permanent_alloc(sizeof(switch_loadable_module_t))) == 0) { 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Couldn't allocate memory\n"); 
 		return SWITCH_STATUS_GENERR; 
 	} 
@@ -384,7 +384,7 @@
 			break; 
 		} 
   
-		if ((module = switch_core_permenant_alloc(sizeof(switch_loadable_module_t))) == 0) { 
+		if ((module = switch_core_permanent_alloc(sizeof(switch_loadable_module_t))) == 0) { 
 			err = "Could not allocate memory\n"; 
 			break; 
 		} 
@@ -397,7 +397,7 @@
 		return SWITCH_STATUS_GENERR; 
 	} 
   
-	module->filename = switch_core_permenant_strdup(filename); 
+	module->filename = switch_core_permanent_strdup(filename); 
 	module->module_interface = module_interface; 
 	module->switch_module_load = load_func_ptr; 
   
@@ -711,7 +711,7 @@
 	return i;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_api_execute(char *cmd, char *arg, switch_stream_handle_t *stream)
+SWITCH_DECLARE(switch_status_t) switch_api_execute(char *cmd, char *arg, switch_core_session_t *session, switch_stream_handle_t *stream)
 {
 	switch_api_interface_t *api;
 	switch_status_t status;
@@ -734,7 +734,7 @@
 	}
 
 	if ((api = switch_loadable_module_get_api_interface(cmd)) != 0) {
-		status = api->function(arg, stream);
+		status = api->function(arg, session, stream);
 	} else {
 		status = SWITCH_STATUS_FALSE;
 		stream->write_function(stream, "INVALID COMMAND [%s]", cmd);

Modified: freeswitch/branches/stkn/src/switch_utils.c
==============================================================================
--- freeswitch/branches/stkn/src/switch_utils.c	(original)
+++ freeswitch/branches/stkn/src/switch_utils.c	Tue Aug  1 13:17:53 2006
@@ -34,16 +34,6 @@
 #include <string.h>
 #include <stdlib.h>
 
-SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, int32_t flags, char *buf, switch_size_t *len)
-{
-	switch_status_t status;
-
-	if ((status = apr_socket_recvfrom(from, sock, flags, buf, len)) == SWITCH_STATUS_SUCCESS) {
-		from->port = ntohs(from->sa.sin.sin_port);
-	}
-	return status;
-}
-
 SWITCH_DECLARE(char *) switch_priority_name(switch_priority_t priority)
 {
 	switch(priority) { /*lol*/

Modified: freeswitch/branches/stkn/w32/vsnet/Freeswitch.sln
==============================================================================
--- freeswitch/branches/stkn/w32/vsnet/Freeswitch.sln	(original)
+++ freeswitch/branches/stkn/w32/vsnet/Freeswitch.sln	Tue Aug  1 13:17:53 2006
@@ -384,8 +384,8 @@
 		{05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|Win32.Build.0 = Debug|Win32
 		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|Win32.ActiveCfg = Release|Win32
 		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|Win32.Build.0 = Release|Win32
-		{3D1EED36-A510-4EDB-B4D9-4E0F4A5EC2A8}.Debug|Win32.ActiveCfg = Debug with MySql|Win32
-		{3D1EED36-A510-4EDB-B4D9-4E0F4A5EC2A8}.Debug|Win32.Build.0 = Debug with MySql|Win32
+		{3D1EED36-A510-4EDB-B4D9-4E0F4A5EC2A8}.Debug|Win32.ActiveCfg = Debug|Win32
+		{3D1EED36-A510-4EDB-B4D9-4E0F4A5EC2A8}.Debug|Win32.Build.0 = Debug|Win32
 		{3D1EED36-A510-4EDB-B4D9-4E0F4A5EC2A8}.Release|Win32.ActiveCfg = Release|Win32
 		{3D1EED36-A510-4EDB-B4D9-4E0F4A5EC2A8}.Release|Win32.Build.0 = Release|Win32
 	EndGlobalSection

Modified: freeswitch/branches/stkn/w32/vsnet/GetLibs.vbs
==============================================================================
--- freeswitch/branches/stkn/w32/vsnet/GetLibs.vbs	(original)
+++ freeswitch/branches/stkn/w32/vsnet/GetLibs.vbs	Tue Aug  1 13:17:53 2006
@@ -248,16 +248,13 @@
 '  Lib Build Sectiton
 '  ******************
 Sub BuildLibs_aprutil(BuildDebug, BuildRelease)
-	If Not FSO.FolderExists(LibDestDir & "apr-util") Then 
-'		WgetUnCompress "ftp://ftp.wayne.edu/apache/apr/apr-util-1.2.6.tar.gz", LibDestDir
-		If Not FSO.FolderExists(LibDestDir & "apr-util-1.2.6") Then
-			Wscript.echo "Unable to get apr-util from default download location, Trying backup location:"
-			WgetUnCompress LibsBase & "apr-util-1.2.6.tar.gz", LibDestDir
-		End If
-		RenameFolder LibDestDir & "apr-util-1.2.6", "apr-util"
-		FSO.CopyFile Utilsdir & "apr\xml.vcproj", LibDestDir & "apr-util\xml\expat\lib\", True
-		FSO.CopyFile Utilsdir & "apr\libaprutil.vcproj", LibDestDir & "apr-util\", True
-	End If 
+	If Not FSO.FolderExists(LibDestDir & "apr-util") Then
+		Wscript.echo "Unable to get apr-util from default download location, Trying backup location:"
+		WgetUnCompress LibsBase & "apr-util-1.2.7.tar.gz", LibDestDir
+	End If
+	RenameFolder LibDestDir & "apr-util-1.2.7", "apr-util"
+	FSO.CopyFile Utilsdir & "apr\xml.vcproj", LibDestDir & "apr-util\xml\expat\lib\", True
+	FSO.CopyFile Utilsdir & "apr\libaprutil.vcproj", LibDestDir & "apr-util\", True
 	If FSO.FolderExists(LibDestDir & "apr-util") Then 
 		If BuildDebug Then
 			If Not FSO.FileExists(LibDestDir & "apr-util\xml\expat\lib\LibD\xml.lib") Then 
@@ -285,15 +282,12 @@
 End Sub
 
 Sub BuildLibs_apriconv(BuildDebug, BuildRelease)
-	If Not FSO.FolderExists(LibDestDir & "apr-iconv") Then 
-'		WgetUnCompress "ftp://ftp.wayne.edu/apache/apr/apr-iconv-1.1.1.tar.gz", LibDestDir
-		If Not FSO.FolderExists(LibDestDir & "apr-iconv-1.1.1") Then
-			Wscript.echo "Unable to get apr-iconv from default download location, Trying backup location:"
-			WgetUnCompress LibsBase & "apr-iconv-1.1.1.tar.gz", LibDestDir
-		End If
-		RenameFolder LibDestDir & "apr-iconv-1.1.1", "apr-iconv"
-		FSO.CopyFile Utilsdir & "apr\libapriconv.vcproj", LibDestDir & "apr-iconv\", True
-	End If 
+	If Not FSO.FolderExists(LibDestDir & "apr-iconv-1.1.1") Then
+		Wscript.echo "Unable to get apr-iconv from default download location, Trying backup location:"
+		WgetUnCompress LibsBase & "apr-iconv-1.1.1.tar.gz", LibDestDir
+	End If
+	RenameFolder LibDestDir & "apr-iconv-1.1.1", "apr-iconv"
+	FSO.CopyFile Utilsdir & "apr\libapriconv.vcproj", LibDestDir & "apr-iconv\", True
 	If FSO.FolderExists(LibDestDir & "apr-iconv") Then 
 		If BuildDebug Then
 			If Not FSO.FileExists(LibDestDir & "apr-iconv\Debug\libapriconv-1.lib") Then 
@@ -315,16 +309,13 @@
 End Sub
 
 Sub BuildLibs_apr(BuildDebug, BuildRelease)
-	If Not FSO.FolderExists(LibDestDir & "apr") Then 
-'		WgetUnCompress "ftp://ftp.wayne.edu/apache/apr/apr-1.2.6.tar.gz", LibDestDir
-		If Not FSO.FolderExists(LibDestDir & "apr-1.2.6") Then
-			Wscript.echo "Unable to get apr from default download location, Trying backup location:"
-			WgetUnCompress LibsBase & "apr-1.2.6.tar.gz", LibDestDir
-		End If
-		RenameFolder LibDestDir & "apr-1.2.6", "apr"
-		FSO.CopyFile Utilsdir & "apr\libapr.vcproj", LibDestDir & "apr\", True
-		FSO.CopyFile Utilsdir & "apr\apr.hw", LibDestDir & "apr\include\", True
-	End If 
+	If Not FSO.FolderExists(LibDestDir & "apr") Then
+		Wscript.echo "Unable to get apr from default download location, Trying backup location:"
+		WgetUnCompress LibsBase & "apr-1.2.7.tar.gz", LibDestDir
+	End If
+	RenameFolder LibDestDir & "apr-1.2.7", "apr"
+	FSO.CopyFile Utilsdir & "apr\libapr.vcproj", LibDestDir & "apr\", True
+	FSO.CopyFile Utilsdir & "apr\apr.hw", LibDestDir & "apr\include\", True
 	If FSO.FolderExists(LibDestDir & "apr") Then 
 		If BuildDebug Then
 			If Not FSO.FileExists(LibDestDir & "apr\Debug\libapr-1.lib") Then 
@@ -421,16 +412,13 @@
 End Sub
 
 Sub BuildLibs_sqlite(BuildDebug, BuildRelease)
-	If Not FSO.FolderExists(LibDestDir & "sqlite") Then 
-		WgetUnCompress "http://www.sqlite.org/sqlite-source-3_3_5.zip", LibDestDir 
-		If Not FSO.FolderExists(LibDestDir & "sqlite-source-3_3_5") Then
+		If Not FSO.FolderExists(LibDestDir & "sqlite") Then
 			Wscript.echo "Unable to get SQLite from default download location, Trying backup location:"
-			WgetUnCompress LibsBase & "sqlite-source-3_3_5.zip", LibDestDir
+			WgetUnCompress LibsBase & "sqlite-source-3_3_6.zip", LibDestDir
 		End If
-		RenameFolder LibDestDir & "sqlite-source-3_3_5", "sqlite"
+		RenameFolder LibDestDir & "sqlite-source-3_3_6", "sqlite"
 		FSO.CopyFile Utilsdir & "sqlite.vcproj", LibDestDir & "sqlite\", True
 		FindReplaceInFile LibDestDir & "sqlite\sqlite.vcproj", "WIN32;", "_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;"
-	End If
 	If FSO.FolderExists(LibDestDir & "sqlite") Then 
 		If BuildDebug Then
 			If Not FSO.FileExists(LibDestDir & "sqlite\Debug DLL\sqlite.lib") Then 
@@ -629,9 +617,10 @@
 
 Sub BuildLibs_libsndfile(BuildDebug, BuildRelease)
 	If Not FSO.FolderExists(LibDestDir & "libsndfile") Then 
-		WgetUnCompress LibsBase & "libsndfile-1.0.12.tar.gz", LibDestDir
-		RenameFolder LibDestDir & "libsndfile-1.0.12", "libsndfile"
-		FSO.CopyFile Utilsdir & "libsndfile.vcproj", LibDestDir & "libsndfile\Win32\", True
+		WgetUnCompress LibsBase & "libsndfile-1.0.16.tar.gz", LibDestDir
+		RenameFolder LibDestDir & "libsndfile-1.0.16", "libsndfile"
+		FSO.CopyFile Utilsdir & "libsndfile\*.*", LibDestDir & "libsndfile\Win32\", True
+		FindReplaceInFile LibDestDir & "libsndfile\src\common.c", "memset (ptr + most,", "memset ((char *)ptr + most,"
 	End If 
 	If FSO.FolderExists(LibDestDir & "libsndfile") Then 
 		If BuildDebug Then



More information about the Freeswitch-branches mailing list