]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
log ip and port you get reply to invite from
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 3 Dec 2008 17:13:02 +0000 (17:13 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 3 Dec 2008 17:13:02 +0000 (17:13 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10573 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia.c

index 646125a3165ec88596665f69af4bf15dd41b5831..b0ba5a760190d10ae161a269e52507694c07299f 100644 (file)
@@ -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;
 
-               switch_channel_clear_flag(channel, CF_REQ_MEDIA);
+               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);