[Freeswitch-users] Concurrent RINGING calls limitation
Mickael Hubert
m.hubert at hexanet.fr
Tue Jun 17 10:35:17 MSD 2014
Hi list,
we have found a solution to kevin's issue.
*first, on top of dialplan:*
variables definitions
*<extension name="variables" continue="true">
<condition field="${destination_number}" expression=".*"
break="never"> <action inline="true"
application="set" data="limittotalcalls=200" /> ## limit of total call
<action inline="true" application="set"
data="limitcps=${expr(ceil(${limittotalcalls}*10/100))}" /> ## sum of cps
10% = 20 CPS <action inline="true"
application="set"
data="limitprogresscall=${expr(ceil(${limittotalcalls}*30/100))}" /> ## sum
of call in progress 30% = 60 call in progress
</condition> </extension>*
*after in dialpan*
fix hash with variable ${custdomain}, is ENUM domain of my customer.
* <condition field="${limitcalls}" expression="^yes$" break="never">
<action application="limit" data="hash cps
${custdomain} ${limitcps}/1 limit_exceeded_cps XML
excess_limit"/> <action application="limit"
data="hash total ${custdomain} ${limittotalcalls} limit_exceeded_total XML
excess_limit" /> <action
application="export" data="nolocal:execute_on_answer=limit hash answercall
${custdomain} -1"/> </condition>*
*before bridge (end of dialplan):*
* <condition field="${cond(${expr(${limit_usage(hash total ${custdomain})}
- ${limit_usage(hash answercall ${custdomain})})} > ${limitprogresscall} ?
true:false)}" expression="^true$" break="on-true">
<action application="log" data="WARNING LOG
: Call progress > ${limitprogresscall} to
${custdomain}"/> <action
application="respond" data="503"/> <action
application="hangup" data="CALL_REJECTED"/>
</condition>*
if 80 total calls - 30 answer calls = 50 calls in progress is < to 60
limit, call is passed
BUT, if 90 total calls - 29 answer calls = 61 calls in progress is > to 60
limit, call is rejected
This code is perfect to limit machine call for example.
Thanks for your response.
bye
2014-06-10 14:50 GMT+02:00 Markus Lindenberg <markus.lindenberg at gmail.com>:
> Hi Kevin,
>
> I'm using/abusing limit for limiting incoming calls *to* an extension,
> although I've just discovered that I would have the same problem, in my
> current implementation the limit for the callee is raised when the call is
> bridged:
>
> First I do a inline lookup from the user directory and populate ${user_id}
> with the callee's id.
>
> <condition>
> <action inline="true" application="log" data="INFO
> Dialed number ${destination_number} is ${user_id}@${domain_name} in XML
> User Directory."/>
>
> <!-- Get current limit, if >0 then callee is in a
> call -->
> <action inline="true" application="set"
> data="user_busy=${cond(${limit_usage(db ${domain_name} ${user_id})} > 0 ?
> true : false)}"/>
>
> <!-- Don't use limit if caller=callee! (handover
> to own DECT etc.)-->
> <action inline="true" application="set"
> data="user_busy=${cond("${user_name}" == "${user_id}" ?
> false : ${user_busy})}"/>
> </condition>
>
> <condition field="${user_busy}" expression="false"
> break="never">
> <!-- On bridge increase Call-Limit for the callee
> (B-Leg).
> Limit for outgoing Calls will be increased in
> dialplan/default.xml
> See http://wiki.freeswitch.org/wiki/Limit -->
> <action application="set"
> data="bridge_pre_execute_bleg_app=limit"/>
> <action application="set"
> data="bridge_pre_execute_bleg_data=db ${domain_name} ${user_id} 100
> !USER_BUSY"/>
>
> <action application="limit" data="db
> ${domain_name} ${user_id} 100 !USER_BUSY"/>
>
> <action application="set"
> data="fail_on_single_reject=USER_BUSY"/>
> <action application="bridge" data="user/${user_id}@
> ${domain_name}"/>
>
> <anti-action application="log" data="INFO
> ${user_id}@${domain_name} is busy, not bridging call!"/>
> </condition>
>
> Now if I replace this:
>
> <action application="set"
> data="bridge_pre_execute_bleg_app=limit"/>
> <action application="set"
> data="bridge_pre_execute_bleg_data=db ${domain_name} ${user_id} 100
> !USER_BUSY"/>
>
> with that:
>
> <action application="limit" data="db
> ${domain_name} ${user_id} 100 !USER_BUSY"/>
>
> the callee is marked as busy directly before i try to bridge to the user.
> as soon as the call ends, the limit is reset. I just did a quick test
> though and didn't try all the corner cases.
>
> best regards, markus
>
>
>
> On Tue, Jun 10, 2014 at 12:11 PM, Avi Marcus <avi at avimarcus.net> wrote:
>
>> Just thinking out loud: you can use limit and an execute on answer to
>> decrease the count, and also make sure it decreases it it fails.
>>
>> I assume your ringing limit will be lower than channel limit? Otherwise
>> the channel limit should suffice.
>>
>> -Avi
>> On Jun 10, 2014 10:52 AM, "Kevin Mathy" <k.mathy at hexanet.fr> wrote:
>>
>>> Hi List,
>>>
>>> I'm trying to find something on freeswitch to make a "per-user"
>>> limitation of concurrent "RINGING" calls (or more generally, calls in
>>> PROCEEDING state).
>>>
>>> I've found the "max-proceeding" value I can set in switch.conf.xml, but
>>> it's a system's wide parameter, and I'd like more granularity...
>>>
>>> So, after some time spent on the mailing list and with my friend Google,
>>> it seems that someone asked for quite the same thing 2 years ago, but
>>> didn't get any answer :
>>> http://marc.info/?l=freeswitch-users&m=134375187528797
>>>
>>> So, today, is there anything to achieve this ? Maybe something based on
>>> the "limit" module ?
>>>
>>> Thanks a lot,
>>> Kevin
>>>
>>>
>>>
>>> *Bien cordialement, Best Regards, **Kevin MATHY* | Ingénieur VoIP
>>>
>>>
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>>
>>>
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.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
>>>
>>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>>
>>
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.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
>>
>>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
>
>
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.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
>
>
--
Cordialement
HUBERT Mickaël
Ingénieur VOIP - Hexanet
--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140617/2229b74f/attachment.html
Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users
mailing list