<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html><head><meta http-equiv="Content-Type" content="text/html;charset=us-ascii">
<style>BODY{font:10pt Tahoma, Verdana, sans-serif}</style></head><body>
<DIV>A little known trick for using limit, is that&nbsp; you can do it on the B-LEG, rather then calling it form the A-Leg and you won't have to worry about holding the locks if the B-Leg fails, and you fall over to somethng else.</DIV>
<DIV>&nbsp;</DIV>
<DIV>If you do the limit using "execute_on_originate" and the B-LEG fails somewhere along the way, the lock will go away when the B-LEG goes away. Also if the limit fails, and returns the condition linke user_busy or something else, it will just look like the gateway failed, with that response. </DIV>
<DIV>&nbsp;</DIV>
<DIV>This is a much better way of using limit for some type of outbound applicaiton.</DIV>
<DIV>&nbsp;</DIV>
<DIV>--Dave</DIV><BR>
<BLOCKQUOTE style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<HR>
<B>From:</B> Muhammad Naseer Bhatti [mailto:nbhatti@gmail.com]<BR><B>To:</B> FreeSWITCH Users Help [mailto:freeswitch-users@lists.freeswitch.org]<BR><B>Sent:</B> Wed, 29 May 2013 00:20:13 -0700<BR><B>Subject:</B> Re: [Freeswitch-users] Gateway Call Limits<BR><BR><BR>Hmm, so simple. I wonder how I overlooked it :)<BR><BR>
<DIV class=moz-signature>-- <BR>Thanks,<BR>Muhammad Naseer Bhatti<BR><BR></DIV><BR><BR>jay binks wrote: 
<BLOCKQUOTE type="cite">
<DIV><A href="http://wiki.freeswitch.org/wiki/Limit">http://wiki.freeswitch.org/wiki/Limit</A><BR>
<DIV><BR></DIV>
<DIV>&lt;action application="limit" data="hash ${sip_received_ip} ${destination_number} ${calls_per_second}/1" /&gt;<BR></DIV></DIV>
<DIV class=gmail_extra><BR><BR>
<DIV class=gmail_quote>On 29 May 2013 16:52, Muhammad Naseer Bhatti <SPAN>&lt;<A href="mailto:nbhatti@gmail.com">nbhatti@gmail.com</A>&gt;</SPAN> wrote:<BR>
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class=gmail_quote>
<DIV bgcolor="#FFFFFF" text="#000000"><BR>Sorry for the thread hijack, but on the other hand, is it possible to limit the number of outgoing CPS? Don't seem to see that either in the wiki or a way to make it work.<SPAN class=HOEnZb><FONT color=#888888><BR><BR>
<DIV>-- <BR>Thanks,<BR>Muhammad Naseer Bhatti<BR><BR></DIV></FONT></SPAN>
<DIV>
<DIV class=h5><BR><BR>Alex Ynema wrote: 
<BLOCKQUOTE type="cite">
<DIV><SPAN style="FONT-FAMILY: arial,sans-serif; FONT-SIZE: 13px">Cheers Avi I've now changed that to hash as I don't need it to be persistent.</SPAN>
<DIV style="FONT-FAMILY: arial,sans-serif; FONT-SIZE: 13px">What should I see in the clie to confirm this is working without attempting 150+ calls</DIV>
<DIV style="FONT-FAMILY: arial,sans-serif; FONT-SIZE: 13px"><BR>
<DIV>Basically I've added this to my default.xml</DIV>
<DIV><BR></DIV>
<DIV>
<DIV>&nbsp; &nbsp; &lt;action application="set" data="destnum=${destination_number}" /&gt;</DIV>
<DIV>&nbsp; &nbsp; &lt;action application="bridge" data="loopback/context/zetta-cisco-1,loopback/context/zetta-cisco-2" /&gt;</DIV>
<DIV><BR></DIV>
<DIV>&nbsp; &nbsp; &lt;extension name="zetta-cisco-1"&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition field="destination_number" expression="zetta-cisco-1"&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;action application="limit" data="hash outgoing zetta-cisco-1 150" /&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;action application="bridge" data="sofia/gateway/zetta-cisco-1/${destnum}" /&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/condition&gt;</DIV>
<DIV>&nbsp; &nbsp; &lt;/extension&gt;</DIV>
<DIV>&nbsp; &nbsp; &lt;extension name="zetta-cisco-2"&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition field="destination_number" expression="zetta-cisco-2"&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;action application="limit" data="hash outgoing zetta-cisco-2 150" /&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;action application="bridge" data="sofia/gateway/zetta-cisco-2/${destnum}" /&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/condition&gt;</DIV>
<DIV>&nbsp; &nbsp; &lt;/extension&gt;</DIV></DIV></DIV></DIV>
<DIV class=gmail_extra><BR clear=all>
<DIV><BR>
<DIV>
<DIV><SPAN style="BORDER-COLLAPSE: collapse"><SPAN><FONT face="'times &#13;&#10;new roman', serif"><FONT color=#999999><B>Alex Ynema</B></FONT></FONT></SPAN><SPAN><FONT face="'times new roman', serif"><FONT color=#999999><B>&nbsp;</B>|&nbsp;</FONT></FONT></SPAN><SPAN><FONT face="'times new roman', serif"><FONT color=#999999>IT Consultant</FONT></FONT></SPAN><SPAN><FONT face="'times new roman', serif"><FONT color=#999999><BR></FONT></FONT></SPAN><SPAN><FONT face="'times new roman', &#13;&#10;serif"><FONT color=#999999><A href="mailto:alex@opensystems.net.au">alex@opensystems.net.au</A><BR></FONT></FONT></SPAN></SPAN></DIV>
<DIV><BR></DIV><FONT face="'times new roman', serif"><FONT color=#999999>Level 1, 409-411 Oxford Street, Mount Hawthorne WA 6016</FONT></FONT></DIV>
<DIV><FONT face="'times new roman', serif"><FONT color=#999999>Office: +61 8 9427 2500<BR>Mobile: <A href="tel:%2B61%20404%20796%20894">+61 404 796 894</A><BR></FONT></FONT>
<DIV><FONT color=#999999 face="'times new roman', serif"><BR></FONT>
<DIV><FONT color=#999999 face="'times new roman', serif">IT Consultant for Open Systems Support<BR></FONT>
<DIV><FONT face="'times new roman', serif"><FONT color=#999999><A href="http://www.opensystems.net.au/">www.opensystems.net.au</A></FONT></FONT></DIV></DIV></DIV></DIV></DIV><BR><BR>
<DIV class=gmail_quote>On 29 May 2013 14:13, Avi Marcus <SPAN>&lt;<A href="mailto:avi@avimarcus.net">avi@avimarcus.net</A>&gt;</SPAN> wrote:<BR>
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class=gmail_quote>
<DIV>... just note that's stored in a database (db) not ram (hash) so if you don't need to share it / have persistence, just store it in ram.
<DIV><BR clear=all>
<DIV>
<DIV><SPAN style="FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif; FONT-SIZE: small">-Avi</SPAN></DIV></DIV><BR>
<DIV class=gmail_quote>On Wed, May 29, 2013 at 9:07 AM, Alex Ynema <SPAN>&lt;<A href="mailto:alex@opensystems.net.au">alex@opensystems.net.au</A>&gt;</SPAN> wrote:<BR>
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class=gmail_quote>
<DIV><SPAN style="FONT-FAMILY: arial,sans-serif; FONT-SIZE: 13px">I've implemented this in default.xml hoping to limit each of my two gateways to 150.&nbsp;</SPAN>
<DIV style="FONT-FAMILY: arial,sans-serif; FONT-SIZE: 13px">Based on what's in&nbsp;<A href="http://wiki.freeswitch.org/wiki/Limit#Using_limit_with_per-gateway_or_per-user_channel_limits">http://wiki.freeswitch.org/wiki/Limit#Using_limit_with_per-gateway_or_per-user_channel_limits</A>&nbsp;so hopefully that works.
<DIV>
<DIV><BR></DIV>
<DIV>
<DIV>&nbsp; &nbsp; &lt;extension name="zetta-cisco-1"&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition field="destination_number" expression="zetta-cisco-1"&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;action application="limit" data="db outgoing zetta-cisco-1 150" /&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;action application="bridge" data="sofia/gateway/zetta-cisco-1/${destnum}" /&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/condition&gt;</DIV>
<DIV>&nbsp; &nbsp; &lt;/extension&gt;</DIV>
<DIV>&nbsp; &nbsp; &lt;extension name="zetta-cisco-2"&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition field="destination_number" expression="zetta-cisco-2"&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;action application="limit" data="db outgoing zetta-cisco-2 150" /&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;action application="bridge" data="sofia/gateway/zetta-cisco-2/${destnum}" /&gt;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/condition&gt;</DIV>
<DIV>&nbsp; &nbsp; &lt;/extension&gt;</DIV></DIV></DIV></DIV></DIV>
<DIV class=gmail_extra>
<DIV><BR clear=all>
<DIV>
<DIV><BR>
<DIV>
<DIV><SPAN style="BORDER-COLLAPSE: collapse"><SPAN><FONT face="'times &#13;&#10;new roman', serif"><FONT color=#999999><B>Alex Ynema</B></FONT></FONT></SPAN><SPAN><FONT face="'times new roman', serif"><FONT color=#999999><B>&nbsp;</B>|&nbsp;</FONT></FONT></SPAN><SPAN><FONT face="'times new roman', serif"><FONT color=#999999>IT Consultant</FONT></FONT></SPAN><SPAN><FONT face="'times new roman', serif"><FONT color=#999999><BR></FONT></FONT></SPAN><SPAN><FONT face="'times new roman', &#13;&#10;serif"><FONT color=#999999><A href="mailto:alex@opensystems.net.au">alex@opensystems.net.au</A><BR></FONT></FONT></SPAN></SPAN></DIV>
<DIV><BR></DIV><FONT face="'times new roman', serif"><FONT color=#999999>Level 1, 409-411 Oxford Street, Mount Hawthorne WA 6016</FONT></FONT></DIV></DIV>
<DIV>
<DIV><FONT face="'times new roman', serif"><FONT color=#999999>Office: <A href="tel:%2B61%208%209427%202500">+61 8 9427 2500</A><BR>Mobile: <A href="tel:%2B61%20404%20796%20894">+61 404 796 894</A><BR></FONT></FONT></DIV>
<DIV><FONT color=#999999 face="'times new roman', serif"><BR></FONT>
<DIV>
<DIV><FONT color=#999999 face="'times new &#13;&#10;roman', serif">IT Consultant for Open Systems Support<BR></FONT>
<DIV><FONT face="'times new roman', serif"><FONT color=#999999><A href="http://www.opensystems.net.au/">www.opensystems.net.au</A></FONT></FONT></DIV></DIV></DIV></DIV></DIV></DIV><BR><BR></DIV>
<DIV>
<DIV>
<DIV class=gmail_quote>
<DIV>On 29 May 2013 13:59, Alex Ynema <SPAN>&lt;<A href="mailto:alex@opensystems.net.au">alex@opensystems.net.au</A>&gt;</SPAN> wrote:<BR></DIV>
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class=gmail_quote>
<DIV>
<DIV>Hi,
<DIV>I'm trying to figure out how to limit the number of calls a Gateway is allowed to use. Our Sip provider has provided up with 200 which I need to set within the system somehow.</DIV>
<DIV>What's the best way to handle it for an outgoing only system.</DIV>
<DIV>I've been trying to figure out how how to configure '<SPAN style="LINE-HEIGHT: 19px; FONT-FAMILY: sans-serif; FONT-SIZE: 13px">Rate limiting concurrent outgoing calls via a provider</SPAN>' which is mentioned in the wiki a bit but nothing specific on what to actually do.</DIV></DIV>
<DIV>
<DIV>
<DIV><BR>
<DIV>
<DIV><SPAN style="BORDER-COLLAPSE: collapse"><SPAN><FONT face="'times &#13;&#10;new roman', serif"><FONT color=#999999><B>Alex Ynema</B></FONT></FONT></SPAN><SPAN><FONT face="'times new roman', serif"><FONT color=#999999><B>&nbsp;</B>|&nbsp;</FONT></FONT></SPAN><SPAN><FONT face="'times new roman', serif"><FONT color=#999999>IT Consultant</FONT></FONT></SPAN><SPAN><FONT face="'times new roman', serif"><FONT color=#999999><BR></FONT></FONT></SPAN><SPAN><FONT face="'times new roman', &#13;&#10;serif"><FONT color=#999999><A href="mailto:alex@opensystems.net.au">alex@opensystems.net.au</A><BR></FONT></FONT></SPAN></SPAN></DIV>
<DIV><BR></DIV><FONT face="'times new roman', serif"><FONT color=#999999>Level 1, 409-411 Oxford Street, Mount Hawthorne WA 6016</FONT></FONT></DIV></DIV>
<DIV>
<DIV><FONT face="'times new roman', serif"><FONT color=#999999>Office: <A href="tel:%2B61%208%209427%202500">+61 8 9427 2500</A><BR>Mobile: <A href="tel:%2B61%20404%20796%20894">+61 404 796 894</A><BR></FONT></FONT></DIV>
<DIV><FONT color=#999999 face="'times new roman', serif"><BR></FONT>
<DIV>
<DIV><FONT color=#999999 face="'times new &#13;&#10;roman', serif">IT Consultant for Open Systems Support<BR></FONT>
<DIV><FONT face="'times new roman', serif"><FONT color=#999999><A href="http://www.opensystems.net.au/">www.opensystems.net.au</A></FONT></FONT></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></BLOCKQUOTE></DIV><BR></DIV></DIV></DIV><BR>
<DIV>_________________________________________________________________________<BR>Professional FreeSWITCH Consulting Services:<BR><A href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</A><BR><A href="http://www.freeswitchsolutions.com/">http://www.freeswitchsolutions.com</A><BR><BR>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR><A href="http://www.cudatel.com/">http://www.cudatel.com</A><BR><BR>Official FreeSWITCH Sites<BR><A href="http://www.freeswitch.org/">http://www.freeswitch.org</A><BR><A href="http://wiki.freeswitch.org/">http://wiki.freeswitch.org</A><BR><A href="http://www.cluecon.com/">http://www.cluecon.com</A><BR><BR>FreeSWITCH-users mailing list<BR><A href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</A><BR><A href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</A><BR>UNSUBSCRIBE:<A href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</A><BR><A href="http://www.freeswitch.org/">http://www.freeswitch.org</A><BR><BR></DIV></BLOCKQUOTE></DIV><BR></DIV></DIV><BR>_________________________________________________________________________<BR>Professional FreeSWITCH Consulting Services:<BR><A href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</A><BR><A href="http://www.freeswitchsolutions.com/">http://www.freeswitchsolutions.com</A><BR><BR>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR><A href="http://www.cudatel.com/">http://www.cudatel.com</A><BR><BR>Official FreeSWITCH Sites<BR><A href="http://www.freeswitch.org/">http://www.freeswitch.org</A><BR><A href="http://wiki.freeswitch.org/">http://wiki.freeswitch.org</A><BR><A href="http://www.cluecon.com/">http://www.cluecon.com</A><BR><BR>FreeSWITCH-users mailing list<BR><A href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</A><BR><A href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</A><BR>UNSUBSCRIBE:<A href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</A><BR><A href="http://www.freeswitch.org/">http://www.freeswitch.org</A><BR><BR></BLOCKQUOTE></DIV><BR></DIV><PRE>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<A href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</A>
<A href="http://www.freeswitchsolutions.com/">http://www.freeswitchsolutions.com</A>

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<A href="http://www.cudatel.com/">http://www.cudatel.com</A>

Official FreeSWITCH Sites
<A href="http://www.freeswitch.org/">http://www.freeswitch.org</A>
<A href="http://wiki.freeswitch.org/">http://wiki.freeswitch.org</A>
<A href="http://www.cluecon.com/">http://www.cluecon.com</A>

FreeSWITCH-users mailing list
<A href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</A>
<A href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</A>
UNSUBSCRIBE:<A href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</A>
<A href="http://www.freeswitch.org/">http://www.freeswitch.org</A>
</PRE></BLOCKQUOTE></DIV></DIV></DIV><BR>_________________________________________________________________________<BR>Professional FreeSWITCH Consulting Services:<BR><A href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</A><BR><A href="http://www.freeswitchsolutions.com/">http://www.freeswitchsolutions.com</A><BR><BR>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR><A href="http://www.cudatel.com/">http://www.cudatel.com</A><BR><BR>Official FreeSWITCH Sites<BR><A href="http://www.freeswitch.org/">http://www.freeswitch.org</A><BR><A href="http://wiki.freeswitch.org/">http://wiki.freeswitch.org</A><BR><A href="http://www.cluecon.com/">http://www.cluecon.com</A><BR><BR>FreeSWITCH-users mailing list<BR><A href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</A><BR><A href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</A><BR>UNSUBSCRIBE:<A href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</A><BR><A href="http://www.freeswitch.org/">http://www.freeswitch.org</A><BR><BR></BLOCKQUOTE></DIV><BR><BR clear=all>
<DIV><BR></DIV>-- <BR>Sincerely<BR><BR>Jay </DIV><PRE>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<A class=moz-txt-link-abbreviated href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</A>
<A class=moz-txt-link-freetext href="http://www.freeswitchsolutions.com/">http://www.freeswitchsolutions.com</A>

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<A class=moz-txt-link-freetext href="http://www.cudatel.com/">http://www.cudatel.com</A>

Official FreeSWITCH Sites
<A class=moz-txt-link-freetext href="http://www.freeswitch.org/">http://www.freeswitch.org</A>
<A class=moz-txt-link-freetext href="http://wiki.freeswitch.org/">http://wiki.freeswitch.org</A>
<A class=moz-txt-link-freetext href="http://www.cluecon.com/">http://www.cluecon.com</A>

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></BLOCKQUOTE>
<STYLE>
 * {color:#000000;}
</STYLE>

<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></body></html>