<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Answering my own question for the
record and the search engines:<br>
<br>
Prequesites were:<br>
- Block call progress during ringing until Javascript finishes<br>
- Be able to register and act upon hangups from the a-leg<br>
- Script should only execute once, not a second time for the b-leg<br>
<br>
These things seem to vary between the different execute_* options.
The one that does exactly what we needed was
execute_on_pre_answer. That will run only once on the a-leg, will
not proceed until JS terminates, and enables both hangupHook and
session.ready.<br>
<br>
<br>
On 05.08.2015 14:56, Thomas wrote:<br>
</div>
<blockquote cite="mid:55C24E58.7030705@virtues.net" type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<div class="moz-cite-prefix">It looks like the problem is the JS
running before the call gets bridged. Is there any way to
register a hangup in JS before bridging?<br>
<br>
Since that JS is part of the call setup, it has to run before
the bridge. :/<br>
<br>
On 04.08.2015 11:49, Thomas wrote:<br>
</div>
<blockquote cite="mid:55C0D109.7080608@virtues.net" type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<div class="moz-cite-prefix">It's regular JS sleeps blocking,
but I tried the sleep dialplan app (from JS), too - same
thing. I tried session.ready but it does not change if the SIP
leg hangs up. The whole process establishes the call, so it
terminates once that is done, it's the actual dialing process
through a socket on another device. But the socket isn't
blocking. That was my first guess and I worked around it. <br>
<br>
<br>
On 02.08.2015 18:11, Michael Jerris wrote:<br>
</div>
<blockquote
cite="mid:CAEwTsAjY6a5+yBaY0xM5kkwbAYXY5-nAhFaRMO4HoH6+AG9eqA@mail.gmail.com"
type="cite">what is it blocking on in the js? are you using
session.ready?<span></span><br>
<br>
On Sunday, August 2, 2015, Thomas <<a
moz-do-not-send="true" href="mailto:lists@virtues.net"><a class="moz-txt-link-abbreviated" href="mailto:lists@virtues.net">lists@virtues.net</a></a>>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">They both
don't change/fire. :/ It's as if the JS blocks everything
about that call until it terminates. The hangup does<br>
not even register in the Freeswitch log until after the
script finishes. Tried it outside execute_on_originate with
the<br>
normal javascript application in the XML dialplan - same
effect. The whole process seems to be a single thread -
which<br>
would make sense for most use cases, unfortunately just not
this one. :P<br>
<br>
Is there a way to fork the JS execution into the background?
Something similar to setTimout() maybe? Or even better<br>
execute a dialplan app from JS that allows outside events to
catch up? I tried the sleep application instead of JS<br>
msleep, but that didn't help either.<br>
<br>
On 01.08.2015 22:05, Ken Rice wrote:<br>
> You are looking for session ready or a hanguk up hook
callback see confluence for details<br>
><br>
> Sent from my iPhone<br>
><br>
>> On Aug 1, 2015, at 3:53 PM, Thomas <<a
moz-do-not-send="true" class="moz-txt-link-abbreviated"
href="mailto:lists@virtues.net"><a class="moz-txt-link-abbreviated" href="mailto:lists@virtues.net">lists@virtues.net</a></a>>
wrote:<br>
>><br>
>> Does anyone know if there is a way to track changes
to the call state, most notably a hangup, while executing<br>
>> Javascript? We're using JS to set up a call on a
device connected to Freeswitch through portaudio. That call
is<br>
>> initiated with sip/sofia executing the JS in the
dialplan. If the SIP leg hangs up while the JS is running,
nothing<br>
>> happens until the JS terminates.<br>
>><br>
>> I wanted to check from the script, but haven't
found a way to do that. "session.state" doesn't change,
hangup hook<br>
>> doesn't fire, and without setTimeout or something
similar I didn't find a way to "background" the JS.<br>
>><br>
>> Is there any way to detect a hangup during JS
execution?<br>
>><br>
>> Cheers!<br>
>><br>
>> Thomas<br>
>><br>
>><br>
>>
_________________________________________________________________________<br>
>> Professional FreeSWITCH Consulting Services:<br>
>> <a moz-do-not-send="true" href="javascript:;"
onclick="_e(event, 'cvml', 'consulting@freeswitch.org')">consulting@freeswitch.org</a><br>
>> <a moz-do-not-send="true"
href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
>><br>
>> Official FreeSWITCH Sites<br>
>> <a moz-do-not-send="true"
href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
>> <a moz-do-not-send="true"
href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
>> <a moz-do-not-send="true"
href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
>><br>
>> FreeSWITCH-users mailing list<br>
>> <a moz-do-not-send="true" href="javascript:;"
onclick="_e(event, 'cvml',
'FreeSWITCH-users@lists.freeswitch.org')">FreeSWITCH-users@lists.freeswitch.org</a><br>
>> <a moz-do-not-send="true"
href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users"
target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
>> UNSUBSCRIBE:<a moz-do-not-send="true"
href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
>> <a moz-do-not-send="true"
href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a moz-do-not-send="true" href="javascript:;"
onclick="_e(event, 'cvml', 'consulting@freeswitch.org')">consulting@freeswitch.org</a><br>
<a moz-do-not-send="true"
href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a moz-do-not-send="true" href="http://www.freeswitch.org"
target="_blank">http://www.freeswitch.org</a><br>
<a moz-do-not-send="true"
href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
<a moz-do-not-send="true" href="http://www.cluecon.com"
target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a moz-do-not-send="true" href="javascript:;"
onclick="_e(event, 'cvml',
'FreeSWITCH-users@lists.freeswitch.org')">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a moz-do-not-send="true"
href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users"
target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a moz-do-not-send="true"
href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a moz-do-not-send="true" href="http://www.freeswitch.org"
target="_blank">http://www.freeswitch.org</a><br>
</blockquote>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a>
Official FreeSWITCH Sites
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://confluence.freeswitch.org">http://confluence.freeswitch.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.cluecon.com">http://www.cluecon.com</a>
FreeSWITCH-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a></pre>
</blockquote>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a>
Official FreeSWITCH Sites
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://confluence.freeswitch.org">http://confluence.freeswitch.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.cluecon.com">http://www.cluecon.com</a>
FreeSWITCH-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a></pre>
</blockquote>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a class="moz-txt-link-abbreviated" href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a>
Official FreeSWITCH Sites
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://confluence.freeswitch.org">http://confluence.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.cluecon.com">http://www.cluecon.com</a>
FreeSWITCH-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a></pre>
</blockquote>
<br>
</body>
</html>