From 51fd5a6cee083b18f467c66da40574e38ba426b3 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Wed, 3 Jul 2013 11:21:47 -0500 Subject: [PATCH] --resolve FS-5426 --- conf/vanilla/sip_profiles/internal.xml | 4 ++++ src/mod/endpoints/mod_sofia/conf/sofia.conf.xml | 4 ++++ src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 5 ++++- src/mod/endpoints/mod_sofia/sofia_reg.c | 8 ++++++++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml index 423ec2a60a..4ef9bde0d2 100644 --- a/conf/vanilla/sip_profiles/internal.xml +++ b/conf/vanilla/sip_profiles/internal.xml @@ -178,6 +178,10 @@ + + + + diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml index 5bd3a6dc12..411ea3e44e 100644 --- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -205,6 +205,10 @@ + + + diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 365f585787..ac8b4366f7 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -230,6 +230,7 @@ typedef enum { PFLAG_DISABLE_SRV503, PFLAG_DISABLE_NAPTR, PFLAG_NAT_OPTIONS_PING, + PFLAG_UDP_NAT_OPTIONS_PING, PFLAG_ALL_REG_OPTIONS_PING, PFLAG_MESSAGE_QUERY_ON_REGISTER, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER, diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index d226b928f4..04d17cfd1d 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4309,10 +4309,13 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } else if (!strcasecmp(var, "contact-user")) { profile->contact_user = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "nat-options-ping")) { - if (switch_true(val)) { + if (!strcasecmp(val, "udp-only")) { + sofia_set_pflag(profile, PFLAG_UDP_NAT_OPTIONS_PING); + } else if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_NAT_OPTIONS_PING); } else { sofia_clear_pflag(profile, PFLAG_NAT_OPTIONS_PING); + sofia_clear_pflag(profile, PFLAG_UDP_NAT_OPTIONS_PING); } } else if (!strcasecmp(var, "all-reg-options-ping")) { if (switch_true(val)) { diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 2bdf11e2d1..aba34a321d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -822,6 +822,14 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot) " from sip_registrations where hostname='%s' and " "profile_name='%s'", mod_sofia_globals.hostname, profile->name); + sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile); + switch_safe_free(sql); + } else if (sofia_test_pflag(profile, PFLAG_UDP_NAT_OPTIONS_PING)) { + sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,rpid," + "expires,user_agent,server_user,server_host,profile_name" + " from sip_registrations where status like '%%UDP-NAT%%' " + "and hostname='%s' and profile_name='%s'", mod_sofia_globals.hostname, profile->name); + sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile); switch_safe_free(sql); } else if (sofia_test_pflag(profile, PFLAG_NAT_OPTIONS_PING)) {