Mod limit

From FreeSWITCH Wiki

Jump to: navigation, search

Contents

Mod Limit

Limit the number of calls to or from an arbitrary resource. When the limit is reached, the call is automatically transferred to "limit_exceeded" in the same context

You may choose to take advantage of the odbc-dsn to allow multiple servers to limit the number of calls and stay aware of how many calls <resource> has in session across all participating servers

Synopsis

limit <realm> <resource> <max> [transfer_destination_number]

realm

arbitrary name

resource

the resource on which to limit the number of calls

max

the maximum number of calls allowed to pass

In Depth

The following channel variables are set when mod_limit is called.

  • "limit_realm"
  • "limit_id"
  • "limit_max"

These channel variables are used at hang up to remove the record. More specifically, the delete is limited by uuid, hostname, realm and id.

Example

The following is a simple example of limiting a user in your domain to ${max_calls}.... Where max_calls is a user variable set in directory.conf or a global variable

      <extension name="limit" continue="true">
        <condition>
          <action application="limit" data="$${domain} ${sip_auth_username} ${max_calls}"/>
        </condition>
      </extension> 
      <extension name="limit_exceeded">
        <condition field="destination_number" expression="^limit_exceeded$">
          <action application="playback" data="/sounds/overthelimit.wav"/>
          <action application="hangup"/>
        </condition>
      </extension>

Related

Personal tools