<div dir="ltr"><div><div><div class="gmail_extra">1) console: Wiki says you need two args -- freeswitch.consoleLog("info", "lua rocks\n");<br>2) lua does typing, and the callerID will be a string. So you want to do: if (callerID == "1234567890") then<br>
<div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote" style>-Avi</div><div class="gmail_quote"><br></div><div class="gmail_quote">On Tue, Dec 10, 2013 at 6: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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style: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:rgb(188,50,28)">"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:rgb(188,50,28)">"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:rgb(0,0,0)"> </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:rgb(166,165,25)">if</span> (callerID == <font color="#bc321c">1234567890</font>) <span style="color:rgb(166,165,25)">then</span></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(254,244,156)">
session:execute(<span style="color:rgb(188,50,28)">"conference"</span>,<span style="color:rgb(188,50,28)">"</span>4567<span style="color:rgb(188,50,28)">"</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:rgb(0,0,0)"> </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></div></div></div></div>