• facebook
  • google
  • linkedin
  • twitter

Digit Replacement

  • Posted on: March 1, 2021
  • By:

The Digit Replacement scheme allows some pre-determined prefix to be added to the dialed number, or replaces a portion of the digits with other digits. This scheme is useful when the BuddyTalk device is configured as an IP phone extension to an IP-PBX as described below.

For a caller using a (IP)phone behind an (IP-)PBX, a small number of digits (e.g. 4 digits) is typically used to represent an internal extension number, and a prefix (e.g. 9) will need to be added to a PSTN number in order to make an external call.  Such a prefix may also differ based on the call destination (e.g. 9 for local calls, 8 for long-distance calls).

While the IP-PBX system Digitmap example given in the previous section can handle users dialing internal or external numbers, it is undesirable and inconvenient when the user is making phone calls using voice commands or through their Tablet Controller or Mobile App since it will require the user to change their Contacts on the Alexa App, the Tablet Controller, and the Mobile App to include prefixes etc.  In this case, a Digit Replacement Rule comes in handy.

The Digit Replacement scheme operates on each Digitmap entry and applies a specific Digit Replacement rule on the digits in each of the Digitmap entries.  The Digit Replacement Rules are separated by a vertical bar “|”, corresponding to the sequence of Digitmap entries.  Here are the replacement rules and their respective actions:

  • “/nnn”: add prefix digits nnn in front of the dialing string
  • “@/nnn”: replace whole dialing string with digits nnn
  • “xxx/nnn”: replace matched digits xxx with digits nnn

Here is an example of the Digit Replacement scheme applied to the IP-PBX system example given above. The dialing plan of this IP-PBX system requires that a prefix be added to the following calling types:

  • 9: prefix. Domestic local calls, e.g., 9 4325400
  • 9: prefix. US national calls, e.g., 9 1 408 432 5400
  • 9: prefix. International calls, e.g., 9 011 65 68720828

Here is the original Digitmap for this IP-PBX system:


Extending the Digitmap to account for calls initiated via voice commands, a Tablet Controller, or a Mobile App, we will have the following augmented Digitmap:

0|[2-7]xxx|9[2-9]xxxxxx|[2-9]xxxxxx |91[2-9]xxxxxxxxx|1[2-9]xxxxxxxxx|9011x.T|011x.T|+x.T|[0-9*].#|*xx

This expanded Digitmap allows users to (a) dial with the prefix when dialing from a POTS phone or (b) without a prefix when making calls using voice commands by contact name or through the Tablet Controller or Mobile App’s Contacts.

To handle such numbers without the required prefix, the corresponding Digit Replacement Rules are:


The rules above automatically add the prefix 9 when the Digitmap matches [2-9]xxxxxx1[2-9]xxxxxxxxx. It also replaces the “+” in the +x.T dialing (meaning a leading “+” and any number of digits followed by a pause longer than the timeout defined in the Digitmap timer rules) with 9011 for an external international call.

Here is the resulting Digitmap and Replacement Rule Settings in the BuddyTalk’s GUI page:

The Digit Replacement process is applicable to the following calling methods:

  • Voice commands with either a contact name or a telephone number
  • BuddyTalk Mobile App through Dial Pad digit dialing, Contacts based dialing, or Call History based dialing
  • BuddyTalk Tablet Controller through Dial Pad digit dialing, Contacts based dialing, or Call History based dialing

Note: Since the Digit Replacement Rules are not applied to POTS dialing, the prefix (9) will still be required when calling an external number from a POTS phone connected to the FXS port of the BT device. Please also note that, when applying the Digitmap rules to POTS phone dialing, the matching is conducted digit-by-digit as the user dials the phone number. Therefore, the first (shortest) match will trigger the software to stop and not consider any subsequent matches. However, when calling via voice commands, Tablet Controller, or the Mobile App, the Digitmap process finds the longest match, and then the corresponding Digit Replacement Rule applies.

Share Button