]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6805 add support for logging full timestamps with dialplan, defaults to old behavi...
authorNathan Neulinger <nneul@neulinger.org>
Tue, 11 Nov 2014 19:25:47 +0000 (13:25 -0600)
committerNathan Neulinger <nneul@neulinger.org>
Tue, 11 Nov 2014 19:25:47 +0000 (13:25 -0600)
conf/curl/autoload_configs/switch.conf.xml
conf/insideout/autoload_configs/switch.conf.xml
conf/rayo/autoload_configs/switch.conf.xml
conf/sbc/autoload_configs/switch.conf.xml
conf/vanilla/autoload_configs/switch.conf.xml
src/include/switch_types.h
src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
src/switch_core.c
src/switch_core_session.c

index 09d1c07393576d645de5c2158c9c354743efc71c..bb9af4f3fa55a0777c0e0cc5b4dfd128b98e86d9 100644 (file)
@@ -18,6 +18,8 @@
   <settings>
     <!--Colorize the Console -->
     <param name="colorize-console" value="true"/>
+    <!--Include full timestamps in dialplan logs -->
+    <param name="dialplan-timestamps" value="false"/>
     <!--Most channels to allow at once -->
     <param name="max-sessions" value="1000"/>
     <!--Most channels to create per second -->
index 09d1c07393576d645de5c2158c9c354743efc71c..bb9af4f3fa55a0777c0e0cc5b4dfd128b98e86d9 100644 (file)
@@ -18,6 +18,8 @@
   <settings>
     <!--Colorize the Console -->
     <param name="colorize-console" value="true"/>
+    <!--Include full timestamps in dialplan logs -->
+    <param name="dialplan-timestamps" value="false"/>
     <!--Most channels to allow at once -->
     <param name="max-sessions" value="1000"/>
     <!--Most channels to create per second -->
index ddf41f8996dad28c5d76435bc29f1dfbc4fe168f..e618069ab217cdd5a5fb2e2f3845d5d37a4d3eef 100644 (file)
@@ -24,6 +24,9 @@
     <!-- Colorize the Console -->
     <param name="colorize-console" value="true"/>
 
+    <!--Include full timestamps in dialplan logs -->
+    <param name="dialplan-timestamps" value="false"/>
+
     <!-- Run the timer at 20ms by default and drop down as needed unless you set 1m-timer=true which was previous default -->
     <!-- <param name="1ms-timer" value="true"/> -->
 
index 09d1c07393576d645de5c2158c9c354743efc71c..bb9af4f3fa55a0777c0e0cc5b4dfd128b98e86d9 100644 (file)
@@ -18,6 +18,8 @@
   <settings>
     <!--Colorize the Console -->
     <param name="colorize-console" value="true"/>
+    <!--Include full timestamps in dialplan logs -->
+    <param name="dialplan-timestamps" value="false"/>
     <!--Most channels to allow at once -->
     <param name="max-sessions" value="1000"/>
     <!--Most channels to create per second -->
index d508ad18447ed2292efe2bb608a7879d5033eaad..102a2a7f1e5b523e00f645e2ed5070c1f75b6eec 100644 (file)
@@ -24,6 +24,9 @@
     <!-- Colorize the Console -->
     <param name="colorize-console" value="true"/>
 
+    <!--Include full timestamps in dialplan logs -->
+    <param name="dialplan-timestamps" value="false"/>
+
     <!-- Run the timer at 20ms by default and drop down as needed unless you set 1m-timer=true which was previous default -->
     <!-- <param name="1ms-timer" value="true"/> -->
 
index 6b9f303f4775d0e5d04a10fe05a9224063ab5b83..69602de4190d21d31faff1bc5db0d1faffcc5a26 100644 (file)
@@ -361,7 +361,8 @@ typedef enum {
        SCF_CORE_NON_SQLITE_DB_REQ = (1 << 20),
        SCF_DEBUG_SQL = (1 << 21),
        SCF_API_EXPANSION = (1 << 22),
-       SCF_SESSION_THREAD_POOL = (1 << 23)
+       SCF_SESSION_THREAD_POOL = (1 << 23),
+       SCF_DIALPLAN_TIMESTAMPS = (1 << 24)
 } switch_core_flag_enum_t;
 typedef uint32_t switch_core_flag_t;
 
index b5ff5e63a6f1e4c4273432c55d8a344f692f127a..71908b36f02b18c689993f7139f005059ed25098 100644 (file)
@@ -148,10 +148,15 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                        req_nest = switch_true(req_nesta);
                }
 
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG, 
+               if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
                                                  "%sDialplan: Processing recursive conditions level:%d [%s] require-nested=%s\n", space,
                                                  recur, exten_name, req_nest ? "TRUE" : "FALSE");
-
+               } else {
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG, 
+                                                 "%sDialplan: Processing recursive conditions level:%d [%s] require-nested=%s\n", space,
+                                                 recur, exten_name, req_nest ? "TRUE" : "FALSE");
+               }
        } else {
                if ((tmp = switch_xml_attr(xexten, "name"))) {
                        exten_name = tmp;
@@ -204,15 +209,27 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                }
                
                if (time_match == 1) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                       if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+                                                         "%sDialplan: %s Date/Time Match (PASS) [%s] break=%s\n", space,
+                                                         switch_channel_get_name(channel), exten_name, do_break_a ? do_break_a : "on-false");
+                       } else {
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
                                                          "%sDialplan: %s Date/Time Match (PASS) [%s] break=%s\n", space,
                                                          switch_channel_get_name(channel), exten_name, do_break_a ? do_break_a : "on-false");
+                       }
                        anti_action = SWITCH_FALSE;
                        proceed = 1;
                } else if (time_match == 0) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                       if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+                                                         "%sDialplan: %s Date/TimeMatch (FAIL) [%s] break=%s\n", space,
+                                                         switch_channel_get_name(channel), exten_name, do_break_a ? do_break_a : "on-false");
+                       } else {
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
                                                          "%sDialplan: %s Date/TimeMatch (FAIL) [%s] break=%s\n", space,
                                                          switch_channel_get_name(channel), exten_name, do_break_a ? do_break_a : "on-false");
+                       }
                }
                
                
@@ -230,14 +247,26 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                time_match = switch_xml_std_datetime_check(xregex, tzoff ? &offset : NULL, tzname_);
                                
                                if (time_match == 1) {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                                       if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+                                                                         "%sDialplan: %s Date/Time Match (PASS) [%s]\n", space,
+                                                                         switch_channel_get_name(channel), exten_name);
+                                       } else {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
                                                                          "%sDialplan: %s Date/Time Match (PASS) [%s]\n", space,
                                                                          switch_channel_get_name(channel), exten_name);
+                                       }
                                        anti_action = SWITCH_FALSE;
                                } else if (time_match == 0) {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                                       if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+                                                                         "%sDialplan: %s Date/TimeMatch (FAIL) [%s]\n", space,
+                                                                         switch_channel_get_name(channel), exten_name);
+                                       } else {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
                                                                          "%sDialplan: %s Date/TimeMatch (FAIL) [%s]\n", space,
                                                                          switch_channel_get_name(channel), exten_name);
+                                       }
                                }
 
 
@@ -273,22 +302,40 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                        }
                                        
                                        if ((proceed = switch_regex_perform(field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                                               if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
+                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                                                  "%sDialplan: %s Regex (PASS) [%s] %s(%s) =~ /%s/ match=%s\n", space,
                                                                                  switch_channel_get_name(channel), exten_name, field, field_data, expression, all ? "all" : "any");
+                                               } else {
+                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                                                                                 "%sDialplan: %s Regex (PASS) [%s] %s(%s) =~ /%s/ match=%s\n", space,
+                                                                                 switch_channel_get_name(channel), exten_name, field, field_data, expression, all ? "all" : "any");
+                                               }
                                                pass++;
                                                if (!all && !xor) break;
                                        } else {
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                                               if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
+                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                                                  "%sDialplan: %s Regex (FAIL) [%s] %s(%s) =~ /%s/ match=%s\n", space,
                                                                                  switch_channel_get_name(channel), exten_name, field, field_data, expression, all ? "all" : "any");
+                                               } else {
+                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                                                                                 "%sDialplan: %s Regex (FAIL) [%s] %s(%s) =~ /%s/ match=%s\n", space,
+                                                                                 switch_channel_get_name(channel), exten_name, field, field_data, expression, all ? "all" : "any");
+                                               }
                                                fail++;
                                                if (all && !xor) break;
                                        }
                                } else if (time_match == -1) {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                                       if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                                          "%sDialplan: %s Absolute Condition [%s] match=%s\n", space,
                                                                          switch_channel_get_name(channel), exten_name, all ? "all" : "any");
+                                       } else {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                                                                         "%sDialplan: %s Absolute Condition [%s] match=%s\n", space,
+                                                                         switch_channel_get_name(channel), exten_name, all ? "all" : "any");
+                                       }
                                        pass++;
                                        proceed = 1;
                                        if (!all && !xor) break;
@@ -367,19 +414,37 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                }
 
                                if ((proceed = switch_regex_perform(field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                                       if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+                                                                         "%sDialplan: %s Regex (PASS) [%s] %s(%s) =~ /%s/ break=%s\n", space,
+                                                                         switch_channel_get_name(channel), exten_name, field, field_data, expression, do_break_a ? do_break_a : "on-false");
+                                       } else {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
                                                                          "%sDialplan: %s Regex (PASS) [%s] %s(%s) =~ /%s/ break=%s\n", space,
                                                                          switch_channel_get_name(channel), exten_name, field, field_data, expression, do_break_a ? do_break_a : "on-false");
+                                       }
                                        anti_action = SWITCH_FALSE;
                                } else {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                                       if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+                                                                         "%sDialplan: %s Regex (FAIL) [%s] %s(%s) =~ /%s/ break=%s\n", space,
+                                                                         switch_channel_get_name(channel), exten_name, field, field_data, expression, do_break_a ? do_break_a : "on-false");
+                                       } else {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
                                                                          "%sDialplan: %s Regex (FAIL) [%s] %s(%s) =~ /%s/ break=%s\n", space,
                                                                          switch_channel_get_name(channel), exten_name, field, field_data, expression, do_break_a ? do_break_a : "on-false");
+                                       }
                                }
                        } else if (time_match == -1) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                               if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+                                                                 "%sDialplan: %s Absolute Condition [%s]\n", space,
+                                                                 switch_channel_get_name(channel), exten_name);
+                               } else {
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
                                                                  "%sDialplan: %s Absolute Condition [%s]\n", space,
                                                                  switch_channel_get_name(channel), exten_name);
+                               }
                                anti_action = SWITCH_FALSE;
                                proceed = 1;
                        }
@@ -427,9 +492,15 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                }
 
                                for (;loop_count > 0; loop_count--) {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                                       if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+                                                                         "%sDialplan: %s ANTI-Action %s(%s) %s\n", space,
+                                                                         switch_channel_get_name(channel), application, data, xinline ? "INLINE" : "");
+                                       } else {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
                                                                          "%sDialplan: %s ANTI-Action %s(%s) %s\n", space,
                                                                          switch_channel_get_name(channel), application, data, xinline ? "INLINE" : "");
+                                       }
 
                                        if (xinline) {
                                                exec_app(session, application, data);
@@ -488,9 +559,15 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                        loop_count = atoi(loop);
                                }
                                for (;loop_count > 0; loop_count--) {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                                       if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                                          "%sDialplan: %s Action %s(%s) %s\n", space,
                                                                          switch_channel_get_name(channel), application, app_data, xinline ? "INLINE" : "");
+                                       } else {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                                                                         "%sDialplan: %s Action %s(%s) %s\n", space,
+                                                                         switch_channel_get_name(channel), application, app_data, xinline ? "INLINE" : "");
+                                       }
 
                                        if (xinline) {
                                                exec_app(session, application, app_data);
@@ -607,9 +684,15 @@ SWITCH_STANDARD_DIALPLAN(dialplan_hunt)
                        exten_name = "UNKNOWN";
                }
 
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+               if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                  "Dialplan: %s parsing [%s->%s] continue=%s\n",
                                                  switch_channel_get_name(channel), caller_profile->context, exten_name, cont ? cont : "false");
+               } else {
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+                                                 "Dialplan: %s parsing [%s->%s] continue=%s\n",
+                                                 switch_channel_get_name(channel), caller_profile->context, exten_name, cont ? cont : "false");
+               }
 
                proceed = parse_exten(session, caller_profile, xexten, &extension, exten_name, 0);
 
index cbf3175679e33e2effd9caf80a9500fc46ca38bf..bccaadc2b22f8d7b55a5f67cf6a3abca73240f7f 100644 (file)
@@ -1980,6 +1980,12 @@ static void switch_load_core_config(const char *file)
                                        runtime.core_db_inner_pre_trans_execute = switch_core_strdup(runtime.memory_pool, val);
                                } else if (!strcasecmp(var, "core-db-inner-post-trans-execute") && !zstr(val)) {
                                        runtime.core_db_inner_post_trans_execute = switch_core_strdup(runtime.memory_pool, val);
+                               } else if (!strcasecmp(var, "dialplan-timestamps")) {
+                                       if (switch_true(val)) {
+                                               switch_set_flag((&runtime), SCF_DIALPLAN_TIMESTAMPS);
+                                       } else {
+                                               switch_clear_flag((&runtime), SCF_DIALPLAN_TIMESTAMPS);
+                                       }
                                } else if (!strcasecmp(var, "mailer-app") && !zstr(val)) {
                                        runtime.mailer_app = switch_core_strdup(runtime.memory_pool, val);
                                } else if (!strcasecmp(var, "mailer-app-args") && val) {
index c5f1eaa718ce1b5d679c98273d533407555ca07c..a3728234e1cdad1f0d2ec662ac3e4378c96b41f5 100644 (file)
@@ -2811,8 +2811,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *
        }
 
        
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG, "EXECUTE %s %s(%s)\n",
+       if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "EXECUTE %s %s(%s)\n",
                                          switch_channel_get_name(session->channel), app, switch_str_nil(expanded));
+       } else {
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG, "EXECUTE %s %s(%s)\n",
+                                         switch_channel_get_name(session->channel), app, switch_str_nil(expanded));
+       }
 
        if ((var = switch_channel_get_variable(session->channel, "verbose_presence")) && switch_true(var)) {
                char *myarg = NULL;