From 8afac73cd66c4a392d3e0103408f9ec19f85344f Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Tue, 23 May 2017 17:06:57 -0400 Subject: [PATCH] FS-10338: [mod_sofia] add sip_invite_stamp variable of the time we received initial invite on an inbound call leg --- src/mod/endpoints/mod_sofia/sofia.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index a949b6f5ab..2919a129df 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -9981,6 +9981,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia char *name_params = NULL; const char *req_uri = NULL; char *req_user = NULL; + switch_time_t sip_invite_time; if (sip && sip->sip_contact && sip->sip_contact->m_url->url_params) { uparams = sip->sip_contact->m_url->url_params; @@ -10010,6 +10011,8 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia tech_pvt = switch_core_session_get_private(session); + sip_invite_time = switch_micro_time_now(); + if (!sip || !sip->sip_request || !sip->sip_request->rq_method_name) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received an invalid packet!\n"); nua_respond(nh, SIP_503_SERVICE_UNAVAILABLE, TAG_END()); @@ -10274,6 +10277,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia switch_channel_set_variable_printf(channel, "sip_local_network_addr", "%s", profile->extsipip ? profile->extsipip : profile->sipip); switch_channel_set_variable_printf(channel, "sip_network_ip", "%s", network_ip); switch_channel_set_variable_printf(channel, "sip_network_port", "%d", network_port); + switch_channel_set_variable_printf(channel, "sip_invite_stamp", "%" SWITCH_TIME_T_FMT, sip_invite_time); if (*acl_token) { switch_channel_set_variable(channel, "acl_token", acl_token);