[Freeswitch-users] Failed to pass arguments to lua script of FreeSwitch ('arg' and 'arg[i]' are nil values)
Antonio
asilva at wirelessmundi.com
Tue Mar 13 13:12:50 MSK 2012
Hi,
Your missing an "V" in the arg name, "argv".
You can try do the following:
in diaplan:
<extension name="call lua script" continue="true">
<condition>
<action application="lua" data="yourcript.lua var1 var2"/>
</condition>
</extension>
in the lua:
var1 = argv[1] or "default value to avoid errors"
var2 = argv[1] or "default value var2"
freeswitch.consoleLog("info", tostring(var1) .. "\n")
freeswitch.consoleLog("info", tostring(var2) .. "\n")
you can also call the lua script directly from the cli:
fs:> luarun yourcript.lua var1 var2
Regards,
António
On Tue, 2012-03-13 at 02:46 -0700, king2kin wrote:
> Hi all,
>
> It's said we could access the arguments passed to lua script by
> variable 'arg[i]' where i > 0.
>
> for example, { lua dummy.lua aa 100 }
> then, we will have as follows:
> arg[1] -> aa
> arg[2] -> 100
>
> However, I always get 'nil' values for 'arg[i]' or 'arg' while running
> the lua script.
>
> How can I pass and retrieve arguments or parameters to a lua script of
> FreeSwitch?
>
>
>
>
>
>
>
>
>
> _________________________________________________________________________
> 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
--
Un cordial saludo / Best regards,
_________________________
António Silva
E-mail:asilva at wirelessmundi.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120313/5eb00e2a/attachment.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list