git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8041 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-04-07 14:03:10 +00:00
parent 5cfb90b2cd
commit dd11487727
3 changed files with 19 additions and 15 deletions

View File

@ -2438,6 +2438,7 @@ const char *_url_set_chanvars(switch_core_session_t *session, url_t *url, const
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 @@ const char *_url_set_chanvars(switch_core_session_t *session, url_t *url, const
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);

View File

@ -1173,6 +1173,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
if (contact) {
char *port = (char *) contact->m_url->url_port;
char new_port[25] = "";
display = contact->m_display;
@ -1187,15 +1188,15 @@ void sofia_presence_handle_sip_i_subscribe(int status,
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);
}
}

View File

@ -403,6 +403,7 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han
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 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han
}
}
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);
}
}