diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 12e9a8f277..0faa55baa1 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -454,6 +454,7 @@ struct sofia_gateway { char *auth_username; char *register_password; char *register_from; + char *options_uri; char *register_contact; char *extension; char *real_extension; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index f0bed07d85..26a47e49e7 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2485,16 +2485,6 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) str_rfc_5626 = switch_core_sprintf(gateway->pool, ";reg-id=%s;+sip.instance=\"\"",reg_id,str_guid); } - if (ping_freq) { - if (ping_freq >= 5) { - gateway->ping_freq = ping_freq; - gateway->ping_max = ping_max; - gateway->ping_min = ping_min; - gateway->ping = switch_epoch_time_now(NULL) + ping_freq; - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: invalid ping!\n"); - } - } if ((gw_subs_tag = switch_xml_child(gateway_tag, "subscriptions"))) { parse_gateway_subscriptions(profile, gateway, gw_subs_tag); @@ -2616,6 +2606,19 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) from_user, !zstr(from_domain) ? from_domain : proxy, register_transport); + if (ping_freq) { + if (ping_freq >= 5) { + gateway->ping_freq = ping_freq; + gateway->ping_max = ping_max; + gateway->ping_min = ping_min; + gateway->ping = switch_epoch_time_now(NULL) + ping_freq; + gateway->options_uri = switch_core_sprintf(gateway->pool, "", + !zstr(from_domain) ? from_domain : proxy, register_transport); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: invalid ping!\n"); + } + } + if (contact_host) { if (!strcmp(contact_host, "sip-ip")) { sipip = profile->sipip; diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 3c86824a33..a768cd6b90 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -354,8 +354,8 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) nua_options(nh, 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->register_from), - SIPTAG_CONTACT_STR(gateway_ptr->register_contact), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()); + SIPTAG_TO_STR(gateway_ptr->options_uri), SIPTAG_FROM_STR(profile->url), + SIPTAG_CONTACT_STR(gateway_ptr->register_contact), TAG_END()); switch_safe_free(user_via); user_via = NULL;