Trunk ANI

When the system sends a call to a trunk, it needs to determine what caller-ID to use for that call. The outbound caller-ID is called ANI (Automatic Number Identification).

The system will use a list of rules to find a ANI. Those rules are part of the trunk settings. There are two rule sets for each trunk: A rule set for regular calls and a rule set for emergency calls. If the call is considered to be an emergency call, the system will first attempt to use the rules for emergency calls. If those rules do not come up with a number, the system will continue with the rules for regular calls.

The result of the matching process is stored in the header variables ani-raw (the number, without modifications) and ani-cnam (the name). There are other forms ani-e164, ani-nanpa, ani-plus, ani-row and ani. available that have the number formatted in the respective interpretation. The variables will be ultimately stored in the from variable. In most cases using the {from} header variable in a SIP trunk header will work just fine.

The list of ANI rules is separated by a space character. Each entry consists of a ANI number or a placeholder for the ANI number; each entry may be filtered by one or more conditions, for example disa:from-cell:from or just 6173998147. If there is no ANI available in a placeholder then the system will skip that entry.

Placeholders

ANI numbers can be entered as the literal telephone number that should be used or using the following placeholders:

  • from: This placeholder will use the caller-ID in the From header of the call. This can be useful when used with the from-trunk condition.
  • orig-from: This is like from, but using the original from header that was not changed e.g. by the auto attendant.
  • ext-ani: This placeholder will use the extension ANI of the extension that will be charged for the call when available (see below).
  • ext-eani: This placeholder will use the extension ANI of the extension that will be charged for the call when available.
  • orig-ani: This placeholder will use the extension ANI of the extension that started the call when available.
  • orig-eani: This placeholder will use the extension ANI of the extension that started the call when available.
  • ext-epid: In case the trunk is set to generate EPID for each extension, this placeholder will contain the EPID.
  • ext-number: This placeholder will search a DID in the account and use it as ANI.
  • ext-alias: This placeholder will use the primary account name, which can be a DID but can also be just an extension number (in version 62.1).
  • dom-ani: This placeholder will use the domain ANI when available.
  • dom-eani: This placeholder contains the emergency ANI for the trunk.
  • acd-ani: This placeholder will use the ACD ANI if the user was logged into this ACD.
  • trunk-ani: If there was a trunk ANI set for the trunk, this placeholder will contain that ANI.
  • trunk-prefix: If there was a trunk prefix set for the trunk and the call is associated with an extension, this placeholder will contain that prefix with the extension number.

Conditions

Conditions can block the usage of a ANI. Conditions for presenting a specific ANI can be prepended to a ANI by separating the condition from the ANI with a colon. If there are multiple conditions that must be met in order to present a caller-ID, multiple colons can be used. Conditions can be negated by putting an ! in front of it.

  • from-trunk: If the call comes from a trunk, this condition will be true.
  • from-cell: When the call comes from a users cell phone, this condition is true.
  • from-teams: When the call comes from a users Teams phone through the Teams trunk, this condition is true (available from version 65.0.5 onwards).
  • from-ext: When the call comes from a users extension, this condition is true.
  • hunt: This condition will be true if this call is a hunt group call (starting version 62.1).
  • acd: This condition will be true if this call is a agent group call (starting version 62.1).
  • clip: If the call should block the caller id (CLIP) then this condition will be true.
  • disa: This condition will be true if this call is a DISA (direct inbound station access) call.

If there is no match with the predefined conditions, the system will try to match the condition with an account in the domain (using wildcards). If it matches a service flag, the state of the service flag will determine if the condition matches. For all other account types, when there is a match the condition is true. Account matches can also be negated, for example !40* will match all accounts that do not start with "40".

Examples

The first example always presents the caller-ID 6173998147:

6173998147

The second example presents the caller-ID of the extension if there is one, otherwise 6173998147:

ext-ani 6173998147

The third example presents the caller-ID of the domain if the call is not a DISA call and the user name that initiates the call starts with "40", otherwise the extension ANI if there is one, otherwise 6173998147:

!disa:40*:dom-ani ext-ani 6173998147

Default behavior

If there is no trunk ANI set up, the system will use the following pattern:

acd-ani ext-ani trunk-prefix dom-ani trunk-ani

For emergency calls the default behavior is this:

ext-epid ext-eani dom-eani

Extension ANI

The ANI field for an extension contains in the most simple case just one phone number. The number can be in the global format starting with the +-symbol (e.g. +16173998147) or in the local format (e.g. 6173998147) or in the human readable format (e.g. 617-399-8147).

The ANI can dependent on the trunk that uses the number. In this case, the syntax for this is trunk:ani, for example Trunk1:6173998147 (this requires that the trunk name does not contain spaces).

You can make the ANI also dependent on the destination. In this case the pattern is +prefix:ani, where the prefix must be the beginning of the global number. For example +1978:9781234567 would use the ANI if the call is being sent to a US-number that starts with 978.

You can combine these methods by separating them with a space. The system will the the first pattern until it has found a match or a simple ANI number. For example the pattern Trunk1:6173998147 +1978:9781234567 7811231234 would first check if the call is on Trunk1, and if not check if the call will be sent to a number starting with 978 and if not, use the number 7811231234.

Versions

This documentation describes the behavior in versions 60.1 and after.