[Freeswitch-users] lua script unable to stop moh

Giovanni Maruzzelli gmaruzz at gmail.com
Fri Feb 13 12:31:51 MSK 2015


>From lua, you better do (eg: no need for "session"):

api = freeswitch.API();
uuid = argv[1]


uuid_break_cmd = "uuid_break ".. uuid .. " all";
uuid_hold_cmd  = "uuid_hold off" .. uuid;

freeswitch.consoleLog("notice","uuid break cmd: ".. uuid_break_cmd .. "\n");

api:execute("break","all");
api:execute(uuid_break_cmd);

reply = api:execute(uuid_break_cmd);

freeswitch.consoleLog("notice", "After uuid_break.\n");


On Fri, Feb 13, 2015 at 10:05 AM, Борисов, Дмитрий / Dmitriy Borisov <
bordmi at rarus.ru> wrote:

>
> https://freeswitch.org/confluence/display/FREESWITCH/Lua+API+Reference#LuaAPIReference-freeswitch.Session
> :
> freeswitch.Session
>
> Create a new session.
> local session = freeswitch.Session("sofia/10.0.1.100/1001");
> session:transfer("3000", "XML", "default");
> What you want to do with lua script?
>
>
> 2015-02-13 10:54 GMT+03:00 CT Radu <ct.radu.001 at gmail.com>:
>
>> Anyone with mod_lua knowledge around here ?
>>
>> Thanks,
>> Costin
>>
>> 2015-02-11 11:57 GMT+02:00 CT Radu <ct.radu.001 at gmail.com>:
>>
>>> Hi all,
>>>
>>> I have the following problem:
>>> I have an dialplan rule in freeswitch that delegates the control for the
>>> incoming call on a specific number to an erlang application.
>>> This erlang application, at one point executes a lua script using the
>>> call:
>>> {api, luarun, "luascript.lua uuid"}
>>>
>>> In lua I do the following:
>>> api = freeswitch.API();
>>> session = freeswitch.session(argv[1]);
>>>
>>> uuid = session:get_uuid();
>>>
>>> if session:ready() then
>>>    uuid_break_cmd = "uuid_break ".. uuid .. " all";
>>>    uuid_hold_cmd  = "uuid_hold off" .. uuid;
>>>    freeswitch.consoleLog("notice","uuid break cmd: ".. uuid_break_cmd ..
>>> "\n");
>>>    session:execute("break","all");
>>>    api:executeString(uuid_break_cmd);
>>>    reply = api:executeString(uuid_break_cmd);
>>>
>>>    freeswitch.consoleLog("notice", "After uuid_break.\n");
>>> end
>>>
>>> The thing is that freeswitch ignores completly uuid_break and uuid_hold
>>> off
>>> The same command issued via fs_cli has effect.
>>>
>>> In fs_cli on debug I can see this:
>>> 2015-02-10 20:23:51.405153 [NOTICE] switch_cpp.cpp:1328 uuid break cmd:
>>> uuid_break f36d5e5c-b151-11e4-9674-8f19f7458942 all
>>> EXECUTE sofia/ctradu-dev.ezuce.ro/1002 at ctradu-dev.ezuce.ro break(all)
>>> 2015-02-10 20:23:51.405153 [DEBUG] mod_erlang_event.c:169 Ignoring event
>>> CHANNEL_EXECUTE for attached session f36d5e5c-b151-11e4-9674-8f19f7458942
>>> 2015-02-10 20:23:51.405153 [DEBUG] mod_erlang_event.c:169 Ignoring event
>>> CHANNEL_EXECUTE_COMPLETE for attached session
>>> f36d5e5c-b151-11e4-9674-8f19f7458942
>>> 2015-02-10 20:23:51.405153 [NOTICE] switch_cpp.cpp:1328 After uuid_break.
>>>
>>> Does anyone know why uuid_break has no effect executed from a script
>>> launched via api luarun ?
>>> (And the same command when issued via fs_cli has effect)
>>>
>>> The freeswitch version is 1.4.15~64bit
>>>
>>> Thank you,
>>> Costin
>>>
>>>
>>>
>>>
>>
>> _________________________________________________________________________
>> 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
>
>
> _________________________________________________________________________
> 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
>



-- 
Sincerely,

Giovanni Maruzzelli
Cell : +39-347-2665618
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20150213/3fd8a5c5/attachment-0001.html 


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