[Freeswitch-svn] [commit] r6715 - in freeswitch/branches/stkn/sofia-exp/trunk/src: . include mod/applications/mod_commands mod/applications/mod_conference mod/applications/mod_dptools mod/applications/mod_enum mod/applications/mod_expr mod/applications/mod_fifo mod/applications/mod_limit mod/applications/mod_rss mod/applications/mod_voicemail mod/asr_tts/mod_cepstral mod/codecs/mod_amr mod/dialplans/mod_dialplan_directory mod/endpoints/mod_dingaling mod/endpoints/mod_iax mod/endpoints/mod_portaudio mod/endpoints/mod_sofia mod/endpoints/mod_woomera mod/event_handlers/mod_cdr_csv mod/event_handlers/mod_event_multicast mod/event_handlers/mod_event_socket mod/event_handlers/mod_zeroconf mod/formats/mod_local_stream mod/formats/mod_native_file mod/formats/mod_shout mod/formats/mod_sndfile mod/languages/mod_spidermonkey mod/languages/mod_spidermonkey_core_db mod/languages/mod_spidermonkey_odbc mod/loggers/mod_logfile mod/say/mod_say_de mod/say/mod_say_en mod/say/mod_say_es mod/say/mod_say_fr mod/say/mod_say_it mod/say/mod_say_nl mod/xml_int/mod_xml_cdr mod/xml_int/mod_xml_curl mod/xml_int/mod_xml_rpc
Freeswitch SVN
stkn at freeswitch.org
Wed Dec 12 18:27:30 EST 2007
Author: stkn
Date: Wed Dec 12 18:27:30 2007
New Revision: 6715
Modified:
freeswitch/branches/stkn/sofia-exp/trunk/src/include/switch_module_interfaces.h
freeswitch/branches/stkn/sofia-exp/trunk/src/include/switch_resample.h
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_commands/mod_commands.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_conference/mod_conference.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_enum/mod_enum.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_expr/mod_expr.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_fifo/mod_fifo.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_limit/mod_limit.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_rss/mod_rss.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/asr_tts/mod_cepstral/mod_cepstral.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/codecs/mod_amr/mod_amr.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_iax/mod_iax.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_native_file/mod_native_file.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_shout/decode_ntom.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_shout/interface.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_shout/mpglib.h
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/loggers/mod_logfile/mod_logfile.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_de/mod_say_de.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_en/mod_say_en.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_es/mod_say_es.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_fr/mod_say_fr.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_it/mod_say_it.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_nl/mod_say_nl.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
freeswitch/branches/stkn/sofia-exp/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_apr.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_caller.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_channel.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_config.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_console.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_codec.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_db.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_file.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_session.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_event.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_ivr.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_ivr_play_say.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_loadable_module.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_log.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_resample.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_rtp.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_utils.c
freeswitch/branches/stkn/sofia-exp/trunk/src/switch_xml.cpp
Log:
Merge changes from trunk
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/include/switch_module_interfaces.h (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/include/switch_module_interfaces.h Wed Dec 12 18:27:30 2007
@@ -40,6 +40,7 @@
#define SWITCH_MODULE_INTERFACES_H
#include <switch.h>
+#include "switch_resample.h"
SWITCH_BEGIN_EXTERN_C
/*! \brief A table of functions to execute at various states
@@ -262,6 +263,8 @@
unsigned int samples;
/*! the current samplerate */
uint32_t samplerate;
+ /*! the current native samplerate */
+ uint32_t native_rate;
/*! the number of channels */
uint8_t channels;
/*! integer representation of the format */
@@ -289,6 +292,10 @@
uint32_t offset_pos;
uint32_t last_pos;
int32_t vol;
+ switch_audio_resampler_t *resampler;
+ switch_buffer_t *buffer;
+ switch_byte_t *dbuf;
+ switch_size_t dbuflen;
};
/*! \brief Abstract interface to an asr module */
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/include/switch_resample.h
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/include/switch_resample.h (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/include/switch_resample.h Wed Dec 12 18:27:30 2007
@@ -91,7 +91,7 @@
\brief Destroy an existing resampler handle
\param resampler the resampler handle to destroy
*/
-SWITCH_DECLARE(void) switch_resample_destroy(switch_audio_resampler_t *resampler);
+SWITCH_DECLARE(void) switch_resample_destroy(switch_audio_resampler_t **resampler);
/*!
\brief Resample one float buffer into another using specifications of a given handle
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_commands/mod_commands.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_commands/mod_commands.c Wed Dec 12 18:27:30 2007
@@ -1610,7 +1610,7 @@
return -1;
}
- snprintf(id, sizeof(id), "%d", holder->rows);
+ switch_snprintf(id, sizeof(id), "%d", holder->rows);
switch_xml_set_attr(switch_xml_set_flag(row, SWITCH_XML_DUP), strdup("row_id"), strdup(id));
@@ -1743,9 +1743,9 @@
holder.print_title = 0;
if ((cmdname = strchr(command, ' ')) != 0) {
*cmdname++ = '\0';
- snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api' and name = '%s'", cmdname);
+ switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api' and name = '%s'", cmdname);
} else {
- snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api'");
+ switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api'");
}
} else {
stream->write_function(stream, "-USAGE: %s\n", SHOW_SYNTAX);
@@ -1791,7 +1791,7 @@
if (holder.xml) {
char count[50];
char *xmlstr;
- snprintf(count, sizeof(count), "%d", holder.count);
+ switch_snprintf(count, sizeof(count), "%d", holder.count);
switch_xml_set_attr(switch_xml_set_flag(holder.xml, SWITCH_XML_DUP), strdup("row_count"), strdup(count));
xmlstr = switch_xml_toxml(holder.xml, SWITCH_FALSE);
@@ -1817,7 +1817,7 @@
SWITCH_STANDARD_API(version_function)
{
char version_string[1024];
- snprintf(version_string, sizeof(version_string) - 1, "FreeSwitch Version %s\n", SWITCH_VERSION_FULL);
+ switch_snprintf(version_string, sizeof(version_string) - 1, "FreeSwitch Version %s\n", SWITCH_VERSION_FULL);
stream->write_function(stream, version_string);
return SWITCH_STATUS_SUCCESS;
@@ -1831,7 +1831,7 @@
sprintf(showcmd, "help");
all = 1;
} else {
- snprintf(showcmd, sizeof(showcmd) - 1, "help %s", cmd);
+ switch_snprintf(showcmd, sizeof(showcmd) - 1, "help %s", cmd);
}
if (all) {
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_conference/mod_conference.c Wed Dec 12 18:27:30 2007
@@ -560,19 +560,19 @@
if (call_list) {
char saymsg[1024];
- snprintf(saymsg, sizeof(saymsg), "Auto Calling %d parties", call_list->itteration);
+ switch_snprintf(saymsg, sizeof(saymsg), "Auto Calling %d parties", call_list->itteration);
conference_member_say(member, saymsg, 0);
} else {
if (switch_strlen_zero(conference->special_announce)) {
/* anounce the total number of members in the conference */
if (conference->count >= conference->anounce_count && conference->anounce_count > 1) {
- snprintf(msg, sizeof(msg), "There are %d callers", conference->count);
+ switch_snprintf(msg, sizeof(msg), "There are %d callers", conference->count);
conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
} else if (conference->count == 1 && !conference->perpetual_sound) {
if (conference->alone_sound) {
conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 0);
} else {
- snprintf(msg, sizeof(msg), "You are currently the only person in this conference.");
+ switch_snprintf(msg, sizeof(msg), "You are currently the only person in this conference.");
conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
}
}
@@ -1093,7 +1093,7 @@
}
switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
+ switch_snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
conference_member_say(member, msg, 0);
@@ -1117,7 +1117,7 @@
}
switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
+ switch_snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
conference_member_say(member, msg, 0);
}
@@ -1143,7 +1143,7 @@
}
switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
+ switch_snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
conference_member_say(member, msg, 0);
@@ -1171,7 +1171,7 @@
switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
+ switch_snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
conference_member_say(member, msg, 0);
}
@@ -1196,7 +1196,7 @@
switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
+ switch_snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
conference_member_say(member, msg, 0);
@@ -1221,7 +1221,7 @@
}
switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
+ switch_snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
conference_member_say(member, msg, 0);
@@ -1248,7 +1248,7 @@
switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
+ switch_snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
conference_member_say(member, msg, 0);
@@ -1273,7 +1273,7 @@
}
switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
+ switch_snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
conference_member_say(member, msg, 0);
@@ -1301,7 +1301,7 @@
switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
+ switch_snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
conference_member_say(member, msg, 0);
@@ -1465,6 +1465,9 @@
}
}
+ switch_resample_destroy(&member->read_resampler);
+ switch_resample_destroy(&member->mux_resampler);
+
switch_clear_flag_locked(member, MFLAG_ITHREAD);
return NULL;
@@ -2490,7 +2493,7 @@
} else {
char msg[512];
- snprintf(msg, sizeof(msg), "Muted");
+ switch_snprintf(msg, sizeof(msg), "Muted");
conference_member_say(member, msg, 0);
}
if (stream != NULL) {
@@ -2524,7 +2527,7 @@
} else {
char msg[512];
- snprintf(msg, sizeof(msg), "Un-Muted");
+ switch_snprintf(msg, sizeof(msg), "Un-Muted");
conference_member_say(member, msg, 0);
}
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
@@ -3689,7 +3692,7 @@
}
/* add them to the conference */
if (flags && !strcasecmp(flags, "none")) {
- snprintf(appdata, sizeof(appdata), "%s+flags{%s}", conference_name, flags);
+ switch_snprintf(appdata, sizeof(appdata), "%s+flags{%s}", conference_name, flags);
switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, appdata);
} else {
switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, conference_name);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_dptools/mod_dptools.c Wed Dec 12 18:27:30 2007
@@ -1239,7 +1239,9 @@
int argc;
char *mydata, *argv[4] = { 0 };
char *l = NULL;
-
+ const char *tmp;
+ int rate;
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -1280,6 +1282,13 @@
}
}
+ if ((tmp = switch_channel_get_variable(channel, "record_rate"))) {
+ rate = atoi(tmp);
+ if (rate > 0) {
+ fh.samplerate = rate;
+ }
+ }
+
args.input_callback = on_dtmf;
status = switch_ivr_record_file(session, &fh, path, &args, limit);
@@ -1378,7 +1387,7 @@
char cause_num[35] = "";
cause_str = switch_channel_cause2str(cause);
- snprintf(cause_num, sizeof(cause_num), "%u", cause);
+ switch_snprintf(cause_num, sizeof(cause_num), "%u", cause);
if (switch_true(continue_on_fail) || switch_stristr(cause_str, continue_on_fail) || strstr(cause_num, continue_on_fail)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Continue on fail [%s]: Cause: %s\n", continue_on_fail, cause_str);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_enum/mod_enum.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_enum/mod_enum.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_enum/mod_enum.c Wed Dec 12 18:27:30 2007
@@ -624,17 +624,17 @@
for (rtp = globals.route_order; rtp; rtp = rtp->next) {
for (rp = results; rp; rp = rp->next) {
if (!strcasecmp(rtp->service, rp->service)) {
- snprintf(vbuf, sizeof(vbuf), "enum_route_%d", cnt++);
+ switch_snprintf(vbuf, sizeof(vbuf), "enum_route_%d", cnt++);
switch_channel_set_variable(channel, vbuf, rp->route);
- snprintf(rbp, rbl, "%s|", rp->route);
+ switch_snprintf(rbp, rbl, "%s|", rp->route);
l = strlen(rp->route) + 1;
rbp += l;
rbl -= l;
}
}
}
- snprintf(vbuf, sizeof(vbuf), "%d", cnt);
+ switch_snprintf(vbuf, sizeof(vbuf), "%d", cnt);
switch_channel_set_variable(channel, "enum_route_count", vbuf);
*(rbuf + strlen(rbuf) - 1) = '\0';
switch_channel_set_variable(channel, "enum_auto_route", rbuf);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_expr/mod_expr.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_expr/mod_expr.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_expr/mod_expr.c Wed Dec 12 18:27:30 2007
@@ -128,7 +128,7 @@
err = exprEval(e, &last_expr);
} while (err);
- snprintf(val, sizeof(val), "%0.10f", last_expr);
+ switch_snprintf(val, sizeof(val), "%0.10f", last_expr);
for (p = (val + strlen(val) - 1); p != val; p--) {
if (*p != '0') {
*(p+1) = '\0';
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_fifo/mod_fifo.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_fifo/mod_fifo.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_fifo/mod_fifo.c Wed Dec 12 18:27:30 2007
@@ -471,9 +471,9 @@
switch_assert(x_fifo);
switch_xml_set_attr_d(x_fifo, "name", node->name);
- snprintf(tmp, sizeof(buffer), "%d", node->consumer_count);
+ switch_snprintf(tmp, sizeof(buffer), "%d", node->consumer_count);
switch_xml_set_attr_d(x_fifo, "consumer_count", tmp);
- snprintf(tmp, sizeof(buffer), "%d", node->caller_count);
+ switch_snprintf(tmp, sizeof(buffer), "%d", node->caller_count);
switch_xml_set_attr_d(x_fifo, "caller_count", tmp);
cc_off = xml_hash(x_fifo, node->caller_hash, "callers", "caller", cc_off, verbose);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_limit/mod_limit.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_limit/mod_limit.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_limit/mod_limit.c Wed Dec 12 18:27:30 2007
@@ -325,7 +325,7 @@
static int group_callback(void *pArg, int argc, char **argv, char **columnNames)
{
callback_t *cbt = (callback_t *) pArg;
- snprintf(cbt->buf + strlen(cbt->buf), cbt->len - strlen(cbt->buf), "%s%c", argv[0], *argv[1]);
+ switch_snprintf(cbt->buf + strlen(cbt->buf), cbt->len - strlen(cbt->buf), "%s%c", argv[0], *argv[1]);
cbt->matches++;
return 0;
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_rss/mod_rss.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_rss/mod_rss.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_rss/mod_rss.c Wed Dec 12 18:27:30 2007
@@ -73,7 +73,7 @@
uint32_t len = (uint32_t) strlen(str);
for (x = 0; x < max; x++) {
- snprintf(tstr, sizeof(tstr), "%u", x);
+ switch_snprintf(tstr, sizeof(tstr), "%u", x);
if (!strncasecmp(str, tstr, len)) {
matches++;
}
@@ -316,28 +316,28 @@
title_txt = description_txt = rights_txt = "";
if (jumpto > -1) {
- snprintf(cmd, sizeof(cmd), "%d", jumpto);
+ switch_snprintf(cmd, sizeof(cmd), "%d", jumpto);
jumpto = -1;
} else {
switch_core_speech_flush_tts(&sh);
#ifdef MATCH_COUNT
- snprintf(buf + len, sizeof(buf) - len,
+ switch_snprintf(buf + len, sizeof(buf) - len,
",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
"Select one of the following news sources, or press 0 to exit. " ",<break time=\"600ms\"/>");
#else
- snprintf(buf + len, sizeof(buf) - len,
+ switch_snprintf(buf + len, sizeof(buf) - len,
",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
"Select one of the following news sources, followed by the pound key or press 0 to exit. " ",<break time=\"600ms\"/>");
#endif
len = (int32_t) strlen(buf);
for (idx = 0; idx < feed_index; idx++) {
- snprintf(buf + len, sizeof(buf) - len, "%d: %s. <break time=\"600ms\"/>", idx + 1, feed_names[idx]);
+ switch_snprintf(buf + len, sizeof(buf) - len, "%d: %s. <break time=\"600ms\"/>", idx + 1, feed_names[idx]);
len = (int32_t) strlen(buf);
}
- snprintf(buf + len, sizeof(buf) - len, "<break time=\"2000ms\"/>");
+ switch_snprintf(buf + len, sizeof(buf) - len, "<break time=\"2000ms\"/>");
len = (int32_t) strlen(buf);
args.input_callback = NULL;
@@ -497,7 +497,7 @@
switch_strftime(date, &retsize, sizeof(date), "%I:%M %p", &tm);
- snprintf(buf, sizeof(buf),
+ switch_snprintf(buf, sizeof(buf),
",<break time=\"500ms\"/>%s. %s. %s. local time: %s, Press 0 for options, 5 to change voice, or pound to return to the main menu. ",
title_txt, description_txt, rights_txt, date);
args.input_callback = NULL;
@@ -555,14 +555,14 @@
}
if (switch_test_flag(&dtb, SFLAG_INFO)) {
switch_clear_flag(&dtb, SFLAG_INFO);
- snprintf(buf + len, sizeof(buf) - len, "%s %s. I am speaking at %u words per minute. ", sh.engine, sh.voice, dtb.speed);
+ switch_snprintf(buf + len, sizeof(buf) - len, "%s %s. I am speaking at %u words per minute. ", sh.engine, sh.voice, dtb.speed);
len = (uint32_t) strlen(buf);
}
if (switch_test_flag(&dtb, SFLAG_INSTRUCT)) {
switch_clear_flag(&dtb, SFLAG_INSTRUCT);
cont = 1;
- snprintf(buf + len, sizeof(buf) - len,
+ switch_snprintf(buf + len, sizeof(buf) - len,
"Press star to pause or resume speech. "
"To go to the next item, press six. "
"To go back, press 4. "
@@ -570,21 +570,21 @@
"To change voices, press five. To restore the original voice press 9. "
"To hear these options again, press zero or press pound to return to the main menu. ");
} else {
- snprintf(buf + len, sizeof(buf) - len, "Story %d. ", dtb.index + 1);
+ switch_snprintf(buf + len, sizeof(buf) - len, "Story %d. ", dtb.index + 1);
len = (uint32_t) strlen(buf);
if (entries[dtb.index].subject_txt) {
- snprintf(buf + len, sizeof(buf) - len, "Subject: %s. ", entries[dtb.index].subject_txt);
+ switch_snprintf(buf + len, sizeof(buf) - len, "Subject: %s. ", entries[dtb.index].subject_txt);
len = (uint32_t) strlen(buf);
}
if (entries[dtb.index].dept_txt) {
- snprintf(buf + len, sizeof(buf) - len, "From the %s department. ", entries[dtb.index].dept_txt);
+ switch_snprintf(buf + len, sizeof(buf) - len, "From the %s department. ", entries[dtb.index].dept_txt);
len = (uint32_t) strlen(buf);
}
if (entries[dtb.index].title_txt) {
- snprintf(buf + len, sizeof(buf) - len, "%s", entries[dtb.index].title_txt);
+ switch_snprintf(buf + len, sizeof(buf) - len, "%s", entries[dtb.index].title_txt);
len = (uint32_t) strlen(buf);
}
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c Wed Dec 12 18:27:30 2007
@@ -893,7 +893,7 @@
while(switch_channel_ready(channel)) {
- snprintf(key_buf, sizeof(key_buf), "%s:%s:%s",
+ switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s",
profile->listen_file_key,
profile->save_file_key,
profile->record_file_key);
@@ -1007,7 +1007,7 @@
cbt.len = sizeof(msg_count);
- snprintf(sql, sizeof(sql),
+ switch_snprintf(sql, sizeof(sql),
"select count(*) from voicemail_data where user='%s' and domain='%s' and in_folder='%s' and read_epoch=0",
myid,
domain_name,
@@ -1015,7 +1015,7 @@
vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
*total_new_messages = atoi(msg_count);
- snprintf(sql, sizeof(sql),
+ switch_snprintf(sql, sizeof(sql),
"select count(*) from voicemail_data where user='%s' and domain='%s' and in_folder='%s' and read_epoch=0 and read_flags='%s'",
myid,
domain_name,
@@ -1024,7 +1024,7 @@
vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
*total_new_urgent_messages = atoi(msg_count);
- snprintf(sql, sizeof(sql),
+ switch_snprintf(sql, sizeof(sql),
"select count(*) from voicemail_data where user='%s' and domain='%s' and in_folder='%s' and read_epoch!=0",
myid,
domain_name,
@@ -1033,7 +1033,7 @@
*total_saved_messages = atoi(msg_count);
- snprintf(sql, sizeof(sql),
+ switch_snprintf(sql, sizeof(sql),
"select count(*) from voicemail_data where user='%s' and domain='%s' and in_folder='%s' and read_epoch!=0 and read_flags='%s'",
myid,
domain_name,
@@ -1063,7 +1063,7 @@
args.input_callback = cancel_on_dtmf;
- snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s",
+ switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s",
profile->listen_file_key,
profile->save_file_key,
profile->delete_file_key,
@@ -1071,7 +1071,7 @@
profile->callback_key);
- snprintf(input, sizeof(input), "%s:%d", cbt->type == MSG_NEW ? "new" : "saved", cbt->want+1);
+ switch_snprintf(input, sizeof(input), "%s:%d", cbt->type == MSG_NEW ? "new" : "saved", cbt->want+1);
memset(&cc, 0, sizeof(cc));
cc.profile = profile;
args.buf = &cc;
@@ -1141,13 +1141,13 @@
switch_time_exp_lt(&tm, atoi(cbt->created_epoch) * 1000000);
switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
- snprintf(tmp,sizeof(tmp), "%d", total_new_messages);
+ switch_snprintf(tmp,sizeof(tmp), "%d", total_new_messages);
switch_channel_set_variable(channel, "voicemail_total_new_messages", tmp);
- snprintf(tmp,sizeof(tmp), "%d", total_saved_messages);
+ switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_messages);
switch_channel_set_variable(channel, "voicemail_total_saved_messages", tmp);
- snprintf(tmp,sizeof(tmp), "%d", total_new_urgent_messages);
+ switch_snprintf(tmp,sizeof(tmp), "%d", total_new_urgent_messages);
switch_channel_set_variable(channel, "voicemail_urgent_new_messages", tmp);
- snprintf(tmp,sizeof(tmp), "%d", total_saved_urgent_messages);
+ switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_urgent_messages);
switch_channel_set_variable(channel, "voicemail_urgent_saved_messages", tmp);
switch_channel_set_variable(channel, "voicemail_current_folder", cbt->in_folder);
switch_channel_set_variable(channel, "voicemail_account", cbt->user);
@@ -1157,7 +1157,7 @@
switch_channel_set_variable(channel, "voicemail_file_path", cbt->file_path);
switch_channel_set_variable(channel, "voicemail_read_flags", cbt->read_flags);
switch_channel_set_variable(channel, "voicemail_time", date);
- snprintf(tmp,sizeof(tmp), "%d", priority);
+ switch_snprintf(tmp,sizeof(tmp), "%d", priority);
switch_channel_set_variable(channel, "voicemail_priority", tmp);
message_len = atoi(cbt->message_len);
@@ -1166,7 +1166,7 @@
duration.day += duration.yr * 365;
duration.hr += duration.day * 24;
- snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
+ switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
duration.hr,
duration.min,
duration.sec
@@ -1310,12 +1310,12 @@
if (total_new_urgent_messages > 0) {
- snprintf(msg_count, sizeof(msg_count), "%d:urgent-new", total_new_urgent_messages);
+ switch_snprintf(msg_count, sizeof(msg_count), "%d:urgent-new", total_new_urgent_messages);
TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
informed++;
}
if (total_new_messages > 0 && total_new_messages != total_new_urgent_messages) {
- snprintf(msg_count, sizeof(msg_count), "%d:new", total_new_messages);
+ switch_snprintf(msg_count, sizeof(msg_count), "%d:new", total_new_messages);
TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
informed++;
}
@@ -1328,13 +1328,13 @@
}
if (total_saved_urgent_messages > 0) {
- snprintf(msg_count, sizeof(msg_count), "%d:urgent-saved", total_saved_urgent_messages);
+ switch_snprintf(msg_count, sizeof(msg_count), "%d:urgent-saved", total_saved_urgent_messages);
TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
informed++;
}
if (total_saved_messages > 0 && total_saved_messages != total_saved_urgent_messages) {
- snprintf(msg_count, sizeof(msg_count), "%d:saved", total_saved_messages);
+ switch_snprintf(msg_count, sizeof(msg_count), "%d:saved", total_saved_messages);
TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
informed++;
}
@@ -1347,7 +1347,7 @@
}
if (!informed) {
- snprintf(msg_count, sizeof(msg_count), "0:new");
+ switch_snprintf(msg_count, sizeof(msg_count), "0:new");
TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
informed++;
}
@@ -1368,7 +1368,7 @@
switch(play_msg_type) {
case MSG_NEW:
{
- snprintf(sql, sizeof(sql),
+ switch_snprintf(sql, sizeof(sql),
"select * from voicemail_data where user='%s' and domain='%s' and read_epoch=0 order by read_flags", myid, domain_name);
total_messages = total_new_messages;
heard_auto_new = heard_auto_saved = 1;
@@ -1377,7 +1377,7 @@
case MSG_SAVED:
default:
{
- snprintf(sql, sizeof(sql),
+ switch_snprintf(sql, sizeof(sql),
"select * from voicemail_data where user='%s' and domain='%s' and read_epoch !=0 order by read_flags", myid, domain_name);
total_messages = total_saved_messages;
heard_auto_new = heard_auto_saved = 1;
@@ -1394,12 +1394,12 @@
break;
}
}
- snprintf(sql, sizeof(sql), "update voicemail_data set read_epoch=%ld where user='%s' and domain='%s' and flags='save'",
+ switch_snprintf(sql, sizeof(sql), "update voicemail_data set read_epoch=%ld where user='%s' and domain='%s' and flags='save'",
(long)time(NULL), myid, domain_name);
vm_execute_sql(profile, sql, profile->mutex);
- snprintf(sql, sizeof(sql), "select file_path from voicemail_data where user='%s' and domain='%s' and flags='delete'", myid, domain_name);
+ switch_snprintf(sql, sizeof(sql), "select file_path from voicemail_data where user='%s' and domain='%s' and flags='delete'", myid, domain_name);
vm_execute_sql_callback(profile, profile->mutex, sql, unlink_callback, NULL);
- snprintf(sql, sizeof(sql), "delete from voicemail_data where user='%s' and domain='%s' and flags='delete'", myid, domain_name);
+ switch_snprintf(sql, sizeof(sql), "delete from voicemail_data where user='%s' and domain='%s' and flags='delete'", myid, domain_name);
vm_execute_sql(profile, sql, profile->mutex);
vm_check_state = VM_CHECK_FOLDER_SUMMARY;
}
@@ -1425,7 +1425,7 @@
switch_safe_free(sql);
}
- snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s",
+ switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s",
profile->record_greeting_key,
profile->choose_greeting_key,
profile->record_name_key,
@@ -1506,7 +1506,7 @@
char key_buf[80] = "";
play_msg_type = MSG_NONE;
- snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s",
+ switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s",
profile->play_new_messages_key,
profile->play_saved_messages_key,
profile->config_menu_key,
@@ -1789,7 +1789,7 @@
}
}
- snprintf(sql, sizeof(sql),
+ switch_snprintf(sql, sizeof(sql),
"select * from voicemail_prefs where user='%s' and domain='%s'",
id,
domain_name);
@@ -1874,7 +1874,7 @@
if ((status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) && switch_channel_ready(channel)) {
char input[10] = "", key_buf[80] = "", term = 0;
- snprintf(key_buf, sizeof(key_buf), "%s:%s",
+ switch_snprintf(key_buf, sizeof(key_buf), "%s:%s",
profile->urgent_key,
profile->terminator_key);
@@ -1946,13 +1946,13 @@
switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
switch_channel_set_variable(channel, "voicemail_current_folder", myfolder);
- snprintf(tmp,sizeof(tmp), "%d", total_new_messages);
+ switch_snprintf(tmp,sizeof(tmp), "%d", total_new_messages);
switch_channel_set_variable(channel, "voicemail_total_new_messages", tmp);
- snprintf(tmp,sizeof(tmp), "%d", total_saved_messages);
+ switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_messages);
switch_channel_set_variable(channel, "voicemail_total_saved_messages", tmp);
- snprintf(tmp,sizeof(tmp), "%d", total_new_urgent_messages);
+ switch_snprintf(tmp,sizeof(tmp), "%d", total_new_urgent_messages);
switch_channel_set_variable(channel, "voicemail_urgent_new_messages", tmp);
- snprintf(tmp,sizeof(tmp), "%d", total_saved_urgent_messages);
+ switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_urgent_messages);
switch_channel_set_variable(channel, "voicemail_urgent_saved_messages", tmp);
switch_channel_set_variable(channel, "voicemail_account", id);
switch_channel_set_variable(channel, "voicemail_domain", domain_name);
@@ -1961,7 +1961,7 @@
switch_channel_set_variable(channel, "voicemail_file_path", file_path);
switch_channel_set_variable(channel, "voicemail_read_flags", read_flags);
switch_channel_set_variable(channel, "voicemail_time", date);
- snprintf(tmp,sizeof(tmp), "%d", priority);
+ switch_snprintf(tmp,sizeof(tmp), "%d", priority);
switch_channel_set_variable(channel, "voicemail_priority", tmp);
switch_channel_set_variable(channel, "voicemail_email", email_vm);
@@ -1971,7 +1971,7 @@
switch_core_measure_time(l_duration, &duration);
duration.day += duration.yr * 365;
duration.hr += duration.day * 24;
- snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
+ switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
duration.hr,
duration.min,
duration.sec
@@ -2366,7 +2366,7 @@
duration.day += duration.yr * 365;
duration.hr += duration.day * 24;
- snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
+ switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
duration.hr,
duration.min,
duration.sec
@@ -2383,7 +2383,7 @@
switch_strftime(read_date, &retsize, sizeof(read_date), fmt, &tm);
}
- snprintf(heard, sizeof(heard), *read_date == '\0' ? "never" : read_date);
+ switch_snprintf(heard, sizeof(heard), *read_date == '\0' ? "never" : read_date);
get = switch_mprintf("http://%s:%s%s/get/%s", holder->host, holder->port, holder->uri, fname);
del = switch_mprintf("http://%s:%s%s/del/%s", holder->host, holder->port, holder->uri, fname);
@@ -2397,7 +2397,7 @@
//"<a href=%s>Delete This Message</a><br><hr noshade size=1>",
strcmp(argv[10], URGENT_FLAG_STRING) ? "normal" : "urgent", create_date, heard, duration_str);
- snprintf(title_b4, sizeof(title_b4), "%s <%s> %s", argv[5], argv[6], rss_date);
+ switch_snprintf(title_b4, sizeof(title_b4), "%s <%s> %s", argv[5], argv[6], rss_date);
switch_url_encode(title_b4, title_aft, sizeof(title_aft)-1);
@@ -2455,7 +2455,7 @@
duration.day += duration.yr * 365;
duration.hr += duration.day * 24;
- snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
+ switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
duration.hr,
duration.min,
duration.sec
@@ -2481,7 +2481,7 @@
x_tmp = switch_xml_add_child_d(holder->x_item, "description", 0);
- snprintf(heard, sizeof(heard), *read_date == '\0' ? "never" : read_date);
+ switch_snprintf(heard, sizeof(heard), *read_date == '\0' ? "never" : read_date);
if ((fname = strrchr(argv[8], '/'))) {
fname++;
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/asr_tts/mod_cepstral/mod_cepstral.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/asr_tts/mod_cepstral/mod_cepstral.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/asr_tts/mod_cepstral/mod_cepstral.c Wed Dec 12 18:27:30 2007
@@ -134,7 +134,7 @@
cepstral->params = swift_params_new(NULL);
swift_params_set_string(cepstral->params, "audio/encoding", "pcm16");
- snprintf(srate, sizeof(srate), "%d", rate);
+ switch_snprintf(srate, sizeof(srate), "%d", rate);
swift_params_set_string(cepstral->params, "audio/sampling-rate", srate);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/codecs/mod_amr/mod_amr.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/codecs/mod_amr/mod_amr.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/codecs/mod_amr/mod_amr.c Wed Dec 12 18:27:30 2007
@@ -203,7 +203,7 @@
context->enc_mode = globals.default_bitrate;
}
- snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode);
+ switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode);
codec->fmtp_out = switch_core_strdup(codec->memory_pool, fmtptmp);
context->enc_mode = AMR_DEFAULT_BITRATE;
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c Wed Dec 12 18:27:30 2007
@@ -113,9 +113,9 @@
return NULL;
}
- snprintf(filter, sizeof(filter), "exten=%s", caller_profile->destination_number);
+ switch_snprintf(filter, sizeof(filter), "exten=%s", caller_profile->destination_number);
if (caller_profile->context) {
- snprintf(filter + strlen(filter), sizeof(filter) - strlen(filter), "context=%s", caller_profile->context);
+ switch_snprintf(filter + strlen(filter), sizeof(filter) - strlen(filter), "context=%s", caller_profile->context);
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c Wed Dec 12 18:27:30 2007
@@ -505,7 +505,7 @@
char *user, *host, *f_user = NULL, *ffrom = NULL, *f_host = NULL, *f_resource = NULL;
mdl_profile_t *profile = NULL;
- assert(proto != NULL);
+ switch_assert(proto != NULL);
if (from && (f_user = strdup(from))) {
if ((f_host = strchr(f_user, '@'))) {
@@ -749,8 +749,8 @@
static int get_codecs(struct private_object *tech_pvt)
{
- assert(tech_pvt != NULL);
- assert(tech_pvt->session != NULL);
+ switch_assert(tech_pvt != NULL);
+ switch_assert(tech_pvt->session != NULL);
if (!tech_pvt->num_codecs) {
if (globals.codec_string) {
@@ -901,7 +901,7 @@
static int do_candidates(struct private_object *tech_pvt, int force)
{
switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (switch_test_flag(tech_pvt, TFLAG_DO_CAND)) {
return 1;
@@ -1054,10 +1054,10 @@
unsigned int elapsed;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_set_flag_locked(tech_pvt, TFLAG_IO);
@@ -1147,10 +1147,10 @@
struct private_object *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt->read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN;
@@ -1170,10 +1170,10 @@
struct private_object *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL RING\n", switch_channel_get_name(channel));
@@ -1187,10 +1187,10 @@
struct private_object *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
@@ -1204,10 +1204,10 @@
struct private_object *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_clear_flag_locked(tech_pvt, TFLAG_IO);
switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
@@ -1310,7 +1310,7 @@
struct private_object *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
return SWITCH_STATUS_SUCCESS;
}
@@ -1320,7 +1320,7 @@
struct private_object *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
return SWITCH_STATUS_SUCCESS;
@@ -1331,7 +1331,7 @@
struct private_object *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF [%s]\n", dtmf);
@@ -1346,10 +1346,10 @@
int payload = 0;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (struct private_object *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session))) {
if (switch_channel_ready(channel)) {
@@ -1376,7 +1376,7 @@
if (switch_test_flag(tech_pvt, TFLAG_IO)) {
switch_status_t status;
- assert(tech_pvt->rtp_session != NULL);
+ switch_assert(tech_pvt->rtp_session != NULL);
tech_pvt->read_frame.datalen = 0;
@@ -1448,10 +1448,10 @@
int bytes = 0, samples = 0, frames = 0;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (struct private_object *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session))) {
if (switch_channel_ready(channel)) {
@@ -1496,10 +1496,10 @@
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
@@ -1515,10 +1515,10 @@
struct private_object *tech_pvt;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch (msg->message_id) {
case SWITCH_MESSAGE_INDICATE_ANSWER:
@@ -1556,10 +1556,10 @@
char *subject, *body;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
if (!(body = switch_event_get_body(event))) {
@@ -1643,7 +1643,7 @@
*p++ = '\0';
u = profile_name;
profile_name = p;
- snprintf(ubuf, sizeof(ubuf), "%s@%s/talk", u, profile_name);
+ switch_snprintf(ubuf, sizeof(ubuf), "%s@%s/talk", u, profile_name);
user = ubuf;
}
@@ -1661,10 +1661,10 @@
}
if (strchr(id_num, '@')) {
- snprintf(ubuf, sizeof(ubuf), "%s/talk", id_num);
+ switch_snprintf(ubuf, sizeof(ubuf), "%s/talk", id_num);
user = ubuf;
} else {
- snprintf(ubuf, sizeof(ubuf), "%s@%s/talk", id_num, profile_name);
+ switch_snprintf(ubuf, sizeof(ubuf), "%s@%s/talk", id_num, profile_name);
user = ubuf;
}
}
@@ -1713,7 +1713,7 @@
if (outbound_profile) {
char name[128];
- snprintf(name, sizeof(name), "DingaLing/%s", outbound_profile->destination_number);
+ switch_snprintf(name, sizeof(name), "DingaLing/%s", outbound_profile->destination_number);
switch_channel_set_name(channel, name);
caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
@@ -2198,7 +2198,7 @@
profile->message = "";
profile->user_flags |= LDL_FLAG_COMPONENT;
switch_mutex_init(&profile->mutex, SWITCH_MUTEX_NESTED, module_pool);
- snprintf(dbname, sizeof(dbname), "dingaling_%s", profile->name);
+ switch_snprintf(dbname, sizeof(dbname), "dingaling_%s", profile->name);
profile->dbname = switch_core_strdup(module_pool, dbname);
@@ -2340,7 +2340,7 @@
ldl_status status = LDL_STATUS_SUCCESS;
char *sql;
- assert(handle != NULL);
+ switch_assert(handle != NULL);
if (!(profile = ldl_handle_get_private(handle))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR NO PROFILE!\n");
@@ -2549,10 +2549,10 @@
if ((session = ldl_session_get_private(dlsession))) {
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "using Existing session for %s\n", ldl_session_get_id(dlsession));
@@ -2670,7 +2670,7 @@
context,
exten)) != 0) {
char name[128];
- snprintf(name, sizeof(name), "DingaLing/%s", tech_pvt->caller_profile->destination_number);
+ switch_snprintf(name, sizeof(name), "DingaLing/%s", tech_pvt->caller_profile->destination_number);
switch_channel_set_name(channel, name);
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_iax/mod_iax.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_iax/mod_iax.c Wed Dec 12 18:27:30 2007
@@ -338,7 +338,7 @@
}
channel = switch_core_session_get_channel(tech_pvt->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (tech_pvt->samprate || *samprate) {
@@ -459,10 +459,10 @@
private_t *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
iax_set_private(tech_pvt->iax_session, tech_pvt);
@@ -488,10 +488,10 @@
private_t *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL RING\n", switch_channel_get_name(channel));
@@ -505,10 +505,10 @@
private_t *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
@@ -522,10 +522,10 @@
private_t *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_clear_flag_locked(tech_pvt, TFLAG_IO);
switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
@@ -564,10 +564,10 @@
private_t *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch (sig) {
case SWITCH_SIG_KILL:
@@ -603,7 +603,7 @@
private_t *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
return SWITCH_STATUS_SUCCESS;
}
@@ -613,7 +613,7 @@
private_t *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
return SWITCH_STATUS_SUCCESS;
@@ -625,7 +625,7 @@
char *digit;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
if (tech_pvt->iax_session) {
for (digit = dtmf; *digit; digit++) {
iax_send_dtmf(tech_pvt->iax_session, *digit);
@@ -644,10 +644,10 @@
switch_byte_t *data;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
tech_pvt->read_frame.flags = SFF_NONE;
*frame = NULL;
@@ -713,10 +713,10 @@
//switch_frame_t *pframe;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
return SWITCH_STATUS_FALSE;
@@ -739,10 +739,10 @@
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
iax_answer(tech_pvt->iax_session);
@@ -757,10 +757,10 @@
private_t *tech_pvt;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (private_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch (msg->message_id) {
case SWITCH_MESSAGE_INDICATE_REJECT:
@@ -810,7 +810,7 @@
if (outbound_profile) {
char name[128];
- snprintf(name, sizeof(name), "IAX/%s-%04x", outbound_profile->destination_number, rand() & 0xffff);
+ switch_snprintf(name, sizeof(name), "IAX/%s-%04x", outbound_profile->destination_number, rand() & 0xffff);
switch_channel_set_name(channel, name);
caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
@@ -857,10 +857,10 @@
char *body;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
if (!(body = switch_event_get_body(event))) {
@@ -1131,7 +1131,7 @@
iaxevent->ies.called_context,
iaxevent->ies.called_number)) != 0) {
char name[128];
- snprintf(name, sizeof(name), "IAX/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
+ switch_snprintf(name, sizeof(name), "IAX/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
switch_channel_set_name(channel, name);
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c Wed Dec 12 18:27:30 2007
@@ -174,10 +174,10 @@
int16_t abuf[2048];
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
last = switch_timestamp_now() - waitsec;
@@ -249,7 +249,7 @@
char buf[512];
switch_event_t *event;
- snprintf(buf, sizeof(buf), "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id);
+ switch_snprintf(buf, sizeof(buf), "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id);
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_RINGING) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_info", "%s", buf);
@@ -306,10 +306,10 @@
private_t *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL RING\n", switch_channel_get_name(channel));
@@ -323,10 +323,10 @@
private_t *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
@@ -365,7 +365,7 @@
switch_mutex_lock(globals.pvt_lock);
if (switch_strlen_zero(tech_pvt->call_id)) {
- snprintf(tech_pvt->call_id, sizeof(tech_pvt->call_id), "%d", ++globals.call_id);
+ switch_snprintf(tech_pvt->call_id, sizeof(tech_pvt->call_id), "%d", ++globals.call_id);
switch_core_hash_insert(globals.call_hash, tech_pvt->call_id, tech_pvt);
switch_core_session_set_read_codec(tech_pvt->session, &globals.read_codec);
switch_core_session_set_write_codec(tech_pvt->session, &globals.write_codec);
@@ -433,10 +433,10 @@
private_t *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
remove_pvt(tech_pvt);
@@ -461,10 +461,10 @@
private_t *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch (sig) {
case SWITCH_SIG_KILL:
@@ -492,10 +492,10 @@
private_t *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n");
@@ -508,7 +508,7 @@
private_t *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
return SWITCH_STATUS_SUCCESS;
}
@@ -518,7 +518,7 @@
private_t *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
return SWITCH_STATUS_SUCCESS;
@@ -529,7 +529,7 @@
private_t *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF ON CALL %s [%s]\n", tech_pvt->call_id, dtmf);
@@ -544,10 +544,10 @@
switch_status_t status = SWITCH_STATUS_FALSE;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
if (!globals.audio_stream) {
return SWITCH_STATUS_FALSE;
@@ -646,10 +646,10 @@
private_t *tech_pvt = NULL;
switch_status_t status = SWITCH_STATUS_FALSE;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
if (!globals.audio_stream) {
return SWITCH_STATUS_FALSE;
@@ -681,10 +681,10 @@
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
return SWITCH_STATUS_SUCCESS;
}
@@ -695,10 +695,10 @@
private_t *tech_pvt;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch (msg->message_id) {
@@ -766,7 +766,7 @@
if (outbound_profile) {
char name[128];
const char *id = !switch_strlen_zero(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na";
- snprintf(name, sizeof(name), "PortAudio/%s", id);
+ switch_snprintf(name, sizeof(name), "PortAudio/%s", id);
switch_channel_set_name(channel, name);
@@ -1611,7 +1611,7 @@
ip, NULL, NULL, NULL, modname, NULL,
dest)) != 0) {
char name[128];
- snprintf(name, sizeof(name), "PortAudio/%s",
+ switch_snprintf(name, sizeof(name), "PortAudio/%s",
tech_pvt->caller_profile->destination_number ? tech_pvt->caller_profile->destination_number : modname);
switch_channel_set_name(channel, name);
@@ -1689,19 +1689,19 @@
if (action) {
if (strlen(action) == 1) {
- snprintf(cmd_buf, sizeof(cmd_buf), "dtmf %s", action);
+ switch_snprintf(cmd_buf, sizeof(cmd_buf), "dtmf %s", action);
cmd = cmd_buf;
} else if (!strcmp(action, "mute")) {
- snprintf(cmd_buf, sizeof(cmd_buf), "flags off mouth");
+ switch_snprintf(cmd_buf, sizeof(cmd_buf), "flags off mouth");
cmd = cmd_buf;
} else if (!strcmp(action, "unmute")) {
- snprintf(cmd_buf, sizeof(cmd_buf), "flags on mouth");
+ switch_snprintf(cmd_buf, sizeof(cmd_buf), "flags on mouth");
cmd = cmd_buf;
} else if (!strcmp(action, "switch")) {
- snprintf(cmd_buf, sizeof(cmd_buf), "switch %s", wcmd);
+ switch_snprintf(cmd_buf, sizeof(cmd_buf), "switch %s", wcmd);
cmd = cmd_buf;
} else if (!strcmp(action, "call")) {
- snprintf(cmd_buf, sizeof(cmd_buf), "call %s", wcmd);
+ switch_snprintf(cmd_buf, sizeof(cmd_buf), "call %s", wcmd);
cmd = cmd_buf;
} else if (!strcmp(action, "hangup") || !strcmp(action, "list") || !strcmp(action, "answer")) {
cmd = action;
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Wed Dec 12 18:27:30 2007
@@ -77,10 +77,10 @@
private_object_t *tech_pvt;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
tech_pvt->read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN;
@@ -107,10 +107,10 @@
private_object_t *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SOFIA RING\n");
@@ -123,10 +123,10 @@
private_object_t *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SOFIA EXECUTE\n");
@@ -197,10 +197,10 @@
int sip_cause;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
cause = switch_channel_get_cause(channel);
sip_cause = hangup_cause_to_sip(cause);
@@ -269,10 +269,10 @@
uint32_t session_timeout = 0;
const char *val;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
@@ -350,10 +350,10 @@
int payload = 0;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
return SWITCH_STATUS_FALSE;
@@ -378,7 +378,7 @@
return SWITCH_STATUS_GENERR;
}
- assert(tech_pvt->rtp_session != NULL);
+ switch_assert(tech_pvt->rtp_session != NULL);
tech_pvt->video_read_frame.datalen = 0;
while (switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->video_read_frame.datalen == 0) {
@@ -417,10 +417,10 @@
switch_status_t status = SWITCH_STATUS_SUCCESS;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
while (!(tech_pvt->video_read_codec.implementation && switch_rtp_ready(tech_pvt->video_rtp_session))) {
if (switch_channel_ready(channel)) {
@@ -457,10 +457,10 @@
int payload = 0;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
return SWITCH_STATUS_FALSE;
@@ -484,7 +484,7 @@
return SWITCH_STATUS_GENERR;
}
- assert(tech_pvt->rtp_session != NULL);
+ switch_assert(tech_pvt->rtp_session != NULL);
tech_pvt->read_frame.datalen = 0;
@@ -543,10 +543,10 @@
int bytes = 0, samples = 0, frames = 0;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session))) {
if (switch_channel_ready(channel)) {
@@ -595,10 +595,10 @@
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch (sig) {
@@ -632,10 +632,10 @@
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
return SWITCH_STATUS_SUCCESS;
}
@@ -646,10 +646,10 @@
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
return SWITCH_STATUS_SUCCESS;
}
@@ -659,7 +659,7 @@
private_object_t *tech_pvt;
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
return switch_rtp_queue_rfc2833(tech_pvt->rtp_session,
digits, tech_pvt->profile->dtmf_duration * (tech_pvt->read_codec.implementation->samples_per_second / 1000));
@@ -672,10 +672,10 @@
switch_status_t status;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch (msg->message_id) {
case SWITCH_MESSAGE_INDICATE_BROADCAST: {
@@ -939,10 +939,10 @@
nua_handle_t *msg_nh;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
if (!(body = switch_event_get_body(event))) {
body = "";
@@ -1020,7 +1020,7 @@
}
if (!strcasecmp(argv[0], "gateway")) {
if ((gp = sofia_reg_find_gateway(argv[1]))) {
- assert(gp->state < REG_STATE_LAST);
+ switch_assert(gp->state < REG_STATE_LAST);
stream->write_function(stream, "%s\n", line);
stream->write_function(stream, "Name \t%s\n", switch_str_nil(gp->name));
@@ -1108,7 +1108,7 @@
c++;
for (gp = profile->gateways; gp; gp = gp->next) {
- assert(gp->state < REG_STATE_LAST);
+ switch_assert(gp->state < REG_STATE_LAST);
stream->write_function(stream, "%25s\t%s\t %32s\t%s", gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]);
if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) {
stream->write_function(stream, " (retry: %ds)", gp->retry - time(NULL));
@@ -1280,7 +1280,7 @@
}
data = strdup(cmd);
- assert(data);
+ switch_assert(data);
if ((p = strchr(data, '/'))) {
profile_name = data;
@@ -1323,7 +1323,7 @@
cb.stream = &mystream;
sql = switch_mprintf("select contact from sip_registrations where sip_user='%q' and sip_host='%q'", user, domain);
- assert(sql);
+ switch_assert(sql);
sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, contact_callback, &cb);
switch_safe_free(sql);
if (mystream.data) {
@@ -1526,7 +1526,7 @@
if ((dest_to = strchr(dest, '^'))) {
*dest_to++ = '\0';
tech_pvt->dest_to = switch_core_session_alloc(nsession, strlen(dest_to) + 5);
- snprintf(tech_pvt->dest_to, strlen(dest_to) + 5, "sip:%s", dest_to);
+ switch_snprintf(tech_pvt->dest_to, strlen(dest_to) + 5, "sip:%s", dest_to);
}
if ((host = strchr(dest, '%'))) {
@@ -1559,7 +1559,7 @@
}
} else {
tech_pvt->dest = switch_core_session_alloc(nsession, strlen(dest) + 5);
- snprintf(tech_pvt->dest, strlen(dest) + 5, "sip:%s", dest);
+ switch_snprintf(tech_pvt->dest, strlen(dest) + 5, "sip:%s", dest);
}
}
@@ -1593,7 +1593,7 @@
*/
private_object_t *ctech_pvt;
ctech_pvt = switch_core_session_get_private(session);
- assert(ctech_pvt != NULL);
+ switch_assert(ctech_pvt != NULL);
tech_pvt->bte = ctech_pvt->te;
tech_pvt->bcng_pt = ctech_pvt->cng_pt;
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Dec 12 18:27:30 2007
@@ -66,7 +66,7 @@
}
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
switch_channel_answer(channel);
switch_channel_set_variable(channel, "auto_answer_destination", switch_channel_get_variable(channel, "destination_number"));
@@ -713,7 +713,7 @@
}
skip:
- assert(gateway_tag);
+ switch_assert(gateway_tag);
}
}
@@ -745,7 +745,7 @@
return status;
}
- snprintf(url, sizeof(url), "profile=%s", switch_str_nil(profile_name));
+ switch_snprintf(url, sizeof(url), "profile=%s", switch_str_nil(profile_name));
if (!(xml = switch_xml_open_cfg(cf, &cfg, url))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
@@ -800,7 +800,7 @@
profile->user_agent = SOFIA_USER_AGENT;
profile->name = switch_core_strdup(profile->pool, xprofilename);
- snprintf(url, sizeof(url), "sofia_reg_%s", xprofilename);
+ switch_snprintf(url, sizeof(url), "sofia_reg_%s", xprofilename);
profile->dbname = switch_core_strdup(profile->pool, url);
switch_core_hash_init(&profile->chat_hash, profile->pool);
@@ -1178,11 +1178,11 @@
if (session) {
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
- assert(tech_pvt->nh != NULL);
+ switch_assert(tech_pvt != NULL);
+ switch_assert(tech_pvt->nh != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel %s entering state [%s]\n",
switch_channel_get_name(channel), nua_callstate_name(ss_state));
@@ -1299,7 +1299,7 @@
if (replaces_str) {
home = su_home_new(sizeof(*home));
- assert(home != NULL);
+ switch_assert(home != NULL);
if ((replaces = sip_replaces_make(home, replaces_str))
&& (bnh = nua_handle_by_replaces(nua, replaces))) {
sofia_private_t *b_private;
@@ -1500,7 +1500,7 @@
if (switch_test_flag(tech_pvt, TFLAG_NOHUP)) {
switch_clear_flag_locked(tech_pvt, TFLAG_NOHUP);
} else {
- snprintf(st, sizeof(st), "%d", status);
+ switch_snprintf(st, sizeof(st), "%d", status);
switch_channel_set_variable(channel, "sip_term_status", st);
switch_channel_hangup(channel, sofia_glue_sip_cause_to_freeswitch(status));
}
@@ -1590,7 +1590,7 @@
}
home = su_home_new(sizeof(*home));
- assert(home != NULL);
+ switch_assert(home != NULL);
if ((replaces = sip_replaces_make(home, rep))
&& (bnh = nua_handle_by_replaces(nua, replaces))) {
@@ -1807,13 +1807,13 @@
channel = switch_core_session_get_channel(session);
/* Barf if we didn't get it */
- assert(channel != NULL);
+ switch_assert(channel != NULL);
/* make sure we have our privates */
tech_pvt = switch_core_session_get_private(session);
/* Barf if we didn't get it */
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
/* move signal_ptr where we need it (right past Signal=) */
signal_ptr = signal_ptr + 7;
@@ -2098,7 +2098,7 @@
if (sip->sip_max_forwards) {
char max_forwards[32];
- snprintf(max_forwards, sizeof(max_forwards), "%lu", sip->sip_max_forwards->mf_count);
+ switch_snprintf(max_forwards, sizeof(max_forwards), "%lu", sip->sip_max_forwards->mf_count);
switch_channel_set_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE, max_forwards);
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Dec 12 18:27:30 2007
@@ -81,7 +81,7 @@
tech_pvt->session_id++;
- snprintf(buf, sizeof(buf),
+ switch_snprintf(buf, sizeof(buf),
"v=0\n"
"o=FreeSWITCH %010u %010u IN IP4 %s\n"
"s=FreeSWITCH\n"
@@ -90,7 +90,7 @@
"m=audio %d RTP/AVP", tech_pvt->owner_id, tech_pvt->session_id, ip, ip, sr, port);
if (tech_pvt->rm_encoding) {
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt);
} else if (tech_pvt->num_codecs) {
int i;
int already_did[128] = { 0 };
@@ -109,7 +109,7 @@
already_did[imp->ianacode] = 1;
}
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", imp->ianacode);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", imp->ianacode);
if (!ptime) {
ptime = imp->microseconds_per_frame / 1000;
}
@@ -117,20 +117,20 @@
}
if (tech_pvt->te > 95) {
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te);
}
if (tech_pvt->cng_pt && use_cng) {
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt);
}
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\n");
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\n");
if (tech_pvt->rm_encoding) {
rate = tech_pvt->rm_rate;
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", tech_pvt->pt, tech_pvt->rm_encoding, rate);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", tech_pvt->pt, tech_pvt->rm_encoding, rate);
if (tech_pvt->fmtp_out) {
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->pt, tech_pvt->fmtp_out);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->pt, tech_pvt->fmtp_out);
}
if (tech_pvt->read_codec.implementation && !ptime) {
ptime = tech_pvt->read_codec.implementation->microseconds_per_frame / 1000;
@@ -159,38 +159,38 @@
if (ptime && ptime != imp->microseconds_per_frame / 1000) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ptime %u != advertised ptime %u\n", imp->microseconds_per_frame / 1000, ptime);
}
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, rate);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, rate);
if (imp->fmtp) {
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp);
}
}
}
if (tech_pvt->te > 95) {
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te);
}
if (tech_pvt->cng_pt && use_cng) {
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d CN/8000\n", tech_pvt->cng_pt);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d CN/8000\n", tech_pvt->cng_pt);
if (!tech_pvt->rm_encoding) {
tech_pvt->cng_pt = 0;
}
} else {
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=silenceSupp:off - - - -\n");
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=silenceSupp:off - - - -\n");
}
if (ptime) {
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=ptime:%d\n", ptime);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=ptime:%d\n", ptime);
}
if (switch_test_flag(tech_pvt, TFLAG_VIDEO) && tech_pvt->video_rm_encoding) {
sofia_glue_tech_choose_video_port(tech_pvt);
if ((v_port = tech_pvt->adv_sdp_video_port)) {
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=video %d RTP/AVP", v_port);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=video %d RTP/AVP", v_port);
sofia_glue_tech_set_video_codec(tech_pvt, 0);
/*****************************/
if (tech_pvt->video_rm_encoding) {
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->video_pt);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->video_pt);
} else if (tech_pvt->num_codecs) {
int i;
int already_did[128] = { 0 };
@@ -208,20 +208,20 @@
already_did[imp->ianacode] = 1;
}
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", imp->ianacode);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", imp->ianacode);
if (!ptime) {
ptime = imp->microseconds_per_frame / 1000;
}
}
}
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\n");
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\n");
if (tech_pvt->rm_encoding) {
rate = tech_pvt->video_rm_rate;
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%ld\n", tech_pvt->video_pt, tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%ld\n", tech_pvt->video_pt, tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate);
if (tech_pvt->video_fmtp_out) {
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->video_pt, tech_pvt->video_fmtp_out);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->video_pt, tech_pvt->video_fmtp_out);
}
} else if (tech_pvt->num_codecs) {
int i;
@@ -244,9 +244,9 @@
rate = imp->samples_per_second;
}
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, imp->samples_per_second);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, imp->samples_per_second);
if (imp->fmtp) {
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp);
}
}
}
@@ -269,7 +269,7 @@
goto end;
}
- assert(tech_pvt->session != NULL);
+ switch_assert(tech_pvt->session != NULL);
if ((abs = switch_channel_get_variable(tech_pvt->channel, "absolute_codec_string"))) {
codec_string = abs;
@@ -327,9 +327,9 @@
{
char name[256];
- assert(session != NULL);
- assert(profile != NULL);
- assert(tech_pvt != NULL);
+ switch_assert(session != NULL);
+ switch_assert(profile != NULL);
+ switch_assert(tech_pvt != NULL);
switch_core_session_add_stream(session, NULL);
@@ -358,7 +358,7 @@
switch_core_session_set_private(session, tech_pvt);
- snprintf(name, sizeof(name), "sofia/%s/%s", profile->name, channame);
+ switch_snprintf(name, sizeof(name), "sofia/%s/%s", profile->name, channame);
switch_channel_set_name(tech_pvt->channel, name);
}
@@ -414,7 +414,7 @@
tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip);
tech_pvt->adv_sdp_audio_port = sdp_port;
- snprintf(tmp, sizeof(tmp), "%d", sdp_port);
+ switch_snprintf(tmp, sizeof(tmp), "%d", sdp_port);
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE, tmp);
@@ -446,7 +446,7 @@
tech_pvt->adv_sdp_video_port = sdp_port;
- snprintf(tmp, sizeof(tmp), "%d", sdp_port);
+ switch_snprintf(tmp, sizeof(tmp), "%d", sdp_port);
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_PORT_VARIABLE, tmp);
@@ -680,12 +680,12 @@
const char *rep;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER);
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_clear_flag_locked(tech_pvt, TFLAG_SDP);
@@ -838,13 +838,13 @@
char hash_key[256] = "";
e_dest = strdup(tech_pvt->e_dest);
- assert(e_dest != NULL);
+ switch_assert(e_dest != NULL);
user = e_dest;
if ((host = strchr(user, '@'))) {
*host++ = '\0';
}
- snprintf(hash_key, sizeof(hash_key), "%s%s%s", user, host, cid_num);
+ switch_snprintf(hash_key, sizeof(hash_key), "%s%s%s", user, host, cid_num);
tech_pvt->chat_from = tech_pvt->from_str;
tech_pvt->chat_to = tech_pvt->dest;
@@ -906,10 +906,10 @@
switch_caller_profile_t *caller_profile;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
caller_profile = switch_channel_get_caller_profile(channel);
@@ -1124,7 +1124,7 @@
char tmp[50];
uint32_t rtp_timeout_sec = tech_pvt->profile->rtp_timeout_sec;
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
if (switch_channel_test_flag(tech_pvt->channel, CF_BYPASS_MEDIA)) {
@@ -1175,7 +1175,7 @@
tech_pvt->agreed_pt,
tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
- snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
+ switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE, tmp);
@@ -1318,8 +1318,8 @@
sdp_session_t *sdp;
uint8_t match = 0;
- assert(tech_pvt != NULL);
- assert(r_sdp != NULL);
+ switch_assert(tech_pvt != NULL);
+ switch_assert(r_sdp != NULL);
parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0);
@@ -1368,10 +1368,10 @@
const char *val;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
greedy = !!(tech_pvt->profile->pflags & PFLAG_GREEDY);
@@ -1542,7 +1542,7 @@
char tmp[80];
int num;
- snprintf(tmp, sizeof(tmp), "%s@%uk@%ui", near_match->iananame, near_match->samples_per_second, ptime);
+ switch_snprintf(tmp, sizeof(tmp), "%s@%uk@%ui", near_match->iananame, near_match->samples_per_second, ptime);
prefs[0] = tmp;
num = switch_loadable_module_get_codecs_sorted(search, 1, prefs, 1);
@@ -1569,7 +1569,7 @@
tech_pvt->rm_fmtp = switch_core_session_strdup(session, (char *) map->rm_fmtp);
tech_pvt->remote_sdp_audio_port = (switch_port_t) m->m_port;
tech_pvt->agreed_pt = (switch_payload_t) map->rm_pt;
- snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
+ switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip);
switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp);
@@ -1651,7 +1651,7 @@
tech_pvt->video_rm_fmtp = switch_core_session_strdup(session, (char *) map->rm_fmtp);
tech_pvt->remote_sdp_video_port = (switch_port_t) m->m_port;
tech_pvt->video_agreed_pt = (switch_payload_t) map->rm_pt;
- snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_video_port);
+ switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_video_port);
switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_VIDEO_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip);
switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_VIDEO_PORT_VARIABLE, tmp);
} else {
@@ -1740,7 +1740,7 @@
if ((val = switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE))
&& (other_session = switch_core_session_locate(val))) {
other_channel = switch_core_session_get_channel(other_session);
- assert(other_channel != NULL);
+ switch_assert(other_channel != NULL);
switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, sdp);
if (!switch_test_flag(tech_pvt, TFLAG_CHANGE_MEDIA) && (switch_channel_test_flag(other_channel, CF_OUTBOUND) &&
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Wed Dec 12 18:27:30 2007
@@ -53,7 +53,7 @@
}
user = strdup(to);
- assert(user);
+ switch_assert(user);
if ((host = strchr(user, '@'))) {
*host++ = '\0';
@@ -183,7 +183,7 @@
switch_stream_handle_t stream = { 0 };
switch_event_header_t *hp;
- assert(event != NULL);
+ switch_assert(event != NULL);
if (!(account = switch_event_get_header(event, "mwi-message-account"))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing required Header 'MWI-Message-Account'\n");
@@ -196,7 +196,7 @@
}
dup_account = strdup(account);
- assert(dup_account != NULL);
+ switch_assert(dup_account != NULL);
sofia_glue_get_user_host(dup_account, &user, &host);
if (!host || !(profile = sofia_glue_find_profile(host))) {
@@ -226,7 +226,7 @@
switch_safe_free(stream.data);
- assert (sql != NULL);
+ switch_assert (sql != NULL);
sofia_glue_execute_sql_callback(profile,
SWITCH_FALSE,
profile->ireg_mutex,
@@ -292,7 +292,7 @@
sql = switch_mprintf("select *,1,'%q','%q' from sip_subscriptions where event='presence'", status, rpid);
}
- assert(sql != NULL);
+ switch_assert(sql != NULL);
switch_mutex_lock(mod_sofia_globals.hash_mutex);
for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
@@ -792,7 +792,7 @@
to_host, event
);
- assert(sql != NULL);
+ switch_assert(sql != NULL);
sofia_glue_execute_sql(profile, SWITCH_FALSE, sql, NULL);
free(sql);
@@ -803,7 +803,7 @@
sql = switch_mprintf("insert into sip_subscriptions values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld)",
proto, from_user, from_host, to_user, to_host, event, contact_str, call_id, full_from, full_via, exp);
- assert(sql != NULL);
+ switch_assert(sql != NULL);
sofia_glue_execute_sql(profile, SWITCH_FALSE, sql, NULL);
free(sql);
@@ -958,7 +958,7 @@
{
url_t *to = sip->sip_to->a_url;
url_t *from = sip->sip_from->a_url;
- snprintf(hash_key, len, "%s%s%s", from->url_user, from->url_host, to->url_user);
+ switch_snprintf(hash_key, len, "%s%s%s", from->url_user, from->url_host, to->url_user);
}
void sofia_presence_handle_sip_i_message(int status,
@@ -1081,7 +1081,7 @@
if (sofia_reg_find_reg_url(tech_pvt->profile, sip->sip_from->a_url->url_user, sip->sip_from->a_url->url_host, buf, sizeof(buf))) {
home = su_home_new(sizeof(*home));
- assert(home != NULL);
+ switch_assert(home != NULL);
tech_pvt->chat_from = sip_header_as_string(home, (const sip_header_t *) sip->sip_to);
tech_pvt->chat_to = switch_core_session_strdup(tech_pvt->session, buf);
sofia_presence_set_hash_key(hash_key, sizeof(hash_key), sip);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Wed Dec 12 18:27:30 2007
@@ -159,7 +159,7 @@
char *contact = NULL;
char to[128] = "";
- snprintf(to, sizeof(to), "%s@%s", argv[1], argv[2]);
+ switch_snprintf(to, sizeof(to), "%s@%s", argv[1], argv[2]);
contact = sofia_glue_get_url_from_contact(argv[3], 1);
nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(profile->url), SIPTAG_TO_STR(to), NUTAG_URL(contact), SIPTAG_CONTACT_STR(profile->url), TAG_END());
@@ -211,9 +211,9 @@
#endif
if (now) {
- snprintf(sql, sizeof(sql), "select '%s',* from sip_registrations where expires > 0 and expires <= %ld", profile->name, (long) now);
+ switch_snprintf(sql, sizeof(sql), "select '%s',* from sip_registrations where expires > 0 and expires <= %ld", profile->name, (long) now);
} else {
- snprintf(sql, sizeof(sql), "select '%s',* from sip_registrations where expires > 0", profile->name);
+ switch_snprintf(sql, sizeof(sql), "select '%s',* from sip_registrations where expires > 0", profile->name);
}
switch_mutex_lock(profile->ireg_mutex);
@@ -224,26 +224,26 @@
sofia_reg_del_callback,
NULL);
if (now) {
- snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and expires <= %ld", (long) now);
+ switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and expires <= %ld", (long) now);
} else {
- snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0");
+ switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0");
}
sofia_glue_execute_sql(profile, SWITCH_TRUE, sql, NULL);
if (now) {
- snprintf(sql, sizeof(sql), "delete from sip_authentication where expires > 0 and expires <= %ld", (long) now);
+ switch_snprintf(sql, sizeof(sql), "delete from sip_authentication where expires > 0 and expires <= %ld", (long) now);
} else {
- snprintf(sql, sizeof(sql), "delete from sip_authentication where expires > 0");
+ switch_snprintf(sql, sizeof(sql), "delete from sip_authentication where expires > 0");
}
sofia_glue_execute_sql(profile, SWITCH_TRUE, sql, NULL);
if (now) {
- snprintf(sql, sizeof(sql), "delete from sip_subscriptions where expires > 0 and expires <= %ld", (long) now);
+ switch_snprintf(sql, sizeof(sql), "delete from sip_subscriptions where expires > 0 and expires <= %ld", (long) now);
} else {
- snprintf(sql, sizeof(sql), "delete from sip_subscriptions where expires > 0");
+ switch_snprintf(sql, sizeof(sql), "delete from sip_subscriptions where expires > 0");
}
sofia_glue_execute_sql(profile, SWITCH_TRUE, sql, NULL);
if (now) {
- snprintf(sql, sizeof(sql), "select * from sip_registrations where status like '%%NATHACK%%'");
+ switch_snprintf(sql, sizeof(sql), "select * from sip_registrations where status like '%%NATHACK%%'");
sofia_glue_execute_sql_callback(profile,
SWITCH_TRUE,
NULL,
@@ -269,9 +269,9 @@
cbt.len = len;
if (host) {
- snprintf(val, len, "select contact from sip_registrations where sip_user='%s' and sip_host='%s'", user, host);
+ switch_snprintf(val, len, "select contact from sip_registrations where sip_user='%s' and sip_host='%s'", user, host);
} else {
- snprintf(val, len, "select contact from sip_registrations where sip_user='%s'", user);
+ switch_snprintf(val, len, "select contact from sip_registrations where sip_user='%s'", user);
}
@@ -303,7 +303,7 @@
switch_mutex_lock(profile->ireg_mutex);
sql = switch_mprintf("insert into sip_authentication (nonce, expires) values('%q', %ld)",
uuid_str, time(NULL) + profile->nonce_ttl);
- assert(sql != NULL);
+ switch_assert(sql != NULL);
sofia_glue_execute_sql(profile, SWITCH_FALSE, sql, NULL);
switch_safe_free(sql);
switch_mutex_unlock(profile->ireg_mutex);
@@ -346,7 +346,7 @@
const char *call_id = NULL;
/* all callers must confirm that sip, sip->sip_request and sip->sip_contact are not NULL */
- assert(sip != NULL && sip->sip_contact != NULL && sip->sip_request != NULL);
+ switch_assert(sip != NULL && sip->sip_contact != NULL && sip->sip_request != NULL);
get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_addr);
network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
@@ -385,10 +385,10 @@
}
if (contact->m_url->url_params) {
- snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%s;%s>",
+ switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%s;%s>",
display, contact->m_url->url_user, contact->m_url->url_host, port, contact->m_url->url_params);
} else {
- snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%s>", display, contact->m_url->url_user, contact->m_url->url_host, port);
+ switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%s>", display, contact->m_url->url_user, contact->m_url->url_host, port);
}
}
@@ -423,10 +423,10 @@
if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact"))) {
if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-connectile-dysfunction")) {
if (contact->m_url->url_params) {
- snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s>",
+ switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s>",
display, contact->m_url->url_user, network_ip, network_port, contact->m_url->url_params);
} else {
- snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d>", display, contact->m_url->url_user, network_ip, network_port);
+ switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d>", display, contact->m_url->url_user, network_ip, network_port);
}
cd = 1;
exptime = 20;
@@ -475,7 +475,7 @@
}
call_id = sip->sip_call_id->i_id; //sip_header_as_string(profile->home, (void *) sip->sip_call_id);
- assert(call_id);
+ switch_assert(call_id);
if (exptime) {
@@ -709,7 +709,7 @@
goto cancel;
}
- snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->register_username, gateway->register_password);
+ switch_snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->register_username, gateway->register_password);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Authenticating '%s' with '%s'.\n", profile->username, authentication);
@@ -810,7 +810,7 @@
if (switch_strlen_zero(np)) {
first = 1;
sql = switch_mprintf("select nonce from sip_authentication where nonce='%q'", nonce);
- assert(sql != NULL);
+ switch_assert(sql != NULL);
if (!sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, np, nplen)) {
free(sql);
ret = AUTH_STALE;
@@ -992,7 +992,7 @@
char *mydata, *argv[50];
mydata = strdup(val);
- assert(mydata != NULL);
+ switch_assert(mydata != NULL);
argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0])));
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c Wed Dec 12 18:27:30 2007
@@ -205,10 +205,10 @@
int rate = 8000;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt->frame.data = tech_pvt->databuf;
@@ -248,10 +248,10 @@
struct private_object *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERA RING\n", switch_channel_get_name(channel));
@@ -265,10 +265,10 @@
struct private_object *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERA EXECUTE\n", switch_channel_get_name(channel));
@@ -282,10 +282,10 @@
struct private_object *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
switch_core_codec_destroy(&tech_pvt->read_codec);
switch_core_codec_destroy(&tech_pvt->write_codec);
@@ -320,10 +320,10 @@
struct private_object *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
if (!tech_pvt->udp_socket) {
return SWITCH_STATUS_FALSE;
@@ -366,7 +366,7 @@
struct private_object *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
return switch_socket_waitfor(tech_pvt->read_poll, ms) ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS;
}
@@ -376,7 +376,7 @@
struct private_object *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
return SWITCH_STATUS_SUCCESS;
// return switch_socket_waitfor(tech_pvt->write_poll, ms);
@@ -390,10 +390,10 @@
switch_size_t len;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
for(;;) {
if (switch_test_flag(tech_pvt, TFLAG_ABORT) || !tech_pvt->udp_socket) {
@@ -436,10 +436,10 @@
//switch_frame_t *pframe;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
if (switch_test_flag(tech_pvt, TFLAG_ABORT) || !tech_pvt->udp_socket) {
return SWITCH_STATUS_GENERR;
@@ -506,7 +506,7 @@
char name[128];
switch_caller_profile_t *caller_profile;
- snprintf(name, sizeof(name), "Woomera/%s-%04x", outbound_profile->destination_number, rand() & 0xffff);
+ switch_snprintf(name, sizeof(name), "Woomera/%s-%04x", outbound_profile->destination_number, rand() & 0xffff);
switch_channel_set_name(channel, name);
caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
@@ -953,13 +953,13 @@
woomera_message wmsg;
int res = 0;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
+ switch_assert(tech_pvt != NULL);
if (!tech_pvt->udp_socket) {
tech_create_read_socket(tech_pvt);
@@ -1089,7 +1089,7 @@
NULL,
exten)) != 0) {
char name[128];
- snprintf(name, sizeof(name), "Woomera/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
+ switch_snprintf(name, sizeof(name), "Woomera/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
switch_channel_set_name(channel, name);
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c Wed Dec 12 18:27:30 2007
@@ -217,24 +217,24 @@
tt_created = (time_t) (caller_profile->times->created / 1000000);
mtt_created = (time_t) (caller_profile->times->created / 1000);
- snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_created);
+ switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_created);
switch_channel_set_variable(channel, "start_epoch", tmp);
- snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->created);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->created);
switch_channel_set_variable(channel, "start_uepoch", tmp);
tt_answered = (time_t) (caller_profile->times->answered / 1000000);
mtt_answered = (time_t) (caller_profile->times->answered / 1000);
- snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_answered);
+ switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_answered);
switch_channel_set_variable(channel, "answer_epoch", tmp);
- snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
switch_channel_set_variable(channel, "answer_uepoch", tmp);
tt_hungup = (time_t) (caller_profile->times->hungup / 1000000);
mtt_hungup = (time_t) (caller_profile->times->hungup / 1000);
- snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_hungup);
+ switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_hungup);
switch_channel_set_variable(channel, "end_epoch", tmp);
- snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup);
switch_channel_set_variable(channel, "end_uepoch", tmp);
uduration = caller_profile->times->hungup - caller_profile->times->created;
@@ -253,22 +253,22 @@
switch_channel_set_variable(channel, "last_arg", last_arg);
switch_channel_set_variable(channel, "caller_id", cid_buf);
- snprintf(tmp, sizeof(tmp), "%d", duration);
+ switch_snprintf(tmp, sizeof(tmp), "%d", duration);
switch_channel_set_variable(channel, "duration", tmp);
- snprintf(tmp, sizeof(tmp), "%d", billsec);
+ switch_snprintf(tmp, sizeof(tmp), "%d", billsec);
switch_channel_set_variable(channel, "billsec", tmp);
- snprintf(tmp, sizeof(tmp), "%d", mduration);
+ switch_snprintf(tmp, sizeof(tmp), "%d", mduration);
switch_channel_set_variable(channel, "mduration", tmp);
- snprintf(tmp, sizeof(tmp), "%d", billmsec);
+ switch_snprintf(tmp, sizeof(tmp), "%d", billmsec);
switch_channel_set_variable(channel, "billmsec", tmp);
- snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, uduration);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, uduration);
switch_channel_set_variable(channel, "uduration", tmp);
- snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, billusec);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, billusec);
switch_channel_set_variable(channel, "billusec", tmp);
if (globals.debug) {
@@ -395,7 +395,7 @@
size_t len = strlen(param->txt) + 2;
if (end_of(param->txt) != '\n') {
tpl = switch_core_alloc(pool, len);
- snprintf(tpl, len, "%s\n", param->txt);
+ switch_snprintf(tpl, len, "%s\n", param->txt);
} else {
tpl = switch_core_strdup(pool, param->txt);
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c Wed Dec 12 18:27:30 2007
@@ -290,7 +290,7 @@
term++;
}
}
- snprintf(tmpname, sizeof(tmpname), "Orig-%s", var);
+ switch_snprintf(tmpname, sizeof(tmpname), "Orig-%s", var);
switch_event_add_header(local_event, SWITCH_STACK_BOTTOM, tmpname, "%s", val);
var = term + 1;
} else {
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Wed Dec 12 18:27:30 2007
@@ -450,7 +450,7 @@
if (data) {
- snprintf(buf, sizeof(buf), "Content-Type: log/data\nContent-Length: %" SWITCH_SSIZE_T_FMT "\n\n", strlen(data));
+ switch_snprintf(buf, sizeof(buf), "Content-Type: log/data\nContent-Length: %" SWITCH_SSIZE_T_FMT "\n\n", strlen(data));
len = strlen(buf);
switch_socket_send(listener->sock, buf, &len);
len = strlen(data);
@@ -487,7 +487,7 @@
len = strlen(listener->ebuf);
- snprintf(hbuf, sizeof(hbuf), "Content-Length: %" SWITCH_SSIZE_T_FMT "\n" "Content-Type: text/event-%s\n" "\n", len, etype);
+ switch_snprintf(hbuf, sizeof(hbuf), "Content-Length: %" SWITCH_SSIZE_T_FMT "\n" "Content-Type: text/event-%s\n" "\n", len, etype);
len = strlen(hbuf);
switch_socket_send(listener->sock, hbuf, &len);
@@ -558,7 +558,7 @@
switch_size_t rlen, blen;
char buf[1024] = "";
rlen = strlen(reply);
- snprintf(buf, sizeof(buf), "Content-Type: api/response\nContent-Length: %" SWITCH_SSIZE_T_FMT "\n\n", rlen);
+ switch_snprintf(buf, sizeof(buf), "Content-Type: api/response\nContent-Length: %" SWITCH_SSIZE_T_FMT "\n\n", rlen);
blen = strlen(buf);
switch_socket_send(acs->listener->sock, buf, &blen);
switch_socket_send(acs->listener->sock, reply, &rlen);
@@ -590,7 +590,7 @@
if (!strncasecmp(cmd, "exit", 4)) {
switch_clear_flag_locked(listener, LFLAG_RUNNING);
- snprintf(reply, reply_len, "+OK bye");
+ switch_snprintf(reply, reply_len, "+OK bye");
goto done;
}
@@ -603,9 +603,9 @@
if (!strcmp(prefs.password, pass)) {
switch_set_flag_locked(listener, LFLAG_AUTHED);
- snprintf(reply, reply_len, "+OK accepted");
+ switch_snprintf(reply, reply_len, "+OK accepted");
} else {
- snprintf(reply, reply_len, "-ERR invalid");
+ switch_snprintf(reply, reply_len, "-ERR invalid");
switch_clear_flag_locked(listener, LFLAG_RUNNING);
}
@@ -621,18 +621,18 @@
assert(channel != NULL);
if (!strncasecmp(cmd, "connect", 7)) {
- snprintf(reply, reply_len, "+OK");
+ switch_snprintf(reply, reply_len, "+OK");
goto done;
} else if (!strncasecmp(cmd, "sendmsg", 7)) {
if (switch_test_flag(listener, LFLAG_ASYNC)) {
if ((status = switch_core_session_queue_private_event(listener->session, &event)) == SWITCH_STATUS_SUCCESS) {
- snprintf(reply, reply_len, "+OK");
+ switch_snprintf(reply, reply_len, "+OK");
} else {
- snprintf(reply, reply_len, "-ERR memory error");
+ switch_snprintf(reply, reply_len, "-ERR memory error");
}
} else {
switch_ivr_parse_event(listener->session, event);
- snprintf(reply, reply_len, "+OK");
+ switch_snprintf(reply, reply_len, "+OK");
}
goto done;
} else if (!strncasecmp(cmd, "getvar", 6)) {
@@ -648,7 +648,7 @@
}
}
- snprintf(reply, reply_len, "%s", val);
+ switch_snprintf(reply, reply_len, "%s", val);
goto done;
} else if (!strncasecmp(cmd, "myevents", 8)) {
listener->event_list[SWITCH_EVENT_CHANNEL_CREATE] = 1;
@@ -674,7 +674,7 @@
if (strstr(cmd, "xml") || strstr(cmd, "XML")) {
listener->format = EVENT_FORMAT_XML;
}
- snprintf(reply, reply_len, "+OK Events Enabled");
+ switch_snprintf(reply, reply_len, "+OK Events Enabled");
goto done;
}
@@ -705,7 +705,7 @@
}
switch_event_fire(&event);
- snprintf(reply, reply_len, "+OK");
+ switch_snprintf(reply, reply_len, "+OK");
goto done;
} else if (!strncasecmp(cmd, "sendmsg", 7)) {
switch_core_session_t *session;
@@ -737,13 +737,13 @@
if (session) {
if ((status = switch_core_session_queue_private_event(session, &event)) == SWITCH_STATUS_SUCCESS) {
- snprintf(reply, reply_len, "+OK");
+ switch_snprintf(reply, reply_len, "+OK");
} else {
- snprintf(reply, reply_len, "-ERR memory error");
+ switch_snprintf(reply, reply_len, "-ERR memory error");
}
switch_core_session_rwunlock(session);
} else {
- snprintf(reply, reply_len, "-ERR invalid session id [%s]", uuid);
+ switch_snprintf(reply, reply_len, "-ERR invalid session id [%s]", uuid);
}
goto done;
@@ -764,7 +764,7 @@
acs.bg = 0;
api_exec(NULL, (void *) &acs);
- //snprintf(reply, reply_len, "+OK");
+ //switch_snprintf(reply, reply_len, "+OK");
return SWITCH_STATUS_SUCCESS;
} else if (!strncasecmp(cmd, "bgapi ", 6)) {
@@ -805,7 +805,7 @@
switch_uuid_get(&uuid);
switch_uuid_format(acs->uuid_str, &uuid);
}
- snprintf(reply, reply_len, "+OK Job-UUID: %s", acs->uuid_str);
+ switch_snprintf(reply, reply_len, "+OK Job-UUID: %s", acs->uuid_str);
return SWITCH_STATUS_SUCCESS;
} else if (!strncasecmp(cmd, "log", 3)) {
@@ -832,9 +832,9 @@
if (ltype && ltype != SWITCH_LOG_INVALID) {
listener->level = ltype;
switch_set_flag(listener, LFLAG_LOG);
- snprintf(reply, reply_len, "+OK log level %s [%d]", level_s, listener->level);
+ switch_snprintf(reply, reply_len, "+OK log level %s [%d]", level_s, listener->level);
} else {
- snprintf(reply, reply_len, "-ERR invalid log level");
+ switch_snprintf(reply, reply_len, "-ERR invalid log level");
}
} else if (!strncasecmp(cmd, "nolog", 5)) {
void *pop;
@@ -842,9 +842,9 @@
if (switch_test_flag(listener, LFLAG_LOG)) {
switch_clear_flag_locked(listener, LFLAG_LOG);
- snprintf(reply, reply_len, "+OK no longer logging");
+ switch_snprintf(reply, reply_len, "+OK no longer logging");
} else {
- snprintf(reply, reply_len, "-ERR not loging");
+ switch_snprintf(reply, reply_len, "-ERR not loging");
}
} else if (!strncasecmp(cmd, "event", 5)) {
char *next, *cur;
@@ -894,7 +894,7 @@
}
if (!key_count) {
- snprintf(reply, reply_len, "-ERR no keywords supplied");
+ switch_snprintf(reply, reply_len, "-ERR no keywords supplied");
goto done;
}
@@ -902,7 +902,7 @@
switch_set_flag_locked(listener, LFLAG_EVENTS);
}
- snprintf(reply, reply_len, "+OK event listener enabled %s", listener->format == EVENT_FORMAT_XML ? "xml" : "plain");
+ switch_snprintf(reply, reply_len, "+OK event listener enabled %s", listener->format == EVENT_FORMAT_XML ? "xml" : "plain");
} else if (!strncasecmp(cmd, "nixevent", 8)) {
char *next, *cur;
@@ -948,7 +948,7 @@
}
if (!key_count) {
- snprintf(reply, reply_len, "-ERR no keywords supplied");
+ switch_snprintf(reply, reply_len, "-ERR no keywords supplied");
goto done;
}
@@ -956,7 +956,7 @@
switch_set_flag_locked(listener, LFLAG_EVENTS);
}
- snprintf(reply, reply_len, "+OK events nixed");
+ switch_snprintf(reply, reply_len, "+OK events nixed");
} else if (!strncasecmp(cmd, "noevents", 8)) {
void *pop;
@@ -971,9 +971,9 @@
/* wipe the hash */
switch_core_hash_destroy(&listener->event_hash);
switch_core_hash_init(&listener->event_hash, listener->pool);
- snprintf(reply, reply_len, "+OK no longer listening for events");
+ switch_snprintf(reply, reply_len, "+OK no longer listening for events");
} else {
- snprintf(reply, reply_len, "-ERR not listening for events");
+ switch_snprintf(reply, reply_len, "-ERR not listening for events");
}
}
@@ -983,7 +983,7 @@
}
if (switch_strlen_zero(reply)) {
- snprintf(reply, reply_len, "-ERR command not found");
+ switch_snprintf(reply, reply_len, "-ERR command not found");
}
return status;
@@ -1060,7 +1060,7 @@
switch_safe_free(event_str);
} else {
- snprintf(buf, sizeof(buf), "Content-Type: auth/request\n\n");
+ switch_snprintf(buf, sizeof(buf), "Content-Type: auth/request\n\n");
len = strlen(buf);
switch_socket_send(listener->sock, buf, &len);
@@ -1079,7 +1079,7 @@
goto done;
}
if (*reply != '\0') {
- snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
+ switch_snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
len = strlen(buf);
switch_socket_send(listener->sock, buf, &len);
}
@@ -1108,7 +1108,7 @@
}
if (*reply != '\0') {
- snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
+ switch_snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
len = strlen(buf);
switch_socket_send(listener->sock, buf, &len);
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c Wed Dec 12 18:27:30 2007
@@ -145,7 +145,7 @@
return;
}
- snprintf(data, len, "%s=%s", hp->name, hp->value);
+ switch_snprintf(data, len, "%s=%s", hp->name, hp->value);
if (sw_text_record_add_string(text_record, data) != SW_OKAY) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to add service text: %s\n", data);
free(data);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c Wed Dec 12 18:27:30 2007
@@ -79,7 +79,7 @@
local_stream_context_t *cp;
char file_buf[128] = "", path_buf[512] = "";
switch_timer_t timer = {0};
-
+ int fd = -1;
if (switch_core_timer_init(&timer, source->timer_name, source->interval, source->samples, source->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't start timer.\n");
@@ -89,7 +89,7 @@
while(RUNNING) {
const char *fname;
-
+
if (switch_dir_open(&source->dir_handle, source->location, source->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't open directory: %s\n", source->location);
return NULL;
@@ -98,27 +98,37 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open directory: %s\n", source->location);
switch_yield(1000000);
- while(RUNNING && (fname = switch_dir_next_file(source->dir_handle, file_buf, sizeof(file_buf)))) {
+ while(RUNNING) {
switch_size_t olen;
uint8_t abuf[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0};
- snprintf(path_buf, sizeof(path_buf), "%s%s%s", source->location, SWITCH_PATH_SEPARATOR, fname);
- if (switch_stristr(".loc", path_buf)) {
- int fd, bytes;
+ if (fd > -1) {
char *p;
+ if (switch_fd_read_line(fd, path_buf, sizeof(path_buf))) {
+ if ((p = strchr(path_buf, '\r')) ||
+ (p = strchr(path_buf, '\n'))) {
+ *p = '\0';
+ }
+ } else {
+ close(fd);
+ fd = -1;
+ continue;
+ }
+ } else {
+ if (!(fname = switch_dir_next_file(source->dir_handle, file_buf, sizeof(file_buf)))) {
+ break;
+ }
+
+ switch_snprintf(path_buf, sizeof(path_buf), "%s%s%s", source->location, SWITCH_PATH_SEPARATOR, fname);
- if ((fd = open(path_buf, O_RDONLY)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open %s\n", fname);
- switch_yield(1000000);
+ if (switch_stristr(".loc", path_buf)) {
+ if ((fd = open(path_buf, O_RDONLY)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open %s\n", fname);
+ switch_yield(1000000);
+ }
continue;
}
- bytes = read(fd, path_buf, sizeof(path_buf));
- if ((p = strchr(path_buf, '\r')) ||
- (p = strchr(path_buf, '\n'))) {
- *p = '\0';
- }
- close(fd);
}
fname = path_buf;
@@ -139,6 +149,7 @@
while (RUNNING) {
switch_core_timer_next(&timer);
olen = source->samples;
+
if (switch_core_file_read(&fh, abuf, &olen) != SWITCH_STATUS_SUCCESS || !olen) {
switch_core_file_close(&fh);
break;
@@ -156,8 +167,13 @@
}
switch_dir_close(source->dir_handle);
+ source->dir_handle = NULL;
}
+
+ if (fd > -1) {
+ close(fd);
+ }
switch_core_destroy_memory_pool(&source->pool);
@@ -168,25 +184,37 @@
{
local_stream_context_t *context;
local_stream_source_t *source;
+ char *alt_path = NULL;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This format does not support writing!\n");
return SWITCH_STATUS_FALSE;
}
+ alt_path = switch_mprintf("%s/%d", path, handle->samplerate);
+
switch_mutex_lock(globals.mutex);
- source = switch_core_hash_find(globals.source_hash, path);
+ if ((source = switch_core_hash_find(globals.source_hash, alt_path))) {
+ path = alt_path;
+ } else {
+ source = switch_core_hash_find(globals.source_hash, path);
+ }
switch_mutex_unlock(globals.mutex);
if (!source) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unknown source %s\n", path);
- return SWITCH_STATUS_FALSE;
+ status = SWITCH_STATUS_FALSE;
+ goto end;
}
if ((context = switch_core_alloc(handle->memory_pool, sizeof(*context))) == 0) {
- return SWITCH_STATUS_MEMERR;
+ status = SWITCH_STATUS_MEMERR;
+ goto end;
}
+
+
handle->samples = 0;
handle->samplerate = source->rate;
handle->channels = source->channels;
@@ -201,7 +229,8 @@
switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, handle->memory_pool);
if (switch_buffer_create_dynamic(&context->audio_buffer, 512, 1024, 0) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
- return SWITCH_STATUS_MEMERR;
+ status = SWITCH_STATUS_MEMERR;
+ goto end;
}
context->source = source;
@@ -211,8 +240,9 @@
source->context_list = context;
switch_mutex_unlock(source->mutex);
-
- return SWITCH_STATUS_SUCCESS;
+ end:
+ switch_safe_free(alt_path);
+ return status;
}
static switch_status_t local_stream_file_close(switch_file_handle_t *handle)
@@ -350,6 +380,7 @@
}
source->samples = switch_bytes_per_frame(source->rate, source->interval);
+
switch_core_hash_insert(globals.source_hash, source->name, source);
switch_mutex_init(&source->mutex, SWITCH_MUTEX_NESTED, source->pool);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_native_file/mod_native_file.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_native_file/mod_native_file.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_native_file/mod_native_file.c Wed Dec 12 18:27:30 2007
@@ -26,7 +26,7 @@
* Anthony Minessale II <anthmct at yahoo.com>
*
*
- * mod_native_file.c -- Framework Demo Module
+ * mod_native_file.c -- Native Files
*
*/
#include <switch.h>
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_shout/decode_ntom.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_shout/decode_ntom.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_shout/decode_ntom.c Wed Dec 12 18:27:30 2007
@@ -20,12 +20,12 @@
else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \
else { *(samples) = sum; }
-#define NTOM_MUL (32768)
-static unsigned long ntom_val[2] = { NTOM_MUL >> 1, NTOM_MUL >> 1 };
-static unsigned long ntom_step = NTOM_MUL;
+//static unsigned long ntom_val[2] = { NTOM_MUL >> 1, NTOM_MUL >> 1 };
+//static unsigned long ntom_step = NTOM_MUL;
-int synth_ntom_set_step(long m, long n)
+
+int synth_ntom_set_step(struct mpstr *mp, long m, long n)
{
if (param.verbose > 1)
debug_printf("Init rate converter: %ld->%ld\n", m, n);
@@ -36,14 +36,14 @@
}
n *= NTOM_MUL;
- ntom_step = n / m;
+ mp->ntom_step = n / m;
- if (ntom_step > 8 * NTOM_MUL) {
+ if (mp->ntom_step > 8 * NTOM_MUL) {
debug_printf("%d max. 1:8 conversion allowed!\n", __LINE__);
return (1);
}
- ntom_val[0] = ntom_val[1] = NTOM_MUL >> 1;
+ mp->ntom_val[0] = mp->ntom_val[1] = NTOM_MUL >> 1;
return (0);
@@ -89,12 +89,12 @@
bo--;
bo &= 0xf;
buf = mp->synth_buffs[0];
- ntom = ntom_val[1] = ntom_val[0];
+ ntom = mp->ntom_val[1] = mp->ntom_val[0];
} else {
samples++;
out += 2; /* to compute the right *pnt value */
buf = mp->synth_buffs[1];
- ntom = ntom_val[1];
+ ntom = mp->ntom_val[1];
}
if (bo & 0x1) {
@@ -116,7 +116,7 @@
for (j = 16; j; j--, window += 0x10) {
real sum;
- ntom += ntom_step;
+ ntom += mp->ntom_step;
if (ntom < NTOM_MUL) {
window += 16;
b0 += 16;
@@ -147,7 +147,7 @@
}
}
- ntom += ntom_step;
+ ntom += mp->ntom_step;
if (ntom >= NTOM_MUL) {
real sum;
sum = window[0x0] * b0[0x0];
@@ -172,7 +172,7 @@
for (j = 15; j; j--, b0 -= 0x20, window -= 0x10) {
real sum;
- ntom += ntom_step;
+ ntom += mp->ntom_step;
if (ntom < NTOM_MUL) {
window -= 16;
b0 += 16;
@@ -204,7 +204,7 @@
}
}
- ntom_val[channel] = ntom;
+ mp->ntom_val[channel] = ntom;
*pnt = ((unsigned char *) samples - out);
return clip;
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_shout/interface.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_shout/interface.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_shout/interface.c Wed Dec 12 18:27:30 2007
@@ -27,6 +27,9 @@
mp->bsnum = 0;
mp->synth_bo = 1;
mp->outsamplerate = samplerate;
+ mp->ntom_val[0] = NTOM_MUL >> 1;
+ mp->ntom_val[1] = NTOM_MUL >> 1;
+ mp->ntom_step = NTOM_MUL;
make_decode_tables_scale(mp, outscale);
@@ -241,7 +244,7 @@
m = n;
}
- if (synth_ntom_set_step(n, m))
+ if (synth_ntom_set_step(mp, n, m))
return MP3_ERR;
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_shout/mpglib.h
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_shout/mpglib.h (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_shout/mpglib.h Wed Dec 12 18:27:30 2007
@@ -3,6 +3,7 @@
#else
#define debug_printf(fmt,...)
#endif
+#define NTOM_MUL (32768)
struct buf {
unsigned char *pnt;
@@ -39,7 +40,8 @@
int longLimit[9][23]; /*sample limits re setting volume */
int shortLimit[9][14];
real decwin[512 + 32]; /* scale table */
-
+ unsigned long ntom_val[2];
+ unsigned long ntom_step;
};
#define BOOL int
@@ -54,7 +56,7 @@
int decodeMP3(struct mpstr *mp, char *inmemory, int inmemsize, char *outmemory, int outmemsize, int *done);
void ExitMP3(struct mpstr *mp);
-extern int synth_ntom_set_step(long, long);
+extern int synth_ntom_set_step(struct mpstr *mp, long, long);
extern int synth_ntom(struct mpstr *mp, real * bandPtr, int channel, unsigned char *out, int *pnt);
extern int synth_ntom_mono(struct mpstr *mp, real * bandPtr, unsigned char *samples, int *pnt);
extern int synth_ntom_8bit(real *, int, unsigned char *, int *);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c Wed Dec 12 18:27:30 2007
@@ -61,6 +61,9 @@
int mode = 0;
char *ext;
struct format_map *map = NULL;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
+ char *alt_path = NULL, *next, *last, *ldup = NULL;
+ size_t alt_len = 0;
if ((ext = strrchr(path, '.')) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Format\n");
@@ -141,11 +144,28 @@
if ((mode & SFM_WRITE) && sf_format_check(&context->sfinfo) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error : file format is invalid (0x%08X).\n", context->sfinfo.format);
return SWITCH_STATUS_GENERR;
- };
+ }
- if ((context->handle = sf_open(path, mode, &context->sfinfo)) == 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening File [%s] [%s]\n", path, sf_strerror(context->handle));
- return SWITCH_STATUS_GENERR;
+ alt_len = strlen(path) + 10;
+ switch_zmalloc(alt_path, alt_len);
+
+ switch_copy_string(alt_path, path, alt_len);
+ if ((last = strrchr(alt_path, *SWITCH_PATH_SEPARATOR))) {
+ next = ++last;
+ ldup = strdup(last);
+ switch_assert(ldup);
+ switch_snprintf(next, alt_len - (last - alt_path), "%d%s%s", handle->samplerate, SWITCH_PATH_SEPARATOR, ldup);
+ if ((context->handle = sf_open(alt_path, mode, &context->sfinfo))) {
+ path = alt_path;
+ }
+ }
+
+ if (!context->handle) {
+ if ((context->handle = sf_open(path, mode, &context->sfinfo)) == 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening File [%s] [%s]\n", path, sf_strerror(context->handle));
+ status = SWITCH_STATUS_GENERR;
+ goto end;
+ }
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opening File [%s] %dhz\n", path, context->sfinfo.samplerate);
@@ -157,8 +177,15 @@
handle->seekable = context->sfinfo.seekable;
handle->speed = 0;
handle->private_info = context;
+
- return SWITCH_STATUS_SUCCESS;
+ end:
+
+ switch_safe_free(alt_path);
+ switch_safe_free(ldup);
+
+
+ return status;
}
static switch_status_t sndfile_file_close(switch_file_handle_t *handle)
@@ -300,9 +327,7 @@
if (!skip) {
char *p;
struct format_map *map = switch_core_permanent_alloc(sizeof(*map));
- if (!map) {
- abort();
- }
+ switch_assert(map);
map->ext = switch_core_permanent_strdup(info.extension);
map->uext = switch_core_permanent_strdup(info.extension);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Wed Dec 12 18:27:30 2007
@@ -403,7 +403,7 @@
subst_string = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
len = (uint32_t) (strlen(pcre_obj->string) + strlen(subst_string) + 10);
substituted = malloc(len);
- assert(substituted != NULL);
+ switch_assert(substituted != NULL);
switch_perform_substitution(pcre_obj->re, pcre_obj->proceed, subst_string, pcre_obj->string, substituted, len, pcre_obj->ovector);
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, substituted));
free(substituted);
@@ -800,7 +800,7 @@
const char *err = NULL;
char derr[512] = "";
- assert(filename != NULL);
+ switch_assert(filename != NULL);
status = switch_dso_load(&dso, filename, module_manager.pool);
@@ -880,13 +880,13 @@
len += strlen(file);
len += 4;
path = (char *) switch_core_alloc(module_manager.pool, len);
- snprintf(path, len, "%s%s%s", dir, SWITCH_PATH_SEPARATOR, file);
+ switch_snprintf(path, len, "%s%s%s", dir, SWITCH_PATH_SEPARATOR, file);
} else {
len = strlen(dir);
len += strlen(file);
len += 8;
path = (char *) switch_core_alloc(module_manager.pool, len);
- snprintf(path, len, "%s%s%s%s", dir, SWITCH_PATH_SEPARATOR, file, ext);
+ switch_snprintf(path, len, "%s%s%s%s", dir, SWITCH_PATH_SEPARATOR, file, ext);
}
}
@@ -1215,7 +1215,7 @@
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
while ((has = switch_channel_has_dtmf(channel))) {
switch_channel_dequeue_dtmf(channel, buf, sizeof(buf));
@@ -1237,7 +1237,7 @@
}
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
while (switch_core_session_dequeue_event(jss->session, &event) == SWITCH_STATUS_SUCCESS) {
@@ -1266,7 +1266,7 @@
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
CHANNEL_SANITY_CHECK();
@@ -1341,7 +1341,7 @@
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
CHANNEL_SANITY_CHECK();
@@ -1400,7 +1400,7 @@
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
CHANNEL_SANITY_CHECK();
@@ -1481,7 +1481,7 @@
switch_channel_state_t state;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
state = switch_channel_get_state(channel);
@@ -1506,7 +1506,7 @@
if (argc > 0) {
if ((function = JS_ValueToFunction(cx, argv[0]))) {
switch_channel_t *channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
jss->on_hangup = function;
jss->hook_state = switch_channel_get_state(channel);
switch_channel_set_private(channel, "jss", jss);
@@ -1538,7 +1538,7 @@
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
CHANNEL_SANITY_CHECK();
@@ -1592,7 +1592,7 @@
JS_ResumeRequest(cx, cb_state.saveDepth);
*rval = cb_state.ret;
- snprintf(posbuf, sizeof(posbuf), "%u", fh.offset_pos);
+ switch_snprintf(posbuf, sizeof(posbuf), "%u", fh.offset_pos);
switch_channel_set_variable(channel, "last_file_position", posbuf);
return JS_TRUE;
@@ -1606,7 +1606,7 @@
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (argc > 1) {
char *var, *val;
@@ -1633,7 +1633,7 @@
}
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (argc > 0) {
const char *var, *val;
@@ -1720,7 +1720,7 @@
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
CHANNEL_SANITY_CHECK();
@@ -1752,7 +1752,7 @@
switch_core_speech_text_param_tts(&jss->speech->sh, "voice", voice_name);
} else {
jss->speech = switch_core_session_alloc(jss->session, sizeof(*jss->speech));
- assert(jss->speech != NULL);
+ switch_assert(jss->speech != NULL);
if (init_speech_engine(jss, tts_name, voice_name) != SWITCH_STATUS_SUCCESS) {
eval_some_js("~throw new Error(\"Cannot allocate speech engine!\");", cx, obj, rval);
jss->speech = NULL;
@@ -1804,7 +1804,7 @@
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
CHANNEL_SANITY_CHECK();
@@ -1862,7 +1862,7 @@
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
CHANNEL_SANITY_CHECK_ANSWER();
@@ -1878,7 +1878,7 @@
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
CHANNEL_SANITY_CHECK_ANSWER();
@@ -1916,7 +1916,7 @@
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
*rval = BOOLEAN_TO_JSVAL(switch_channel_ready(channel) ? JS_TRUE : JS_FALSE);
@@ -1936,7 +1936,7 @@
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
started = switch_time_now();
@@ -1975,7 +1975,7 @@
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
started = switch_time_now();
@@ -2010,7 +2010,7 @@
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
/* you can execute some apps before you answer */
/* CHANNEL_SANITY_CHECK(); */
@@ -2020,7 +2020,6 @@
const switch_application_interface_t *application_interface;
char *app_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
char *app_arg = NULL;
- struct js_session *jss = JS_GetPrivate(cx, obj);
jsrefcount saveDepth;
METHOD_SANITY_CHECK();
@@ -2109,7 +2108,7 @@
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
CHANNEL_SANITY_CHECK();
@@ -2175,7 +2174,7 @@
for (p = val + strlen(val) - 1; *p == ' '; p--)
*p = '\0';
- snprintf(code, sizeof(code), "~%s[\"%s\"] = \"%s\"", config_data->name, line, val);
+ switch_snprintf(code, sizeof(code), "~%s[\"%s\"] = \"%s\"", config_data->name, line, val);
eval_some_js(code, config_data->cx, config_data->obj, &rval);
}
@@ -2374,7 +2373,7 @@
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, config_data.buffer));
} else {
char errmsg[256];
- snprintf(errmsg, 256, "~throw new Error(\"Curl returned error %u.\");", (unsigned)code);
+ switch_snprintf(errmsg, 256, "~throw new Error(\"Curl returned error %u.\");", (unsigned)code);
eval_some_js(errmsg, cx, obj, rval);
}
@@ -2454,7 +2453,7 @@
if (jss && jss->session) {
channel = switch_core_session_get_channel(jss->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
caller_profile = switch_channel_get_caller_profile(channel);
}
@@ -2470,7 +2469,9 @@
if (!channel) {
switch (param) {
case SESSION_CAUSE:
- *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_channel_cause2str(jss->cause)));
+ if (jss) {
+ *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_channel_cause2str(jss->cause)));
+ }
break;
default:
*vp = BOOLEAN_TO_JSVAL(JS_FALSE);
@@ -2548,7 +2549,7 @@
JSObject *session_obj;
if ((session_obj = JS_DefineObject(cx, obj, name, &session_class, NULL, 0))) {
*jss = malloc(sizeof(**jss));
- assert(*jss);
+ switch_assert(*jss);
memset(*jss, 0, sizeof(**jss));
(*jss)->session = session;
@@ -2580,7 +2581,7 @@
struct js_session *jss = NULL;
jss = malloc(sizeof(*jss));
- assert(jss);
+ switch_assert(jss);
memset(jss, 0, sizeof(*jss));
jss->cx = cx;
jss->obj = obj;
@@ -2974,7 +2975,7 @@
char *supplied_error, code_buf[256] = "";
if (argc > 0 && (supplied_error = JS_GetStringBytes(JS_ValueToString(cx, argv[0])))) {
- snprintf(code_buf, sizeof(code_buf), "~throw new Error(\"%s\");", supplied_error);
+ switch_snprintf(code_buf, sizeof(code_buf), "~throw new Error(\"%s\");", supplied_error);
eval_some_js(code_buf, cx, obj, rval);
}
@@ -3271,7 +3272,7 @@
/* Emaculent conception of session object into the script if one is available */
if (!(session && new_js_session(cx, javascript_global_object, session, &jss, "session", flags))) {
- snprintf(buf, sizeof(buf), "~var session = false;");
+ switch_snprintf(buf, sizeof(buf), "~var session = false;");
eval_some_js(buf, cx, javascript_global_object, &rval);
}
if (ro) {
@@ -3291,17 +3292,17 @@
}
if (!argc) {
- snprintf(buf, sizeof(buf), "~var argv = new Array();");
+ switch_snprintf(buf, sizeof(buf), "~var argv = new Array();");
eval_some_js(buf, cx, javascript_global_object, &rval);
} else {
/* create a js doppleganger of this argc/argv */
- snprintf(buf, sizeof(buf), "~var argv = new Array(%d);", argc);
+ switch_snprintf(buf, sizeof(buf), "~var argv = new Array(%d);", argc);
eval_some_js(buf, cx, javascript_global_object, &rval);
- snprintf(buf, sizeof(buf), "~var argc = %d", argc);
+ switch_snprintf(buf, sizeof(buf), "~var argc = %d", argc);
eval_some_js(buf, cx, javascript_global_object, &rval);
for (y = 0; y < argc; y++) {
- snprintf(buf, sizeof(buf), "~argv[%d] = \"%s\";", x++, argv[y]);
+ switch_snprintf(buf, sizeof(buf), "~argv[%d] = \"%s\";", x++, argv[y]);
eval_some_js(buf, cx, javascript_global_object, &rval);
}
}
@@ -3398,11 +3399,11 @@
char *path, *cmd;
path = switch_mprintf("%s%smwi.js", SWITCH_GLOBAL_dirs.script_dir, SWITCH_PATH_SEPARATOR);
- assert(path != NULL);
+ switch_assert(path != NULL);
if (switch_file_exists(path, NULL) == SWITCH_STATUS_SUCCESS) {
cmd = switch_mprintf("%s %s", path, account);
- assert(cmd != NULL);
+ switch_assert(cmd != NULL);
js_thread_launch(cmd);
switch_safe_free(cmd);
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c Wed Dec 12 18:27:30 2007
@@ -113,18 +113,18 @@
jsval rval;
int x = 0;
- snprintf(code, sizeof(code), "~var _Db_RoW_ = {}");
+ switch_snprintf(code, sizeof(code), "~var _Db_RoW_ = {}");
eval_some_js(code, dbo->cx, dbo->obj, &rval);
for (x = 0; x < argc; x++) {
- snprintf(code, sizeof(code), "~_Db_RoW_[\"%s\"] = \"%s\"", columnNames[x], argv[x]);
+ switch_snprintf(code, sizeof(code), "~_Db_RoW_[\"%s\"] = \"%s\"", columnNames[x], argv[x]);
eval_some_js(code, dbo->cx, dbo->obj, &rval);
}
- snprintf(code, sizeof(code), "~%s(_Db_RoW_)", dbo->code_buffer);
+ switch_snprintf(code, sizeof(code), "~%s(_Db_RoW_)", dbo->code_buffer);
eval_some_js(code, dbo->cx, dbo->obj, &rval);
- snprintf(code, sizeof(code), "~delete _Db_RoW_");
+ switch_snprintf(code, sizeof(code), "~delete _Db_RoW_");
eval_some_js(code, dbo->cx, dbo->obj, &rval);
return 0;
@@ -208,13 +208,13 @@
return JS_FALSE;
}
- snprintf(code, sizeof(code), "~var _dB_RoW_DaTa_ = {}");
+ switch_snprintf(code, sizeof(code), "~var _dB_RoW_DaTa_ = {}");
eval_some_js(code, dbo->cx, dbo->obj, rval);
if (*rval == JS_FALSE) {
return JS_TRUE;
}
for (x = 0; x < colcount; x++) {
- snprintf(code, sizeof(code), "~_dB_RoW_DaTa_[\"%s\"] = \"%s\"",
+ switch_snprintf(code, sizeof(code), "~_dB_RoW_DaTa_[\"%s\"] = \"%s\"",
(char *) switch_core_db_column_name(dbo->stmt, x), (char *) switch_core_db_column_text(dbo->stmt, x));
eval_some_js(code, dbo->cx, dbo->obj, rval);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c Wed Dec 12 18:27:30 2007
@@ -357,10 +357,8 @@
if (odbc_obj->stmt) {
SQLSMALLINT c = 0, x = 0;
SQLLEN m = 0;
- char code[66560];
- snprintf(code, sizeof(code), "~var _oDbC_dB_RoW_DaTa_ = {}");
- eval_some_js(code, cx, obj, rval);
+ eval_some_js("~var _oDbC_dB_RoW_DaTa_ = {}", cx, obj, rval);
if (*rval == JS_FALSE) {
return JS_TRUE;
}
@@ -383,7 +381,7 @@
data = esc;
}
- snprintf((char *) odbc_obj->code, odbc_obj->codelen, "~_oDbC_dB_RoW_DaTa_[\"%s\"] = \"%s\"", name, data);
+ switch_snprintf((char *) odbc_obj->code, odbc_obj->codelen, "~_oDbC_dB_RoW_DaTa_[\"%s\"] = \"%s\"", name, data);
switch_safe_free(esc);
eval_some_js((char *) odbc_obj->code, cx, obj, rval);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/loggers/mod_logfile/mod_logfile.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/loggers/mod_logfile/mod_logfile.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/loggers/mod_logfile/mod_logfile.c Wed Dec 12 18:27:30 2007
@@ -137,7 +137,7 @@
p = malloc(strlen(profile->logfile)+WARM_FUZZY_OFFSET);
- assert(p);
+ switch_assert(p);
memset(p, '\0', strlen(profile->logfile)+WARM_FUZZY_OFFSET);
@@ -283,7 +283,7 @@
if (switch_strlen_zero(new_profile->logfile)) {
char logfile[512];
- snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch.log");
+ switch_snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch.log");
new_profile->logfile = strdup(logfile);
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_de/mod_say_de.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_de/mod_say_de.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_de/mod_say_de.c Wed Dec 12 18:27:30 2007
@@ -53,18 +53,18 @@
#define say_num(num, t) { \
char tmp[80];\
- switch_status_t status;\
- snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
- if ((status = de_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
- return status;\
+ switch_status_t tstatus;\
+ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
+ if ((tstatus = de_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
+ return tstatus;\
}}\
#define say_file(...) {\
char tmp[80];\
- switch_status_t status;\
- snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
- if ((status = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
- return status;\
+ switch_status_t tstatus;\
+ switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
+ if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
+ return tstatus;\
}\
if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
return SWITCH_STATUS_FALSE;\
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_en/mod_say_en.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_en/mod_say_en.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_en/mod_say_en.c Wed Dec 12 18:27:30 2007
@@ -53,18 +53,18 @@
#define say_num(num, t) { \
char tmp[80];\
- switch_status_t status;\
- snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
- if ((status = en_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
- return status;\
+ switch_status_t tstatus;\
+ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
+ if ((tstatus = en_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
+ return tstatus;\
}}\
#define say_file(...) {\
char tmp[80];\
- switch_status_t status;\
- snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
- if ((status = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
- return status;\
+ switch_status_t tstatus;\
+ switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
+ if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
+ return tstatus;\
}\
if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
return SWITCH_STATUS_FALSE;\
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_es/mod_say_es.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_es/mod_say_es.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_es/mod_say_es.c Wed Dec 12 18:27:30 2007
@@ -53,18 +53,18 @@
#define say_num(num, t) { \
char tmp[80];\
- switch_status_t status;\
- snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
- if ((status = es_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
- return status;\
+ switch_status_t tstatus;\
+ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
+ if ((tstatus = es_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
+ return tstatus;\
}}\
#define say_file(...) {\
char tmp[80];\
- switch_status_t status;\
- snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
- if ((status = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
- return status;\
+ switch_status_t tstatus;\
+ switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
+ if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
+ return tstatus;\
}\
if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
return SWITCH_STATUS_FALSE;\
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_fr/mod_say_fr.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_fr/mod_say_fr.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_fr/mod_say_fr.c Wed Dec 12 18:27:30 2007
@@ -53,18 +53,18 @@
#define say_num(num, t) { \
char tmp[80];\
- switch_status_t status;\
- snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
- if ((status = fr_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
- return status;\
+ switch_status_t tstatus;\
+ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
+ if ((tstatus = fr_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
+ return tstatus;\
}}\
#define say_file(...) {\
char tmp[80];\
- switch_status_t status;\
- snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
- if ((status = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
- return status;\
+ switch_status_t tstatus;\
+ switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
+ if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
+ return tstatus;\
}\
if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
return SWITCH_STATUS_FALSE;\
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_it/mod_say_it.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_it/mod_say_it.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_it/mod_say_it.c Wed Dec 12 18:27:30 2007
@@ -53,18 +53,18 @@
#define say_num(num, t) { \
char tmp[80];\
- switch_status_t status;\
- snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
- if ((status = it_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
- return status;\
+ switch_status_t tstatus;\
+ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
+ if ((tstatus = it_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
+ return tstatus;\
}}\
#define say_file(...) {\
char tmp[80];\
- switch_status_t status;\
- snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
- if ((status = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
- return status;\
+ switch_status_t tstatus;\
+ switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
+ if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
+ return tstatus;\
}\
if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
return SWITCH_STATUS_FALSE;\
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_nl/mod_say_nl.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_nl/mod_say_nl.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/say/mod_say_nl/mod_say_nl.c Wed Dec 12 18:27:30 2007
@@ -53,18 +53,18 @@
#define say_num(num, t) { \
char tmp[80];\
- switch_status_t status;\
- snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
- if ((status = nl_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
- return status;\
+ switch_status_t tstatus;\
+ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
+ if ((tstatus = nl_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
+ return tstatus;\
}}\
#define say_file(...) {\
char tmp[80];\
- switch_status_t status;\
- snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
- if ((status = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
- return status;\
+ switch_status_t tstatus;\
+ switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
+ if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
+ return tstatus;\
}\
if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
return SWITCH_STATUS_FALSE;\
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c Wed Dec 12 18:27:30 2007
@@ -74,132 +74,134 @@
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_status_t status = SWITCH_STATUS_FALSE;
- if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
- /* build the XML */
- if (!(xml_text = switch_xml_toxml(cdr, SWITCH_TRUE))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
- goto error;
- }
+ if (switch_ivr_generate_xml_cdr(session, &cdr) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Generating Data!\n");
+ return SWITCH_STATUS_FALSE;
+ }
- if (!(logdir = switch_channel_get_variable(channel, "xml_cdr_base"))) {
- logdir = globals.log_dir;
- }
+ /* build the XML */
+ xml_text = switch_xml_toxml(cdr, SWITCH_TRUE);
+ if (!xml_text) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ goto error;
+ }
- if (!switch_strlen_zero(logdir)) {
- if ((path = switch_mprintf("%s%s%s.cdr.xml",
- logdir,
- SWITCH_PATH_SEPARATOR,
- switch_core_session_get_uuid(session)))) {
- if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
- int wrote;
- wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
- close(fd);
- fd = -1;
- } else {
- char ebuf[512] = { 0 };
+ if (!(logdir = switch_channel_get_variable(channel, "xml_cdr_base"))) {
+ logdir = globals.log_dir;
+ }
+
+ if (!switch_strlen_zero(logdir)) {
+ if ((path = switch_mprintf("%s%s%s.cdr.xml",
+ logdir,
+ SWITCH_PATH_SEPARATOR,
+ switch_core_session_get_uuid(session)))) {
+ if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
+ int wrote;
+ wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
+ close(fd);
+ fd = -1;
+ } else {
+ char ebuf[512] = { 0 };
#ifdef WIN32
- strerror_s(ebuf, sizeof(ebuf), errno);
+ strerror_s(ebuf, sizeof(ebuf), errno);
#else
- strerror_r(errno, ebuf, sizeof(ebuf));
+ strerror_r(errno, ebuf, sizeof(ebuf));
#endif
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing [%s][%s]\n", path, ebuf);
- }
- switch_safe_free(path);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing [%s][%s]\n", path, ebuf);
}
+ switch_safe_free(path);
}
+ }
- /* try to post it to the web server */
- if (!switch_strlen_zero(globals.url)) {
- struct curl_slist *headers = NULL;
- curl_handle = curl_easy_init();
-
- if (globals.encode) {
- switch_size_t need_bytes = strlen(xml_text) * 3;
-
- xml_text_escaped = malloc(need_bytes);
- assert(xml_text_escaped);
- memset(xml_text_escaped, 0, sizeof(xml_text_escaped));
- if (globals.encode == 1) {
- headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
- switch_url_encode(xml_text, xml_text_escaped, need_bytes - 1);
- } else {
- headers = curl_slist_append(headers, "Content-Type: application/x-www-form-base64-encoded");
- switch_b64_encode((unsigned char *)xml_text, need_bytes / 3, (unsigned char *)xml_text_escaped, need_bytes);
- }
- switch_safe_free(xml_text);
- xml_text = xml_text_escaped;
+ /* try to post it to the web server */
+ if (!switch_strlen_zero(globals.url)) {
+ struct curl_slist *headers = NULL;
+ curl_handle = curl_easy_init();
+
+ if (globals.encode) {
+ switch_size_t need_bytes = strlen(xml_text) * 3;
+
+ xml_text_escaped = malloc(need_bytes);
+ switch_assert(xml_text_escaped);
+ memset(xml_text_escaped, 0, sizeof(xml_text_escaped));
+ if (globals.encode == 1) {
+ headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
+ switch_url_encode(xml_text, xml_text_escaped, need_bytes - 1);
} else {
- headers = curl_slist_append(headers, "Content-Type: application/x-www-form-plaintext");
- }
-
- if (!(curl_xml_text = switch_mprintf("cdr=%s", xml_text))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
- goto error;
+ headers = curl_slist_append(headers, "Content-Type: application/x-www-form-base64-encoded");
+ switch_b64_encode((unsigned char *)xml_text, need_bytes / 3, (unsigned char *)xml_text_escaped, need_bytes);
}
+ switch_safe_free(xml_text);
+ xml_text = xml_text_escaped;
+ } else {
+ headers = curl_slist_append(headers, "Content-Type: application/x-www-form-plaintext");
+ }
+
+ if (!(curl_xml_text = switch_mprintf("cdr=%s", xml_text))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ goto error;
+ }
- if (!switch_strlen_zero(globals.cred)) {
- curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
- curl_easy_setopt(curl_handle, CURLOPT_USERPWD, globals.cred);
- }
+ if (!switch_strlen_zero(globals.cred)) {
+ curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+ curl_easy_setopt(curl_handle, CURLOPT_USERPWD, globals.cred);
+ }
- curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers);
- curl_easy_setopt(curl_handle, CURLOPT_POST, 1);
- curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, curl_xml_text);
- curl_easy_setopt(curl_handle, CURLOPT_URL, globals.url);
- curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-xml/1.0");
- curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, httpCallBack);
-
- if (globals.ignore_cacert_check) {
- curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);
- }
+ curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers);
+ curl_easy_setopt(curl_handle, CURLOPT_POST, 1);
+ curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, curl_xml_text);
+ curl_easy_setopt(curl_handle, CURLOPT_URL, globals.url);
+ curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-xml/1.0");
+ curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, httpCallBack);
+
+ if (globals.ignore_cacert_check) {
+ curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);
+ }
- /* these were used for testing, optionally they may be enabled if someone desires
- curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 120); // tcp timeout
- curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level
- */
-
- for (cur_try = 0; cur_try < globals.retries; cur_try++) {
- if (cur_try > 0) {
- switch_yield(globals.delay * 1000000);
- }
- curl_easy_perform(curl_handle);
- curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
- if (httpRes == 200) {
- goto success;
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Got error [%ld] posting to web server [%s]\n",httpRes, globals.url);
- }
-
+ /* these were used for testing, optionally they may be enabled if someone desires
+ curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 120); // tcp timeout
+ curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level
+ */
+
+ for (cur_try = 0; cur_try < globals.retries; cur_try++) {
+ if (cur_try > 0) {
+ switch_yield(globals.delay * 1000000);
}
- curl_easy_cleanup(curl_handle);
- curl_slist_free_all(headers);
- curl_handle = NULL;
-
- /* if we are here the web post failed for some reason */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to post to web server, writing to file\n");
-
- if ((path = switch_mprintf("%s%s%s.cdr.xml",
- globals.err_log_dir,
- SWITCH_PATH_SEPARATOR,
- switch_core_session_get_uuid(session)))) {
- if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
- int wrote;
- wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
- close(fd);
- fd = -1;
- } else {
- char ebuf[512] = { 0 };
+ curl_easy_perform(curl_handle);
+ curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
+ if (httpRes == 200) {
+ goto success;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Got error [%ld] posting to web server [%s]\n",httpRes, globals.url);
+ }
+
+ }
+ curl_easy_cleanup(curl_handle);
+ curl_slist_free_all(headers);
+ curl_handle = NULL;
+
+ /* if we are here the web post failed for some reason */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to post to web server, writing to file\n");
+
+ if ((path = switch_mprintf("%s%s%s.cdr.xml",
+ globals.err_log_dir,
+ SWITCH_PATH_SEPARATOR,
+ switch_core_session_get_uuid(session)))) {
+ if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
+ int wrote;
+ wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
+ close(fd);
+ fd = -1;
+ } else {
+ char ebuf[512] = { 0 };
#ifdef WIN32
- strerror_s(ebuf, sizeof(ebuf), errno);
+ strerror_s(ebuf, sizeof(ebuf), errno);
#else
- strerror_r(errno, ebuf, sizeof(ebuf));
+ strerror_r(errno, ebuf, sizeof(ebuf));
#endif
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error![%s]\n", ebuf);
- }
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error![%s]\n", ebuf);
}
}
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Generating Data!\n");
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c Wed Dec 12 18:27:30 2007
@@ -138,7 +138,7 @@
switch_uuid_get(&uuid);
switch_uuid_format(uuid_str, &uuid);
- snprintf(filename, sizeof(filename), "%s%s.tmp.xml", SWITCH_GLOBAL_dirs.temp_dir, uuid_str);
+ switch_snprintf(filename, sizeof(filename), "%s%s.tmp.xml", SWITCH_GLOBAL_dirs.temp_dir, uuid_str);
curl_handle = curl_easy_init();
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
@@ -194,7 +194,9 @@
if(keep_files_around) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "XML response is in %s\n", filename);
} else {
- unlink(filename);
+ if (unlink(filename) != 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "XML response file [%s] delete failed\n", filename);
+ }
}
return xml;
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c Wed Dec 12 18:27:30 2007
@@ -190,7 +190,7 @@
goto fail;
}
- snprintf(z, sizeof(z), "%s:%s", globals.user, globals.pass);
+ switch_snprintf(z, sizeof(z), "%s:%s", globals.user, globals.pass);
Base64Encode(z, t);
if (!strcmp(p, t)) {
@@ -241,9 +241,9 @@
} else {
if (mypass1) {
if (at) {
- snprintf(z, sizeof(z), "%s@%s:%s", user, domain_name, mypass1);
+ switch_snprintf(z, sizeof(z), "%s@%s:%s", user, domain_name, mypass1);
} else {
- snprintf(z, sizeof(z), "%s:%s", user, mypass1);
+ switch_snprintf(z, sizeof(z), "%s:%s", user, mypass1);
}
Base64Encode(z, t);
@@ -255,9 +255,9 @@
if (mypass2) {
if (at) {
- snprintf(z, sizeof(z), "%s@%s:%s", user, domain_name, mypass2);
+ switch_snprintf(z, sizeof(z), "%s@%s:%s", user, domain_name, mypass2);
} else {
- snprintf(z, sizeof(z), "%s:%s", user, mypass2);
+ switch_snprintf(z, sizeof(z), "%s:%s", user, mypass2);
}
Base64Encode(z, t);
@@ -270,9 +270,9 @@
if (box) {
if (mypass1) {
if (at) {
- snprintf(z, sizeof(z), "%s@%s:%s", box, domain_name, mypass1);
+ switch_snprintf(z, sizeof(z), "%s@%s:%s", box, domain_name, mypass1);
} else {
- snprintf(z, sizeof(z), "%s:%s", box, mypass1);
+ switch_snprintf(z, sizeof(z), "%s:%s", box, mypass1);
}
Base64Encode(z, t);
@@ -284,9 +284,9 @@
if (mypass2) {
if (at) {
- snprintf(z, sizeof(z), "%s@%s:%s", box, domain_name, mypass2);
+ switch_snprintf(z, sizeof(z), "%s@%s:%s", box, domain_name, mypass2);
} else {
- snprintf(z, sizeof(z), "%s:%s", box, mypass2);
+ switch_snprintf(z, sizeof(z), "%s:%s", box, mypass2);
}
Base64Encode(z, t);
@@ -321,7 +321,7 @@
switch_xml_free(x_domain_root);
}
- snprintf(z, sizeof(z), "Basic realm=\"%s\"", domain_name ? domain_name : globals.realm);
+ switch_snprintf(z, sizeof(z), "Basic realm=\"%s\"", domain_name ? domain_name : globals.realm);
ResponseAddField(r, "WWW-Authenticate", z);
ResponseStatus(r, 401);
return FALSE;
@@ -362,7 +362,7 @@
new_uri = "/";
}
- snprintf(tmp, sizeof(tmp), "%s%s",
+ switch_snprintf(tmp, sizeof(tmp), "%s%s",
SWITCH_GLOBAL_dirs.htdocs_dir,
new_uri
);
@@ -370,7 +370,7 @@
if (switch_directory_exists(tmp, NULL) == SWITCH_STATUS_SUCCESS) {
for (x = 0; x < 2; x++) {
- snprintf(tmp, sizeof(tmp), "%s%s%s%s",
+ switch_snprintf(tmp, sizeof(tmp), "%s%s%s%s",
SWITCH_GLOBAL_dirs.htdocs_dir,
new_uri,
end_of(new_uri) == *SWITCH_PATH_SEPARATOR ? "" : SWITCH_PATH_SEPARATOR,
@@ -378,7 +378,7 @@
);
if (switch_file_exists(tmp, NULL) == SWITCH_STATUS_SUCCESS) {
- snprintf(tmp, sizeof(tmp), "%s%s%s",
+ switch_snprintf(tmp, sizeof(tmp), "%s%s%s",
new_uri,
end_of(new_uri) == '/' ? "" : "/",
list[x]
@@ -624,7 +624,7 @@
}
- snprintf(buf, sizeof(buf), "Connection: close\r\n");
+ switch_snprintf(buf, sizeof(buf), "Connection: close\r\n");
ConnWrite(r->conn, buf, (uint32_t) strlen(buf));
if (html) {
@@ -712,16 +712,16 @@
if (switch_core_management_exec(relative_oid, action, buf, sizeof(buf)) == SWITCH_STATUS_SUCCESS) {
if (action == SMA_SET) {
if (*buf != '\0') {
- snprintf(buf, sizeof(buf), "OK\n");
+ switch_snprintf(buf, sizeof(buf), "OK\n");
}
}
} else {
if (*buf != '\0') {
- snprintf(buf, sizeof(buf), "ERROR\n");
+ switch_snprintf(buf, sizeof(buf), "ERROR\n");
}
}
} else {
- snprintf(buf, sizeof(buf), "Invalid Action %s\n", s_action);
+ switch_snprintf(buf, sizeof(buf), "Invalid Action %s\n", s_action);
}
/* Return our result. */
@@ -765,7 +765,7 @@
}
}
- snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch_http.log");
+ switch_snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch_http.log");
ServerCreate(&globals.abyssServer, "XmlRpcServer", globals.port, SWITCH_GLOBAL_dirs.htdocs_dir, logfile);
xmlrpc_server_abyss_set_handler(&env, &globals.abyssServer, "/RPC2", registryP);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_apr.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_apr.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_apr.c Wed Dec 12 18:27:30 2007
@@ -502,9 +502,11 @@
const char *name;
while (apr_dir_read(&(thedir->finfo), finfo_flags, thedir->dir_handle) == SWITCH_STATUS_SUCCESS) {
+
if (thedir->finfo.filetype != APR_REG) {
continue;
}
+
if (!(name = thedir->finfo.fname)) {
name = thedir->finfo.name;
}
@@ -516,6 +518,7 @@
if (name) {
switch_copy_string(buf, name, len);
fname = buf;
+ break;
} else {
continue;
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_caller.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_caller.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_caller.c Wed Dec 12 18:27:30 2007
@@ -200,75 +200,75 @@
if (!switch_strlen_zero(caller_profile->username)) {
- snprintf(header_name, sizeof(header_name), "%s-Username", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Username", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->username);
}
if (!switch_strlen_zero(caller_profile->dialplan)) {
- snprintf(header_name, sizeof(header_name), "%s-Dialplan", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Dialplan", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->dialplan);
}
if (!switch_strlen_zero(caller_profile->caller_id_name)) {
- snprintf(header_name, sizeof(header_name), "%s-Caller-ID-Name", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Caller-ID-Name", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->caller_id_name);
}
if (!switch_strlen_zero(caller_profile->caller_id_number)) {
- snprintf(header_name, sizeof(header_name), "%s-Caller-ID-Number", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Caller-ID-Number", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->caller_id_number);
}
if (!switch_strlen_zero(caller_profile->network_addr)) {
- snprintf(header_name, sizeof(header_name), "%s-Network-Addr", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Network-Addr", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->network_addr);
}
if (!switch_strlen_zero(caller_profile->ani)) {
- snprintf(header_name, sizeof(header_name), "%s-ANI", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-ANI", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->ani);
}
if (!switch_strlen_zero(caller_profile->aniii)) {
- snprintf(header_name, sizeof(header_name), "%s-ANI-II", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-ANI-II", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->aniii);
}
if (!switch_strlen_zero(caller_profile->destination_number)) {
- snprintf(header_name, sizeof(header_name), "%s-Destination-Number", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Destination-Number", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->destination_number);
}
if (!switch_strlen_zero(caller_profile->uuid)) {
- snprintf(header_name, sizeof(header_name), "%s-Unique-ID", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Unique-ID", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->uuid);
}
if (!switch_strlen_zero(caller_profile->source)) {
- snprintf(header_name, sizeof(header_name), "%s-Source", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Source", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->source);
}
if (!switch_strlen_zero(caller_profile->context)) {
- snprintf(header_name, sizeof(header_name), "%s-Context", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Context", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->context);
}
if (!switch_strlen_zero(caller_profile->rdnis)) {
- snprintf(header_name, sizeof(header_name), "%s-RDNIS", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-RDNIS", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->rdnis);
}
if (!switch_strlen_zero(caller_profile->chan_name)) {
- snprintf(header_name, sizeof(header_name), "%s-Channel-Name", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Name", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->chan_name);
}
if (caller_profile->times) {
- snprintf(header_name, sizeof(header_name), "%s-Channel-Created-Time", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Created-Time", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->created);
- snprintf(header_name, sizeof(header_name), "%s-Channel-Answered-Time", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Answered-Time", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
- snprintf(header_name, sizeof(header_name), "%s-Channel-Hangup-Time", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Hangup-Time", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup);
- snprintf(header_name, sizeof(header_name), "%s-Channel-Transfer-Time", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Transfer-Time", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->transferred);
}
- snprintf(header_name, sizeof(header_name), "%s-Screen-Bit", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Screen-Bit", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_SCREEN) ? "yes" : "no");
- snprintf(header_name, sizeof(header_name), "%s-Privacy-Hide-Name", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Privacy-Hide-Name", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME) ? "yes" : "no");
- snprintf(header_name, sizeof(header_name), "%s-Privacy-Hide-Number", prefix);
+ switch_snprintf(header_name, sizeof(header_name), "%s-Privacy-Hide-Number", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER) ? "yes" : "no");
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_channel.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_channel.c Wed Dec 12 18:27:30 2007
@@ -595,7 +595,7 @@
switch_channel_event_set_data(channel, event);
} else {
char state_num[25];
- snprintf(state_num, sizeof(state_num), "%d", channel->state);
+ switch_snprintf(state_num, sizeof(state_num), "%d", channel->state);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State", "%s", (char *) switch_channel_state_name(channel->state));
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%s", (char *) state_num);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", channel->name);
@@ -830,7 +830,7 @@
}
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State", "%s", switch_channel_state_name(channel->state));
- snprintf(state_num, sizeof(state_num), "%d", channel->state);
+ switch_snprintf(state_num, sizeof(state_num), "%d", channel->state);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%s", state_num);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", switch_channel_get_name(channel));
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", switch_core_session_get_uuid(channel->session));
@@ -870,7 +870,7 @@
x++;
switch_assert(vvar && vval);
- snprintf(buf, sizeof(buf), "variable_%s", vvar);
+ switch_snprintf(buf, sizeof(buf), "variable_%s", vvar);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, buf, "%s", vval);
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_config.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_config.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_config.c Wed Dec 12 18:27:30 2007
@@ -41,7 +41,7 @@
if (switch_is_file_path(file_path)) {
path = file_path;
} else {
- snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, file_path);
+ switch_snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, file_path);
path = path_buf;
}
@@ -57,7 +57,7 @@
int last = -1;
char *var, *val;
- snprintf(path_buf, sizeof(path_buf), "%s%sfreeswitch.conf", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR);
+ switch_snprintf(path_buf, sizeof(path_buf), "%s%sfreeswitch.conf", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR);
path = path_buf;
if ((f = fopen(path, "r")) == 0) {
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_console.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_console.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_console.c Wed Dec 12 18:27:30 2007
@@ -94,7 +94,7 @@
ret = -1;
} else {
ret = 0;
- snprintf(end, remaining, "%s", data);
+ switch_snprintf(end, remaining, "%s", data);
handle->data_len = strlen(buf);
handle->end = (uint8_t *) (handle->data) + handle->data_len;
}
@@ -204,7 +204,7 @@
char * prompt(EditLine *e) {
if (*prompt_str == '\0') {
gethostname(hostname, sizeof(hostname));
- snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", hostname);
+ switch_snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", hostname);
}
return prompt_str;
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core.c Wed Dec 12 18:27:30 2007
@@ -534,7 +534,7 @@
if (bg) {
bg = 0;
#ifdef WIN32
- snprintf(path, sizeof(path), "Global\\Freeswitch.%d", getpid());
+ switch_snprintf(path, sizeof(path), "Global\\Freeswitch.%d", getpid());
shutdown_event = CreateEvent(NULL, FALSE, FALSE, path);
if (shutdown_event) {
WaitForSingleObject(shutdown_event, INFINITE);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_codec.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_codec.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_codec.c Wed Dec 12 18:27:30 2007
@@ -54,7 +54,7 @@
}
switch_channel_set_variable(channel, "read_codec", codec->implementation->iananame);
- snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
+ switch_snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
switch_channel_set_variable(channel, "read_rate", tmp);
session->read_codec = codec;
@@ -92,7 +92,7 @@
}
switch_channel_set_variable(channel, "write_codec", codec->implementation->iananame);
- snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
+ switch_snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
switch_channel_set_variable(channel, "write_rate", tmp);
session->write_codec = codec;
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_db.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_db.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_db.c Wed Dec 12 18:27:30 2007
@@ -42,7 +42,7 @@
if (switch_is_file_path(dbname)) {
strncpy(buf, dbname, size);
} else {
- snprintf(buf, size, "%s%s%s.db", SWITCH_GLOBAL_dirs.db_dir, SWITCH_PATH_SEPARATOR, dbname);
+ switch_snprintf(buf, size, "%s%s%s.db", SWITCH_GLOBAL_dirs.db_dir, SWITCH_PATH_SEPARATOR, dbname);
}
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_file.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_file.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_file.c Wed Dec 12 18:27:30 2007
@@ -73,10 +73,10 @@
fh->handler = switch_core_strdup(fh->memory_pool, rhs);
}
- if (rate) {
- fh->samplerate = rate;
- } else {
- rate = 8000;
+ if (!fh->samplerate) {
+ if (!(fh->samplerate = rate)) {
+ fh->samplerate = 8000;
+ }
}
if (channels) {
@@ -85,25 +85,130 @@
fh->channels = 1;
}
- if ((status = fh->file_interface->file_open(fh, file_path)) == SWITCH_STATUS_SUCCESS) {
- switch_set_flag(fh, SWITCH_FILE_OPEN);
+ if ((status = fh->file_interface->file_open(fh, file_path)) != SWITCH_STATUS_SUCCESS) {
+ return status;
+ }
+
+ if ((flags & SWITCH_FILE_FLAG_READ)) {
+ fh->native_rate = fh->samplerate;
+ } else {
+ fh->native_rate = rate;
+ }
+
+ if (fh->samplerate != rate) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Sample rate doesn't match\n");
+ if ((flags & SWITCH_FILE_FLAG_READ)) {
+ fh->samplerate = rate;
+ }
}
+ switch_set_flag(fh, SWITCH_FILE_OPEN);
+
return status;
}
SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh, void *data, switch_size_t *len)
{
+ switch_status_t status;
+ switch_size_t orig_len = *len;
+
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
- return fh->file_interface->file_read(fh, data, len);
+ if (fh->buffer && switch_buffer_inuse(fh->buffer)) {
+ *len = switch_buffer_read(fh->buffer, data, orig_len);
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ if ((status = fh->file_interface->file_read(fh, data, len)) != SWITCH_STATUS_SUCCESS) {
+ goto done;
+ }
+
+ if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->native_rate != fh->samplerate) {
+ if (!fh->resampler) {
+ if (switch_resample_create(&fh->resampler,
+ fh->native_rate,
+ orig_len * 10,
+ fh->samplerate,
+ orig_len * 10,
+ fh->memory_pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
+ return SWITCH_STATUS_GENERR;
+ }
+ }
+
+ fh->resampler->from_len = switch_short_to_float(data, fh->resampler->from, (int) *len);
+ fh->resampler->to_len =
+ switch_resample_process(fh->resampler, fh->resampler->from, fh->resampler->from_len, fh->resampler->to, fh->resampler->to_size, 0);
+
+ if (fh->resampler->to_len > orig_len) {
+ if (!fh->buffer) {
+ switch_buffer_create_dynamic(&fh->buffer, fh->resampler->to_len * 2, fh->resampler->to_len * 4, fh->resampler->to_len * 8);
+ switch_assert(fh->buffer);
+ }
+ if (!fh->dbuf) {
+ fh->dbuflen = fh->resampler->to_len * 2;
+ fh->dbuf = switch_core_alloc(fh->memory_pool, fh->dbuflen);
+ }
+ switch_assert(fh->resampler->to_len <= fh->dbuflen);
+
+ switch_float_to_short(fh->resampler->to, (int16_t *) fh->dbuf, fh->resampler->to_len);
+ switch_buffer_write(fh->buffer, fh->dbuf, fh->resampler->to_len * 2);
+ *len = switch_buffer_read(fh->buffer, data, orig_len);
+ } else {
+ switch_float_to_short(fh->resampler->to, data, fh->resampler->to_len);
+ *len = fh->resampler->to_len;
+ }
+
+ }
+
+ done:
+
+ return status;
}
SWITCH_DECLARE(switch_status_t) switch_core_file_write(switch_file_handle_t *fh, void *data, switch_size_t *len)
{
+ switch_size_t orig_len = *len;
+
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
+
+ if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->native_rate != fh->samplerate) {
+ if (!fh->resampler) {
+ if (switch_resample_create(&fh->resampler,
+ fh->native_rate,
+ orig_len * 10,
+ fh->samplerate,
+ orig_len * 10,
+ fh->memory_pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
+ return SWITCH_STATUS_GENERR;
+ }
+ }
+
+ fh->resampler->from_len = switch_short_to_float(data, fh->resampler->from, (int) *len);
+ fh->resampler->to_len =
+ switch_resample_process(fh->resampler, fh->resampler->from, fh->resampler->from_len, fh->resampler->to, fh->resampler->to_size, 0);
+ if (fh->resampler->to_len > orig_len) {
+ if (!fh->dbuf) {
+ fh->dbuflen = fh->resampler->to_len * 2;
+ fh->dbuf = switch_core_alloc(fh->memory_pool, fh->dbuflen);
+ }
+ switch_assert(fh->resampler->to_len <= fh->dbuflen);
+ switch_float_to_short(fh->resampler->to, (int16_t *) fh->dbuf, fh->resampler->to_len);
+ data = fh->dbuf;
+ } else {
+ switch_float_to_short(fh->resampler->to, data, fh->resampler->to_len);
+ }
+
+ *len = fh->resampler->to_len;
+
+ }
+
+ if (!*len) {
+ return SWITCH_STATUS_SUCCESS;
+ }
return fh->file_interface->file_write(fh, data, len);
}
@@ -151,6 +256,13 @@
switch_clear_flag(fh, SWITCH_FILE_OPEN);
status = fh->file_interface->file_close(fh);
+ if (fh->buffer) {
+ switch_buffer_destroy(&fh->buffer);
+ }
+
+ switch_resample_destroy(&fh->resampler);
+
+
if (switch_test_flag(fh, SWITCH_FILE_FLAG_FREE_POOL)) {
switch_core_destroy_memory_pool(&fh->memory_pool);
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_session.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_core_session.c Wed Dec 12 18:27:30 2007
@@ -566,11 +566,9 @@
char buf[256];
switch_size_t has;
- /* sweep theese under the rug, they wont be leaked they will be reclaimed
- when the session ends.
- */
- session->read_resampler = NULL;
- session->write_resampler = NULL;
+ /* clear resamplers*/
+ switch_resample_destroy(&session->read_resampler);
+ switch_resample_destroy(&session->write_resampler);
/* clear indications */
switch_core_session_flush_message(session);
@@ -808,7 +806,7 @@
switch_queue_create(&session->event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
switch_queue_create(&session->private_event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
- snprintf(session->name, sizeof(session->name), "%"SWITCH_SIZE_T_FMT, session->id);
+ switch_snprintf(session->name, sizeof(session->name), "%"SWITCH_SIZE_T_FMT, session->id);
switch_mutex_lock(runtime.throttle_mutex);
session->id = session_manager.session_id++;
switch_core_hash_insert(session_manager.session_table, session->uuid_str, session);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_event.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_event.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_event.c Wed Dec 12 18:27:30 2007
@@ -761,7 +761,7 @@
if (encode) {
switch_url_encode(hp->value, encode_buf, encode_len - 1);
} else {
- snprintf(encode_buf, encode_len, "[%s]", hp->value);
+ switch_snprintf(encode_buf, encode_len, "[%s]", hp->value);
}
llen = strlen(hp->name) + strlen(encode_buf) + 8;
@@ -779,7 +779,7 @@
}
}
- snprintf(buf + len, dlen - len, "%s: %s\n", hp->name, switch_strlen_zero(encode_buf) ? "_undef_" : encode_buf);
+ switch_snprintf(buf + len, dlen - len, "%s: %s\n", hp->name, switch_strlen_zero(encode_buf) ? "_undef_" : encode_buf);
len = strlen(buf);
}
@@ -809,12 +809,12 @@
}
if (blen) {
- snprintf(buf + len, dlen - len, "Content-Length: %d\n\n%s", blen, event->body);
+ switch_snprintf(buf + len, dlen - len, "Content-Length: %d\n\n%s", blen, event->body);
} else {
- snprintf(buf + len, dlen - len, "\n");
+ switch_snprintf(buf + len, dlen - len, "\n");
}
} else {
- snprintf(buf + len, dlen - len, "\n");
+ switch_snprintf(buf + len, dlen - len, "\n");
}
*str = buf;
@@ -877,7 +877,7 @@
if (body) {
int blen = (int) strlen(body);
char blena[25];
- snprintf(blena, sizeof(blena), "%d", blen);
+ switch_snprintf(blena, sizeof(blena), "%d", blen);
if (blen) {
switch_xml_t xbody = NULL;
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_ivr.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_ivr.c Wed Dec 12 18:27:30 2007
@@ -1456,25 +1456,25 @@
if (!(time_tag = switch_xml_add_child_d(x_times, "created_time", t_off++))) {
goto error;
}
- snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->created);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->created);
switch_xml_set_txt_d(time_tag, tmp);
if (!(time_tag = switch_xml_add_child_d(x_times, "answered_time", t_off++))) {
goto error;
}
- snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
switch_xml_set_txt_d(time_tag, tmp);
if (!(time_tag = switch_xml_add_child_d(x_times, "hangup_time", t_off++))) {
goto error;
}
- snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup);
switch_xml_set_txt_d(time_tag, tmp);
if (!(time_tag = switch_xml_add_child_d(x_times, "transfer_time", t_off++))) {
goto error;
}
- snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->transferred);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->transferred);
switch_xml_set_txt_d(time_tag, tmp);
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_ivr_play_say.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_ivr_play_say.c Wed Dec 12 18:27:30 2007
@@ -127,7 +127,7 @@
}
switch_url_encode(data, enc_hint, sizeof(enc_hint));
- snprintf(hint_data, sizeof(hint_data), "macro_name=%s&lang=%s&data=%s&destination_number=%s", macro_name, chan_lang, enc_hint, switch_channel_get_variable(channel,"destination_number"));
+ switch_snprintf(hint_data, sizeof(hint_data), "macro_name=%s&lang=%s&data=%s&destination_number=%s", macro_name, chan_lang, enc_hint, switch_channel_get_variable(channel,"destination_number"));
if (switch_xml_locate("phrases", NULL, NULL, NULL, &xml, &cfg, hint_data) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of phrases failed.\n");
@@ -348,8 +348,6 @@
const char *vval;
time_t start = 0;
uint32_t org_silence_hits = 0;
- switch_audio_resampler_t *resampler = NULL;
- int16_t resamp_out[2048];
if (!fh) {
fh = &lfh;
@@ -362,27 +360,13 @@
switch_assert(read_codec != NULL);
fh->channels = read_codec->implementation->number_of_channels;
+ fh->native_rate = read_codec->implementation->actual_samples_per_second;
- if (fh->samplerate) {
- if (fh->samplerate != read_codec->implementation->actual_samples_per_second) {
- if (switch_resample_create(&resampler,
- read_codec->implementation->actual_samples_per_second,
- read_codec->implementation->actual_samples_per_second * 20,
- fh->samplerate,
- fh->samplerate * 20,
- switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
- return SWITCH_STATUS_GENERR;
- }
- }
- } else {
- fh->samplerate = read_codec->implementation->actual_samples_per_second;
- }
if (switch_core_file_open(fh,
file,
fh->channels,
- fh->samplerate,
+ read_codec->implementation->actual_samples_per_second,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_core_session_reset(session);
@@ -553,18 +537,10 @@
}
}
- if (!switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
+ if (!switch_test_flag(fh, SWITCH_FILE_PAUSE) && !switch_test_flag(read_frame, SFF_CNG)) {
int16_t *data = read_frame->data;
len = (switch_size_t) read_frame->datalen / 2;
- if (resampler) {
- resampler->from_len = switch_short_to_float(read_frame->data, resampler->from, (int) len);
- resampler->to_len = switch_resample_process(resampler, resampler->from, resampler->from_len, resampler->to, resampler->to_size, 0);
- switch_float_to_short(resampler->to, resamp_out, read_frame->datalen);
- len = resampler->to_len;
- data = resamp_out;
- }
-
if (switch_core_file_write(fh, data, &len) != SWITCH_STATUS_SUCCESS) {
break;
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_loadable_module.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_loadable_module.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_loadable_module.c Wed Dec 12 18:27:30 2007
@@ -784,7 +784,7 @@
len += strlen(file);
len += 8;
path = (char *) switch_core_alloc(loadable_modules.pool, len);
- snprintf(path, len, "%s%s%s%s", dir, SWITCH_PATH_SEPARATOR, file, ext);
+ switch_snprintf(path, len, "%s%s%s%s", dir, SWITCH_PATH_SEPARATOR, file, ext);
}
switch_mutex_lock(loadable_modules.mutex);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_log.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_log.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_log.c Wed Dec 12 18:27:30 2007
@@ -222,7 +222,7 @@
len = (uint32_t) (strlen(extra_fmt) + strlen(date) + strlen(filep) + 32 + strlen(funcp) + strlen(fmt));
new_fmt = malloc(len + 1);
switch_assert(new_fmt);
- snprintf(new_fmt, len, extra_fmt, date, switch_log_level2str(level), filep, line, funcp, 128, fmt);
+ switch_snprintf(new_fmt, len, extra_fmt, date, switch_log_level2str(level), filep, line, funcp, 128, fmt);
fmt = new_fmt;
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_resample.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_resample.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_resample.c Wed Dec 12 18:27:30 2007
@@ -111,11 +111,17 @@
#endif
}
-SWITCH_DECLARE(void) switch_resample_destroy(switch_audio_resampler_t *resampler)
+SWITCH_DECLARE(void) switch_resample_destroy(switch_audio_resampler_t **resampler)
{
+
+ if (resampler && *resampler) {
#ifndef DISABLE_RESAMPLE
- resample_close(resampler->resampler);
+ if ((*resampler)->resampler) {
+ resample_close((*resampler)->resampler);
+ }
#endif
+ *resampler = NULL;
+ }
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_rtp.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_rtp.c Wed Dec 12 18:27:30 2007
@@ -652,8 +652,8 @@
char ice_user[80];
char user_ice[80];
- snprintf(ice_user, sizeof(ice_user), "%s%s", login, rlogin);
- snprintf(user_ice, sizeof(user_ice), "%s%s", rlogin, login);
+ switch_snprintf(ice_user, sizeof(ice_user), "%s%s", login, rlogin);
+ switch_snprintf(user_ice, sizeof(user_ice), "%s%s", rlogin, login);
rtp_session->ice_user = switch_core_strdup(rtp_session->pool, ice_user);
rtp_session->user_ice = switch_core_strdup(rtp_session->pool, user_ice);
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_utils.c
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_utils.c (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_utils.c Wed Dec 12 18:27:30 2007
@@ -229,7 +229,7 @@
unsigned char in[B64BUFFLEN];
unsigned char out[B64BUFFLEN + 512];
- snprintf(filename, 80, "%smail.%d%04x", SWITCH_GLOBAL_dirs.temp_dir, (int)time(NULL), rand() & 0xffff);
+ switch_snprintf(filename, 80, "%smail.%d%04x", SWITCH_GLOBAL_dirs.temp_dir, (int)time(NULL), rand() & 0xffff);
if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644))) {
if (file) {
@@ -237,7 +237,7 @@
return SWITCH_FALSE;
}
- snprintf(buf, B64BUFFLEN, "MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"%s\"\n", bound);
+ switch_snprintf(buf, B64BUFFLEN, "MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"%s\"\n", bound);
if (!write_buf(fd, buf)) {
return SWITCH_FALSE;
}
@@ -251,9 +251,9 @@
if (file) {
if (body && switch_stristr("content-type", body)) {
- snprintf(buf, B64BUFFLEN, "--%s\n", bound);
+ switch_snprintf(buf, B64BUFFLEN, "--%s\n", bound);
} else {
- snprintf(buf, B64BUFFLEN, "--%s\nContent-Type: text/plain\n\n", bound);
+ switch_snprintf(buf, B64BUFFLEN, "--%s\nContent-Type: text/plain\n\n", bound);
}
if (!write_buf(fd, buf))
return SWITCH_FALSE;
@@ -277,7 +277,7 @@
}
}
- snprintf(buf, B64BUFFLEN,
+ switch_snprintf(buf, B64BUFFLEN,
"\n\n--%s\nContent-Type: %s; name=\"%s\"\n"
"Content-ID: <ATTACHED at freeswitch.org>\n"
"Content-Transfer-Encoding: base64\n"
@@ -322,7 +322,7 @@
if (file) {
- snprintf(buf, B64BUFFLEN, "\n\n--%s--\n.\n", bound);
+ switch_snprintf(buf, B64BUFFLEN, "\n\n--%s--\n.\n", bound);
if (!write_buf(fd, buf))
return SWITCH_FALSE;
}
@@ -334,7 +334,7 @@
if (ifd) {
close(ifd);
}
- snprintf(buf, B64BUFFLEN, "/bin/cat %s | %s %s %s", filename, runtime.mailer_app, runtime.mailer_app_args, to);
+ switch_snprintf(buf, B64BUFFLEN, "/bin/cat %s | %s %s %s", filename, runtime.mailer_app, runtime.mailer_app_args, to);
if(system(buf)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to execute command: %s\n", buf);
}
@@ -826,7 +826,7 @@
static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"];
- if (snprintf(tmp, sizeof tmp, fmt,
+ if (switch_snprintf(tmp, sizeof tmp, fmt,
src[0], src[1], src[2], src[3]) >= (int)size) {
return NULL;
}
Modified: freeswitch/branches/stkn/sofia-exp/trunk/src/switch_xml.cpp
==============================================================================
--- freeswitch/branches/stkn/sofia-exp/trunk/src/switch_xml.cpp (original)
+++ freeswitch/branches/stkn/sofia-exp/trunk/src/switch_xml.cpp Wed Dec 12 18:27:30 2007
@@ -294,7 +294,7 @@
for (t = root->s; t && t < s; t++)
if (*t == '\n')
line++;
- snprintf(fmt, SWITCH_XML_ERRL, "[error near line %d]: %s", line, err);
+ switch_snprintf(fmt, SWITCH_XML_ERRL, "[error near line %d]: %s", line, err);
va_start(ap, err);
vsnprintf(root->err, SWITCH_XML_ERRL, fmt, ap);
@@ -1288,7 +1288,7 @@
*domain = NULL;
if (!params) {
- snprintf(my_params, sizeof(my_params), "domain=%s", domain_name);
+ switch_snprintf(my_params, sizeof(my_params), "domain=%s", domain_name);
params = my_params;
}
@@ -1312,10 +1312,10 @@
*domain = NULL;
if (!switch_strlen_zero(xtra_params)) {
- snprintf(params, sizeof(params), "key=%s&user=%s&domain=%s&ip=%s&%s", key,
+ switch_snprintf(params, sizeof(params), "key=%s&user=%s&domain=%s&ip=%s&%s", key,
switch_str_nil(user_name), switch_str_nil(domain_name), switch_str_nil(ip), xtra_params);
} else {
- snprintf(params, sizeof(params), "key=%s&user=%s&domain=%s&ip=%s", key,
+ switch_snprintf(params, sizeof(params), "key=%s&user=%s&domain=%s&ip=%s", key,
switch_str_nil(user_name), switch_str_nil(domain_name), switch_str_nil(ip));
xtra_params = "";
}
@@ -1374,7 +1374,7 @@
switch_thread_rwlock_wrlock(RWLOCK);
}
- snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "freeswitch.xml");
+ switch_snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "freeswitch.xml");
if ((new_main = switch_xml_parse_file(path_buf))) {
*err = switch_xml_error(new_main);
switch_copy_string(not_so_threadsafe_error_buffer, *err, sizeof(not_so_threadsafe_error_buffer));
More information about the Freeswitch-svn
mailing list