From 2580c41f8217b1122200632f92cde0c0a5c70eab Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 25 Nov 2006 16:35:56 +0000 Subject: [PATCH] add vars git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3455 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index d3bce9c1f6..84a2e53031 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3930,8 +3930,8 @@ static void sip_i_invite(nua_t *nua, char *displayname; char *username, *to_username = NULL; char *url_user = (char *) from->a_url->url_user; - char *to_user, *to_host; - + char *to_user, *to_host, *to_port; + if (!(tech_pvt = (private_object_t *) switch_core_session_alloc(session, sizeof(private_object_t)))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n"); terminate_session(&session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER, __LINE__); @@ -3944,6 +3944,9 @@ static void sip_i_invite(nua_t *nua, to_user = (char *) to->a_url->url_user; to_host = (char *) to->a_url->url_host; + if (!(to_port = (char *) to->a_url->url_port)) { + to_port = "5060"; + } if (switch_strlen_zero(to_user)) { /* if sofia doesnt parse the To: right, we'll have to do it */ if ((to_user = sip_header_as_string(tech_pvt->home, (sip_header_t *) to))) { @@ -3985,7 +3988,7 @@ static void sip_i_invite(nua_t *nua, } if (profile->pflags & PFLAG_FULL_ID) { - if (!(to_username = switch_mprintf("%s@%s", (char *) to_user, (char *) to_host))) { + if (!(to_username = switch_mprintf("%s@%s:%s", (char *) to_user, (char *) to_host, to_port))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); switch_safe_free(username); return; @@ -4006,6 +4009,11 @@ static void sip_i_invite(nua_t *nua, switch_channel_set_variable(channel, "sip_from_user_stripped", (char *)from->a_url->url_user); } switch_channel_set_variable(channel, "sip_from_host", (char *) from->a_url->url_host); + switch_channel_set_variable(channel, "sip_from_port", (char *) from->a_url->url_port); + + switch_channel_set_variable(channel, "sip_to_user", (char *) to_user); + switch_channel_set_variable(channel, "sip_to_host", to_host); + switch_channel_set_variable(channel, "sip_to_port", (char *) to_port); if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session), (char *) from->a_url->url_user, profile->dialplan,