diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 59b5200780..05e50c952f 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -533,6 +533,7 @@ struct sofia_gateway { int pinging; sofia_gateway_status_t status; switch_time_t uptime; + uint32_t contact_in_ping; uint32_t ping_freq; int ping_count; int ping_max; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 56ce021b52..bf9579f353 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3716,7 +3716,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag, if ((gateway = switch_core_alloc(profile->pool, sizeof(*gateway)))) { const char *sipip, *format; switch_uuid_t uuid; - uint32_t ping_freq = 0, extension_in_contact = 0, ping_monitoring = 0, distinct_to = 0, rfc_5626 = 0; + uint32_t ping_freq = 0, extension_in_contact = 0, contact_in_ping = 0, ping_monitoring = 0, distinct_to = 0, rfc_5626 = 0; int ping_max = 1, ping_min = 1; char *register_str = "true", *scheme = "Digest", *realm = NULL, @@ -3831,6 +3831,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag, caller_id_in_from = val; } else if (!strcmp(var, "extension")) { extension = val; + } else if (!strcmp(var, "contact-in-ping")) { + contact_in_ping = switch_true(val); } else if (!strcmp(var, "ping")) { ping_freq = atoi(val); } else if (!strcmp(var, "ping-max")) { @@ -4029,6 +4031,9 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag, gateway->options_to_uri = switch_core_sprintf(gateway->pool, "", !zstr(from_domain) ? from_domain : proxy); gateway->options_from_uri = gateway->options_to_uri; + if (contact_in_ping) { + gateway->contact_in_ping = contact_in_ping; + } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: invalid ping!\n"); } diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 569699a1c8..f539844572 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -389,6 +389,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)), TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_TO_STR(gateway_ptr->options_to_uri), SIPTAG_FROM_STR(gateway_ptr->options_from_uri), + TAG_IF(gateway_ptr->contact_in_ping, SIPTAG_CONTACT_STR(gateway_ptr->register_contact)), TAG_IF(gateway_ptr->options_user_agent, SIPTAG_USER_AGENT_STR(gateway_ptr->options_user_agent)), TAG_END());