Skip to content

Understanding CPS

CPS, calls per second, is the rate at which new calls arrive or leave. Limiting it protects the switch, your vendors and your agreements with them from floods of attempts, which are typical for autodialers and for misconfigured or compromised equipment. FlySIP enforces CPS limits so that short bursts pass and only sustained excess is rejected.

Traffic never arrives evenly. Sixty calls in a minute are 1 CPS on average, but they may come as fifty calls in five seconds and ten in the next fifty-five. A strict per-second counter would reject most of the burst although the average is within the limit. FlySIP uses a token bucket instead:

  1. The bucket holds a minute of calls. Its size is the CPS limit multiplied by 60. A limit of 1 lets up to 60 calls through in a burst.
  2. Every call takes one call’s worth from the bucket. If enough is left, the call passes; if not, it is rejected.
  3. The bucket refills continuously at the CPS limit, one call per second for a limit of 1, and never beyond its size.

With a limit of 1 and a full bucket, a burst of 50 calls in 5 seconds passes and leaves room for 15 calls: 60 − 50 + 5 refilled. If 55 more calls come in the next 5 seconds, 20 of them pass (15 + 5 refilled) and 35 are rejected. If only 10 calls come over the next 50 seconds, all of them pass.

Object Field When the limit is reached
Account Max Calls Per Second New calls of the account are rejected
Authentication rule Max Calls Per Second New calls matched by the rule are rejected
Customer Max Calls Per Second New calls of all the customer’s accounts are rejected
Connection Max CPS The connection is skipped and the call hunts to the next route
Environment Max CPS New calls of the whole environment are rejected. Set by the owner of the installation

An empty field means unlimited. Limits can be fractional: 0.5 allows one call every two seconds on average. A rejected call gets a CDR with a negative result code that names the limit. See SIP response codes.

  • Account — a SIP identity (username/password or IP) owned by a customer that originates and receives calls and carries its own balance.
  • Authentication Rule — a rule that identifies the account for an incoming call by source IP, CLI, called number or other SIP fields instead of a password.
  • Connection — a route to a vendor (SIP host, port, protocol, codecs) used by routing to send calls.
  • Capacity — the maximum number of concurrent calls of a connection or account.
  • Hunting — trying the next route after a failed attempt.

Set Max CPS 10 on the vendor’s connection. Calls above the limit go to the next connection in the routing group instead of being rejected by the vendor. Add a second vendor for the same destinations if all overflow must still complete.

Set Max Calls Per Second on the customer or on its accounts to what you sell, and Max Sessions for concurrent calls. Rejected attempts cost the switch very little, while attempts that reach vendors lower your ASR with them. See Understanding ASR.

Calls are rejected although the average CPS is lower than the limit

Section titled “Calls are rejected although the average CPS is lower than the limit”

The limit allows a burst of one minute of calls, not more. Traffic that sends several minutes’ worth of calls at once, for example after a dialler restart, runs the bucket empty. Raise the limit or ask the customer to pace the dialler.