On Wed, Oct 21, 2009 at 3:51 PM, Mark Campbell-Smith
<mcampbellsmith@gmail.com> wrote:
Thanks Guys for your suggestions! Very much appreciated.
The reason I asked was that I want to check if a variable is set or
not. I don't think your suggestions will work because I actually have
to check to see an undefined variable. Any way to do this?
Not in the dialplan itself. Better off using a script for this.
I want to have the same extension for checking digits read from DTMF.
The problem is that the digits are not set to the variable until the
transfer statement, which means I would require 2 extensions. It
will make things simpler if I can have the same extension that reads
the digits and then checks them.
You need either to use multiple extensions or use a script. The dialplan was specifically designed not to be a programming language and the functionality you seek is best served by using a script or by using transfer to drop the call through the diaplan again and use another extension.
-MC
For example:
<extension name="checkdigits">
<condition field="destination_number" expression="^checkdigits$"/>
<!--The next condition should be true if the variable $digits
is not set/undefined -->
<condition field="${digits}" expression="^[^.+]$" />
-----<<<< what should be here to check for undefined variable $digits
?
<action application="read" data="1 10 ivr/ivr-hello.wav
digits 10000 #"/>
<action application="phrase" data="spell,${digits}"/>
<action application="transfer" data="checkdigits digits XML
features"/>
</condition>
<condition field="${pincode}" expression="^${some_variable}$">
< SOME ACTIONS HERE >
</condition>
</extension>