On Fri, Apr 27, 2012 at 9:25 AM, Chris B. Ware <chrisbware@yahoo.it> wrote:
Hi,

I'd like to set a channel variable and use it in a time condition like this:

<condition mon="${rmon}" >

with rmon=1-12 (just to be sure condition is verified).

I can't find out why it doesn't work. 

- Using <action application="info"/> , I can see variable is set [1-12]
- I've tried also <condition mon="${rmon}"  inline="true">
- Using directly  <condition mon="1-12" > it works


Like Jeff says, be sure that the ${rmon} variable is getting set with the inline="true" attribute. Note: You don't use inline="true" in a condition tag.

Try this:
<condition field="${rmon}" expression="^[12]?[0-9]$">

You need to use a regular expression when checking the value of a channel variable and you need to wrap the the chan var in ${}. Check this section of the XML Dialplan wiki page:
http://wiki.freeswitch.org/wiki/Dialplan_XML#Caller_Profile_Fields_vs._Channel_Variables

Let us know how it goes!
-MC