<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Mike: <br>
<br>
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. <br>
<br>
<br>
Also, is creating 'limits.xml' required? <br>
<br>
Would it work if i can just add '<font face="'courier new',
monospace">handle_over_limit</font>' extension in 'default.xml',
omit the 'XML over_limit_actions' part in the limit action?<br>
<br>
<br>
<br>
<br>
<extension name="PBX Extension"><br>
<condition field="destination_number"
expression="^(1[0-9]{1})$"><br>
<br>
<action application="limit" data="db ${domain} 11 1
handle_over_limit XML over_limit_actions"/><br>
<action application="bridge" data="user/$1"/><br>
<br>
</condition><br>
</extension> <br>
On 7/13/2011 11:22 PM, Michael Collins wrote:
<blockquote
cite="mid:CAKzWOxVtNTEptQn6n-1POqiF9ntpLV-SsZeP3oufnSOOpFPoLA@mail.gmail.com"
type="cite"><br>
<br>
<div class="gmail_quote">On Wed, Jul 13, 2011 at 6:24 PM, ran
zhang <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:rzhang@gosilverplus.com" target="_blank">rzhang@gosilverplus.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
hi all:<br>
<br>
I'm trying to limit each registered user's active
calls, so<br>
if that particular registered user pass the limit, FS stops
sending any<br>
new incoming call to it and it can't make any new calls.<br>
<br>
I looked into 'limit' api, the counter increment
everytime a<br>
call FS receives, regardless of which user it is for, and
counter doesnt<br>
reset itself after the call is finished.<br>
</blockquote>
<div><br>
</div>
<div>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:</div>
<div><br>
</div>
<div>
<div><font face="'courier new', monospace"><action
application="limit" data="hash ${domain} $1 1
handle_over_limit XML over_limit_actions"/></font></div>
</div>
<div><br>
</div>
<div>Then add this new file as "limits.xml" in conf/dialplan/ :</div>
<div><br>
</div>
<div>
<div><font face="'courier new', monospace"><include>
</font></div>
<div><font face="'courier new', monospace"> <context
name="over_limit_actions">
</font></div>
<div><font face="'courier new', monospace"> <extension
name="oops, too many calls for this one">
</font></div>
<div><font face="'courier new', monospace"> <condition
field="destination_number"
expression="handle_over_limit">
</font></div>
<div><font face="'courier new', monospace"> <action
application="answer"/>
</font></div>
<div><font face="'courier new', monospace"> <action
application="playback" data="ivr/ivr-no_no_no.wav"/>
</font></div>
<div><font face="'courier new', monospace"> <action
application="playback" data="ivr/ivr-no_no_no.wav"/>
</font></div>
<div><font face="'courier new', monospace"> <action
application="playback" data="ivr/ivr-no_no_no.wav"/>
</font></div>
<div><font face="'courier new', monospace"> <action
application="hangup" data="USER_BUSY"/>
</font></div>
<div><font face="'courier new', monospace">
</condition>
</font></div>
<div><font face="'courier new', monospace">
</extension>
</font></div>
<div><font face="'courier new', monospace"> </context>
</font></div>
<div><font face="'courier new', monospace"></include></font></div>
</div>
<div><br>
</div>
<div>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:</div>
<div><br>
</div>
<div>
<div><font face="'courier new', monospace"><action
application="limit" data="hash ${domain} $1 4
handle_over_limit XML over_limit_actions"/></font></div>
</div>
<div><br>
</div>
<div>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:</div>
<div><br>
</div>
<div>
<div><font face="'courier new', monospace"> <!-- set
outound caller limit -->
</font></div>
<div><font face="'courier new', monospace"> <extension
name="set outbound limit" continue="true">
</font></div>
<div><font face="'courier new', monospace"> <condition
field="destination_number" expression="^1?\d{7}"
break="on-false"/>
</font></div>
<div><font face="'courier new', monospace"> <condition
field="caller_id_number" expression="^(10[01][0-9])">
</font></div>
<div><font face="'courier new', monospace"> <action
application="limit" data="hash ${domain} $1
4 handle_over_limit XML over_limit_actions"/></font>
</div>
<div><font face="'courier new', monospace"> <action
application="log" data="INFO Added limit for caller
$1"/>
</font></div>
<div><font face="'courier new', monospace">
</condition>
</font></div>
<div><font face="'courier new', monospace">
</extension>
</font></div>
<div> </div>
</div>
<div>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.)</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>-MC</div>
<div><br>
</div>
<div>
<br>
</div>
<div><br>
</div>
</div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Join us at ClueCon 2011, Aug 9-11, Chicago
<a class="moz-txt-link-freetext" href="http://www.cluecon.com">http://www.cluecon.com</a> 877-7-4ACLUE
FreeSWITCH-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
</pre>
</blockquote>
<br>
</body>
</html>