From 797bdf3edcd9202064bfa11406577f37b449c763 Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Wed, 18 Jul 2012 20:41:07 +0000 Subject: [PATCH] Added debug-level param for spandsp tone detector --- .../conf/autoload_configs/spandsp.conf.xml | 2 +- src/mod/applications/mod_spandsp/mod_spandsp.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml b/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml index 6f062cc731..c2c943bf30 100644 --- a/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml +++ b/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml @@ -34,7 +34,7 @@ - + diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index f79bea68ac..8a382cfcb1 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -492,8 +492,6 @@ switch_status_t load_configuration(switch_bool_t reload) spandsp_globals.ident = "SpanDSP Fax Ident"; spandsp_globals.header = "SpanDSP Fax Header"; spandsp_globals.timezone = ""; - - /* TODO make configuration param */ spandsp_globals.tonedebug = 0; if ((xml = switch_xml_open_cfg("spandsp.conf", &cfg, NULL)) || (xml = switch_xml_open_cfg("fax.conf", &cfg, NULL))) { @@ -592,6 +590,16 @@ switch_status_t load_configuration(switch_bool_t reload) /* Configure call progress detector */ if ((callprogress = switch_xml_child(cfg, "descriptors"))) { + /* check if debugging is enabled */ + const char *debug = switch_xml_attr(callprogress, "debug-level"); + if (!zstr(debug) && switch_is_number(debug)) { + int debug_val = atoi(debug); + if (debug_val > 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting tone detector debug-level to : %d\n", debug_val); + spandsp_globals.tonedebug = debug_val; + } + } + for (xdescriptor = switch_xml_child(callprogress, "descriptor"); xdescriptor; xdescriptor = switch_xml_next(xdescriptor)) { const char *name = switch_xml_attr(xdescriptor, "name"); const char *tone_name = NULL;