[Freeswitch-users] Need help with lua called from dial plan - How to delimit arguments?

Dušan Dragić dragic.dusan at gmail.com
Sun May 31 02:41:06 MSD 2015


Use single quotes (but Giovanni's suggestion is the way to go).

On 30 May 2015 at 22:21, Jim Lynch <jim at k4gvo.com> wrote:
> I have a line in my dialplan that looks like this:
>      <action application="lua" data="cid.lua  ${caller_id_name}
> ${caller_id_number}" />
>
> However when the program is executed and the caller_id_name has a space
> in it, the number gets lost.
> I can't figure out a way to add delimiters that get passed to the
> shell.  None of these work:
>
>      <action application="lua" data="cid.lua \"${caller_id_name}\"
> \"${caller_id_number}\"" />
> or
>      <action application="lua" data="cid.lua ''${caller_id_name}''
> ''${caller_id_number}''" />
> or
>      <action application="lua" data="cid.lua \"\"${caller_id_name}\"\"
> \"\"${caller_id_number}\"\"" />
>
> None of those work.  The quotes are all stripped off when running this test
>
> lua file:
> tmp_file = "/tmp/cidtest.txt";
> local file = assert(io.open(tmp_file, "a"));
> local m_name=argv[1];
> local m_number=argv[2];
> file:write("j cid is ",m_name," number is ",m_number,"\n");
>
> Any suggestions?
>
> Thanks,
> Jim.
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.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



-- 
Dušan Dragić



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