From c582653bf89bee4501e8f8c1ad164e360e6eecab Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 3 Dec 2008 17:13:02 +0000 Subject: [PATCH] log ip and port you get reply to invite from git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10573 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/sofia.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 646125a316..b0ba5a7601 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2258,9 +2258,23 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status const char *uuid; switch_core_session_t *other_session; private_object_t *tech_pvt = switch_core_session_get_private(session); + su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua)); + char network_ip[80]; + int network_port = 0; + switch_caller_profile_t *caller_profile = NULL; + + get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); + network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port); + + switch_channel_set_variable(channel, "sip_reply_host", network_ip); + switch_channel_set_variable_printf(channel, "sip_reply_port", "%d", network_port); + + if ((caller_profile = switch_channel_get_caller_profile(channel))) { + caller_profile->network_addr = switch_core_strdup(caller_profile->pool, network_ip); + } switch_channel_clear_flag(channel, CF_REQ_MEDIA); - + if ((status == 180 || status == 183 || status == 200)) { if (sip->sip_user_agent && sip->sip_user_agent->g_string) { switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);