It's because you're executing Lua in-line. Lua is getting executed *before* all of the applications listed above it. Remove the inline="true" and you'll be okay.<br>-MC<br><br><div class="gmail_quote">
On Thu, Jun 28, 2012 at 11:10 AM, Gary Chen <span dir="ltr"><<a href="mailto:Gary.Chen@lightyear.net" target="_blank">Gary.Chen@lightyear.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal">FreeSWITCH Version 1.2.0-rc2+git~20120625T160048Z~690cae5de1<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I am trying to validate the input from read app using lua. Here is my dialplan:<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"> <extension name="account_code_setup" continue="true"><u></u><u></u></p><p class="MsoNormal"> <condition field="${use_acct_code}" expression="^YES$|^VALIDATE$"><u></u><u></u></p>
<p class="MsoNormal"> <action application="answer"/><u></u><u></u></p><p class="MsoNormal"> <action application="read" data="2 15 'tone_stream://%(10000,0,350,440)' acctcode 30000 #"/><u></u><u></u></p>
<p class="MsoNormal"> <action application="log" data="username: '${user_name}' acctcode: '${acctcode}'"/><u></u><u></u></p><p class="MsoNormal"> <action application="set" data="sip_h_X-account-code=${acctcode}"/><u></u><u></u></p>
<p class="MsoNormal"> <action inline="true" application="lua" data="validate_acctcode.lua ${use_acct_code} ${acctcode_list} ${acctcode}"/><u></u><u></u></p><p class="MsoNormal">
</condition><u></u><u></u></p><p class="MsoNormal"> <condition field="${validate}" expression="^NO$"><u></u><u></u></p><p class="MsoNormal"> <anti-action application="respond" data="406 Invalid account code"/><u></u><u></u></p>
<p class="MsoNormal"> <anti-action application="hangup"/><u></u><u></u></p><p class="MsoNormal"> </condition><u></u><u></u></p><p class="MsoNormal"> </extension><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I can assign ${acctcode} to sip_h_X-account-code. But it always has nil value when pass to lua.<u></u><u></u></p><p class="MsoNormal">What am I doing wrong?<span class="HOEnZb"><font color="#888888"><u></u><u></u></font></span></p>
<span class="HOEnZb"><font color="#888888"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Gary <u></u><u></u></p></font></span></div></div><br></blockquote></div><br>