[Freeswitch-branches] [commit] r8112 - freeswitch/branches/cseket/src/mod/endpoints/mod_sofia

Freeswitch SVN cseket at freeswitch.org
Mon Apr 14 13:54:15 EDT 2008


Author: cseket
Date: Mon Apr 14 13:54:14 2008
New Revision: 8112

Added:
   freeswitch/branches/cseket/src/mod/endpoints/mod_sofia/mod_sofia.h
      - copied, changed from r8099, /freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
Modified:
   freeswitch/branches/cseket/src/mod/endpoints/mod_sofia/sofia.c

Log:
"auto" port for tls. 
Don't break defaults, when port settings are missing or invalid use defaults.
(SFSIP-54)
-*-This line, and those below, will be ignored--
rt for tls. SFSIP-54"

M    sofia.c
A    mod_sofia.h


Copied: freeswitch/branches/cseket/src/mod/endpoints/mod_sofia/mod_sofia.h (from r8099, /freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h)
==============================================================================
--- /freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	(original)
+++ freeswitch/branches/cseket/src/mod/endpoints/mod_sofia/mod_sofia.h	Mon Apr 14 13:54:14 2008
@@ -79,6 +79,7 @@
 #define SOFIA_SECURE_MEDIA_CONFIRMED_VARIABLE "sip_secure_media_confirmed"
 #define SOFIA_HAS_CRYPTO_VARIABLE "sip_has_crypto"
 #define SOFIA_CRYPTO_MANDATORY_VARIABLE "sip_crypto_mandatory"
+#define SOFIA_AUTO_PORT -1
 
 #include <sofia-sip/nua.h>
 #include <sofia-sip/sip_status.h>

Modified: freeswitch/branches/cseket/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/branches/cseket/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/branches/cseket/src/mod/endpoints/mod_sofia/sofia.c	Mon Apr 14 13:54:14 2008
@@ -1084,7 +1084,7 @@
 					} else if (!strcasecmp(var, "cng-pt")) {
 						profile->cng_pt = (switch_payload_t) atoi(val);
 					} else if (!strcasecmp(var, "sip-port")) {
-						profile->sip_port = strcasecmp(val, "auto") ? atoi(val) : 0;
+						profile->sip_port = strcasecmp(val, "auto") ? atoi(val) : SOFIA_AUTO_PORT;
 					} else if (!strcasecmp(var, "vad")) {
 						if (!strcasecmp(val, "in")) {
 							switch_set_flag(profile, TFLAG_VAD_IN);
@@ -1266,7 +1266,7 @@
 					} else if (!strcasecmp(var, "tls-bind-params")) {
 						profile->tls_bind_params = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "tls-sip-port")) {
-						profile->tls_sip_port = atoi(val);
+						profile->tls_sip_port = strcasecmp(val, "auto") ? atoi(val) : SOFIA_AUTO_PORT;
 					} else if (!strcasecmp(var, "tls-cert-dir")) {
 						profile->tls_cert_dir = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "tls-version")) {
@@ -1309,6 +1309,10 @@
 					profile->rtpip = switch_core_strdup(profile->pool, "127.0.0.1");
 				}
 
+				if (!profile->sip_port) {
+					profile->sip_port = atoi(SOFIA_DEFAULT_PORT);
+				}
+
 				if (!profile->dialplan) {
 					profile->dialplan = switch_core_strdup(profile->pool, "XML");
 				}
@@ -1317,14 +1321,14 @@
 					profile->sipdomain = switch_core_strdup(profile->pool, profile->sipip);
 				}
 				if (profile->extsipip) {
-					if (!profile->sip_port) {
+					if (profile->sip_port == SOFIA_AUTO_PORT) {
 						profile->url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:*", profile->extsipip);
 					} else {
 						profile->url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->extsipip, profile->sip_port);
 					}
 					profile->bindurl = switch_core_sprintf(profile->pool, "%s;maddr=%s", profile->url, profile->sipip);
 				} else {
-					if (!profile->sip_port) {
+					if (profile->sip_port == SOFIA_AUTO_PORT) {
 						profile->url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:*", profile->sipip);
 					} else {
 						profile->url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->sipip, profile->sip_port);
@@ -1346,11 +1350,21 @@
 					}
 
 					if (profile->extsipip) {
-						profile->tls_url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->extsipip, profile->tls_sip_port);
-						profile->tls_bindurl = switch_core_sprintf(profile->pool, "sips:mod_sofia@%s:%d;maddr=%s", profile->extsipip, profile->tls_sip_port, profile->sipip);
+						if (profile->tls_sip_port == SOFIA_AUTO_PORT) {
+							profile->tls_url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:*", profile->extsipip);
+							profile->tls_bindurl = switch_core_sprintf(profile->pool, "sips:mod_sofia@%s:*;maddr=%s", profile->extsipip, profile->sipip);
+						} else {
+							profile->tls_url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->extsipip, profile->tls_sip_port);
+							profile->tls_bindurl = switch_core_sprintf(profile->pool, "sips:mod_sofia@%s:%d;maddr=%s", profile->extsipip, profile->tls_sip_port, profile->sipip);
+						}
 					} else {
-						profile->tls_url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->sipip, profile->tls_sip_port);
-						profile->tls_bindurl = switch_core_sprintf(profile->pool, "sips:mod_sofia@%s:%d", profile->sipip, profile->tls_sip_port);
+						if (profile->tls_sip_port == SOFIA_AUTO_PORT) {
+							profile->tls_url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:*", profile->sipip);
+							profile->tls_bindurl = switch_core_sprintf(profile->pool, "sips:mod_sofia@%s:*", profile->sipip);
+						} else {
+							profile->tls_url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->sipip, profile->tls_sip_port);
+							profile->tls_bindurl = switch_core_sprintf(profile->pool, "sips:mod_sofia@%s:%d", profile->sipip, profile->tls_sip_port);
+						}
 					}
 
 					if (profile->tls_bind_params) {



More information about the Freeswitch-branches mailing list