<div dir="ltr">Set a channel variable in Lua: <div><a href="http://wiki.freeswitch.org/wiki/Lua#session:setVariable">http://wiki.freeswitch.org/wiki/Lua#session:setVariable</a><br clear="all"><div dir="ltr"><span style="font-family:Verdana,Arial,Helvetica,sans-serif"><span style="font-size:small"><br>
</span></span></div><div dir="ltr"><span style="font-family:Verdana,Arial,Helvetica,sans-serif"><span style="font-size:small">-Avi</span></span></div>
<br><br><div class="gmail_quote">On Thu, May 31, 2012 at 7:59 AM, Samira Mh <span dir="ltr"><<a href="mailto:saami_mh@ymail.com" target="_blank">saami_mh@ymail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div style="font-family:'times new roman','new york',times,serif;font-size:12pt">hi guys,</div><div><div><span style="font-family:'times new roman','new york',times,serif"><include></span></div>
<div><span style="font-family:'times new roman','new york',times,serif"> <extension name="welcome_ivr"></span></div><div><span style="font-family:'times new roman','new york',times,serif"> <condition field="destination_number" expression="^samira$"></span></div>
<div><span style="font-family:'times new roman','new york',times,serif"> <action application="lua" data="welcome.lua"/></span></div><div><span style="font-family:'times new roman','new york',times,serif"> </condition></span></div>
<div><span style="font-family:'times new roman','new york',times,serif"> </extension></span></div><div><span style="font-family:'times new roman','new york',times,serif"></include></span></div>
<div style="font-family:'times new roman','new york',times,serif;font-size:12pt"><br></div></div><div style="font-family:'times new roman','new york',times,serif;font-size:12pt">i have created lua script like this:</div>
<div><div><span style="font-family:'times new roman','new york',times,serif">/usr/local/freeswitch/script/</span><span style="font-family:'times new roman','new york',times,serif">welcome.lua</span></div>
<div><span style="font-family:'times new roman','new york',times,serif"><br></span></div><div><span style="font-family:'times new roman','new york',times,serif">#!/usr/bin/lua</span></div>
<div>
<span style="font-family:'times new roman','new york',times,serif"><br></span></div><div><span style="font-family:'times new roman','new york',times,serif">local sf = string.format</span></div>
<div><span style="font-family:'times new roman','new york',times,serif"><br></span></div><div><span style="font-family:'times new roman','new york',times,serif">function binary_op(a, b, callback)</span></div>
<div><span style="font-family:'times new roman','new york',times,serif"> return callback(a, b);</span></div><div><span style="font-family:'times new roman','new york',times,serif">end</span></div>
<div><span style="font-family:'times new roman','new york',times,serif"><br></span></div><div><span style="font-family:'times new roman','new york',times,serif">function plus(a, b) return a + b end</span></div>
<div><span style="font-family:'times new roman','new york',times,serif">function minus(a, b) return a - b end</span></div><div><span style="font-family:'times new roman','new york',times,serif">function times(a, b)
return a * b end</span></div><div><span style="font-family:'times new roman','new york',times,serif"><br></span></div><div><span style="font-family:'times new roman','new york',times,serif">print(sf("Plus : %d", binary_op(5, 5, plus)));</span></div>
<div><span style="font-family:'times new roman','new york',times,serif">print(sf("Minus: %d", binary_op(5, 5, minus)));</span></div><div><span style="font-family:'times new roman','new york',times,serif">print(sf("Times: %d", binary_op(5, 5, times)));</span></div>
<div style="font-family:'times new roman','new york',times,serif;font-size:12pt"><br></div><div style="font-family:'times new roman','new york',times,serif;font-size:12pt">the result of running that is 3 number,</div>
<div style="font-family:'times new roman','new york',times,serif;font-size:12pt">but how can i get the 3 number in dialplan of freeswitch so that use the result of this number on it
?</div><div style="font-family:'times new roman','new york',times,serif;font-size:12pt">thanks so much</div><div style="font-family:'times new roman','new york',times,serif;font-size:12pt">
<br></div></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>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.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://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
Join Us At ClueCon - Aug 7-9, 2012<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>
<br></blockquote></div><br></div></div>