[Freeswitch-users] Lua problem there are only two arguments evaluated
Michael Collins
msc at freeswitch.org
Tue Jul 31 19:22:37 MSD 2012
I believe you need to run this command "inline":
<action application="set"
data="msgtime=msg_${strftime(%Y_%m_%d_%H_%M_%S)}_${mailbox}.alaw"/>
Change it to this and try again:
<action application="set"
data="msgtime=msg_${strftime(%Y_%m_%d_%H_%M_%S)}_${mailbox}.alaw"
inline="true"/>
Let us know if it works or not. Also, your homework assignment will be to
read this:
http://wiki.freeswitch.org/wiki/Dialplan_XML#Inline_Actions
And learn about hunting (or "parsing" phase) vs. execution phase of
dialplan processing. :)
-MC
On Tue, Jul 31, 2012 at 2:12 AM, Thomas Hoellriegel <admin at blindi.net>wrote:
> hi guy,
> I have simply written a voicemailrecording in lua.
> My dialplan extension is:
> <extension name="dorf_mailboxes" >
> <condition field="destination_number"
> expression="^44[0-9][0-9][0-9]**[0-9]\d*$">
> <action application="set" data="msgtime=msg_${strftime(%**
> Y_%m_%d_%H_%M_%S)}_${mailbox}.**alaw"/>
> <action application="lua" data="recordmsg.lua
> $${dorf_mailbox_prefix}/${**mailbox_to}/greeting.alaw ${mailbox}
> ${msgtime}"/>
> </condition>
> </extension>
>
> The luascript:
>
> -- simply mailbox recording
> -- parameters:
> -- mailbox, sender, message
> mailbox = argv[1];
> from_box = argv[2];
> msg_file = argv[3];
> snd = "/usr/local/freeswitch/sounds/**dorf";
> file, errMsg = io.open( mailbox, "r" );
> if not file then
> session:streamFile("/usr/**local/freeswitch/sounds/dorf/**
> mailbox_not.alaw")
> session:execute("transfer","**dorf_now XML dorf_now");
> else
> freeswitch.consoleLog("info", "msg_file is: " .. msg_file .. "\n");
> session:execute("playback",**mailbox);
> session:streamFile("/usr/**local/freeswitch/sounds/ivr/**beep.alaw")
> session:execute("record","/**tmp/" .. msg_file .. " 180 200 3 ");
> session:execute("transfer","**dorf_send XML dorf_send");
> end
>
> I become the error:
> [ERR] mod_lua.cpp:198 /usr/local/freeswitch/scripts/**recordmsg.lua:13
> : attempt to concatenate global 'msg_file' (a nil value)M
>
>
> I have 3 arguments, only 2 arguments will be works.
> Can your help please?
> thanks.
>
>
--
Michael S Collins
Twitter: @mercutioviz
http://www.FreeSWITCH.org
http://www.ClueCon.com
http://www.OSTAG.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120731/186e6dc0/attachment-0001.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list