run expand_vars if input contains a special escaped character not just when it contains a variable to eat up back slashes

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13015 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-04-14 15:24:30 +00:00
parent 59b3cdc2a6
commit 21538b2bf9
5 changed files with 16 additions and 3 deletions

View 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);

View 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;

View 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;

View 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 {

View 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;