[Freeswitch-users] Limit concurrent calls

Tomasz Szuster tomasz.szuster at gmail.com
Fri Mar 29 23:43:58 MSK 2013


Thx Avi,

Your answer has more than useful :).

Regards.
Tom.


On Fri, Mar 29, 2013 at 10:06 AM, Avi Marcus <avi at avimarcus.net> wrote:

> Ah!
>
> You're using the same hash value for each user.
> it's $backend $realm $resource.
> So if you want each user to *different* limits, you need to name their
> realm/resource differently.
>
> E.g. I use <action application="limit" data="hash outbound 1000 2"/> which
> limits outbound *for user 1000* to only 2 calls.
>
> So do something like: <action application="limit" data="hash
> fraud_protection calls_max_intl_1000 1 !NORMAL_TEMPORARY_FAILURE" />
>
> ALSO:
> This is a BAD idea! <condition field="caller_id_number" expression="1000$"
> />
> 1) it matches any number that ends in 1000 -- you meant to do ^1000$
> 2) Anybody can set the caller ID number to anything they want (unless your
> system is completely firewalled and they can't access it, except internally
> and you TRUST everyone...) and then get access to this route.
> The suggestion is to create users and set passwords or ACL for them, and
> then set a variable accountcode. That variable is added internally so is as
> safe as the credentials. Use ${accountcode} for your match then.
> See: http://wiki.freeswitch.org/wiki/XML_User_Directory_Guide -- I'll
> update it a bit...
>
> -Avi Marcus
> BestFone
>
> On Fri, Mar 29, 2013 at 9:30 AM, Tomasz Szuster <tomasz.szuster at gmail.com>wrote:
>
>> <extension name="test1" >
>>    <condition field="caller_id_number" expression="1000$" />
>>    <condition field="destination_number" expression="^(61\d{7})$" >
>>        <action application="limit" data="hash fraud_protection
>> calls_max_intl 3 !NORMAL_TEMPORARY_FAILURE" />
>>        <action application="set" data="RECORD_TITLE=Recording
>> ${destination_number} ${caller_id_number} ${strftime(%Y-%m-%d %H:%M)}" />
>>        <action application="set" data="media_bug_answer_req=true" />
>>        <action application="set" data="recording_follow_transfer=true" />
>>        <action application="set" data="continue_on_fail=true" />
>>        <action application="set" data="hangup_after_bridge=true" />
>>        <action application="bridge"
>> data="{codec_string='PCMA'}sofia/gateway/${distributor(distributor1)}/$1"
>> loop="2" />
>>    </condition>
>> </extension>
>>
>>
>> <extension name="test2" >
>>    <condition field="caller_id_number" expression="2000" />
>>    <condition field="destination_number" expression="^(61\d{7})$" >
>>        <action application="limit" data="hash fraud_protection
>> calls_max_intl 1 !NORMAL_TEMPORARY_FAILURE" />
>>        <action application="set" data="media_bug_answer_req=true" />
>>        <action application="set" data="recording_follow_transfer=true" />
>>        <action application="set" data="continue_on_fail=true" />
>>        <action application="set" data="hangup_after_bridge=true" />
>>        <action application="bridge"
>> data="{codec_string='PCMA'}sofia/gateway/${distributor(distributor2)}/$1"
>> loop="3" />
>>    </condition>
>> </extension>
>>
>>
>> logs:
>>
>> first call:
>>
>> EXECUTE sofia/internal/1000 at sip1.linuxtechnology.com.pl limit(hash
>> fraud_protection calls_max_intl 3 !NORMAL_TEMPORARY_FAILURE)
>> 2013-03-29 06:12:22.954993 [INFO] switch_limit.c:126 incr called:
>> fraud_protection_calls_max_intl max:3, interval:0
>> 2013-03-29 06:12:22.954993 [INFO] mod_hash.c:202 Usage for
>> fraud_protection_calls_max_intl is now 1/3
>>
>>
>> During first call, I've tried to establish second call:
>>
>> EXECUTE sofia/internal/2000 at sip1.linuxtechnology.com.pl limit(hash
>> fraud_protection calls_max_intl 1 !NORMAL_TEMPORARY_FAILURE)
>> 2013-03-29 06:12:31.915022 [INFO] switch_limit.c:126 incr called:
>> fraud_protection_calls_max_intl max:1, interval:0
>> 2013-03-29 06:12:31.915022 [INFO] mod_hash.c:189 Usage for
>> fraud_protection_calls_max_intl is already at max value (1)
>> 2013-03-29 06:12:31.915022 [DEBUG] switch_channel.c:3011 (sofia/internal/
>> 2000 at sip1.linuxtechnology.com.pl) Callstate Change RINGING -> HANGUP
>> 2013-03-29 06:12:31.915022 [NOTICE] mod_dptools.c:4326 Hangup
>> sofia/internal/2000 at sip1.linuxtechnology.com.pl [CS_EXECUTE]
>> [NORMAL_TEMPORARY_FAILURE]
>>
>> Regards.
>> Tom
>>
>>
>> On Thu, Mar 28, 2013 at 11:59 PM, Avi Marcus <avi at avimarcus.net> wrote:
>>
>>> Can you give some of your dialplan and logs? It sounds like you're using
>>> it fine.
>>> Do you have transfers going on in the dialplan?
>>>
>>> -Avi
>>>
>>> On Fri, Mar 29, 2013 at 12:36 AM, Tomasz Szuster <
>>> tomasz.szuster at gmail.com> wrote:
>>>
>>>> Hi Nick.
>>>>
>>>> I used different gateways.
>>>>
>>>> Regards
>>>> Tom
>>>> On 28 Mar 2013 23:21, "Nick Vines" <jnvines at gmail.com> wrote:
>>>>
>>>>> Try changing "gateway" to something like "gateway_dialplan1" and
>>>>> "gateway_dialplan2". You are just querying the same limit data
>>>>> otherwise.
>>>>>
>>>>>
>>>>> On Thu, Mar 28, 2013 at 3:02 PM, Tomasz Szuster <
>>>>> tomasz.szuster at gmail.com> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I've set up limit for outgoing calls using
>>>>>> http://wiki.freeswitch.org/wiki/FS_weekly_2010_12_01, especially by
>>>>>> adding:
>>>>>>
>>>>>> limit hash fraud_protection calls_max_intl 32
>>>>>> !NORMAL_TEMPORARY_FAILURE to the dialplan.
>>>>>>
>>>>>> When I created second dialplan with different call_max_intl value
>>>>>> freeswitch did not get it.
>>>>>> It has still remember call_max_intl 32 from first dialplan.
>>>>>>
>>>>>> At console I've got:
>>>>>>
>>>>>> *Usage for fraud_protection_calls_max_intl is already at max value
>>>>>> (32)*
>>>>>>
>>>>>> I've also try with:
>>>>>>
>>>>>> <action application="limit_execute" data="hash outbound gateway 12
>>>>>> bridge sofia/gateway/gateway/$1" />
>>>>>>
>>>>>> Result was the same as for limit hash.
>>>>>>
>>>>>> My goal is to create dialplans with different calls max where calls
>>>>>> max value are treated separately.
>>>>>>
>>>>>> Can you please advice how to proceed, where to look ?
>>>>>> --
>>>>>> Regards.
>>>>>> Tom
>>>>>>
>>>>>>
>>>>>> _________________________________________________________________________
>>>>>> 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
>>>>
>>>>
>>>
>>> _________________________________________________________________________
>>> 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
>>>
>>>
>>
>>
>> --
>> Pozdrawiam
>> Tomasz
>>
>> _________________________________________________________________________
>> 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
>
>


-- 
Pozdrawiam
Tomasz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130329/4431e3a1/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list