<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">&lt;<a href="mailto:saami_mh@ymail.com" target="_blank">saami_mh@ymail.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><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif;font-size:12pt">hi guys,</div><div><div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">&lt;include&gt;</span></div>

<div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif"> &lt;extension name=&quot;welcome_ivr&quot;&gt;</span></div><div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">  &lt;condition field=&quot;destination_number&quot; expression=&quot;^samira$&quot;&gt;</span></div>

<div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">   &lt;action application=&quot;lua&quot; data=&quot;welcome.lua&quot;/&gt;</span></div><div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">  &lt;/condition&gt;</span></div>

<div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif"> &lt;/extension&gt;</span></div><div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">&lt;/include&gt;</span></div>

<div style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif;font-size:12pt"><br></div></div><div style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif;font-size:12pt">i have created lua script like this:</div>

<div><div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">/usr/local/freeswitch/script/</span><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">welcome.lua</span></div>

<div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif"><br></span></div><div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">#!/usr/bin/lua</span></div>
<div>
<span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif"><br></span></div><div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">local sf = string.format</span></div>

<div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif"><br></span></div><div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">function binary_op(a, b, callback)</span></div>

<div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">        return callback(a, b);</span></div><div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">end</span></div>

<div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif"><br></span></div><div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">function  plus(a, b) return a + b end</span></div>

<div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">function  minus(a, b) return a - b end</span></div><div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">function  times(a, b)
 return a * b end</span></div><div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif"><br></span></div><div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">print(sf(&quot;Plus : %d&quot;, binary_op(5, 5, plus)));</span></div>

<div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">print(sf(&quot;Minus: %d&quot;, binary_op(5, 5, minus)));</span></div><div><span style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">print(sf(&quot;Times: %d&quot;, binary_op(5, 5, times)));</span></div>

<div style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif;font-size:12pt"><br></div><div style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif;font-size:12pt">the result of running that is 3 number,</div>

<div style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,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:&#39;times new roman&#39;,&#39;new york&#39;,times,serif;font-size:12pt">thanks so much</div><div style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,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>