[Freeswitch-branches] [commit] r2140 - in freeswitch/branches/mishehu: . libs mac/xcode mac/xcode/FreeSWITCH.xcodeproj mac/xcode/libs scripts/socket scripts/socket/FreeSWITCH src src/include src/mod/event_handlers/mod_cdr src/mod/event_handlers/mod_event_socket src/mod/formats/mod_sndfile w32/vsnet w32/vsnet/Tools/libsndfile
Freeswitch SVN
mishehu at freeswitch.org
Tue Jul 25 18:58:20 EDT 2006
Author: mishehu
Date: Tue Jul 25 18:58:16 2006
New Revision: 2140
Added:
freeswitch/branches/mishehu/mac/xcode/FreeSWITCH.xcodeproj/
- copied from r2139, /freeswitch/trunk/mac/xcode/FreeSWITCH.xcodeproj/
freeswitch/branches/mishehu/mac/xcode/FreeSWITCH.xcodeproj/project.pbxproj
- copied unchanged from r2139, /freeswitch/trunk/mac/xcode/FreeSWITCH.xcodeproj/project.pbxproj
freeswitch/branches/mishehu/mac/xcode/apr.plist
- copied unchanged from r2139, /freeswitch/trunk/mac/xcode/apr.plist
freeswitch/branches/mishehu/mac/xcode/aprutil.plist
- copied unchanged from r2139, /freeswitch/trunk/mac/xcode/aprutil.plist
freeswitch/branches/mishehu/mac/xcode/dingaling.plist
- copied unchanged from r2139, /freeswitch/trunk/mac/xcode/dingaling.plist
freeswitch/branches/mishehu/mac/xcode/gsm.plist
- copied unchanged from r2139, /freeswitch/trunk/mac/xcode/gsm.plist
freeswitch/branches/mishehu/mac/xcode/iksemel.plist
- copied unchanged from r2139, /freeswitch/trunk/mac/xcode/iksemel.plist
freeswitch/branches/mishehu/mac/xcode/ilbc.plist
- copied unchanged from r2139, /freeswitch/trunk/mac/xcode/ilbc.plist
freeswitch/branches/mishehu/mac/xcode/libfreeswitch.plist
- copied unchanged from r2139, /freeswitch/trunk/mac/xcode/libfreeswitch.plist
freeswitch/branches/mishehu/mac/xcode/pcre.plist
- copied unchanged from r2139, /freeswitch/trunk/mac/xcode/pcre.plist
freeswitch/branches/mishehu/mac/xcode/resample.plist
- copied unchanged from r2139, /freeswitch/trunk/mac/xcode/resample.plist
freeswitch/branches/mishehu/mac/xcode/sndfile.plist
- copied unchanged from r2139, /freeswitch/trunk/mac/xcode/sndfile.plist
freeswitch/branches/mishehu/mac/xcode/speakup.plist
- copied unchanged from r2139, /freeswitch/trunk/mac/xcode/speakup.plist
freeswitch/branches/mishehu/mac/xcode/sqlite.plist
- copied unchanged from r2139, /freeswitch/trunk/mac/xcode/sqlite.plist
freeswitch/branches/mishehu/mac/xcode/srtp.plist
- copied unchanged from r2139, /freeswitch/trunk/mac/xcode/srtp.plist
freeswitch/branches/mishehu/mac/xcode/teletone.plist
- copied unchanged from r2139, /freeswitch/trunk/mac/xcode/teletone.plist
freeswitch/branches/mishehu/w32/vsnet/Tools/libsndfile/
- copied from r2139, /freeswitch/trunk/w32/vsnet/Tools/libsndfile/
freeswitch/branches/mishehu/w32/vsnet/Tools/libsndfile/config.h
- copied unchanged from r2139, /freeswitch/trunk/w32/vsnet/Tools/libsndfile/config.h
freeswitch/branches/mishehu/w32/vsnet/Tools/libsndfile/libsndfile.vcproj
- copied unchanged from r2139, /freeswitch/trunk/w32/vsnet/Tools/libsndfile/libsndfile.vcproj
freeswitch/branches/mishehu/w32/vsnet/Tools/libsndfile/sndfile.h
- copied unchanged from r2139, /freeswitch/trunk/w32/vsnet/Tools/libsndfile/sndfile.h
Removed:
freeswitch/branches/mishehu/libs/MD5
freeswitch/branches/mishehu/mac/xcode/libs/
Modified:
freeswitch/branches/mishehu/Makefile.am
freeswitch/branches/mishehu/Makefile.in
freeswitch/branches/mishehu/scripts/socket/FreeSWITCH/Client.pm
freeswitch/branches/mishehu/scripts/socket/fs.pl
freeswitch/branches/mishehu/src/include/switch_apr.h
freeswitch/branches/mishehu/src/include/switch_core.h
freeswitch/branches/mishehu/src/include/switch_module_interfaces.h
freeswitch/branches/mishehu/src/include/switch_types.h
freeswitch/branches/mishehu/src/include/switch_utils.h
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/Makefile
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/mysqlcdr.h
freeswitch/branches/mishehu/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
freeswitch/branches/mishehu/src/mod/formats/mod_sndfile/Makefile
freeswitch/branches/mishehu/src/mod/formats/mod_sndfile/mod_sndfile.c
freeswitch/branches/mishehu/src/switch_core.c
freeswitch/branches/mishehu/src/switch_event.c
freeswitch/branches/mishehu/src/switch_ivr.c
freeswitch/branches/mishehu/src/switch_utils.c
freeswitch/branches/mishehu/w32/vsnet/GetLibs.vbs
Log:
Added checking for MySQL server 'going away' in MysqlCDR, added csvcdr.o to Makefile.
Modified: freeswitch/branches/mishehu/Makefile.am
==============================================================================
--- freeswitch/branches/mishehu/Makefile.am (original)
+++ freeswitch/branches/mishehu/Makefile.am Tue Jul 25 18:58:16 2006
@@ -164,9 +164,9 @@
@./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)
Modified: freeswitch/branches/mishehu/Makefile.in
==============================================================================
--- freeswitch/branches/mishehu/Makefile.in (original)
+++ freeswitch/branches/mishehu/Makefile.in Tue Jul 25 18:58:16 2006
@@ -805,7 +805,7 @@
distdir: $(DISTFILES)
$(am__remove_distdir)
- mkdir $(distdir)
+ mkdir -p $(distdir)
$(mkdir_p) $(distdir)/build/config $(distdir)/src/include
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
@@ -1084,9 +1084,9 @@
@./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)
Modified: freeswitch/branches/mishehu/scripts/socket/FreeSWITCH/Client.pm
==============================================================================
--- freeswitch/branches/mishehu/scripts/socket/FreeSWITCH/Client.pm (original)
+++ freeswitch/branches/mishehu/scripts/socket/FreeSWITCH/Client.pm Tue Jul 25 18:58:16 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/mishehu/scripts/socket/fs.pl
==============================================================================
--- freeswitch/branches/mishehu/scripts/socket/fs.pl (original)
+++ freeswitch/branches/mishehu/scripts/socket/fs.pl Tue Jul 25 18:58:16 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/mishehu/src/include/switch_apr.h
==============================================================================
--- freeswitch/branches/mishehu/src/include/switch_apr.h (original)
+++ freeswitch/branches/mishehu/src/include/switch_apr.h Tue Jul 25 18:58:16 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/mishehu/src/include/switch_core.h
==============================================================================
--- freeswitch/branches/mishehu/src/include/switch_core.h (original)
+++ freeswitch/branches/mishehu/src/include/switch_core.h Tue Jul 25 18:58:16 2006
@@ -867,6 +867,25 @@
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
\param fh the file handle to close
\return SWITCH_STATUS_SUCCESS if the file handle was closed
Modified: freeswitch/branches/mishehu/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/branches/mishehu/src/include/switch_module_interfaces.h (original)
+++ freeswitch/branches/mishehu/src/include/switch_module_interfaces.h Tue Jul 25 18:58:16 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/mishehu/src/include/switch_types.h
==============================================================================
--- freeswitch/branches/mishehu/src/include/switch_types.h (original)
+++ freeswitch/branches/mishehu/src/include/switch_types.h Tue Jul 25 18:58:16 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;
Modified: freeswitch/branches/mishehu/src/include/switch_utils.h
==============================================================================
--- freeswitch/branches/mishehu/src/include/switch_utils.h (original)
+++ freeswitch/branches/mishehu/src/include/switch_utils.h Tue Jul 25 18:58:16 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/mishehu/src/mod/event_handlers/mod_cdr/Makefile
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/Makefile (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/Makefile Tue Jul 25 18:58:16 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/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp Tue Jul 25 18:58:16 2006
@@ -59,6 +59,7 @@
{
if(newchannel != 0)
{
+ errorcode = 0;
memset(clid,0,80);
memset(dialplan,0,80);
memset(myuuid,0,37);
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp Tue Jul 25 18:58:16 2006
@@ -86,7 +86,7 @@
char* MysqlCDR::sql_query = 0;
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] = "";
@@ -217,29 +217,34 @@
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;
+ 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)
+ {
+ 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;
- 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));
}
}
@@ -434,13 +439,22 @@
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);
+ int mysql_stmt_error_code = mysql_stmt_execute(stmt);
+ switch_console_printf(SWITCH_CHANNEL_LOG,"MysqlCDR::process_record() - Statement executed? Error: %d\n",mysql_stmt_error_code);
- const char* bah2 = mysql_stmt_error(stmt);
- switch_console_printf(SWITCH_CHANNEL_LOG,"MySQL encountered error: %s\n",bah2);
+ 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);
+
+ if(mysql_stmt_error_code == 1)
+ {
+ connect_to_database();
+ mysql_stmt_bind_param(stmt,bindmetemp);
+ mysql_stmt_error_code = mysql_stmt_execute(stmt);
+ if (mysql_stmt_error_code != 0)
+ errorstate = 1;
+ }
- if(logchanvars && chanvars_supp.size() > 0)
+ if(logchanvars && chanvars_supp.size() > 0 && errorstate == 0)
{
long long insertid = mysql_stmt_insert_id(stmt);
@@ -484,25 +498,11 @@
}
}
-
- mysql_commit(conn);
-
- /* For future use
- if(!mysql_stmt_execute(stmt))
- {
- if(errorstate == TRUE)
- reprocess_tempdumped_data();
+ if(errorstate == 0)
mysql_commit(conn);
- errorstate=FALSE();
- }
else
- {
- errorstate = TRUE;
mysql_rollback(conn);
- tempdump_data();
- }
- */
-
+
delete [] bindmetemp;
if(temp_chanvars_holder.size() > 0)
{
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/mysqlcdr.h
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/mysqlcdr.h (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/mysqlcdr.h Tue Jul 25 18:58:16 2006
@@ -94,6 +94,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/mishehu/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Tue Jul 25 18:58:16 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)) {
@@ -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/mishehu/src/mod/formats/mod_sndfile/Makefile
==============================================================================
--- freeswitch/branches/mishehu/src/mod/formats/mod_sndfile/Makefile (original)
+++ freeswitch/branches/mishehu/src/mod/formats/mod_sndfile/Makefile Tue Jul 25 18:58:16 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/mishehu/src/mod/formats/mod_sndfile/mod_sndfile.c
==============================================================================
--- freeswitch/branches/mishehu/src/mod/formats/mod_sndfile/mod_sndfile.c (original)
+++ freeswitch/branches/mishehu/src/mod/formats/mod_sndfile/mod_sndfile.c Tue Jul 25 18:58:16 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,
};
Modified: freeswitch/branches/mishehu/src/switch_core.c
==============================================================================
--- freeswitch/branches/mishehu/src/switch_core.c (original)
+++ freeswitch/branches/mishehu/src/switch_core.c Tue Jul 25 18:58:16 2006
@@ -543,8 +543,25 @@
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)
{
Modified: freeswitch/branches/mishehu/src/switch_event.c
==============================================================================
--- freeswitch/branches/mishehu/src/switch_event.c (original)
+++ freeswitch/branches/mishehu/src/switch_event.c Tue Jul 25 18:58:16 2006
@@ -112,6 +112,7 @@
"SESSION_CRASH",
"MODULE_LOAD",
"DTMF",
+ "MESSAGE",
"ALL"
};
Modified: freeswitch/branches/mishehu/src/switch_ivr.c
==============================================================================
--- freeswitch/branches/mishehu/src/switch_ivr.c (original)
+++ freeswitch/branches/mishehu/src/switch_ivr.c Tue Jul 25 18:58:16 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/mishehu/src/switch_utils.c
==============================================================================
--- freeswitch/branches/mishehu/src/switch_utils.c (original)
+++ freeswitch/branches/mishehu/src/switch_utils.c Tue Jul 25 18:58:16 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/mishehu/w32/vsnet/GetLibs.vbs
==============================================================================
--- freeswitch/branches/mishehu/w32/vsnet/GetLibs.vbs (original)
+++ freeswitch/branches/mishehu/w32/vsnet/GetLibs.vbs Tue Jul 25 18:58:16 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