<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Hi Michael,<br>
    <br>
    a PHP script connect to Event socket and launch "luarun&nbsp; call.lua
    &lt;legA number&gt; &lt;legB number&gt; &lt;sip account number&gt;<br>
    <br>
    Script call.lua, upload sip account password from a DB and then call
    A number and B number using the same SIP account, bridging them.<br>
    What I'd like to do is:<br>
    <br>
    - place call to legB number only after legA has answered the call<br>
    - detect hangupCause on both legs to check if something goes wrong<br>
    - return SUCCESS or hangup cause to the PHP script <br>
    <br>
    Is it science fiction? With Asterisk isn't so hard to do and, since
    I'm in love with FS, please don't disappoint me :-)<br>
    <br>
    Chris B.<br>
    &nbsp;<br>
    <br>
    Il 13/09/2011 18:44, Michael Collins ha scritto:
    <blockquote
cite="mid:CAKzWOxW2Dwva26ZBdJ4gy9ChT6coGNsq8BJBvPFvWSG2kpK+BQ@mail.gmail.com"
      type="cite">How are you calling this Lua script to begin with?
      What is the big picture, that is, what is the problem you're
      solving? Some context might help us give you a better answer.
      <div><br>
      </div>
      <div>-MC<br>
        <br>
        <div class="gmail_quote">
          On Tue, Sep 13, 2011 at 5:21 AM, <span dir="ltr">&lt;<a
              moz-do-not-send="true"
              href="mailto:chrisbware@interfree.it">chrisbware@interfree.it</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">
            <span>Hi,</span><br>
            <span>&nbsp;</span><br>
            <span>thank you for your help, but doesn't work.</span><br>
            <span>legA:ready() is true when the first session start and
              not when the call is answered.</span><br>
            <span>So legB is called at the same time.</span><br>
            <span>&nbsp;</span><br>
            <span>Any other suggestion?</span><br>
            <span>&nbsp;</span><br>
            <span>&nbsp;</span><br>
            <span>&nbsp;</span><br>
            <span>&nbsp;</span><br>
            <span>-----Messaggio originale-----</span><br>
            <span>Da: Sergey Scheglov &lt;<a moz-do-not-send="true"
                href="mailto:sid@eltc.ru" target="_blank">sid@eltc.ru</a>&gt;</span><br>
            <span>Inviato il: 13 Set 2011 - 17:15</span><br>
            <span>A: <a moz-do-not-send="true"
                href="mailto:freeswitch-users@lists.freeswitch.org"
                target="_blank">freeswitch-users@lists.freeswitch.org</a></span>
            <div>
              <div class="h5"><br>
                <span><br>
                  <br>
                  ? 13 Sep 2011 09:39:33 -0000<br>
                  <a moz-do-not-send="true"
                    href="mailto:chrisbware@interfree.it"
                    target="_blank">chrisbware@interfree.it</a> wrote:<br>
                  <br>
                  &gt; <br>
                  &gt; Hi guys,<br>
                  &gt; <br>
                  &gt; I've read anything on this argument on Wiki but I
                  can't find a<br>
                  &gt; complete answer.<br>
                  &gt; <br>
                  &gt; I need to bridge two calls in Lua, waiting the
                  first to be answered.<br>
                  &gt; My basic script is:<br>
                  &gt; <br>
                  &gt; local GwParams =<br>
                  &gt;
"origination_caller_id_number="..gateway..",sip_auth_username="..gateway..",sip_auth_password="..sip_passwd<br>
                  &gt; local slegA =<br>
                  &gt;
"[ignore_early_media=false,"..GwParams.."]sofia/external/"..callee.."@"..sip_domain<br>
                  &gt; local slegB =<br>
                  &gt;
"[ignore_early_media=true,"..GwParams.."]sofia/external/"..called.."@"..sip_domain<br>
                  &gt; <br>
                  &gt; legA = freeswitch.Session(slegA);<br>
                  &gt; legB = freeswitch.Session(slegB);<br>
                  &gt; freeswitch.bridge(legA, legB);<br>
                  &gt; <br>
                  &gt; <br>
                  &gt; It works but legA and legB are called at the same
                  time. Using:<br>
                  &gt; <br>
                  &gt; while (legA:answered()== false) do end;<br>
                  &gt; <br>
                  &gt; between the two session do the job but called
                  parties can't hear<br>
                  &gt; audio.<br>
                  &gt; <br>
                  &gt; I promise to add a script on wiki if you help me
                  ! :)<br>
                  &gt; <br>
                  &gt; Thanks in advance.<br>
                  &gt; <br>
                  &gt; <br>
                  &gt;
-------------------------------------------------------------------------------<br>
                  &gt; Valore legale alle tue mail<br>
                  &gt; InterfreePEC - la tua Posta Elettronica
                  Certificata<br>
                  &gt; <a moz-do-not-send="true"
                    href="http://pec.interfree.it" target="_blank">http://pec.interfree.it</a><br>
                  &gt;
-------------------------------------------------------------------------------<br>
                  &gt; <br>
                  &gt; <br>
                  &gt; <br>
                  &gt; FreeSWITCH-users mailing list<br>
                  &gt; <a moz-do-not-send="true"
                    href="mailto:FreeSWITCH-users@lists.freeswitch.org"
                    target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
                  &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; 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; <a moz-do-not-send="true"
                    href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
                  &gt; <br>
                  <br>
                  Try:<br>
                  <br>
                  legA = freeswitch.Session(slegA);<br>
                  if (legA:ready()) then<br>
                  legB = freeswitch.Session(slegB, legA);<br>
                  freeswitch.bridge(legA, legB);<br>
                  end<br>
                  <br>
                  ----<br>
                  <br>
                  Scheglov Sergey<br>
                  <br>
                  <br>
                  FreeSWITCH-users mailing list<br>
                  <a moz-do-not-send="true"
                    href="mailto:FreeSWITCH-users@lists.freeswitch.org"
                    target="_blank">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></span><br>
                <br>
-------------------------------------------------------------------------------<br>
                Valore legale alle tue mail<br>
                InterfreePEC - la tua Posta Elettronica Certificata<br>
                <a moz-do-not-send="true" href="http://pec.interfree.it"
                  target="_blank">http://pec.interfree.it</a><br>
-------------------------------------------------------------------------------<br>
              </div>
            </div>
            <br>
            <br>
            FreeSWITCH-users mailing list<br>
            <a moz-do-not-send="true"
              href="mailto: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>
          </blockquote>
        </div>
        <br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>

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>