[Freeswitch-svn] [commit] r13575 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia
FreeSWITCH SVN
brian at freeswitch.org
Wed Jun 3 09:35:08 PDT 2009
Author: brian
Date: Wed Jun 3 11:35:08 2009
New Revision: 13575
Log:
cleanup by mike and bkw
Modified:
freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Wed Jun 3 11:35:08 2009
@@ -2550,7 +2550,6 @@
if (!strncasecmp(profile_name, "gateway", 7)) {
char *gw, *params;
sofia_gateway_t *gateway_ptr = NULL;
- char *dup_dest = NULL, *dest_host, *dest_user;
if (!(gw = strchr(profile_name, '/'))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n");
@@ -2633,12 +2632,6 @@
tech_pvt->invite_contact = switch_core_session_strdup(nsession, gateway_ptr->register_contact);
}
- dup_dest = strdup(dest);
- switch_assert(dup_dest != NULL);
- sofia_glue_get_user_host(dup_dest, &dest_user, &dest_host);
- tech_pvt->remote_ip = switch_core_session_sprintf(nsession, "%s", dest_host);
- switch_safe_free(dup_dest);
-
gateway_ptr->ob_calls++;
if (gateway_ptr->ob_vars) {
@@ -2651,8 +2644,6 @@
}
} else {
- char *dup_dest = NULL, *dest_host, *dest_user;
-
if (!(dest = strchr(profile_name, '/'))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n");
cause = SWITCH_CAUSE_INVALID_NUMBER_FORMAT;
@@ -2670,12 +2661,6 @@
profile_name = profile->domain_name;
}
- dup_dest = strdup(dest);
- switch_assert(dup_dest != NULL);
- sofia_glue_get_user_host(dup_dest, &dest_user, &dest_host);
- tech_pvt->remote_ip = switch_core_session_sprintf(nsession, "%s", dest_host);
- switch_safe_free(dup_dest);
-
if (!strncasecmp(dest, "sip:", 4) || !strncasecmp(dest, "sips:", 5)) {
tech_pvt->dest = switch_core_session_strdup(nsession, dest);
} else if ((host = strchr(dest, '%'))) {
@@ -2711,6 +2696,8 @@
}
}
+ sofia_glue_get_user_host(switch_core_session_strdup(nsession, tech_pvt->dest), NULL, &tech_pvt->remote_ip);
+
if (dest_to) {
if (strchr(dest_to, '@')) {
tech_pvt->dest_to = switch_core_session_sprintf(nsession, "sip:%s", dest_to);
Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 3 11:35:08 2009
@@ -4038,7 +4038,10 @@
{
char *p, *h, *u = in;
- *user = NULL;
+ if (user) {
+ *user = NULL;
+ }
+
*host = NULL;
/* First isolate the host part from the user part */
@@ -4049,7 +4052,7 @@
}
/* Clean out the user part of its protocol prefix (if any) */
- if ((p = strchr(u, ':'))) {
+ if (user && (p = strchr(u, ':'))) {
*p++ = '\0';
u = p;
}
@@ -4067,7 +4070,10 @@
*p = '\0';
}
+ if (user) {
*user = u;
+ }
+
*host = h;
return 1;
More information about the Freeswitch-svn
mailing list