Skip to content

Call flow

Every call that reaches FlySIP goes through the same five stages, whether it comes from a wholesale trunk, a registered softphone or a calling-card IVR. Knowing the order tells you where to look when a call fails: each stage rejects the call with its own response code and leaves its own trace in the panel.

Call flow: authenticate, authorize, route, hunt, charge

  1. Authentication finds the account the call belongs to. The switch checks the SIP digest credentials of the request, or matches the remote IP, CLI, CLD and domains against the Authentication Rules of all accounts. If no account matches, the call is rejected and no CDR is written. See Authentication.
  2. Authorization checks that somebody pays for the call. Starting from the account, the switch walks up the chain of customers to the root customer. For each of them it finds the tariff and the rate that matches the called number, compares Balance with Credit Limit, and calculates the maximum duration the caller can afford. A missing rate, a rate marked Forbidden, or an exhausted balance anywhere in the chain rejects the call. See Rating and billing.
  3. Routing builds the list of vendor connections that can take the call. The switch takes the Routing Group of the account (or of the authentication rule that matched), finds the termination routes whose prefix matches the called number, and orders the connections according to the routing policy. See Routing.
  4. Hunting sends the INVITE to the first connection on the list and waits. On a failure response or a timeout it moves to the next connection, until one answers or the list is exhausted. The last response code is returned to the caller.
  5. Charging happens when the call ends. The switch rates the call once per billed entity: the account, every customer in the chain and the vendor. It updates their balances and writes one CDR per entity, which is why the same call appears under Call Records (CDRs) with the customer price and under Vendors Call Records with the vendor price.

While the call is up, the media is relayed by the switch when Use Media Relay is enabled on the connection, and the Max Session Time of the account limits the total duration. See Call timeouts.

  • Account — a SIP identity (username/password or IP) owned by a customer that originates and receives calls and carries its own balance.
  • Customer — a billable entity that owns accounts, has a balance, a credit limit and an assigned tariff.
  • Authentication Rule — a rule that maps incoming calls to an account by remote IP, CLI, CLD or domain.
  • Routing Group — an ordered set of vendor connections and termination routes used to route a call.
  • Connection — a SIP gateway of a vendor with its own host, authentication and capacity.
  • CDR — the call detail record written when a call ends: duration, price, disconnect cause and the entities billed.

The call is rejected with 401 or 403 and there is no CDR

Section titled “The call is rejected with 401 or 403 and there is no CDR”

The call did not pass authentication. Either no authentication rule matches the remote IP and numbers, two rules match with the same weight, or the digest credentials are wrong. Check Tools & Debugs → Test Dialplan with the same CLI, CLD and remote address, and Vendors → Registrations when the caller is a registered device. Calls that fail before authorization are only visible in SIP Logs Viewer.

The account exists but calls to one destination fail

Section titled “The account exists but calls to one destination fail”

Authorization or routing failed for that number. Test Dialplan shows which one: no rate means the tariff of the account or of a customer above it has no prefix for the number; no routes means no termination route in the routing group matches it. A Forbidden rate blocks the destination on purpose.

The call rings for a long time and then fails

Section titled “The call rings for a long time and then fails”

Hunting is trying every connection in turn. Each attempt waits for the 1xx Timeout and 2xx Timeout of the route and the Reply Timeout of the connection before moving on. Shorten the timeouts on vendors that do not respond, or set Huntstop on routes where retrying elsewhere makes no sense.

This is expected. One record is written for every billed entity: the account’s customer sees the customer price, the vendor record shows the termination cost, and a reseller in between gets its own record. Together they show the margin on the call.