]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
run expand_vars if input contains a special escaped character not just when it contai...
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 14 Apr 2009 15:24:30 +0000 (15:24 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 14 Apr 2009 15:24:30 +0000 (15:24 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13015 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_utils.h
src/switch_channel.c
src/switch_event.c
src/switch_ivr_play_say.c
src/switch_utils.c

index 8c1654ee2cb5a1d66bdabf1c7c9558c3e049a745..1b965b4a7600bef8e6908be5f46df41241bdc9a0 100644 (file)
@@ -87,7 +87,20 @@ static inline switch_bool_t switch_is_moh(const char *s)
 }
 
 
+static inline int switch_string_has_escaped_data(const char *in)
+{
+       const char *i = strchr(in, '\\');
 
+       while (i && *i == '\\') {
+               i++;
+               if (*i == '\\' || *i == 'n' || *i == 's' || *i == 't') {
+                       return 1;
+               }
+               i = strchr(i, '\\');
+       }
+       
+       return 0;
+}
 
 SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size_t ilen, unsigned char *out, switch_size_t olen);
 SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen);
index 67fe38f68202d4c27e030d033e18a21cf08b73ff..aa0f03f74be8a1dc17edc6a1f3fd993101e8abe5 100644 (file)
@@ -1916,7 +1916,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel
                return (char *) in;
        }
 
-       nv = switch_string_var_check_const(in);
+       nv = switch_string_var_check_const(in) || switch_string_has_escaped_data(in);
 
        if (!nv) {
                return (char *) in;
index 40e0f5c98a2b7c5fa1c3c18d8e7673ebf62deb3a..924c95b6c8d0897451e5285afb75ef3a8789c511 100644 (file)
@@ -1331,7 +1331,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const
        char *func_val = NULL;
        int nv = 0;
 
-       nv = switch_string_var_check_const(in);
+       nv = switch_string_var_check_const(in) || switch_string_has_escaped_data(in);
 
        if (!nv) {
                return (char *) in;
index 3f9badd590ec649c71f9c109c4bcd0df6232d508..1935ea5f40085e11df2fe756a7eec1fb73301fa1 100644 (file)
@@ -1559,6 +1559,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t
                                if (switch_strlen_zero(digits_regex)) {
                                        return SWITCH_STATUS_SUCCESS;
                                }
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Test Regex [%s][%s]\n", digit_buffer, digits_regex);
                                if (switch_regex_match(digit_buffer, digits_regex) == SWITCH_STATUS_SUCCESS) {
                                        return SWITCH_STATUS_SUCCESS;
                                } else {
index 42f2e6e3c3bfc0e6b17192d99fd4de0b076d2338..8ebf16e41cb3be328da01da4896d79d9ec21f0c4 100644 (file)
@@ -61,7 +61,6 @@ int switch_inet_pton(int af, const char *src, void *dst)
 }
 #endif
 
-
 SWITCH_DECLARE(switch_status_t) switch_frame_alloc(switch_frame_t **frame, switch_size_t size)
 {
        switch_frame_t *new_frame;