<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <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 &lt;<a moz-do-not-send="true"
          href="mailto:lists@virtues.net">lists@virtues.net</a>&gt;
        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>
          &gt; You are looking for session ready or a hanguk up hook
          callback see confluence for details<br>
          &gt;<br>
          &gt; Sent from my iPhone<br>
          &gt;<br>
          &gt;&gt; On Aug 1, 2015, at 3:53 PM, Thomas &lt;<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>&gt;
          wrote:<br>
          &gt;&gt;<br>
          &gt;&gt; Does anyone know if there is a way to track changes
          to the call state, most notably a hangup, while executing<br>
          &gt;&gt; Javascript? We're using JS to set up a call on a
          device connected to Freeswitch through portaudio. That call is<br>
          &gt;&gt; initiated with sip/sofia executing the JS in the
          dialplan. If the SIP leg hangs up while the JS is running,
          nothing<br>
          &gt;&gt; happens until the JS terminates.<br>
          &gt;&gt;<br>
          &gt;&gt; I wanted to check from the script, but haven't found
          a way to do that. "session.state" doesn't change, hangup hook<br>
          &gt;&gt; doesn't fire, and without setTimeout or something
          similar I didn't find a way to "background" the JS.<br>
          &gt;&gt;<br>
          &gt;&gt; Is there any way to detect a hangup during JS
          execution?<br>
          &gt;&gt;<br>
          &gt;&gt; Cheers!<br>
          &gt;&gt;<br>
          &gt;&gt; Thomas<br>
          &gt;&gt;<br>
          &gt;&gt;<br>
          &gt;&gt;
_________________________________________________________________________<br>
          &gt;&gt; Professional FreeSWITCH Consulting Services:<br>
          &gt;&gt; <a moz-do-not-send="true" href="javascript:;"
            onclick="_e(event, 'cvml', 'consulting@freeswitch.org')">consulting@freeswitch.org</a><br>
          &gt;&gt; <a moz-do-not-send="true"
            href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
          &gt;&gt;<br>
          &gt;&gt; Official FreeSWITCH Sites<br>
          &gt;&gt; <a moz-do-not-send="true"
            href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
          &gt;&gt; <a moz-do-not-send="true"
            href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
          &gt;&gt; <a moz-do-not-send="true"
            href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
          &gt;&gt;<br>
          &gt;&gt; FreeSWITCH-users mailing list<br>
          &gt;&gt; <a moz-do-not-send="true" href="javascript:;"
            onclick="_e(event, 'cvml',
            'FreeSWITCH-users@lists.freeswitch.org')">FreeSWITCH-users@lists.freeswitch.org</a><br>
          &gt;&gt; <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>
          &gt;&gt; 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>
          &gt;&gt; <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 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>