<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"><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"><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"><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"><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>