From 3b04608c2e09f858ba1f0a5b0b4ffe4ea0669719 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 20 Sep 2010 15:32:48 -0500 Subject: [PATCH 1/2] MODAPP-457 --- src/mod/applications/mod_spandsp/mod_spandsp_fax.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 2ea3eb00a3..9b8b051f50 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -789,9 +789,9 @@ static t38_mode_t negotiate_t38(pvt_t *pvt) t38_options->T38FaxRateManagement = "transferredTCF"; t38_options->T38FaxMaxBuffer = 2000; t38_options->T38FaxMaxDatagram = LOCAL_FAX_MAX_DATAGRAM; - if (strcasecmp(t38_options->T38FaxUdpEC, "t38UDPRedundancy") == 0 - || - strcasecmp(t38_options->T38FaxUdpEC, "t38UDPFEC") == 0) { + if (!zstr(t38_options->T38FaxUdpEC) && + (strcasecmp(t38_options->T38FaxUdpEC, "t38UDPRedundancy") == 0 || + strcasecmp(t38_options->T38FaxUdpEC, "t38UDPFEC") == 0)) { t38_options->T38FaxUdpEC = "t38UDPRedundancy"; } else { t38_options->T38FaxUdpEC = NULL; From 09fa66787ec26d523b286e4e4d7e3846effc6394 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 20 Sep 2010 16:55:09 -0500 Subject: [PATCH 2/2] add 'sofia global siptrace on' so we don't have to always teach people to enable sip trace on each profile --- src/mod/endpoints/mod_sofia/mod_sofia.c | 23 +++++++++++++++++++++++ src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia_glue.c | 21 +++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 1e8876e638..c5de286696 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3507,6 +3507,7 @@ SWITCH_STANDARD_API(sofia_function) "sofia status|xmlstatus gateway \n" "sofia loglevel [0-9]\n" "sofia tracelevel \n" + "sofa global siptrace [on|off]\n" "--------------------------------------------------------------------------------\n"; if (session) { @@ -3562,6 +3563,26 @@ SWITCH_STANDARD_API(sofia_function) } else if (!strcasecmp(argv[0], "help")) { stream->write_function(stream, "%s", usage_string); goto done; + } else if (!strcasecmp(argv[0], "global")) { + int on = -1; + + if (argc > 1) { + if (!strcasecmp(argv[1], "siptrace")) { + if (argc > 2) { + on = switch_true(argv[2]); + } + } + } + + if (on != -1) { + sofia_glue_global_siptrace(on); + stream->write_function(stream, "+OK Global siptrace %s", on ? "on" : "off"); + } else { + stream->write_function(stream, "-ERR Usage: siptrace on|off"); + } + + goto done; + } else if (!strcasecmp(argv[0], "recover")) { if (argv[1] && !strcasecmp(argv[1], "flush")) { sofia_glue_recover(SWITCH_TRUE); @@ -4637,6 +4658,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_console_set_complete("add sofia loglevel ::[all:default:tport:iptsec:nea:nta:nth_client:nth_server:nua:soa:sresolv:stun ::[0:1:2:3:4:5:6:7:8:9"); switch_console_set_complete("add sofia tracelevel ::[console:alert:crit:err:warning:notice:info:debug"); + switch_console_set_complete("add sofia global siptrace ::[on:off"); + switch_console_set_complete("add sofia profile"); switch_console_set_complete("add sofia profile restart all"); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 5a6995806a..4e0c4fda1c 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1012,3 +1012,4 @@ char *sofia_glue_get_multipart(switch_core_session_t *session, const char *prefi void sofia_glue_tech_simplify(private_object_t *tech_pvt); switch_console_callback_match_t *sofia_reg_find_reg_url_multi(sofia_profile_t *profile, const char *user, const char *host); switch_bool_t sofia_glue_profile_exists(const char *key); +void sofia_glue_global_siptrace(switch_bool_t on); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 4018407961..0d3d9d2b60 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4342,6 +4342,27 @@ void sofia_glue_restart_all_profiles(void) } + +void sofia_glue_global_siptrace(switch_bool_t on) +{ + switch_hash_index_t *hi; + const void *var; + void *val; + sofia_profile_t *pptr; + + switch_mutex_lock(mod_sofia_globals.hash_mutex); + if (mod_sofia_globals.profile_hash) { + for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) { + switch_hash_this(hi, &var, NULL, &val); + if ((pptr = (sofia_profile_t *) val)) { + nua_set_params(pptr->nua, TPTAG_LOG(on), TAG_END()); + } + } + } + switch_mutex_unlock(mod_sofia_globals.hash_mutex); + +} + void sofia_glue_del_profile(sofia_profile_t *profile) { sofia_gateway_t *gp;