[Freeswitch-svn] [commit] r1153 - in freeswitch/branches/james: . libs/iax/src libs/libdingaling/src src src/mod/endpoints/mod_dingaling src/mod/endpoints/mod_wanpipe w32/vsnet w32/vsnet/Tools/gnutls

james at freeswitch.org james at freeswitch.org
Wed Jun 7 14:22:25 EDT 2006


Author: james
Date: Fri Apr 14 05:24:38 2006
New Revision: 1153

Added:
   freeswitch/branches/james/w32/vsnet/Tools/gnutls/
      - copied from r1150, /freeswitch/trunk/w32/vsnet/Tools/gnutls/
   freeswitch/branches/james/w32/vsnet/Tools/gnutls/gnutls.zip
      - copied unchanged from r1150, /freeswitch/trunk/w32/vsnet/Tools/gnutls/gnutls.zip
   freeswitch/branches/james/w32/vsnet/Tools/gnutls/libcrypt.zip
      - copied unchanged from r1150, /freeswitch/trunk/w32/vsnet/Tools/gnutls/libcrypt.zip
   freeswitch/branches/james/w32/vsnet/Tools/gnutls/libgpg-error.zip
      - copied unchanged from r1150, /freeswitch/trunk/w32/vsnet/Tools/gnutls/libgpg-error.zip
Modified:
   freeswitch/branches/james/   (props changed)
   freeswitch/branches/james/libs/iax/src/iax.c
   freeswitch/branches/james/libs/iax/src/winpoop.h
   freeswitch/branches/james/libs/libdingaling/src/libdingaling.c
   freeswitch/branches/james/libs/libdingaling/src/libdingaling.h
   freeswitch/branches/james/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/branches/james/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
   freeswitch/branches/james/src/switch_rtp.c
   freeswitch/branches/james/w32/vsnet/GetLibs.vbs

Log:
Updated branch to trunk.


Modified: freeswitch/branches/james/libs/iax/src/iax.c
==============================================================================
--- freeswitch/branches/james/libs/iax/src/iax.c	(original)
+++ freeswitch/branches/james/libs/iax/src/iax.c	Fri Apr 14 05:24:38 2006
@@ -36,7 +36,7 @@
 #endif
 
 void gettimeofday(struct timeval *tv, void /*struct timezone*/ *tz);
-
+#include "winpoop.h"
 
 #else
 

Modified: freeswitch/branches/james/libs/iax/src/winpoop.h
==============================================================================
--- freeswitch/branches/james/libs/iax/src/winpoop.h	(original)
+++ freeswitch/branches/james/libs/iax/src/winpoop.h	Fri Apr 14 05:24:38 2006
@@ -24,7 +24,6 @@
 
 static INLINE int inet_aton(char *cp, struct in_addr *inp)
 {
-	int res;
 	int a1, a2, a3, a4;
 	unsigned int saddr;
 	if (sscanf(cp, "%d.%d.%d.%d", &a1, &a2, &a3, &a4) != 4)

Modified: freeswitch/branches/james/libs/libdingaling/src/libdingaling.c
==============================================================================
--- freeswitch/branches/james/libs/libdingaling/src/libdingaling.c	(original)
+++ freeswitch/branches/james/libs/libdingaling/src/libdingaling.c	Fri Apr 14 05:24:38 2006
@@ -72,6 +72,7 @@
 	int debug;
 	apr_pool_t *memory_pool;
 	unsigned int id;
+	ldl_logger_t logger;
 } globals;
 
 struct packet_node {
@@ -128,6 +129,41 @@
 	void *private_data;
 };
 
+
+static char *cut_path(char *in)
+{
+	char *p, *ret = in;
+	char delims[] = "/\\";
+	char *i;
+
+	for (i = delims; *i; i++) {
+		p = in;
+		while ((p = strchr(p, *i)) != 0) {
+			ret = ++p;
+		}
+	}
+	return ret;
+}
+
+static void default_logger(char *file, const char *func, int line, int level, char *fmt, ...)
+{
+	char *fp;
+	char data[1024];
+
+	va_list ap;
+	
+	fp = cut_path(file);
+
+	va_start(ap, fmt);
+
+	vsnprintf(data, sizeof(data), fmt, ap);
+
+	fprintf(globals.log_stream, "%s:%d %s() %s", file, line, func, data);
+
+	va_end(ap);
+
+}
+
 static unsigned int next_id(void)
 {
 	return globals.id++;
@@ -147,7 +183,7 @@
 		apr_pool_t *pool = session->pool;
 
 		if (globals.debug) {
-			fprintf(globals.log_stream, "Destroyed Session %s\n", session->id);
+			globals.logger(DL_LOG_DEBUG, "Destroyed Session %s\n", session->id);
 		}
 		if (session->id) {
 			apr_hash_set(session->handle->sessions, session->id, APR_HASH_KEY_STRING, NULL);
@@ -170,7 +206,7 @@
 	ldl_session_t *session = NULL;
 	
 	if (!(session = apr_palloc(handle->pool, sizeof(ldl_session_t)))) {
-		fprintf(globals.log_stream, "Memory ERROR!\n");
+		globals.logger(DL_LOG_DEBUG, "Memory ERROR!\n");
 		*session_p = NULL;
 		return LDL_STATUS_MEMERR;
 	}
@@ -190,7 +226,7 @@
 	*session_p = session;
 	
 	if (globals.debug) {
-		fprintf(globals.log_stream, "Created Session %s\n", id);
+		globals.logger(DL_LOG_DEBUG, "Created Session %s\n", id);
 	}
 
 	return LDL_STATUS_SUCCESS;
@@ -211,13 +247,13 @@
 
 	if (!session) {
 		if (globals.debug) {
-			fprintf(globals.log_stream, "Non-Existent Session %s!\n", id);
+			globals.logger(DL_LOG_DEBUG, "Non-Existent Session %s!\n", id);
 		}
 		return LDL_STATUS_MEMERR;
 	}
 	
 	if (globals.debug) {
-		fprintf(globals.log_stream, "Message for Session %s\n", id);
+		globals.logger(DL_LOG_DEBUG, "Message for Session %s\n", id);
 	}
 
 	while(xml) {
@@ -251,7 +287,7 @@
 									session->payload_len++;
 								
 									if (globals.debug) {
-										fprintf(globals.log_stream, "Add Payload [%s] id='%s'\n", name, id);
+										globals.logger(DL_LOG_DEBUG, "Add Payload [%s] id='%s'\n", name, id);
 									}
 								}
 							}
@@ -276,7 +312,7 @@
 							for (x = 0; x < session->candidate_len; x++) {
 								if (session->candidates[x].pref == pref) {
 									if (globals.debug) {
-										fprintf(globals.log_stream, "Duplicate Pref!\n");
+										globals.logger(DL_LOG_DEBUG, "Duplicate Pref!\n");
 									}
 									index = x;
 									break;
@@ -311,7 +347,7 @@
 							session->candidates[index].port = atoi(key);
 						}
 						if (globals.debug) {
-							fprintf(globals.log_stream, 
+							globals.logger(DL_LOG_DEBUG, 
 									"New Candidate %d\n"
 									"name=%s\n"
 									"type=%s\n"
@@ -394,7 +430,7 @@
 	apr_thread_mutex_lock(handle->lock);
 	if ((packet_node = apr_hash_get(handle->retry_hash, id, APR_HASH_KEY_STRING))) {
 		if (globals.debug) {
-			fprintf(globals.log_stream, "Cancel packet %s\n", packet_node->id);
+			globals.logger(DL_LOG_DEBUG, "Cancel packet %s\n", packet_node->id);
 		}
 		packet_node->retries = 0;
 	}
@@ -500,9 +536,9 @@
 				}
 			}
 		} else if (strcmp("failure", iks_name(node)) == 0) {
-			fprintf(globals.log_stream, "sasl authentication failed\n");
+			globals.logger(DL_LOG_DEBUG, "sasl authentication failed\n");
 		} else if (strcmp("success", iks_name(node)) == 0) {
-			fprintf(globals.log_stream, "XMPP server connected\n");
+			globals.logger(DL_LOG_DEBUG, "XMPP server connected\n");
 			iks_send_header(handle->parser, handle->acc->server);
 			ldl_set_flag(handle, LDL_FLAG_AUTHORIZED);
 		} else {
@@ -516,11 +552,11 @@
 		break;
 #if 0
 	case IKS_NODE_STOP:
-		fprintf(globals.log_stream, "server disconnected\n");
+		globals.logger(DL_LOG_DEBUG, "server disconnected\n");
 		break;
 
 	case IKS_NODE_ERROR:
-		fprintf(globals.log_stream, "stream error\n");
+		globals.logger(DL_LOG_DEBUG, "stream error\n");
 		break;
 #endif
 
@@ -553,7 +589,7 @@
 
 static int on_error(void *user_data, ikspak * pak)
 {
-	fprintf(globals.log_stream, "authorization failed\n");
+	globals.logger(DL_LOG_DEBUG, "authorization failed\n");
 	return IKS_FILTER_EAT;
 }
 
@@ -633,7 +669,7 @@
 	len = apr_queue_size(handle->retry_queue); 
 
 	if (globals.debug && len) {
-		fprintf(globals.log_stream, "Processing %u packets in retry queue\n", len);
+		globals.logger(DL_LOG_DEBUG, "Processing %u packets in retry queue\n", len);
 	}
 	apr_thread_mutex_lock(handle->lock);		
 	while(x < len && apr_queue_trypop(handle->retry_queue, &pop) == APR_SUCCESS) {
@@ -646,7 +682,7 @@
 			if (packet_node->retries > 0) {
 				packet_node->retries--;
 				if (globals.debug) {
-					fprintf(globals.log_stream, "Sending packet %s (%d left)\n", packet_node->id, packet_node->retries);
+					globals.logger(DL_LOG_DEBUG, "Sending packet %s (%d left)\n", packet_node->id, packet_node->retries);
 				}
 				iks_send(handle->parser, packet_node->xml);
 				packet_node->next = now + 5000000;
@@ -654,7 +690,7 @@
 		}
 		if (packet_node->retries == 0) {
 			if (globals.debug) {
-				fprintf(globals.log_stream, "Discarding packet %s\n", packet_node->id);
+				globals.logger(DL_LOG_DEBUG, "Discarding packet %s\n", packet_node->id);
 			}
 			apr_hash_set(handle->retry_hash, packet_node->id, APR_HASH_KEY_STRING, NULL);
 			iks_delete(packet_node->xml);
@@ -691,11 +727,11 @@
 		case IKS_OK:
 			break;
 		case IKS_NET_NODNS:
-			fprintf(globals.log_stream, "hostname lookup failed\n");
+			globals.logger(DL_LOG_DEBUG, "hostname lookup failed\n");
 		case IKS_NET_NOCONN:
-			fprintf(globals.log_stream, "connection failed\n");
+			globals.logger(DL_LOG_DEBUG, "connection failed\n");
 		default:
-			fprintf(globals.log_stream, "io error %d\n", e);
+			globals.logger(DL_LOG_DEBUG, "io error %d\n", e);
 			microsleep(500);
 			continue;
 		}
@@ -719,7 +755,7 @@
 			}
 
 			if (IKS_OK != e) {
-				fprintf(globals.log_stream, "io error %d\n", e);
+				globals.logger(DL_LOG_DEBUG, "io error %d\n", e);
 				microsleep(500);
 				break;
 			}
@@ -730,13 +766,13 @@
 
 			if (!ldl_test_flag(handle, LDL_FLAG_AUTHORIZED)) {
 				if (IKS_NET_TLSFAIL == e) {
-					fprintf(globals.log_stream, "tls handshake failed\n");
+					globals.logger(DL_LOG_DEBUG, "tls handshake failed\n");
 					microsleep(500);
 					break;
 				}
 
 				if (handle->counter == 0) {
-					fprintf(globals.log_stream, "network timeout\n");
+					globals.logger(DL_LOG_DEBUG, "network timeout\n");
 					microsleep(500);
 					break;
 				}
@@ -828,6 +864,11 @@
 	return handle->private_info;
 }
 
+void ldl_global_set_logger(ldl_logger_t logger)
+{
+	globals.logger = logger;
+}
+
 unsigned int ldl_session_terminate(ldl_session_t *session)
 {
 	iks *iq, *sess;
@@ -1012,15 +1053,16 @@
 
 	memset(&globals, 0, sizeof(globals));
 	if (apr_pool_create(&globals.memory_pool, NULL) != LDL_STATUS_SUCCESS) {
-		fprintf(globals.log_stream, "Could not allocate memory pool\n");
+		globals.logger(DL_LOG_DEBUG, "Could not allocate memory pool\n");
 		return LDL_STATUS_MEMERR;
 	}
 
 	globals.log_stream = stdout;
 	globals.debug = debug;
 	globals.id = 300;
+	globals.logger = default_logger;
 	ldl_set_flag(&globals, LDL_FLAG_INIT);
-
+	
 	return LDL_STATUS_SUCCESS;
 }
 

Modified: freeswitch/branches/james/libs/libdingaling/src/libdingaling.h
==============================================================================
--- freeswitch/branches/james/libs/libdingaling/src/libdingaling.h	(original)
+++ freeswitch/branches/james/libs/libdingaling/src/libdingaling.h	Fri Apr 14 05:24:38 2006
@@ -127,9 +127,20 @@
 	LDL_DESCRIPTION_ACCEPT
 } ldl_description_t;
 
+#define DL_PRE __FILE__, __FUNCTION__, __LINE__
+#define DL_LOG_DEBUG DL_PRE, 7
+#define DL_LOG_INFO DL_PRE, 6
+#define DL_LOG_NOTICE DL_PRE, 5
+#define DL_LOG_WARNING DL_PRE, 4
+#define DL_LOG_ERR DL_PRE, 3
+#define DL_LOG_CRIT DL_PRE, 2
+#define DL_LOG_ALERT DL_PRE, 1
+#define DL_LOG_EMERG DL_PRE, 0
+
 typedef ldl_status (*ldl_loop_callback_t)(ldl_handle_t *);
 typedef ldl_status (*ldl_session_callback_t)(ldl_handle_t *, ldl_session_t *, ldl_signal_t, char *);
 typedef ldl_status (*ldl_response_callback_t)(ldl_handle_t *, char *);
+typedef void (*ldl_logger_t)(char *file, const char *func, int line, int level, char *fmt, ...);
 
 #define ldl_yield(ms) apr_sleep(ms * 10); apr_thread_yield();
 
@@ -230,6 +241,12 @@
   \return the data
 */
 void *ldl_session_get_private(ldl_session_t *session);
+
+/*!
+  \brief Set a custom logger
+  \param logger the logger function
+*/
+void ldl_global_set_logger(ldl_logger_t logger);
 
 /*!
   \brief Perform a probe on a given id to resolve the proper Jingle Resource

Modified: freeswitch/branches/james/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/branches/james/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/branches/james/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Fri Apr 14 05:24:38 2006
@@ -32,6 +32,8 @@
 #include <switch.h>
 #include <libdingaling.h>
 
+#define DL_CAND_WAIT 10000000
+
 static const char modname[] = "mod_dingaling";
 
 static switch_memory_pool *module_pool = NULL;
@@ -116,8 +118,12 @@
 	int32_t timestamp_send;
 	int32_t timestamp_recv;
 	int32_t timestamp_dtmf;
+	uint32_t last_read;
 	char *codec_name;
 	uint8_t codec_num;
+	switch_time_t last_cand;
+	char *stun_ip;
+	uint16_t stun_port;
 };
 
 struct rfc2833_digit {
@@ -147,8 +153,19 @@
 static ldl_status handle_response(ldl_handle_t *handle, char *id);
 static switch_status load_config(void);
 
+static void dl_logger(char *file, const char *func, int line, int level, char *fmt, ...)
+{
+	va_list ap;
+	char data[1024];
 
+	va_start(ap, fmt);
+	
+	vsnprintf(data, sizeof(data), fmt, ap);
+	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, data);
 
+	va_end(ap);
+}
+
 static void get_codecs(struct private_object *tech_pvt)
 {
 	assert(tech_pvt != NULL);
@@ -219,7 +236,12 @@
 
 	started = switch_time_now();
 
-	next_cand = switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? switch_time_now() + 5000000 : switch_time_now() + 20000000;
+	if (!tech_pvt->last_cand) {
+		tech_pvt->last_cand = switch_time_now();
+		next_cand = tech_pvt->last_cand;
+	} else {
+		next_cand = tech_pvt->last_cand + DL_CAND_WAIT;
+	}
 
 	while(! (switch_test_flag(tech_pvt, TFLAG_CODEC_READY) && switch_test_flag(tech_pvt, TFLAG_RTP_READY))) {
 		now = switch_time_now();
@@ -233,7 +255,7 @@
 		if (now >= next_cand) {
 			ldl_payload_t payloads[5];
 			
-			next_cand += 10000000;
+			next_cand += DL_CAND_WAIT;
 			memset(payloads, 0, sizeof(payloads));
 
 			if (!switch_test_flag(tech_pvt, TFLAG_CODEC_READY)) {
@@ -270,26 +292,33 @@
 				
 				if (!strncasecmp(advip, "stun:", 5)) {
 					char *stun_ip = advip + 5;
+					
+					if (tech_pvt->stun_ip) {
+						cand[0].address = tech_pvt->stun_ip;
+						cand[0].port = tech_pvt->stun_port;
+					} else {
+						if (!stun_ip) {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! NO STUN SERVER!\n");
+							switch_channel_hangup(channel);
+							break;
+						}
 
-					if (!stun_ip) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! NO STUN SERVER!\n");
-						switch_channel_hangup(channel);
-						break;
+						cand[0].address = tech_pvt->profile->ip;
+						if (switch_stun_lookup(&cand[0].address,
+											   &cand[0].port,
+											   stun_ip,
+											   SWITCH_STUN_DEFAULT_PORT,
+											   &err,
+											   switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, err);
+							switch_channel_hangup(channel);
+							break;
+						}
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Success %s:%d\n", cand[0].address, cand[0].port);
 					}
-
-					cand[0].address = tech_pvt->profile->ip;
-					if (switch_stun_lookup(&cand[0].address,
-										   &cand[0].port,
-										   stun_ip,
-										   SWITCH_STUN_DEFAULT_PORT,
-										   &err,
-										   switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, err);
-						switch_channel_hangup(channel);
-						break;
-					}
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Success %s:%d\n", cand[0].address, cand[0].port);
 					cand[0].type = "stun";
+					tech_pvt->stun_ip = switch_core_session_strdup(tech_pvt->session, cand[0].address);
+					tech_pvt->stun_port = cand[0].port;
 				} else {
 					cand[0].type = "local";
 				}
@@ -360,7 +389,7 @@
 													 tech_pvt->codec_num,
 													 tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
 													 tech_pvt->read_codec.implementation->microseconds_per_frame,
-													 0,
+													 SWITCH_RTP_FLAG_USE_TIMER,
 													 NULL,
 													 &err, switch_core_session_get_pool(tech_pvt->session)))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err);
@@ -632,6 +661,9 @@
 			} 
 		}
 
+		if (switch_test_flag(&tech_pvt->read_frame, SFF_CNG)) {
+			tech_pvt->read_frame.datalen = tech_pvt->last_read ? tech_pvt->last_read : tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
+		}
 
 		if (tech_pvt->read_frame.datalen > 0) {
 			bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
@@ -640,7 +672,7 @@
 			ms = frames * tech_pvt->read_codec.implementation->microseconds_per_frame;
 			tech_pvt->timestamp_recv += (int32_t) samples;
 			tech_pvt->read_frame.samples = (int) samples;
-
+			tech_pvt->last_read = tech_pvt->read_frame.datalen;
 			//printf("READ bytes=%d payload=%d frames=%d samples=%d ms=%d ts=%d sampcount=%d\n", (int)tech_pvt->read_frame.datalen, (int)payload, (int)frames, (int)samples, (int)ms, (int)tech_pvt->timestamp_recv, (int)tech_pvt->read_frame.samples);
 			break;
 		}
@@ -1029,6 +1061,7 @@
 		} else if (!strcasecmp(cfg.category, "interface")) {
 			if (!globals.init) {
 				ldl_global_init(globals.debug);
+				ldl_global_set_logger(dl_logger);
 				globals.init = 1;
 			}
 
@@ -1126,6 +1159,7 @@
 				tech_pvt->codec_index = -1;
 				tech_pvt->profile = profile;
 				tech_pvt->local_port = switch_rtp_request_port();
+				tech_pvt->last_cand = switch_time_now() + DL_CAND_WAIT;
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n");
 				switch_core_session_destroy(&session);
@@ -1213,7 +1247,7 @@
 			unsigned int len = 0;
 			char *err;
 
-
+			tech_pvt->last_cand = switch_time_now();
 			if (ldl_session_get_candidates(dlsession, &candidates, &len) == LDL_STATUS_SUCCESS) {
 				unsigned int x;
 
@@ -1228,7 +1262,19 @@
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "candidates %s:%d\n", candidates[x].address, candidates[x].port);
 					if (!strcasecmp(candidates[x].protocol, "udp") && 
 						((profile->lanaddr && !strncasecmp(candidates[x].address, profile->lanaddr, strlen(profile->lanaddr))) ||
-						 (strncasecmp(candidates[x].address, "10.", 3) && strncasecmp(candidates[x].address, "192.168.", 8)))) {
+						 (strncasecmp(candidates[x].address, "10.", 3) && 
+						  strncasecmp(candidates[x].address, "192.168.", 8) &&
+						  strncasecmp(candidates[x].address, "127.", 4) &&
+						  strncasecmp(candidates[x].address, "1.", 2) &&
+						  strncasecmp(candidates[x].address, "2.", 2) &&
+						  strncasecmp(candidates[x].address, "172.16.", 7) &&
+						  strncasecmp(candidates[x].address, "172.17.", 7) &&
+						  strncasecmp(candidates[x].address, "172.18.", 7) &&
+						  strncasecmp(candidates[x].address, "172.19.", 7) &&
+						  strncasecmp(candidates[x].address, "172.2", 5) &&
+						  strncasecmp(candidates[x].address, "172.30.", 7) &&
+						  strncasecmp(candidates[x].address, "172.31.", 7)
+						  ))) {
 						ldl_payload_t payloads[5];
 						ldl_candidate_t cand[1];
 
@@ -1275,24 +1321,29 @@
 						if (!strncasecmp(advip, "stun:", 5)) {
 							char *stun_ip = advip + 5;
 
-							if (!stun_ip) {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! NO STUN SERVER!\n");
-								switch_channel_hangup(channel);
-								break;
-							}
+							if (tech_pvt->stun_ip) {
+								cand[0].address = tech_pvt->stun_ip;
+								cand[0].port = tech_pvt->stun_port;
+							} else {							
+								if (!stun_ip) {
+									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! NO STUN SERVER!\n");
+									switch_channel_hangup(channel);
+									break;
+								}
 
-							cand[0].address = profile->ip;
-							if (switch_stun_lookup(&cand[0].address,
-												   &cand[0].port,
-												   stun_ip,
-												   SWITCH_STUN_DEFAULT_PORT,
-												   &err,
-												   switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, err);
-								switch_channel_hangup(channel);
-								return LDL_STATUS_FALSE;
+								cand[0].address = profile->ip;
+								if (switch_stun_lookup(&cand[0].address,
+													   &cand[0].port,
+													   stun_ip,
+													   SWITCH_STUN_DEFAULT_PORT,
+													   &err,
+													   switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
+									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, err);
+									switch_channel_hangup(channel);
+									return LDL_STATUS_FALSE;
+								}
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Success %s:%d\n", cand[0].address, cand[0].port);
 							}
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Success %s:%d\n", cand[0].address, cand[0].port);
 							cand[0].type = "stun";
 						} else {
 							cand[0].type = "local";

Modified: freeswitch/branches/james/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
==============================================================================
--- freeswitch/branches/james/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	(original)
+++ freeswitch/branches/james/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	Fri Apr 14 05:24:38 2006
@@ -786,8 +786,6 @@
 				}
 			}
 
-
-			switch_channel_set_caller_profile(channel, caller_profile);
 			tech_pvt->caller_profile = caller_profile;
 
 			if (bchan) {
@@ -802,7 +800,7 @@
 					switch_set_flag(tech_pvt, TFLAG_NOSIG);
 					snprintf(name, sizeof(name), "WanPipe/%s/nosig-%04x", bchan, rand() & 0xffff);
 					switch_channel_set_name(channel, name);			
-
+					switch_channel_set_caller_profile(channel, caller_profile);
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid address\n");
 					switch_core_session_destroy(new_session);
@@ -854,6 +852,7 @@
 					
 					snprintf(name, sizeof(name), "WanPipe/s%dc%d/%s-%04x", spri->span, channo, caller_profile->destination_number, rand() & 0xffff);
 					switch_channel_set_name(channel, name);			
+					switch_channel_set_caller_profile(channel, caller_profile);
 					sr = pri_sr_new();
 					pri_sr_set_channel(sr, channo, 0, 0);
 					pri_sr_set_bearer(sr, 0, SPANS[span]->l1);

Modified: freeswitch/branches/james/src/switch_rtp.c
==============================================================================
--- freeswitch/branches/james/src/switch_rtp.c	(original)
+++ freeswitch/branches/james/src/switch_rtp.c	Fri Apr 14 05:24:38 2006
@@ -268,6 +268,7 @@
 	}
 
 	rtp_session->pool = pool;
+	rtp_session->flags = flags;
 
 	/* for from address on recvfrom calls */
 	switch_sockaddr_info_get(&rtp_session->from_addr, NULL, SWITCH_UNSPEC, 0, 0, rtp_session->pool);
@@ -493,15 +494,15 @@
 		}
 
 		if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) {
-			
 			if ((switch_time_now() - rtp_session->next_read) > 1000) {
 				/* We're late! We're Late!*/
-				memset(&rtp_session->recv_msg, 0, 13);
+				memset(&rtp_session->recv_msg, 0, SWITCH_RTP_CNG_PAYLOAD);
 				rtp_session->recv_msg.header.pt = SWITCH_RTP_CNG_PAYLOAD;
 				*flags |= SFF_CNG;
-				/* RE-Sync the clock and return a CNG frame */
-				rtp_session->next_read = switch_time_now() + rtp_session->ms_per_packet;
-				return 13;
+				/* Set the next waypoint and return a CNG frame */
+				rtp_session->next_read += rtp_session->ms_per_packet;
+				*payload_type = SWITCH_RTP_CNG_PAYLOAD;
+				return SWITCH_RTP_CNG_PAYLOAD;
 			}
 		
 			if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK) && status == SWITCH_STATUS_BREAK) {
@@ -605,7 +606,7 @@
 
 		bytes = sbytes;
 	}
-
+	rtp_session->send_msg.header.pt = rtp_session->payload;
 	switch_socket_sendto(rtp_session->sock, rtp_session->remote_addr, 0, (void*)&rtp_session->send_msg, &bytes);
 
 	if (rtp_session->ice_user) {
@@ -630,7 +631,6 @@
 	rtp_session->seq = htons(rtp_session->seq);
 	rtp_session->send_msg.header.seq = rtp_session->seq;
 	rtp_session->send_msg.header.ts = htonl(rtp_session->ts);
-	rtp_session->payload = (uint8_t)htonl(rtp_session->payload);
 
 	return rtp_common_write(rtp_session, data, datalen, rtp_session->payload);
 
@@ -642,10 +642,10 @@
 	if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) || !rtp_session->remote_addr) {
 		return -1;
 	}
+
 	rtp_session->ts += ts;
 	rtp_session->send_msg.header.seq = htons(mseq);
 	rtp_session->send_msg.header.ts = htonl(rtp_session->ts);
-	rtp_session->send_msg.header.pt = (uint8_t)htonl(payload);
 
 	return rtp_common_write(rtp_session, data, datalen, payload);
 }

Modified: freeswitch/branches/james/w32/vsnet/GetLibs.vbs
==============================================================================
--- freeswitch/branches/james/w32/vsnet/GetLibs.vbs	(original)
+++ freeswitch/branches/james/w32/vsnet/GetLibs.vbs	Fri Apr 14 05:24:38 2006
@@ -178,6 +178,7 @@
 
 If BuildModDingaling Then
 	BuildLibs_iksemel BuildDebug, BuildRelease
+	BuildLibs_libdingaling BuildDebug, BuildRelease
 End If
 
 If BuildModIaxChan Then



More information about the Freeswitch-svn mailing list