]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7405 Fix <condition regex="all"> to work with time conditions
authorArtur Zaprzała <zapartur@gmail.com>
Tue, 16 Jun 2015 13:05:27 +0000 (15:05 +0200)
committerArtur Zaprzała <artur@artur.katowicka>
Thu, 9 Jul 2015 21:03:15 +0000 (23:03 +0200)
src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c

index 2abbee967d06921492f723d57375b3e0fa75c9d3..5d4987ff1cb9ce3e9b1f20b542fe4f5056a36e2d 100644 (file)
@@ -234,6 +234,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                        switch_channel_del_variable_prefix(channel, "DP_REGEX_MATCH");
 
                        for (xregex = switch_xml_child(xcond, "regex"); xregex; xregex = xregex->next) {
+                               int time_match;
                                check_tz();
                                time_match = switch_xml_std_datetime_check(xregex, tzoff ? &offset : NULL, tzname_);
                                
@@ -247,7 +248,6 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                                                          "%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) {
                                        if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
@@ -334,6 +334,9 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                        pass++;
                                        proceed = 1;
                                        if (!all && !xor) break;
+                               } else {        // time_match == 0
+                                       fail++;
+                                       if (all) break;
                                }
                                
                                if (field && strchr(expression, '(')) {
@@ -347,7 +350,6 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                        switch_safe_free(save_field_data);
                                        switch_regex_safe_free(save_re);
                                        
-                                       
                                        save_expression = strdup(expression);
                                        save_field_data = strdup(field_data);
                                        save_re = re;
@@ -360,7 +362,6 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
 
                                switch_safe_free(field_expanded);
                                switch_safe_free(expression_expanded);
-                               
                        }
 
                        if (xor) {
@@ -371,17 +372,10 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                if ((all && !fail) || (!all && pass)) {
                                        anti_action = SWITCH_FALSE; 
                                }
-                               if (all && total != pass) {
-                                       proceed = 1;
-                                       pass = 0;
-                                       fail++;
-                                       anti_action = SWITCH_TRUE;
-                               }
                        }
 
                        switch_safe_free(field_expanded);
                        switch_safe_free(expression_expanded);
-                       
                } else {
                        if ((xexpression = switch_xml_child(xcond, "expression"))) {
                                expression = switch_str_nil(xexpression->txt);