-
Notifications
You must be signed in to change notification settings - Fork 2
Routing
This is done by the switch_route module module.
Here's a brief description of the first steps in a call lifecycle. The term trunk is used intensively here, so you might want to also read the Trunks wiki entry.
- New call in a trunk.
- The name of the trunk is used to find a trunk in the system.
- If none is found, the call ends with error unknown_incoming_trunk.
- If the trunk does not belong to an organization, the call ends with error trunk_without_organization.
- If the trunk belongs to a disabled carrier, the call ends with error carrier_disabled (since #79).
- If found, the incoming dialrules of the trunk (ani) are used to translate the ani to E164.
- If the ani can't be translated to E164, the call ends with error cant_translate_incoming_ani
- If found, the incomig dialrules of the trunk (dnis) are used to translate the dnis to E164.
- If the dnis can't be translated to E164, the call ends with error cant_translate_incoming_dnis
- If the trunk belongs to a client, the ani in e164 format is used to search for a did in the system:
- The call ends with error client_using_unknown_did if none is found.
- If a did is found, but it's owned by a different subscriber, the call ends with ani_in_wrong_trunk.
- If the trunk belongs to a client, the numbering plan dial rules are used to translate the dnis into E164.
- If the dnis can't be translated to E164, the call ends with error cant_translate_dnis_by_numplan.
- For on net calls, the plan assigned to the target dnis will be checked to know if it allows incoming calls, if not, the call ends with incoming_calls_not_allowed_for_client.
- For on net calls, when an incoming call should be charged but there's no tariff for that specific combination of ani/dnis, the call ends with unknown_tariff_for_incoming_call.
- All off net calls from trunks that don't belong to a subscriber or an internal trunk, are denied with the error unknown_source_for_offnet_call.
- All calls where the subscriber can't be identified correctly, ends with error unknown_source_for_offnet_call.
- If the call is on net, but the destination did is not assigned to a trunk, the call ends with cant_route_to_local_unallocated_did.
- For off net calls, routes are selected based on the routing plan of the originating did. See [Below](#selecting routes) for the details.
See Hangup Causes.
Every DID is assigned a routing plan. A routing plan is just a sorted collection of route categories. Route categories are basically tags, used to group routes. A route plan usually looks like this
premium - normal - low
Meaning that routes will be searched for, and tried in that particular order (i.e: first, all the available premium routes, then, all the normal ones, and then the ones in the low category).
For every one of those categories, all available routes are selected (just 1 per trunk carrier (since #117), the one that best matches the destination), and then sorted by LCR.