<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">What does "<font face="arial,
        helvetica, sans-serif">transfer doesn't work properly" means?<br>
        What happens, now, with the call after the lua script finish
        executing?<br>
        <br>
      </font>-------- Original Message --------<br>
      <b>Subject: </b>Re: [Freeswitch-users] Unbridge and send to queue<br>
      <b>From: </b>David Villasmil Govea
      <a class="moz-txt-link-rfc2396E" href="mailto:david.villasmil@gmail.com">&lt;david.villasmil@gmail.com&gt;</a><br>
      <b>To: </b>FreeSWITCH Users Help
      <a class="moz-txt-link-rfc2396E" href="mailto:freeswitch-users@lists.freeswitch.org">&lt;freeswitch-users@lists.freeswitch.org&gt;</a><br>
      <b>Date: </b>03.01.2015 20:57<br>
    </div>
    <blockquote
cite="mid:CAPTi0grR0CxvFoUQnM9Ai4Sixe4o9N-CPOdvfvKtiBb3KBQhuA@mail.gmail.com"
      type="cite">
      <p dir="ltr">Can anyone help with this?</p>
      <div class="gmail_quote">On Jan 2, 2015 4:51 PM, "David Villasmil
        Govea" &lt;<a moz-do-not-send="true"
          href="mailto:david.villasmil@gmail.com">david.villasmil@gmail.com</a>&gt;
        wrote:<br type="attribution">
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir="ltr">Hello,
            <div><br>
            </div>
            <div>Problem is transfer's not working from the lua, and I
              need to execute a lua script before sending the b-leg to
              the queue.&nbsp;</div>
            <div><br>
            </div>
            <div>The whole flow is the following:</div>
            <div><br>
            </div>
            <div>- Receive from A side</div>
            <div>- Launch a lua to get a destination number, and send
              the call to the B-side.</div>
            <div>- When the call is answered, I launch another lua which
              make a few checks and set a maximum call duration. Then it
              needs to send only the b-side to the queue.</div>
            <div><br>
            </div>
            <div><br>
            </div>
            <div>I do the following:</div>
            <div><br>
            </div>
            <div>
              <div><font face="monospace, monospace" size="1"><span
                    style="white-space:pre-wrap"> </span>&lt;extension
                  name="wholesale" continue="true"&gt;</font></div>
              <div><font face="monospace, monospace" size="1"><span
                    style="white-space:pre-wrap"> </span>&lt;condition
                  field="destination_number" expression="^.*$"&gt;</font></div>
              <div><font face="monospace, monospace" size="1"><span
                    style="white-space:pre-wrap"> </span>&lt;action
                  application="info"/&gt;</font></div>
              <div><span
style="font-family:monospace,monospace;font-size:x-small;white-space:pre-wrap">
                </span><span
                  style="font-family:monospace,monospace;font-size:x-small">&lt;action
                  application="set" data="inherit_codec=true"/&gt;</span><br>
              </div>
              <div><font face="monospace, monospace" size="1"><span
                    style="white-space:pre-wrap"> </span>&lt;action
                  application="set" data="continue_on_fail=true"/&gt;</font></div>
              <div><font face="monospace, monospace" size="1"><span
                    style="white-space:pre-wrap"> </span>&lt;action
                  application="set"
                  data="hangup_after_bridge=false"/&gt;</font></div>
              <div><font face="monospace, monospace" size="1"><span
                    style="white-space:pre-wrap"> </span>&lt;action
                  application="set" data="execute_on_answer=lua
                  /usr/local/freeswitch/scripts/check_answered.lua"/&gt;</font></div>
              <div><span
style="font-family:monospace,monospace;font-size:x-small;white-space:pre-wrap">
                </span><span
                  style="font-family:monospace,monospace;font-size:x-small">&lt;action
                  application="lua"
                  data="/usr/local/freeswitch/scripts/script.lua"/&gt;</span><br>
              </div>
              <div><font face="monospace, monospace" size="1"><span
                    style="white-space:pre-wrap"> </span>&lt;action
                  application="hangup" data="NORMAL_CLEARING"/&gt;</font></div>
              <div><font face="monospace, monospace" size="1"><span
                    style="white-space:pre-wrap"> </span>&lt;/condition&gt;</font></div>
              <div><font face="monospace, monospace" size="1"><span
                    style="white-space:pre-wrap"> </span>&lt;/extension&gt;</font></div>
              <div><font size="1"><br>
                </font></div>
            </div>
            <div><br>
            </div>
            <div>The luas work fine EXCEPT the transfer. which &nbsp;I
              execute like:</div>
            <div><br>
            </div>
            <div>
              <div><font face="monospace, monospace" size="1">session:execute("sched_hangup","+"
                  .. (my_dur/1000) &nbsp;.. " alloted_timeout");</font></div>
            </div>
            <div><font face="monospace, monospace" size="1">session:execute("transfer",
                "-bleg 9999 XML default");</font><br>
            </div>
            <div><font face="monospace, monospace" size="1"><br>
              </font></div>
            <div><font face="arial, helvetica, sans-serif">but the
                transfer doesn't work properly.</font></div>
            <div><font face="arial, helvetica, sans-serif">In my
                dialplan I have:</font></div>
            <div><font face="arial, helvetica, sans-serif" size="1"><br>
              </font></div>
            <div><font size="1">
                <div><font face="monospace, monospace"><span
                      style="white-space:pre-wrap"> </span>&lt;extension
                    name="9999"&gt;</font></div>
                <div><font face="monospace, monospace"><span
                      style="white-space:pre-wrap"> </span> &nbsp;&lt;action
                    application="log" data="INFO SENDING CALL TO QUEUE
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;"/&gt;</font></div>
                <div><font face="monospace, monospace"><span
                      style="white-space:pre-wrap"> </span> &nbsp;&lt;action
                    application="lua"
                    data="/usr/local/freeswitch/scripts/queue.lua"/&gt;</font></div>
                <div><font face="monospace, monospace"><span
                      style="white-space:pre-wrap"> </span> &nbsp;&lt;action
                    application="hangup" data="NORMAL_CLEARING"/&gt;</font></div>
                <div><font face="monospace, monospace"><span
                      style="white-space:pre-wrap"> </span>&lt;/extension&gt;</font></div>
                <div><font face="arial, helvetica, sans-serif"><br>
                  </font></div>
                <div><font face="arial, helvetica, sans-serif">Please
                    give me a hand with this&nbsp;</font></div>
                <div><font face="arial, helvetica, sans-serif"><br>
                  </font></div>
                <div><font face="arial, helvetica, sans-serif">David</font></div>
              </font></div>
          </div>
          <div class="gmail_extra"><br>
            <div class="gmail_quote">On Fri, Jan 2, 2015 at 2:06 AM,
              Michael Collins <span dir="ltr">&lt;<a
                  moz-do-not-send="true"
                  href="mailto:msc@freeswitch.org" target="_blank">msc@freeswitch.org</a>&gt;</span>
              wrote:<br>
              <blockquote class="gmail_quote" style="margin:0 0 0
                .8ex;border-left:1px #ccc solid;padding-left:1ex">
                <div dir="ltr">
                  <div>
                    <div>Can you try doing the execute_on_answer w/o the
                      Lua script? Reason I ask is the items you're
                      executing on the session aren't very special and
                      could simply be done with some dialplan XML. Try
                      doing an execute_extension in your
                      execute_on_answer and have that extension have the
                      sched_hangup, callcenter, and sleep apps. <br>
                      <br>
                    </div>
                    Sometimes adding a dp script (Lua, Perl, etc.) can
                    introduce unanticipated effects. A good rule of
                    thumb is that if you can do it just with XML
                    dialplan you probably should<i>.</i> At the very
                    least you should see what happens without the Lua
                    script involved.<span><font color="#888888"><br>
                        <br>
                      </font></span></div>
                  <span><font color="#888888">-Michael<br>
                    </font></span></div>
                <div>
                  <div>
                    <div class="gmail_extra"><br>
                      <div class="gmail_quote">On Wed, Dec 31, 2014 at
                        12:46 PM, David Villasmil Govea <span dir="ltr">&lt;<a
                            moz-do-not-send="true"
                            href="mailto:david.villasmil@gmail.com"
                            target="_blank">david.villasmil@gmail.com</a>&gt;</span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0
                          0 0 .8ex;border-left:1px #ccc
                          solid;padding-left:1ex">
                          <div dir="ltr">Hello,
                            <div><br>
                            </div>
                            <div>I don't think that would work, I need
                              to launch a lua script before transferring
                              the B-leg.</div>
                            <div><br>
                            </div>
                            <div>I need to transfer it from the lua
                              script, but&nbsp;</div>
                            <span>
                              <div><br>
                              </div>
                              <div>session:execute("transfer", "-bleg
                                9999 XML default");<br>
                              </div>
                              <div><br>
                              </div>
                            </span>
                            <div>Doesn't work...</div>
                          </div>
                          <div class="gmail_extra"><br>
                            <div class="gmail_quote">
                              <div>
                                <div>On Wed, Dec 31, 2014 at 9:13 PM,
                                  Andrew <span dir="ltr">&lt;<a
                                      moz-do-not-send="true"
                                      href="mailto:aademattia@comcast.net"
                                      target="_blank">aademattia@comcast.net</a>&gt;</span>
                                  wrote:<br>
                                </div>
                              </div>
                              <blockquote class="gmail_quote"
                                style="margin:0 0 0 .8ex;border-left:1px
                                #ccc solid;padding-left:1ex">
                                <div>
                                  <div>
                                    <div link="blue" vlink="purple"
                                      lang="EN-US">
                                      <div>
                                        <p class="MsoNormal"><span
                                            style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">Maybe
                                            you can set leg b </span><span
style="font-size:9.5pt;font-family:Consolas;background:white">transfer_after_bridge</span><span
style="font-size:9.5pt;font-family:Consolas"> and hang up on leg a.</span></p>
                                        <p class="MsoNormal"><span
                                            style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">&nbsp;</span></p>
                                        <p class="MsoNormal"><a
                                            moz-do-not-send="true"
name="14aaca234a0b5f00_14aa82efcc92b471_14aa21c75f80c177_14aa1fcc62efb90a__MailEndCompose"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">&nbsp;</span></a></p>
                                        <p class="MsoNormal"><b><span
                                              style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> <a
                                              moz-do-not-send="true"
                                              href="mailto:freeswitch-users-bounces@lists.freeswitch.org"
                                              target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>
                                            [mailto:<a
                                              moz-do-not-send="true"
                                              href="mailto:freeswitch-users-bounces@lists.freeswitch.org"
                                              target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>]
                                            <b>On Behalf Of </b>David
                                            Villasmil Govea<br>
                                            <b>Sent:</b> Wednesday,
                                            December 31, 2014 2:41 PM<br>
                                            <b>To:</b> FreeSWITCH Users
                                            Help<br>
                                            <b>Subject:</b> Re:
                                            [Freeswitch-users] Unbridge
                                            and send to queue</span></p>
                                        <div>
                                          <div>
                                            <p class="MsoNormal">&nbsp;</p>
                                            <div>
                                              <p class="MsoNormal">can
                                                anyone help me out with
                                                this?</p>
                                            </div>
                                            <div>
                                              <p class="MsoNormal">&nbsp;</p>
                                              <div>
                                                <p class="MsoNormal">On
                                                  Tue, Dec 23, 2014 at
                                                  5:48 PM, David
                                                  Villasmil Govea &lt;<a
moz-do-not-send="true" href="mailto:david.villasmil@gmail.com"
                                                    target="_blank">david.villasmil@gmail.com</a>&gt;
                                                  wrote:</p>
                                                <blockquote
                                                  style="border:none;border-left:solid
                                                  #cccccc
                                                  1.0pt;padding:0in 0in
                                                  0in
                                                  6.0pt;margin-left:4.8pt;margin-right:0in">
                                                  <p>Hello Guys,</p>
                                                  <p>I receive a call
                                                    from side A and send
                                                    it out to side B.<br>
                                                    I need to unbridge
                                                    this call once it is
                                                    answered and send
                                                    the B side to a
                                                    queue to give it
                                                    moh. How do I do
                                                    that?</p>
                                                  <p>I'm doing
                                                    everything with lua
                                                    and I've tried:</p>
                                                  <p>on my dialplan I
                                                    have:</p>
                                                  <p>&nbsp;&nbsp;&nbsp; &lt;action
                                                    application="set"
                                                    data="execute_on_answer=lua
/usr/local/freeswitch/scripts/check_answered.lua"/&gt;</p>
                                                  <p>in
                                                    check_answered-lua,
                                                    after checking the
                                                    call was in fact
                                                    answered I do:</p>
                                                  <p>&nbsp;&nbsp;&nbsp;
                                                    session:execute("transfer",
                                                    "-bleg 9999 XML
                                                    default");</p>
                                                  <p>and on my dialplan
                                                    I have:</p>
                                                  <p>&lt;extension
                                                    name="9999"&gt;<br>
                                                    &nbsp; &lt;action
                                                    application="log"
                                                    data="INFO SENDING
                                                    CALL TO QUEUE
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;"/&gt;<br>
                                                    &nbsp; &lt;action
                                                    application="lua"
                                                    data="/usr/local/freeswitch/scripts/queue.lua"/&gt;<br>
                                                    &nbsp; &lt;action
                                                    application="hangup"
data="NORMAL_CLEARING"/&gt;<br>
                                                    &lt;/extension&gt;</p>
                                                  <p>queue.lua:</p>
                                                  <p>session:execute("sched_hangup","+50
                                                    alloted_timeout");<br>
session:execute("callcenter","agents_queue");</p>
                                                  <p>session:execute("sleep",my_dur);</p>
                                                  <p>But this doesn't
                                                    seem to work at
                                                    all...</p>
                                                  <p>Can anyone give me
                                                    a hand? thanks!</p>
                                                  <p><span
                                                      style="color:#888888">--
                                                      <br>
                                                      DVG</span></p>
                                                </blockquote>
                                              </div>
                                              <p class="MsoNormal"><br>
                                                <br clear="all">
                                              </p>
                                              <div>
                                                <p class="MsoNormal">&nbsp;</p>
                                              </div>
                                              <p class="MsoNormal">-- </p>
                                              <div>
                                                <p class="MsoNormal">DVG<br>
                                                  <br>
                                                  -- <br>
                                                  Imagination is more
                                                  important than
                                                  knowledge<br>
                                                  Albert Einstein</p>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                    <br>
                                  </div>
                                </div>
_________________________________________________________________________<br>
                                Professional FreeSWITCH Consulting
                                Services:<br>
                                <a moz-do-not-send="true"
                                  href="mailto:consulting@freeswitch.org"
                                  target="_blank">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="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><br>
                              </blockquote>
                            </div>
                            <span><br>
                              <br clear="all">
                              <div><br>
                              </div>
                              -- <br>
                              <div>DVG<br>
                                <br>
                                -- <br>
                                Imagination is more important than
                                knowledge<br>
                                Albert Einstein</div>
                            </span></div>
                          <br>
_________________________________________________________________________<br>
                          Professional FreeSWITCH Consulting Services:<br>
                          <a moz-do-not-send="true"
                            href="mailto:consulting@freeswitch.org"
                            target="_blank">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="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><br>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                  </div>
                </div>
                <br>
_________________________________________________________________________<br>
                Professional FreeSWITCH Consulting Services:<br>
                <a moz-do-not-send="true"
                  href="mailto:consulting@freeswitch.org"
                  target="_blank">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="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><br>
              </blockquote>
            </div>
            <br>
            <br clear="all">
            <div><br>
            </div>
            -- <br>
            <div>DVG<br>
              <br>
              -- <br>
              Imagination is more important than knowledge<br>
              Albert Einstein</div>
          </div>
        </blockquote>
      </div>
      <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>