[Freeswitch-users] please help!!! how to limit each FS registered user's active calls

Steven Ayre steveayre at gmail.com
Thu Jul 14 23:57:14 MSD 2011


"limit subsystem hash not found!" means you have not loaded mod_hash

As for changing the limit line from $1 to 11 what you've done is any
calls to other numbers such as 05 are also registered as a call to 11.
Therefore a call to 05 will prevent a call to 11.

If you want to handle 11 differently from the others, you'll need to
put it in a different extension:

<extension name="PBX Extension 11">
    <condition field="destination_number" expression="^(11)$">
        <action application="limit" data="db ${domain} $1 1
handle_over_limit XML over_limit_actions"/>
        <action application="bridge" data="user/$1"/>
    </condition>
</extension>
<extension name="PBX Extension">
    <condition field="destination_number" expression="^(1[0-9]{1})$">
        <action application="bridge" data="user/$1"/>
    </condition>
</extension>

-Steve



On 14 July 2011 19:38, ran zhang <rzhang at gosilverplus.com> wrote:
> Mike:
>
>     I have added 'limits.xml' as u said.   If i use 'hash', FS generates
> error "limit subsystem hash not found!", so i changed to 'db', following is
> my local extension in my dialplan, i changed '$1' to '11' since i just want
> to limit user/11, but its still limiting incoming calls on all the
> extensions.
>
>
>    Also, is creating 'limits.xml' required?
>
>    Would it work if i can just add 'handle_over_limit' extension in
> 'default.xml', omit the 'XML over_limit_actions' part in the limit action?
>
>
>
>
> <extension name="PBX Extension">
>       <condition field="destination_number" expression="^(1[0-9]{1})$">
>
>         <action application="limit" data="db ${domain} 11 1
> handle_over_limit XML over_limit_actions"/>
>         <action application="bridge" data="user/$1"/>
>
>       </condition>
> </extension>
> On 7/13/2011 11:22 PM, Michael Collins wrote:
>
> On Wed, Jul 13, 2011 at 6:24 PM, ran zhang <rzhang at gosilverplus.com> wrote:
>>
>> hi all:
>>
>>            I'm trying to limit each registered user's active calls, so
>> if that particular registered user pass the limit, FS stops sending any
>> new incoming call to it and it can't make any new calls.
>>
>>            I looked into 'limit' api, the counter increment everytime a
>> call FS receives, regardless of which user it is for, and counter doesnt
>> reset itself after the call is finished.
>
> I presume you mean the limit "dialplan app" and not API. In any case, if you
> have the default configs then locate the Local_Extension in
> conf/dialplan/default.xml. Add this line right after the condition:
> <action application="limit" data="hash ${domain} $1 1 handle_over_limit XML
> over_limit_actions"/>
> Then add this new file as "limits.xml" in conf/dialplan/ :
> <include>
>
>
>   <context name="over_limit_actions">
>
>
>     <extension name="oops, too many calls for this one">
>
>
>       <condition field="destination_number" expression="handle_over_limit">
>
>
>         <action application="answer"/>
>
>
>         <action application="playback" data="ivr/ivr-no_no_no.wav"/>
>
>
>         <action application="playback" data="ivr/ivr-no_no_no.wav"/>
>
>
>         <action application="playback" data="ivr/ivr-no_no_no.wav"/>
>
>
>         <action application="hangup" data="USER_BUSY"/>
>
>
>       </condition>
>
>
>     </extension>
>
>
>   </context>
>
>
> </include>
> Save, then do F6 or reloadxml. Now when you call a local extension it won't
> allow more than one call. Note that you can change the value in the limit's
> data argument. For example, this would cause a limit of 4 concurrent calls,
> sending the 5th call into "oops, too many calls" extension:
> <action application="limit" data="hash ${domain} $1 4 handle_over_limit XML
> over_limit_actions"/>
> The limit application handles everything for you. Note that this only covers
> calls made *to* the extension. If you want to handle calls made *from* the
> extension you will need to add another limit app to the dialplan. Here's an
> example; put it right after the "global" extension in default.xml:
>     <!-- set outound caller limit -->
>
>
>     <extension name="set outbound limit" continue="true">
>
>
>       <condition field="destination_number" expression="^1?\d{7}"
> break="on-false"/>
>
>       <condition field="caller_id_number" expression="^(10[01][0-9])">
>
>
>         <action application="limit" data="hash ${domain} $1
> 4 handle_over_limit XML over_limit_actions"/>
>         <action application="log" data="INFO Added limit for caller $1"/>
>
>
>       </condition>
>
>
>     </extension>
>
>
>
> Again, save, press F6 or do reloadxml. Now when this person makes a call to
> a 7-digit number or does 1+ 7 or more digits, it will add to his limit
> totals. However, if he just calls another 4-digit extension on the system
> then it won't add to his limit. (Adjust this as you see fit.)
> Let me know if this works for you (it worked for me in my little lab
> setting) and I will throw it up on the wiki and maybe add it to the
> cookbook.
> -MC
>
>
>
> _______________________________________________
> Join us at ClueCon 2011, Aug 9-11, Chicago
> http://www.cluecon.com 877-7-4ACLUE
>
> 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 2011, Aug 9-11, Chicago
> http://www.cluecon.com 877-7-4ACLUE
>
> 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
>
>



More information about the FreeSWITCH-users mailing list