<div dir="ltr"><div>getVariable("caller_id_number") will return you a string, not an integer and in Lua type matters.</div><div><br></div><div>So you will be more happy if you use the following:</div><div> if (callerID == "1234567890") then<br>
</div><div><br></div><div>On consoleLog, you are missing the loglevel, see the documentation:</div><div><a href="http://wiki.freeswitch.org/wiki/Mod_lua#freeswitch.consoleLog">http://wiki.freeswitch.org/wiki/Mod_lua#freeswitch.consoleLog</a><br>
</div><div><br></div><div><br></div><div>Hope this helps!</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 10, 2013 at 5:14 PM, Joli Martinez <span dir="ltr"><<a href="mailto:mrjoli021@gmail.com" target="_blank">mrjoli021@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 style="word-wrap:break-word">Hello,<div><br></div><div>I am writing a Lua script that will get the callerId info. I need 1 to be able to get the callerID and also to print any messages to the FS_CLI for debugging purpose. By itself the session:execute does transfer to the correct conference, but it does not work with the callerID. And the consoleLog doesnt work it give me an error on the screen. </div>
<div><br></div><div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(77,44,220);background-color:rgb(254,244,156)">#!/usr/bin/lua</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(254,244,156);min-height:13px">
<br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(254,244,156)">session:answer();</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(254,244,156);min-height:13px">
<br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(254,244,156)">callerID = session:getVariable(<span style="color:#bc321c">"caller_id_number"</span>);</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(254,244,156);min-height:13px">
<br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(254,244,156);min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(254,244,156)">freeswitch.consoleLog(<span style="color:#bc321c">"Hello World"</span>);</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(254,244,156)"><span style="color:rgb(77,44,220)">--session:execute("conference","</span>4567<font color="#4d2cdc">");</font></div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(77,44,220);background-color:rgb(254,244,156)">--while (session:ready() == true) do </div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(77,44,220);background-color:rgb(254,244,156)">
<span style="color:#000000"> </span>--session:setAutoHangup(false);</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(254,244,156);min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(254,244,156)">
<span style="color:#a6a519">if</span> (callerID == <font color="#bc321c">1234567890</font>) <span style="color:#a6a519">then</span></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(254,244,156)">
session:execute(<span style="color:#bc321c">"conference"</span>,<span style="color:#bc321c">"</span>4567<span style="color:#bc321c">"</span>);</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(77,44,220);background-color:rgb(254,244,156)">
--else</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(254,244,156)"><span style="color:rgb(77,44,220)"><span style="color:#000000"> </span>-- session:execute("transfer","</span>7890<font color="#4d2cdc">");</font></div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(166,165,25);background-color:rgb(254,244,156)">end</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(77,44,220);background-color:rgb(254,244,156)">
-- end</div></div><div><br></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>
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><br clear="all"><div><br></div>-- <br>Kind regards,<br>/Areski<br><br>----<br>Arezqui Belaid, <<a href="mailto:areski@gmail.com" target="_blank">areski@gmail.com</a>><br>Founder at Star2Billing (<a href="http://www.star2billing.com" target="_blank">www.star2billing.com</a>)<br>
<br>Tel: +34650784355<br>Twitter: <a href="http://twitter.com/areskib" target="_blank">http://twitter.com/areskib</a> <br>LinkedIn: <a href="http://www.linkedin.com/in/areski" target="_blank">http://www.linkedin.com/in/areski</a>
</div>