[Freeswitch-svn] [commit] r8041 - freeswitch/trunk/src/mod/endpoints/mod_sofia
Freeswitch SVN
anthm at freeswitch.org
Mon Apr 7 10:03:11 EDT 2008
Author: anthm
Date: Mon Apr 7 10:03:10 2008
New Revision: 8041
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
Log:
update
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 Mon Apr 7 10:03:10 2008
@@ -2438,6 +2438,7 @@
const char *user = NULL, *host = NULL, *port = NULL;
char *uri = NULL;
switch_channel_t *channel = switch_core_session_get_channel(session);
+ char new_port[25] = "";
if (url) {
user = url->url_user;
@@ -2462,16 +2463,17 @@
switch_channel_set_variable(channel, user_var, user);
}
- if (!port) {
- port = SOFIA_DEFAULT_PORT;
+
+ if (port) {
+ switch_snprintf(new_port, sizeof(new_port), ":%s", port);
}
switch_channel_set_variable(channel, port_var, port);
if (host) {
if (user) {
- uri = switch_core_session_sprintf(session, "%s@%s:%s", user, host, port);
+ uri = switch_core_session_sprintf(session, "%s@%s:%s", user, host, new_port);
} else {
- uri = switch_core_session_sprintf(session, "%s:%s", host, port);
+ uri = switch_core_session_sprintf(session, "%s:%s", host, new_port);
}
switch_channel_set_variable(channel, uri_var, uri);
switch_channel_set_variable(channel, host_var, host);
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Mon Apr 7 10:03:10 2008
@@ -1173,6 +1173,7 @@
if (contact) {
char *port = (char *) contact->m_url->url_port;
+ char new_port[25] = "";
display = contact->m_display;
@@ -1187,15 +1188,15 @@
display = "\"user\"";
}
- if (!port) {
- port = SOFIA_DEFAULT_PORT;
+ if (port) {
+ switch_snprintf(new_port, sizeof(new_port), ":%s", port);
}
-
+
if (contact->m_url->url_params) {
- contact_str = switch_mprintf("%s <sip:%s@%s:%s;%s>",
- display, contact->m_url->url_user, contact->m_url->url_host, port, contact->m_url->url_params);
+ contact_str = switch_mprintf("%s <sip:%s@%s%s;%s>",
+ display, contact->m_url->url_user, contact->m_url->url_host, new_port, contact->m_url->url_params);
} else {
- contact_str = switch_mprintf("%s <sip:%s@%s:%s>", display, contact->m_url->url_user, contact->m_url->url_host, port);
+ contact_str = switch_mprintf("%s <sip:%s@%s%s>", display, contact->m_url->url_user, contact->m_url->url_host, new_port);
}
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Mon Apr 7 10:03:10 2008
@@ -403,6 +403,7 @@
if (contact->m_url) {
const char *port = contact->m_url->url_port;
+ char new_port[25] = "";
display = contact->m_display;
if (switch_strlen_zero(display)) {
@@ -414,15 +415,15 @@
}
}
- if (!port) {
- port = SOFIA_DEFAULT_PORT;
+ if (port) {
+ switch_snprintf(new_port, sizeof(new_port), ":%s", port);
}
if (contact->m_url->url_params) {
- 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);
+ switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s%s;%s>",
+ display, contact->m_url->url_user, contact->m_url->url_host, new_port, contact->m_url->url_params);
} else {
- switch_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, new_port);
}
}
More information about the Freeswitch-svn
mailing list