From cde54eb5e8f754d3a5322dfefaf883ceab6f668e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 27 Jan 2012 12:55:09 -0600 Subject: [PATCH] FS-3842 the fix was to remove the (null) if you are asking for a to uri in the options with no username try this patch. You were not clear that you were looking for no username in the to uri. Keep in mind our system considers a 404 a sucessful response to an options request anyway but this should be what you want. --- src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 23 +++++++++++++---------- src/mod/endpoints/mod_sofia/sofia_reg.c | 4 ++-- 3 files changed, 16 insertions(+), 12 deletions(-) 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;