[Freeswitch-users] Dialplan - Lua in-line expansion

Phillip Jones pjintheusa at gmail.com
Fri Dec 12 18:44:09 MSK 2014


Perfect - thanks very much.

On Fri, Dec 12, 2014 at 3:52 AM, Борисов, Дмитрий <bordmi at rarus.ru> wrote:
>
> Oh, sorry, not *io.write(result)* but *stream:write(result)*
>
> 2014-12-12 9:59 GMT+03:00 Борисов, Дмитрий <bordmi at rarus.ru>:
>
>> change
>> return result
>> to
>> io.write(result)
>>
>> 2014-12-12 0:32 GMT+03:00 Phillip Jones <pjintheusa at gmail.com>:
>>
>>> Yeah - thanks - I realize I can do that - but it just drives me crazy I
>>> can not get in-line expansion to work. I can't see what I am missing.
>>>
>>> On Thu, Dec 11, 2014 at 3:46 PM, Chad Phillips <chad at apartmentlines.com>
>>> wrote:
>>>
>>>>  how about setting the channel var directly in the script?
>>>>
>>>> session:setVariable("VUM_SAY_CID", result);
>>>>
>>>> although for what you’re doing, i really think there’s a cleaner way to
>>>> do it straight from the dialplan XML...
>>>>
>>>> On Thursday, December 11, 2014 at 1:35 PM, Phillip Jones wrote:
>>>>
>>>> I am going crazy - please tell me what I am missing:
>>>>
>>>> I have a dialplan:
>>>>
>>>> <action application="set" data="VUM_SAY_CID=${lua(util_get10digits.lua
>>>> ${VUM_Outgoing_CallerID_Number})}" inline="true"/>
>>>>
>>>>
>>>> I have a lua script:
>>>>
>>>>
>>>> freeswitch.consoleLog("NOTICE","util_get10digits.lua \n")
>>>> freeswitch.consoleLog("NOTICE","Argument passed [" .. argv[1] .."]\n")
>>>> local result = "none"
>>>> *result = string.sub(argv[1], -10)*
>>>> freeswitch.consoleLog("NOTICE", "Result: [" .. result .."]\n")
>>>> *return result*
>>>>
>>>>
>>>> I run the dialplan:
>>>>
>>>> Dialplan: sofia/Carrier/2154791697 at 64.158.162.74 Action
>>>> set(VUM_SAY_CID=${lua(util_get10digits.lua
>>>> ${VUM_Outgoing_CallerID_Number})}) I
>>>> 2014-12-11 15:20:21.795274 [NOTICE] switch_cpp.cpp:1328
>>>> util_get10digits.lua
>>>> 2014-12-11 15:20:21.795274 [NOTICE] switch_cpp.cpp:1328 Argument passed
>>>> [+12154791697]
>>>> *2014-12-11 15:20:21.795274 [NOTICE] switch_cpp.cpp:1328 Result:
>>>> [2154791697 <%5B2154791697>]*
>>>> 2014-12-11 15:20:21.795274 [DEBUG] switch_cpp.cpp:1075 sofia/Carrier/
>>>> 2154791697 at 64.158.162.74 destroy/unlink session from object
>>>> EXECUTE sofia/Carrier/2154791697 at 64.158.162.74 set(VUM_SAY_CID=)
>>>> *2014-12-11 15:20:21.795274 [DEBUG] mod_dptools.c:1435
>>>> sofia/Carrier/2154791697 at 64.158.162.74 <2154791697 at 64.158.162.74> SET
>>>> [VUM_SAY_CID]=[UNDEF]*
>>>>
>>>>
>>>> The lua script runs correctly - how ever the result is not returned the
>>>> VUM_SAY_CID variable in the dialplan
>>>>
>>>>
>>>> The work around is to set the session variable in the script. But I
>>>> wondering what I am missing. Is "return result" not how you return a result
>>>> from Lua?
>>>>
>>>>
>>>> Thanks for any help.
>>>>
>>>>
>>>> Phil
>>>>
>>>> _________________________________________________________________________
>>>> 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
>>>>
>>>>
>>>>
>>>>
>>>> _________________________________________________________________________
>>>> 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
>>>>
>>>
>>>
>>> _________________________________________________________________________
>>> 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
>>>
>>
>>
>>
>> --
>> with best regards,
>> Dmitriy Borisov
>>
>
>
>
> --
> with best regards,
> Dmitriy Borisov
>
> _________________________________________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20141212/ca63a0c6/attachment-0001.html 


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