That fixed it. The fix was to change hours to ${hours} in the condition field.
Thanks,
Josh
From: Steven Ayre [mailto:steveayre@gmail.com]
Sent: Monday, July 25, 2011 3:40 PM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] Can't get variable set in dial plan
Variables are not fields. Fields are a specific set of attributes of the call... you can however check variables in a condition, it just has a slightly different syntax. Try this.
<extension name="public_did">
<condition field="destination_number" expression="^(.*)$">
<action inline="true" application="set" data="hours=1"/>
</condition>
<condition field="${hours}" expression="^1$">
<action application="answer"/>
<action application="ivr" data="GAC-BH"/>
<action application="hangup"/>
<anti-action application="answer"/>
<anti-action application="ivr" data="GAC-BH"/>
<anti-action application="hangup"/>
</condition>
</extension>
Also note I changed your regex of "1" to "^1$". The first matches any string containing a digit 1 including 10, 21, 100, 200351. The latter matches the start (^) and end ($) of the string so will only match the exact string of 1.
-Steve
On 25 July 2011 20:54, Joshua Foshee <Joshua.Foshee@logixcom.com> wrote:
I am trying to set a variable in the dial plan and use it on a condition. I have pushed the variable setting as close to the condition for testing and this is what I get. Why does it not see the variable set?
<extension name="public_did">
<condition field="destination_number" expression="^(.*)$">
<action inline="true" application="set" data="hours=1"/>
</condition>
<condition field="hours" expression="1">
<action application="answer"/>
<action application="ivr" data="GAC-BH"/>
<action application="hangup"/>
<anti-action application="answer"/>
<anti-action application="ivr" data="GAC-BH"/>
<anti-action application="hangup"/>
</condition>
</extension>
Here is the console output
Dialplan: FreeTDM/1:7/405790xxx8 Regex (PASS) [public_did] destination_number(405790xxx8) =~ /^(.*)$/ break=on-false
Dialplan: FreeTDM/1:7/405790xxx8 Action set(hours=1) INLINE
EXECUTE FreeTDM/1:7/405790xxx8 set(hours=1)
2011-07-25 12:05:25.191357 [DEBUG] mod_dptools.c:1063 FreeTDM/1:7/405790xxx8 SET [hours]=[1]
Dialplan: FreeTDM/1:7/405790xxx8 Regex (FAIL) [public_did] hours() =~ /1/ break=on-false
Dialplan: FreeTDM/1:7/405790xxx8 ANTI-Action answer()
Dialplan: FreeTDM/1:7/405790xxx8 ANTI-Action ivr(GAC-BH)
Dialplan: FreeTDM/1:7/405790xxx8 ANTI-Action hangup()
_______________________________________________
Join us at ClueCon 2011, Aug 9-11, Chicago
http://www.cluecon.com 877-7-4ACLUE
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org