<div dir="ltr">Hello,<div><br></div><div>Problem is transfer&#39;s not working from the lua, and I need to execute a lua script before sending the b-leg to the queue. </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 class="" style="white-space:pre">        </span>&lt;extension name=&quot;wholesale&quot; continue=&quot;true&quot;&gt;</font></div><div><font face="monospace, monospace" size="1"><span class="" style="white-space:pre">                </span>&lt;condition field=&quot;destination_number&quot; expression=&quot;^.*$&quot;&gt;</font></div><div><font face="monospace, monospace" size="1"><span class="" style="white-space:pre">                        </span>&lt;action application=&quot;info&quot;/&gt;</font></div><div><span class="" style="font-family:monospace,monospace;font-size:x-small;white-space:pre">                        </span><span style="font-family:monospace,monospace;font-size:x-small">&lt;action application=&quot;set&quot; data=&quot;inherit_codec=true&quot;/&gt;</span><br></div><div><font face="monospace, monospace" size="1"><span class="" style="white-space:pre">                        </span>&lt;action application=&quot;set&quot; data=&quot;continue_on_fail=true&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1"><span class="" style="white-space:pre">                        </span>&lt;action application=&quot;set&quot; data=&quot;hangup_after_bridge=false&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1"><span class="" style="white-space:pre">                        </span>&lt;action application=&quot;set&quot; data=&quot;execute_on_answer=lua /usr/local/freeswitch/scripts/check_answered.lua&quot;/&gt;</font></div><div><span class="" style="font-family:monospace,monospace;font-size:x-small;white-space:pre">                        </span><span style="font-family:monospace,monospace;font-size:x-small">&lt;action application=&quot;lua&quot; data=&quot;/usr/local/freeswitch/scripts/script.lua&quot;/&gt;</span><br></div><div><font face="monospace, monospace" size="1"><span class="" style="white-space:pre">                        </span>&lt;action application=&quot;hangup&quot; data=&quot;NORMAL_CLEARING&quot;/&gt;</font></div><div><font face="monospace, monospace" size="1"><span class="" style="white-space:pre">                </span>&lt;/condition&gt;</font></div><div><font face="monospace, monospace" size="1"><span class="" style="white-space:pre">        </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  I execute like:</div><div><br></div><div><div><font face="monospace, monospace" size="1">session:execute(&quot;sched_hangup&quot;,&quot;+&quot; .. (my_dur/1000)  .. &quot; alloted_timeout&quot;);</font></div></div><div><font face="monospace, monospace" size="1">session:execute(&quot;transfer&quot;, &quot;-bleg 9999 XML default&quot;);</font><br></div><div><font face="monospace, monospace" size="1"><br></font></div><div><font face="arial, helvetica, sans-serif">but the transfer doesn&#39;t work properly.</font></div><div><font face="arial, helvetica, sans-serif">In my dialplan I have:</font></div><div><font size="1" face="arial, helvetica, sans-serif"><br></font></div><div><font size="1"><div><font face="monospace, monospace"><span class="" style="white-space:pre">        </span>&lt;extension name=&quot;9999&quot;&gt;</font></div><div><font face="monospace, monospace"><span class="" style="white-space:pre">        </span>  &lt;action application=&quot;log&quot; data=&quot;INFO SENDING CALL TO QUEUE &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&quot;/&gt;</font></div><div><font face="monospace, monospace"><span class="" style="white-space:pre">        </span>  &lt;action application=&quot;lua&quot; data=&quot;/usr/local/freeswitch/scripts/queue.lua&quot;/&gt;</font></div><div><font face="monospace, monospace"><span class="" style="white-space:pre">        </span>  &lt;action application=&quot;hangup&quot; data=&quot;NORMAL_CLEARING&quot;/&gt;</font></div><div><font face="monospace, monospace"><span class="" style="white-space:pre">        </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 </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 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&#39;re executing on the session aren&#39;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 class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888">-Michael<br></font></span></div><div class="HOEnZb"><div class="h5"><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 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&#39;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 </div><span><div><br></div><div>session:execute(&quot;transfer&quot;, &quot;-bleg 9999 XML default&quot;);<br></div><div><br></div></span><div>Doesn&#39;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 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.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"><u></u> <u></u></span></p><p class="MsoNormal"><a name="14aa82efcc92b471_14aa21c75f80c177_14aa1fcc62efb90a__MailEndCompose"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> <u></u></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 href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a 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<u></u><u></u></span></p><div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">can anyone help me out with this?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Tue, Dec 23, 2014 at 5:48 PM, David Villasmil Govea &lt;<a href="mailto:david.villasmil@gmail.com" target="_blank">david.villasmil@gmail.com</a>&gt; wrote:<u></u><u></u></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,<u></u><u></u></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?<u></u><u></u></p><p>I&#39;m doing everything with lua and I&#39;ve tried:<u></u><u></u></p><p>on my dialplan I have:<u></u><u></u></p><p>    &lt;action application=&quot;set&quot; data=&quot;execute_on_answer=lua /usr/local/freeswitch/scripts/check_answered.lua&quot;/&gt;<u></u><u></u></p><p>in check_answered-lua, after checking the call was in fact answered I do:<u></u><u></u></p><p>    session:execute(&quot;transfer&quot;, &quot;-bleg 9999 XML default&quot;);<u></u><u></u></p><p>and on my dialplan I have:<u></u><u></u></p><p>&lt;extension name=&quot;9999&quot;&gt;<br>  &lt;action application=&quot;log&quot; data=&quot;INFO SENDING CALL TO QUEUE &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&quot;/&gt;<br>  &lt;action application=&quot;lua&quot; data=&quot;/usr/local/freeswitch/scripts/queue.lua&quot;/&gt;<br>  &lt;action application=&quot;hangup&quot; data=&quot;NORMAL_CLEARING&quot;/&gt;<br>&lt;/extension&gt;<u></u><u></u></p><p>queue.lua:<u></u><u></u></p><p>session:execute(&quot;sched_hangup&quot;,&quot;+50 alloted_timeout&quot;);<br>session:execute(&quot;callcenter&quot;,&quot;agents_queue&quot;);<u></u><u></u></p><p>session:execute(&quot;sleep&quot;,my_dur);<u></u><u></u></p><p>But this doesn&#39;t seem to work at all...<u></u><u></u></p><p>Can anyone give me a hand? thanks!<u></u><u></u></p><p><span style="color:#888888">-- <br>DVG<u></u><u></u></span></p></blockquote></div><p class="MsoNormal"><br><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- <u></u><u></u></p><div><p class="MsoNormal">DVG<br><br>-- <br>Imagination is more important than knowledge<br>Albert Einstein<u></u><u></u></p></div></div></div></div></div></div><br></div></div>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a 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 href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a 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 href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">DVG<br><br>-- <br>Imagination is more important than knowledge<br>Albert Einstein</div>
</div>