From a074814b3f109fcb2d6d376abb7eb670f359df9f Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sat, 11 Jan 2020 01:18:14 +0400 Subject: [PATCH] [mod_sofia] Add abort-on-empty-external-ip global param disabled by default. --- conf/vanilla/autoload_configs/sofia.conf.xml | 1 + src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/conf/vanilla/autoload_configs/sofia.conf.xml b/conf/vanilla/autoload_configs/sofia.conf.xml index d764a59e51..629a0019fa 100644 --- a/conf/vanilla/autoload_configs/sofia.conf.xml +++ b/conf/vanilla/autoload_configs/sofia.conf.xml @@ -2,6 +2,7 @@ + diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index c71b2d0559..59b5200780 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -405,6 +405,7 @@ struct mod_sofia_globals { uint32_t max_reg_threads; time_t presence_epoch; int presence_year; + int abort_on_empty_external_ip; }; extern struct mod_sofia_globals mod_sofia_globals; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 6c33cf45a5..f2388d6879 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4416,6 +4416,8 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) char *val = (char *) switch_xml_attr_soft(param, "value"); if (!strcasecmp(var, "log-level")) { su_log_set_level(NULL, atoi(val)); + } else if (!strcasecmp(var, "abort-on-empty-external-ip")) { + mod_sofia_globals.abort_on_empty_external_ip = switch_true(val); } else if (!strcasecmp(var, "tracelevel")) { mod_sofia_globals.tracelevel = switch_log_str2level(val); } else if (!strcasecmp(var, "debug-presence")) { @@ -5059,7 +5061,9 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ext-rtp-ip\n"); - switch_goto_status(SWITCH_STATUS_GENERR, done); + if (mod_sofia_globals.abort_on_empty_external_ip) { + switch_goto_status(SWITCH_STATUS_GENERR, done); + } } } else if (!strcasecmp(var, "rtp-ip")) { char *ip = mod_sofia_globals.guess_ip;