[Freeswitch-users] B-leg ringing after A-leg hangs-up. LUA.

Brian West brian at freeswitch.com
Fri Feb 26 19:45:23 UTC 2021


Tim,

Based on your description, I would guess that the B-Leg hangs up when they
answer after the a-leg is gone??

/b




On Fri, Feb 26, 2021 at 12:42 PM Тимур Ситдиков <sitdikovt at gmail.com> wrote:

> Hi all. Need help with a simple call script.
> I'm got this in dialplan
> <extension name="call_lua_home">
>       <condition field="destination_number" expression="^(1007)$">
>         <!-- <action application="set" data="session_in_hangup_hook=true"/> -->
> For hangup hook try
>         <action application="lua" data="fork.lua"/>
>       </condition>
> </extension>
> And this in fork.lua
> if session:ready() then
> api = freeswitch.API()
> contact = api:execute("sofia_contact", "*/1007 at compA.com");
> caller = session:getVariable("caller_id_number");
> session1 = freeswitch.Session("{origination_caller_id_name="..caller..
> "}[leg_timeout=30]"..contact.."");
> -- session:setHangupHook("HangupHook");
> if session1:ready() then
>     freeswitch.bridge(session, session1);
> end
> freeswitch.consoleLog("WARNING","=====SCRIPT END\n");
> session:hangup()
> end
>
> 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.
> I want to drop B-leg when A-leg hangs up. Is it possible?
>
> UPD Tried to use hangup hook. It works with stramFile, but no luck with
> session.
> function HangupHook(s, status)
>     freeswitch.consoleLog("WARNING","Event fired breaking out\n");
>     return exit;
>     -- return die;
> end
>
> session:answer();
> session:setHangupHook("HangupHook");
> while (session:ready() == true) do
>
>     session:streamFile(
> "/usr/share/freeswitch/sounds/en/us/callie/ivr/16000/ivr-on_hold_indefinitely.wav"
> );
>
> -- session1 = freeswitch.Session("{origination_caller_id_name="..caller.."}[leg_timeout=30]"..contact.."");
> end
> freeswitch.consoleLog("WARNING","=====SCRIPT END\n");
> session:hangup()
> end
>
> Can anyone help me with this?
>
> Thanks! Regards,Tim
> _________________________________________________________________________
>
> The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
> Enhance your FreeSWITCH install with disruptive priced SMS and PSTN
> services.
> Build your next product on our scalable cloud platform.
>
> Join our online community to chat in real time
> https://signalwire.community
>
> Professional FreeSWITCH Services
> sales at freeswitch.com
> https://freeswitch.com
>
> Official FreeSWITCH Sites
> https://freeswitch.com/oss
> https://freeswitch.org/confluence
> https://cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> https://freeswitch.com



-- 

Brian West | Co-founder and Developer

Need Commercial support? email sales at freeswitch.com

FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045
<https://maps.google.com/?q=17345+Civic+Drive+%232531+Brookfield,+WI+53045&entry=gmail&source=g>

Email: brian at freeswitch.com

Mobile: 918-424-9378

Website: https://www.FreeSWITCH.com <https://www.freeswitch.com/>

[image: https://www.facebook.com/signalwireinc?src=email]
<https://www.facebook.com/freeswitch> [image:
https://twitter.com/freeswitch] <https://twitter.com/freeswitch>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20210226/0bb2b801/attachment.html>


More information about the FreeSWITCH-users mailing list