///\return the section mask
SWITCH_DECLARE(switch_xml_section_t) switch_xml_parse_section_string(_In_opt_z_ const char *str);
-SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond, int *offset);
+SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond, int *offset, const char *tzname);
SWITCH_DECLARE(switch_status_t) switch_xml_locate_language(switch_xml_t *root, switch_xml_t *node, switch_event_t *params, switch_xml_t *language, switch_xml_t *phrases, switch_xml_t *macros, const char *str_language);
} break_t;
+#define check_tz() tzoff = switch_event_get_header(event, "tod_tz_offset"); \
+ tzname = switch_event_get_header(event, "timezone"); \
+ do { \
+ if (!zstr(tzoff) && switch_is_number(tzoff)) { \
+ offset = atoi(tzoff); \
+ } else { \
+ tzoff = NULL; \
+ } \
+ break; \
+ } while(tzoff)
static int parse_exten(switch_event_t *event, switch_xml_t xexten, switch_event_t **extension)
{
char *expression_expanded = NULL, *field_expanded = NULL;
switch_regex_t *re = NULL;
const char *to = switch_event_get_header(event, "to");
+ const char *tzoff = NULL, *tzname = NULL;
+ int offset = 0;
+
+ check_tz();
if (!to) {
to = "nobody";
int ovector[30];
switch_bool_t anti_action = SWITCH_TRUE;
break_t do_break_i = BREAK_ON_FALSE;
+ int time_match;
- int time_match = switch_xml_std_datetime_check(xcond, NULL);
+ check_tz();
+ time_match = switch_xml_std_datetime_check(xcond, tzoff ? &offset : NULL, tzname);
switch_safe_free(field_expanded);
switch_safe_free(expression_expanded);
#define check_tz() tzoff = switch_channel_get_variable(channel, "tod_tz_offset"); \
+ tzname = switch_channel_get_variable(channel, "timezone"); \
do { \
if (!zstr(tzoff) && switch_is_number(tzoff)) { \
offset = atoi(tzoff); \
char *expression_expanded = NULL, *field_expanded = NULL;
switch_regex_t *re = NULL, *save_re = NULL;
int offset = 0;
- const char *tzoff;
+ const char *tzoff = NULL, *tzname = NULL;
check_tz();
int time_match;
check_tz();
- time_match = switch_xml_std_datetime_check(xcond, tzoff ? &offset : NULL);
+ time_match = switch_xml_std_datetime_check(xcond, tzoff ? &offset : NULL, tzname);
switch_safe_free(field_expanded);
for (xregex = switch_xml_child(xcond, "regex"); xregex; xregex = xregex->next) {
check_tz();
- time_match = switch_xml_std_datetime_check(xregex, tzoff ? &offset : NULL);
+ 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,
return xml;
}
-SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond, int *offset)
+SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond, int *offset, const char *tzname)
{
const char *xdt = switch_xml_attr(xcond, "date-time");
if (offset) {
eoffset = *offset;
switch_time_exp_tz(&tm, ts, *offset * 3600);
+ } else if (!zstr(tzname)) {
+ switch_time_exp_tz_name(tzname, &tm, ts);
} else {
tm = tm2;
}