[mod_sofia] Set sip_100_uepoch channel variable on initial 100 trying response.

This commit is contained in:
Andrey Volk 2020-10-27 20:14:51 +04:00
parent 66a92063b6
commit d2e8a775b0
2 changed files with 17 additions and 9 deletions

View File

@ -363,6 +363,7 @@ typedef enum {
TFLAG_PASS_ACK,
TFLAG_KEEPALIVE,
TFLAG_SKIP_EARLY,
TFLAG_100_UEPOCH_SET,
/* No new flags below this line */
TFLAG_MAX
} TFLAGS;

View File

@ -6597,6 +6597,22 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
switch_caller_profile_t *caller_profile = NULL;
int has_t38 = 0;
if (status == 100 && !sofia_test_flag(tech_pvt, TFLAG_100_UEPOCH_SET)) {
sofia_set_flag(tech_pvt, TFLAG_100_UEPOCH_SET);
switch_channel_set_variable_printf(channel, "sip_100_uepoch", "%" SWITCH_TIME_T_FMT, switch_time_now());
}
if (de && de->data && de->data->e_msg) {
sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), &network_port);
switch_channel_set_variable_printf(channel, "sip_local_network_addr", "%s", profile->extsipip ? profile->extsipip : profile->sipip);
switch_channel_set_variable(channel, "sip_reply_host", network_ip);
switch_channel_set_variable_printf(channel, "sip_reply_port", "%d", network_port);
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_clear_flag(channel, CF_REQ_MEDIA);
if (status < 200) {
@ -6644,15 +6660,6 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote Reason: %d\n", tech_pvt->q850_cause);
}
sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), &network_port);
switch_channel_set_variable_printf(channel, "sip_local_network_addr", "%s", profile->extsipip ? profile->extsipip : profile->sipip);
switch_channel_set_variable(channel, "sip_reply_host", network_ip);
switch_channel_set_variable_printf(channel, "sip_reply_port", "%d", network_port);
switch_channel_set_variable_printf(channel, "sip_network_ip", "%s", network_ip);
switch_channel_set_variable_printf(channel, "sip_network_port", "%d", network_port);
if ((caller_profile = switch_channel_get_caller_profile(channel)) && !zstr(network_ip) &&
(zstr(caller_profile->network_addr) || strcmp(caller_profile->network_addr, network_ip))) {
caller_profile->network_addr = switch_core_strdup(caller_profile->pool, network_ip);