[Freeswitch-svn] [commit] r9458 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN brian at freeswitch.org
Thu Sep 4 23:57:57 EDT 2008


Author: brian
Date: Thu Sep  4 23:57:57 2008
New Revision: 9458

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c

Log:
this will make it behave as if you didn't set the ext-sip-ip and ext-rtp-ip if they are empty values.  Also correct the spelling of Invalid

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Thu Sep  4 23:57:57 2008
@@ -1135,7 +1135,7 @@
 							switch_set_flag(profile, TFLAG_VAD_IN);
 							switch_set_flag(profile, TFLAG_VAD_OUT);
 						} else {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invald option %s for VAD\n", val);
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid option %s for VAD\n", val);
 						}
 					} else if (!strcasecmp(var, "unregister-on-options-fail")) {
 						if (switch_true(val)) {
@@ -1488,22 +1488,31 @@
 							switch_set_flag(profile, TFLAG_VAD_IN);
 							switch_set_flag(profile, TFLAG_VAD_OUT);
 						} else {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invald option %s for VAD\n", val);
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid option %s for VAD\n", val);
 						}
 					} else if (!strcasecmp(var, "ext-rtp-ip")) {
-						char *ip = mod_sofia_globals.guess_ip;
-
-						if (!strcmp(val, "0.0.0.0")) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invald IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip);
+						if (!switch_strlen_zero(val)) {
+							char *ip = mod_sofia_globals.guess_ip;
+							
+							if (!strcmp(val, "0.0.0.0")) {
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip);
+							} else {
+								if (!switch_strlen_zero(val)) {
+									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid ext-rtp-ip replaced with %s\n", mod_sofia_globals.guess_ip);
+									ip = "auto";
+								} else {
+									ip = strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip;
+								}
+							}
+							profile->extrtpip = switch_core_strdup(profile->pool, ip);
 						} else {
-							ip = strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip;
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ext-rtp-ip\n");
 						}
-						profile->extrtpip = switch_core_strdup(profile->pool, ip);
 					} else if (!strcasecmp(var, "rtp-ip")) {
 						char *ip = mod_sofia_globals.guess_ip;
 
 						if (!strcmp(val, "0.0.0.0")) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invald IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip);
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip);
 						} else {
 							ip = strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip;
 						}
@@ -1512,31 +1521,33 @@
 						char *ip = mod_sofia_globals.guess_ip;
 
 						if (!strcmp(val, "0.0.0.0")) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invald IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip);
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip);
 						} else {
 							ip = strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip;
 						}
 						profile->sipip = switch_core_strdup(profile->pool, ip);
 					} else if (!strcasecmp(var, "ext-sip-ip")) {
-						char *ip = mod_sofia_globals.guess_ip;
-						char stun_ip[50] = "";
-						char *myip = stun_ip;
-
-						switch_copy_string(stun_ip, ip, sizeof(stun_ip));
-
 						if (!switch_strlen_zero(val)) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid IP replaced with %s\n", mod_sofia_globals.guess_ip);
-						} else if (!strcasecmp(val, "0.0.0.0")) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invald IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip);
-						} else if (strcasecmp(val, "auto")) {
-							switch_port_t port = 0;
-							if (sofia_glue_ext_address_lookup(profile, NULL, &myip, &port, val, profile->pool) == SWITCH_STATUS_SUCCESS) {
-								ip = myip;
-							} else {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to get external ip.\n");
+							char *ip = mod_sofia_globals.guess_ip;
+							char stun_ip[50] = "";
+							char *myip = stun_ip;
+							
+							switch_copy_string(stun_ip, ip, sizeof(stun_ip));
+							
+							if (!strcasecmp(val, "0.0.0.0")) {
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip);
+							} else if (strcasecmp(val, "auto")) {
+								switch_port_t port = 0;
+								if (sofia_glue_ext_address_lookup(profile, NULL, &myip, &port, val, profile->pool) == SWITCH_STATUS_SUCCESS) {
+									ip = myip;
+								} else {
+									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to get external ip.\n");
+								}
 							}
+							profile->extsipip = switch_core_strdup(profile->pool, ip);
+						} else {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ext-sip-ip\n");
 						}
-						profile->extsipip = switch_core_strdup(profile->pool, ip);
 					} else if (!strcasecmp(var, "force-register-domain")) {
 						profile->reg_domain = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "bind-params")) {



More information about the Freeswitch-svn mailing list