[Freeswitch-users] Limit max concurrent calls on gateways in lua

Stanislav Sinyagin ssinyagin at gmail.com
Sun Feb 8 18:25:36 MSK 2015


here's what I do in mod_perl, Lua code will be quite similar:

    $session->execute
        ('set',
         sprintf('user_busy=${cond(${limit_usage(hash %s %s)} > 0 ?
true:false)}',
                 $domain, $availability_username));
    my $user_busy = $session->getVariable('user_busy');
    if( $user_busy eq 'true' )
    {
......

also see my blog entry here:
https://txlab.wordpress.com/2013/06/29/freeswitch-limiting-the-number-of-concurrent-calls-on-multiple-sip-accounts/


On Sun, Feb 8, 2015 at 1:12 PM, Zoltán Szabó <zoell at zoell.us> wrote:
> Hi,
>
> I have a lua script where I do some business logic. After the logic I call a
> number on a gateway, then when the called party picked up, I call an other
> number on a gateway and bridge the two calls. The only problem is that I
> have 5 gateways and each can have maximum of 3 calls (so I can have 15 calls
> on this system).
>
> Here is what I have at the moment (simplified version):
>
> dial_call_1 = "{leg=1}sofia/gateway/gw-1/0035312345678";
> dial_call_2 = "{leg=2}sofia/gateway/gw-2/0035387654321";
>
> session1 = freeswitch.Session(dial_call_1);
>
> if (session1:ready()) then
> session2 = freeswitch.Session(dial_call_2, session1);
>
> if (session2:ready()) then
> freeswitch.bridge(session1, session2);
>
> if (session2:ready()) then
> session2:hangup();
> end
> end
>
> if (session1:ready()) then session1:hangup(); end
> end
>
> How can I use the limit application here to set the max concurrent calls on
> my five gateway, each with 3 max calls and distribute outbound calls between
> them?
>
> Many thanks,
> Zoltan
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.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
> http://www.freeswitch.org



Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list