<br><br><div class="gmail_quote">On Wed, Apr 22, 2009 at 12:19 PM, Chris Fowler <span dir="ltr"><chris@fowler.cc></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I have the following defined:<br>
<br>
<!-- Billing Open? --><br>
<extension name="billing_open" continue="true"><br>
<!-- man strftime - M-F, 9AM to 5PM --><br>
<condition field="${strftime(%w)}" expression="^([1-5])$"/><br>
<condition field="${strftime(%H%M)}" expression="^((09|1[0-6])[0-5][0-9]|1700)$"><br>
<action application="set" data="billingopen=true"/><br>
</condition><br>
</extension><br>
<br>
<br>
<!-- billing line --><br>
<extension name="billing"><br>
<condition field="destination_number" expression="^billing$|^2001$"/><br>
<condition field="billingopen" expression="^true$"><br>
<...><br>
<br>
<br>
But despite the "Billing Open" ext firing correctly:<br>
Action set(billingopen=true)<br>
<br>
The Billing extenstion fails to get the data:<br>
Regex (FAIL) [billing] billingopen() =~ /^true$/ break=on-false<br>
<br>
Please could someone point me in the right direction for using variables correctly in a dialplan? I must be missing something simple...<br>
<br>
Thanks, Chris.<br>
</blockquote></div><br>This is a classic case of "dialplan is parsed all at once." The reason that it is failing is because ${billingopen} is not defined when the extension named "billing" is parsed. You need another pass through the dialplan, for example by adding a transfer app to your "billing_open" extension:<br>
<br><!-- Billing Open? --><br> <extension name="billing_open" continue="true"><br> <!-- man strftime - M-F, 9AM to 5PM --><br>
<condition field="${strftime(%w)}" expression="^([1-5])$"/><br>
<condition field="${strftime(%H%M)}" expression="^((09|1[0-6])[0-5]<br> <action application="set" data="billingopen=true"/><br><b style="color: rgb(51, 51, 255);"> <action application="transfer" data="billing"/><br>
</b> </condition><br>
</extension><br><br>This will send the call back through the dialplan and into the "billing" extension, this time with the value of ${billing_open} == "true" so you can now work with it. The originally dialed number is now available in the ${rdnis} channel variable in case you need it.<br>
<br>Have fun and let us know how it goes.<br>-MC<br>