[Freeswitch-users] Lua script

Areski areski at gmail.com
Tue Dec 10 20:35:35 MSK 2013


getVariable("caller_id_number") will return you a string, not an integer
and in Lua type matters.

So you will be more happy if you use the following:
    if (callerID == "1234567890")  then

On consoleLog, you are missing the loglevel, see the documentation:
http://wiki.freeswitch.org/wiki/Mod_lua#freeswitch.consoleLog


Hope this helps!



On Tue, Dec 10, 2013 at 5:14 PM, Joli Martinez <mrjoli021 at gmail.com> wrote:

> Hello,
>
> 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.
>
> #!/usr/bin/lua
>
> session:answer();
>
> callerID = session:getVariable("caller_id_number");
>
>
> freeswitch.consoleLog("Hello World");
> --session:execute("conference","4567");
> --while (session:ready() == true) do
>   --session:setAutoHangup(false);
>
> if (callerID == 1234567890)  then
>     session:execute("conference","4567");
> --else
>   --  session:execute("transfer","7890");
> end
> -- end
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>


-- 
Kind regards,
/Areski

----
Arezqui Belaid, <areski at gmail.com>
Founder at Star2Billing (www.star2billing.com)

Tel: +34650784355
Twitter: http://twitter.com/areskib
LinkedIn: http://www.linkedin.com/in/areski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20131210/95936f11/attachment.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list