From 3995ca8c00f561e8e8773640abe255fe0c2896f9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthony.minessale@gmail.com> Date: Fri, 26 May 2006 19:25:00 +0000 Subject: [PATCH] add vars to fields in dp git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1511 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- .../dialplans/mod_dialplan_xml/mod_dialplan_xml.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c index 15e9997b6e..6ed3b8f69e 100644 --- a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c +++ b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c @@ -142,10 +142,16 @@ static int parse_exten(switch_core_session_t *session, switch_xml_t xexten, swit field = (char *) switch_xml_attr(xcond, "field"); expression = (char *) switch_xml_attr_soft(xcond, "expression"); - + if (field) { - field_data = switch_caller_get_field_by_name(caller_profile, field); - + if (*field == '$') { + field_data = switch_channel_get_variable(channel, field + 1); + } else { + field_data = switch_caller_get_field_by_name(caller_profile, field); + } + if (!field_data) { + field_data = ""; + } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "test conditions %s(%s) =~ /%s/\n", field, field_data, expression); if (!(proceed = perform_regex(channel, field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Regex mismatch\n");