[Freeswitch-branches] [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:32 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, "