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