-
Notifications
You must be signed in to change notification settings - Fork 2
Routing
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 from a trunk to the given endpoint. The endpoint determines the organization.
- If the endpoint does not belong to an organization, the call ends with error unknown_source_organization.
- Since #226 The following characters are stripped from the ani and dnis:
+()-.- Since #229 Only trunks with
incoming=trueare considered when analyzing an incoming call. - Since #165, trunks are first looked up by ip:
If one is found, that trunk is chosen.- Local trunks are automatically chosen as candidates.
- If multiple trunks (non-local) are found, all dialrules are applied to get a destination DID with the same organization as the trunk. When a valid DID is found in the database, that trunk is selected.
- If no trunks are found after this first filter, then trunks are looked up by name.
- If none are found, the call ends with error unknown_incoming_trunk.
- If multiple matching trunks are found (this should never happen), the call ends with error too_many_matching_trunks.
- If the trunk belongs to a disabled carrier, the call ends with error carrier_disabled (since #79).
- If the trunk belongs to a carrier other than local, and the carrier's organization is different from the trunk's organization, the call ends with error invalid_carrier_organization.
- If the call is from a subscriber, and the trunk belongs to an organization different than from the subscriber's organization, the call ends with error invalid_subscriber_organization.
- 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
- 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 call is from a subscriber and the E164 number is in one of the call barring lists of the subscriber, the call ends with error destination_not_allowed.
- If the call is from a subscriber and the E164 number is in one of the call barring lists of the trunk, the call ends with error destination_not_allowed.
- If the call is from a subscriber, and the subscriber belongs to an organization different than from the did's organization, the call ends with error invalid_did_organization.
- If the call is from a subscriber, and the routing plan chosen belongs to an organization different than from the subscriber's organization, the call ends with error invalid_routing_plan_organization.
- 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.(See #245). - If there's no tariff to charge an outgoing call, the clal ends with unknown_tariff_for_outgoing_call.
- For on net calls, when the target subscriber and the target did have different organizations, the call will end with invalid_organization_for_target_did.
- For on net calls, any routes are picked up (any organization).
- For off net calls, only routes that belong to the subscriber organization are looked for.
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.
- If the source organization of the call is disabled, the call ends with organization_src_disabled.
- If the target organization of the call is disabled, the call ends with organization_dst_disabled.
- If the source subscriber of the call is disabled, the call ends with subscriber_src_disabled.
- If the target subscriber of the call is disabled, the call ends with subscriber_dst_disabled.
- If the source account of the call is disabled, the call ends with account_src_disabled.
- If the target account of the call is disabled, the call ends with account_dst_disabled.
- If the source organization of the call has exceeded the number of calls for its license, the call ends with org_src_calls_exceeded.
- If the target organization of the call has exceeded the number of calls for its license, the call ends with org_dst_calls_exceeded.
- If the source subscriber of the call has exceeded the number of calls for its license, the call ends with subscriber_src_calls_exceeded.
- If the target subscriber of the call has exceeded the number of calls for its license, the call ends with subscriber_dst_calls_exceeded.
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 (carriers and/or trunks, since #228). 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.