<div dir="ltr">There are several ways. One is to use a regex to match any digit and execute a lua script. Inside the script check the last_matching_digits session variable.<br><div><br></div><div>I have not tried it myself, so not sure how well it will work (regex and the variable). If for some reason it does not, you can still use separate bindings for each digit, call the same lua script from each and pass the digit in as a parameter like this:</div><div><br></div><div><span style="color:rgb(0,0,0);font-size:12.8000001907349px"><action application="bind_digit_</span><span style="color:rgb(0,0,0);font-size:12.8000001907349px">action" data="my_digits,0,exec:lua,</span><span style="color:rgb(0,0,0);font-size:12.8000001907349px">your_script.lua,0"/></span><br></div><div><span style="color:rgb(0,0,0);font-size:12.8000001907349px"><action application="bind_digit_</span><span style="color:rgb(0,0,0);font-size:12.8000001907349px">action" data="my_digits,1,exec:lua,</span><span style="color:rgb(0,0,0);font-size:12.8000001907349px">your_script.lua,1"/></span><span style="color:rgb(0,0,0);font-size:12.8000001907349px"><br></span></div><div><span style="color:rgb(0,0,0);font-size:12.8000001907349px"><action application="bind_digit_</span><span style="color:rgb(0,0,0);font-size:12.8000001907349px">action" data="my_digits,2,exec:lua,</span><span style="color:rgb(0,0,0);font-size:12.8000001907349px">your_script.lua,2"/></span><span style="color:rgb(0,0,0);font-size:12.8000001907349px"><br></span></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 8, 2015 at 1:35 PM, Aqs Younas <span dir="ltr"><<a href="mailto:aqsyounas@gmail.com" target="_blank">aqsyounas@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div>Thanks for your reply. <br><br></div>I think i didn't explain my question well. I don't want to execute a separate lua script upon each regex match. <br></div>I want a single script with different functions for corresponding inputs. <br><br><include><br> <context name="default"><br> <extension name="radio"><br> <condition><br> <action application="answer"/><br> <action application="lua" data="main.lua"/> <br> </condition><br> </extension><br></context><br><br><br></div>--main.lua <br></div>function next()<br></div> logic<br></div>end<br></div>function previous()<br></div> logic<br></div>end<br><br></div><b>logic for calling above functions goes here. <br> </b><br></div>Is it possible to right above dialplan in a single script with different fucntions? <br><div><div><br></div><div>Thanks. <br></div><div><div><div><div><div><div><div><div><div> <br></div></div></div></div></div></div></div></div></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 8 May 2015 at 13:11, Oleg Stolyar <span dir="ltr"><<a href="mailto:olegstolyar@gmail.com" target="_blank">olegstolyar@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I just finished playing with it. You can just do this:<div><br></div><div><action application="bind_digit_action" data="my_digits,0,exec:lua,your_script.lua,param1 param2 param3"/><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Fri, May 8, 2015 at 1:05 PM, Aqs Younas <span dir="ltr"><<a href="mailto:aqsyounas@gmail.com" target="_blank">aqsyounas@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div>Hi, users. <br><br>Below is my default.xml snippet. I am using bind_digit_action for different inputs bindings and moves the call to that context upon regex match. <br><br></div><div><condition><br><action application="bind_digit_action" data="moderator,~\*,exec:execute_extension,previous XML Previous"/><br> <action application="bind_digit_action" data="moderator,~\#,exec:execute_extension,next XML Next"/><br> <action application="bind_digit_action" data="moderator,~^\d$,exec:execute_extension,exten XML Exten"/><br> <action application="digit_action_set_realm" data="moderator"/><br> <action application="answer"/><br> <action application="playback" data="shout://<a href="http://127.0.0.1/radio" target="_blank">127.0.0.1/radio</a>"/> </condition><br> <br></div><div>Now I want to write my dialplan in lua which I think is more handy than xml.<br></div><div>Upon regex match call to be executed in corresponding functions.<br><br></div><div>Like, for *<br></div><div><b>function next()</b><br></div><div>for #,<br></div><div><b>function previous()</b><br><br><br></div><div><br></div><div>I know there is a application <b>session.setHangupHook(hangup_function_name)</b>;<br></div><div>Which executes the function(hangup_function_name) upon call hangup.<br><br></div><div>Is there anything available in lua witch executes functions upon regex match.<br></div><div>Or any other way for doing this.<br><br></div><div>Any pointer would be much appreciated. <br><br></div><div>Thanks. <br></div><div><br></div><div><br></div></div>
<br></div></div>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div>
</div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div>