From f703a303f0a0aced9b1f99881e41940b39097429 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Thu, 11 Jan 2007 23:04:54 +0000 Subject: [PATCH] use blank instead of null if no username git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3946 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 2fe541e773..40534d1176 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4108,11 +4108,19 @@ static void sip_i_invite(nua_t *nua, switch_channel_set_variable(channel, "sip_req_port", req_port); if (profile->pflags & PFLAG_FULL_ID) { - if (!(req_username = switch_mprintf("%s@%s:%s", (char *) req_user, (char *) req_host, req_port))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); - switch_safe_free(username); - return; - } + if (req_user) { + if (!(req_username = switch_mprintf("%s@%s:%s", (char *) req_user, (char *) req_host, req_port))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); + switch_safe_free(username); + return; + } + } else { + if (!(req_username = switch_mprintf("%s:%s", (char *) req_host, req_port))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); + switch_safe_free(username); + return; + } + } } contact_user = (char *) sip->sip_contact->m_url->url_user; @@ -4154,7 +4162,7 @@ static void sip_i_invite(nua_t *nua, (char *)modname, (profile->context && !strcasecmp(profile->context, "_domain_")) ? (char *) from->a_url->url_host : profile->context, - req_username ? req_username : (char *) req_user + req_username ? req_username : req_user ? (char *) req_user : "" )) != 0) {