<div dir="ltr">Many thanks for your answer.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 8 May 2015 at 13:43, Oleg Stolyar <span dir="ltr">&lt;<a href="mailto:olegstolyar@gmail.com" target="_blank">olegstolyar@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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">&lt;action application=&quot;bind_digit_</span><span style="color:rgb(0,0,0);font-size:12.8000001907349px">action&quot; data=&quot;my_digits,0,exec:lua,</span><span style="color:rgb(0,0,0);font-size:12.8000001907349px">your_script.lua,0&quot;/&gt;</span><br></div><div><span style="color:rgb(0,0,0);font-size:12.8000001907349px">&lt;action application=&quot;bind_digit_</span><span style="color:rgb(0,0,0);font-size:12.8000001907349px">action&quot; data=&quot;my_digits,1,exec:lua,</span><span style="color:rgb(0,0,0);font-size:12.8000001907349px">your_script.lua,1&quot;/&gt;</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">&lt;action application=&quot;bind_digit_</span><span style="color:rgb(0,0,0);font-size:12.8000001907349px">action&quot; data=&quot;my_digits,2,exec:lua,</span><span style="color:rgb(0,0,0);font-size:12.8000001907349px">your_script.lua,2&quot;/&gt;</span><span style="color:rgb(0,0,0);font-size:12.8000001907349px"><br></span></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 8, 2015 at 1:35 PM, Aqs Younas <span dir="ltr">&lt;<a href="mailto:aqsyounas@gmail.com" target="_blank">aqsyounas@gmail.com</a>&gt;</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&#39;t explain my question well. I don&#39;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>&lt;include&gt;<br>  &lt;context name=&quot;default&quot;&gt;<br>   &lt;extension name=&quot;radio&quot;&gt;<br>        &lt;condition&gt;<br>                &lt;action application=&quot;answer&quot;/&gt;<br>                &lt;action application=&quot;lua&quot; data=&quot;main.lua&quot;/&gt; <br>  &lt;/condition&gt;<br>  &lt;/extension&gt;<br>&lt;/context&gt;<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><div><div class="gmail_extra"><br><div class="gmail_quote">On 8 May 2015 at 13:11, Oleg Stolyar <span dir="ltr">&lt;<a href="mailto:olegstolyar@gmail.com" target="_blank">olegstolyar@gmail.com</a>&gt;</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>&lt;action application=&quot;bind_digit_action&quot; data=&quot;my_digits,0,exec:lua,your_script.lua,param1 param2 param3&quot;/&gt;<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">&lt;<a href="mailto:aqsyounas@gmail.com" target="_blank">aqsyounas@gmail.com</a>&gt;</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>&lt;condition&gt;<br>&lt;action application=&quot;bind_digit_action&quot; data=&quot;moderator,~\*,exec:execute_extension,previous XML Previous&quot;/&gt;<br>        &lt;action application=&quot;bind_digit_action&quot; data=&quot;moderator,~\#,exec:execute_extension,next XML Next&quot;/&gt;<br>        &lt;action application=&quot;bind_digit_action&quot; data=&quot;moderator,~^\d$,exec:execute_extension,exten XML Exten&quot;/&gt;<br>                &lt;action application=&quot;digit_action_set_realm&quot; data=&quot;moderator&quot;/&gt;<br>        &lt;action application=&quot;answer&quot;/&gt;<br>        &lt;action application=&quot;playback&quot; data=&quot;shout://<a href="http://127.0.0.1/radio" target="_blank">127.0.0.1/radio</a>&quot;/&gt; &lt;/condition&gt;<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" 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>