[Freeswitch-users] How to track call changes while running javascript?

Thomas lists at virtues.net
Sun Aug 2 23:24:02 MSD 2015


They both don't change/fire. :/ It's as if the JS blocks everything about that call until it terminates. The hangup does 
not even register in the Freeswitch log until after the script finishes. Tried it outside execute_on_originate with the 
normal javascript application in the XML dialplan - same effect. The whole process seems to be a single thread - which 
would make sense for most use cases, unfortunately just not this one. :P

Is there a way to fork the JS execution into the background? Something similar to setTimout() maybe? Or even better 
execute a dialplan app from JS that allows outside events to catch up? I tried the sleep application instead of JS 
msleep, but that didn't help either.

On 01.08.2015 22:05, Ken Rice wrote:
> You are looking for session ready or a hanguk up hook callback see confluence for details
>
> Sent from my iPhone
>
>> On Aug 1, 2015, at 3:53 PM, Thomas <lists at virtues.net> wrote:
>>
>> Does anyone know if there is a way to track changes to the call state, most notably a hangup, while executing
>> Javascript? We're using JS to set up a call on a device connected to Freeswitch through portaudio. That call is
>> initiated with sip/sofia executing the JS in the dialplan. If the SIP leg hangs up while the JS is running, nothing
>> happens until the JS terminates.
>>
>> I wanted to check from the script, but haven't found a way to do that. "session.state" doesn't change, hangup hook
>> doesn't fire, and without setTimeout or something similar I didn't find a way to "background" the JS.
>>
>> Is there any way to detect a hangup during JS execution?
>>
>> Cheers!
>>
>> Thomas
>>
>>
>> _________________________________________________________________________
>> 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




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