<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.30.3">
</HEAD>
<BODY>
Hi,<BR>
<BR>
Your missing an "V" in the arg name, "argv".<BR>
<BR>
You can try do the following:<BR>
<BR>
in diaplan:<BR>
<BR>
<extension name="call lua script" continue="true"><BR>
<condition><BR>
<action application="lua" data="yourcript.lua var1 var2"/><BR>
</condition><BR>
</extension><BR>
<BR>
<BR>
in the lua:<BR>
<BR>
var1 = argv[1] or "default value to avoid errors"<BR>
var2 = argv[1] or "default value var2"<BR>
<BR>
freeswitch.consoleLog("info", tostring(var1) .. "\n")<BR>
freeswitch.consoleLog("info", tostring(var2) .. "\n")<BR>
<BR>
<BR>
you can also call the lua script directly from the cli:<BR>
<BR>
fs:> luarun yourcript.lua var1 var2<BR>
<BR>
<BR>
Regards,<BR>
António<BR>
<BR>
<BR>
<BR>
On Tue, 2012-03-13 at 02:46 -0700, king2kin wrote: <BR>
<BLOCKQUOTE TYPE=CITE>
Hi all, <BR>
<BR>
It's said we could access the arguments passed to lua script by variable 'arg[i]' where i > 0.<BR>
<BR>
for example, { lua dummy.lua aa 100 }<BR>
then, we will have as follows:<BR>
arg[1] -> aa<BR>
arg[2] -> 100<BR>
<BR>
However, I always get 'nil' values for 'arg[i]' or 'arg' while running the lua script.<BR>
<BR>
How can I pass and retrieve arguments or parameters to a lua script of FreeSwitch?<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<PRE>
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<A HREF="mailto:consulting@freeswitch.org">consulting@freeswitch.org</A>
<A HREF="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</A>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<A HREF="http://www.cudatel.com">http://www.cudatel.com</A>
Official FreeSWITCH Sites
<A HREF="http://www.freeswitch.org">http://www.freeswitch.org</A>
<A HREF="http://wiki.freeswitch.org">http://wiki.freeswitch.org</A>
<A HREF="http://www.cluecon.com">http://www.cluecon.com</A>
FreeSWITCH-users mailing list
<A HREF="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</A>
<A HREF="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</A>
UNSUBSCRIBE:<A HREF="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</A>
<A HREF="http://www.freeswitch.org">http://www.freeswitch.org</A>
</PRE>
</BLOCKQUOTE>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
--
Un cordial saludo / Best regards,
_________________________
António Silva
E-mail:<A HREF="mailto:asilva@wirelessmundi.com">asilva@wirelessmundi.com</A>
</PRE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>