<div dir="ltr"><div>Tim,</div><div><br></div><div>Based on your description, I would guess that the B-Leg hangs up when they answer after the a-leg is gone??</div><div><br></div><div>/b</div><div><br></div><div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 26, 2021 at 12:42 PM Тимур Ситдиков <<a href="mailto:sitdikovt@gmail.com">sitdikovt@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all. Need help with a simple call script. <br>I'm got this in dialplan<div style="color:rgb(248,248,242);background-color:rgb(39,40,34);font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre-wrap"><div><<span style="color:rgb(249,38,114)">extension</span> <span style="color:rgb(166,226,46)">name</span>=<span style="color:rgb(230,219,116)">"call_lua_home"</span>> </div><div>      <<span style="color:rgb(249,38,114)">condition</span> <span style="color:rgb(166,226,46)">field</span>=<span style="color:rgb(230,219,116)">"destination_number"</span> <span style="color:rgb(166,226,46)">expression</span>=<span style="color:rgb(230,219,116)">"^(1007)$"</span>></div><div><div style="line-height:19px"><div>        <span style="color:rgb(136,132,111)"><!-- <action application="set" data="session_in_hangup_hook=true"/> --> For hangup hook try</span></div></div></div><div>        <<span style="color:rgb(249,38,114)">action</span> <span style="color:rgb(166,226,46)">application</span>=<span style="color:rgb(230,219,116)">"lua"</span> <span style="color:rgb(166,226,46)">data</span>=<span style="color:rgb(230,219,116)">"fork.lua"</span>/><br></div><div>      </<span style="color:rgb(249,38,114)">condition</span>></div><div></<span style="color:rgb(249,38,114)">extension</span>>    </div></div><div>And this in fork.lua</div><div style="color:rgb(248,248,242);background-color:rgb(39,40,34);font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span style="color:rgb(249,38,114)">if</span> session:<span style="color:rgb(102,217,239)">ready</span>() <span style="color:rgb(249,38,114)">then</span><br></div><div>api <span style="color:rgb(249,38,114)">=</span> freeswitch.<span style="color:rgb(102,217,239)">API</span>()</div><div>contact <span style="color:rgb(249,38,114)">=</span> api:<span style="color:rgb(102,217,239)">execute</span>(<span style="color:rgb(230,219,116)">"sofia_contact"</span>, <span style="color:rgb(230,219,116)">"*/1007@compA.com"</span>);</div><div>caller <span style="color:rgb(249,38,114)">=</span> session:<span style="color:rgb(102,217,239)">getVariable</span>(<span style="color:rgb(230,219,116)">"caller_id_number"</span>);</div></div><div style="color:rgb(248,248,242);background-color:rgb(39,40,34);font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre-wrap"><div>session1 <span style="color:rgb(249,38,114)">=</span> freeswitch.<span style="color:rgb(102,217,239)">Session</span>(<span style="color:rgb(230,219,116)">"{origination_caller_id_name="</span><span style="color:rgb(249,38,114)">..</span>caller<span style="color:rgb(249,38,114)">..</span><span style="color:rgb(230,219,116)">"}[leg_timeout=30]"</span><span style="color:rgb(249,38,114)">..</span>contact<span style="color:rgb(249,38,114)">..</span><span style="color:rgb(230,219,116)">""</span>);</div><div><span style="color:rgb(136,132,111)">-- session:setHangupHook("HangupHook");</span></div><div><span style="color:rgb(249,38,114)">if</span> session1:<span style="color:rgb(102,217,239)">ready</span>() <span style="color:rgb(249,38,114)">then</span></div><div>    freeswitch.<span style="color:rgb(102,217,239)">bridge</span>(session, session1);</div><div><span style="color:rgb(249,38,114)">end</span></div><div>freeswitch.<span style="color:rgb(102,217,239)">consoleLog</span>(<span style="color:rgb(230,219,116)">"WARNING"</span>,<span style="color:rgb(230,219,116)">"=====SCRIPT END</span><span style="color:rgb(174,129,255)">\n</span><span style="color:rgb(230,219,116)">"</span>);<br></div><div>session:<span style="color:rgb(102,217,239)">hangup</span>()</div><div><span style="color:rgb(249,38,114)">end</span><span style="background-color:rgb(255,255,255);font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)"> </span><br></div></div><div><br></div><div>When Caller is hanging up before B-leg answers - Bleg is continuing to ring. There are still 2 channels in 'show channels' after A-leg hangs up.<br>I want to drop B-leg when A-leg hangs up. Is it possible?</div><div><br></div><div>UPD Tried to use hangup hook. It works with stramFile, but no luck with session.</div><div><div style="color:rgb(248,248,242);background-color:rgb(39,40,34);font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span style="color:rgb(249,38,114)">function</span> <span style="color:rgb(166,226,46)">HangupHook</span>(<span style="color:rgb(253,151,31);font-style:italic">s</span>, <span style="color:rgb(253,151,31);font-style:italic">status</span>)</div><div>    freeswitch.<span style="color:rgb(102,217,239)">consoleLog</span>(<span style="color:rgb(230,219,116)">"WARNING"</span>,<span style="color:rgb(230,219,116)">"Event fired breaking out</span><span style="color:rgb(174,129,255)">\n</span><span style="color:rgb(230,219,116)">"</span>);</div><div>    <span style="color:rgb(249,38,114)">return</span> exit;</div><div>    <span style="color:rgb(136,132,111)">-- return die;</span></div><div><span style="color:rgb(249,38,114)">end</span></div><br><div>session:<span style="color:rgb(102,217,239)">answer</span>();</div><div>session:<span style="color:rgb(102,217,239)">setHangupHook</span>(<span style="color:rgb(230,219,116)">"HangupHook"</span>);<br></div><div><span style="color:rgb(249,38,114)">while</span> (session:<span style="color:rgb(102,217,239)">ready</span>() <span style="color:rgb(249,38,114)">==</span> <span style="color:rgb(174,129,255)">true</span>) <span style="color:rgb(249,38,114)">do</span><br></div><br><div>    session:<span style="color:rgb(102,217,239)">streamFile</span>(<span style="color:rgb(230,219,116)">"/usr/share/freeswitch/sounds/en/us/callie/ivr/16000/ivr-on_hold_indefinitely.wav"</span>);</div><div>    <span style="color:rgb(136,132,111)">-- session1 = freeswitch.Session("{origination_caller_id_name="..caller.."}[leg_timeout=30]"..contact.."");</span></div><div><span style="color:rgb(249,38,114)">end</span></div><div>freeswitch.<span style="color:rgb(102,217,239)">consoleLog</span>(<span style="color:rgb(230,219,116)">"WARNING"</span>,<span style="color:rgb(230,219,116)">"=====SCRIPT END</span><span style="color:rgb(174,129,255)">\n</span><span style="color:rgb(230,219,116)">"</span>);</div><div>session:<span style="color:rgb(102,217,239)">hangup</span>()</div><div><span style="color:rgb(249,38,114)">end</span></div></div></div><div><br></div><div>Can anyone help me with this?<br></div><div><br></div><div>Thanks! Regards,Tim</div></div>
_________________________________________________________________________<br>
<br>
The FreeSWITCH project is sponsored by SignalWire <a href="https://signalwire.com" rel="noreferrer" target="_blank">https://signalwire.com</a><br>
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.<br>
Build your next product on our scalable cloud platform.<br>
<br>
Join our online community to chat in real time <a href="https://signalwire.community" rel="noreferrer" target="_blank">https://signalwire.community</a><br>
<br>
Professional FreeSWITCH Services<br>
<a href="mailto:sales@freeswitch.com" target="_blank">sales@freeswitch.com</a><br>
<a href="https://freeswitch.com" rel="noreferrer" target="_blank">https://freeswitch.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="https://freeswitch.com/oss" rel="noreferrer" target="_blank">https://freeswitch.com/oss</a><br>
<a href="https://freeswitch.org/confluence" rel="noreferrer" target="_blank">https://freeswitch.org/confluence</a><br>
<a href="https://cluecon.com" rel="noreferrer" target="_blank">https://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" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="https://freeswitch.com" rel="noreferrer" target="_blank">https://freeswitch.com</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="font-size:12.8px"><font color="#000000"><br></font></div><div style="font-size:12.8px"><p dir="ltr" style="font-size:12.8px;line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:4.5pt"><span style="font-size:8pt;font-family:Arial;background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><font color="#000000">Brian West | Co-founder and Developer</font></span></p><p style="font-size:12.8px;line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:4.5pt"><span style="font-size:8pt;font-family:Arial;background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><font color="#000000">Need Commercial support? email <a href="mailto:sales@freeswitch.com" target="_blank">sales@freeswitch.com</a> </font></span></p><p dir="ltr" style="font-size:12.8px;line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:4.5pt"><span style="font-size:8pt;font-family:Arial;background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><font color="#000000">FreeSWITCH Solutions | <a href="https://maps.google.com/?q=17345+Civic+Drive+%232531+Brookfield,+WI+53045&entry=gmail&source=g" style="color:rgb(17,85,204)" target="_blank">17345 Civic Drive #2531 Brookfield, WI 53045</a></font></span></p><p dir="ltr" style="font-size:12.8px;line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:4.5pt"><font color="#000000"><span style="font-size:8pt;font-family:Arial;background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Email: </span><span style="color:rgb(17,85,204);font-size:8pt;font-family:Arial;background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><a href="mailto:brian@freeswitch.com" target="_blank">brian@freeswitch.com</a></span></font></p><p dir="ltr" style="font-size:12.8px;line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:4.5pt"><span style="font-size:8pt;font-family:Arial;background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><font color="#000000">Mobile: <span title="Call with Google Voice">918-424-9378</span></font></span></p><p dir="ltr" style="font-size:12.8px;line-height:1.38;margin-top:0pt;margin-bottom:0pt;margin-left:4.5pt"><font color="#000000"><span style="font-size:8pt;font-family:Arial;background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Website: </span><a href="https://www.freeswitch.com/" style="color:rgb(17,85,204)" target="_blank"><span style="font-size:8pt;font-family:Arial;background-color:transparent;vertical-align:baseline;white-space:pre-wrap">https://www.FreeSWITCH.com</span></a></font></p><p dir="ltr" style="font-size:12.8px;line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent;font-size:9pt;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap"><a href="https://www.facebook.com/freeswitch" target="_blank"><img alt="https://www.facebook.com/signalwireinc?src=email" src="https://lh6.googleusercontent.com/AYfRoSNaDNtMPRMevPn_GqcVEMd5NDRFi0GlluGUWzV6I5TAY_3T2-Tt0IuIXeUtEdYsgNsM8DOYKRKhjmrG_-n2Ga-LCnoNk46sO8VyEma1sBFYdiGJcLRUvkrD1CYHN79qimeg" width="31" height="31" style="border: none;"></a> </span><span style="background-color:transparent;font-size:9pt;font-family:Tahoma;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap"><a href="https://twitter.com/freeswitch" target="_blank"><img alt="https://twitter.com/freeswitch" src="https://lh3.googleusercontent.com/W4SqXyybH2qdAozvtoKjcz736qOjk9LHDwldvs1ahc-WVU0putVMSsUH474KDrJ32jsqi6JDjyUWxqeEkN5I1xSlC5ShYrd1b8NIMUkDzDrtbWQfa6A_90UcygqesBtRLgeFirKa" width="31" height="31" style="border: none;"></a></span><br></p></div></div></div></div></div></div></div></div></div></div></div></div></div>