What is ENUM?
ENUM is an extension to DNS. Whilst DNS is normally used to translate human-understandable names to IP addresses,
ENUM uses DNS to translate human-understandable telephone numbers into service addresses that a telephone system
understands. Eventhough a telephone number is not the most under-friendly entity, it is what people are used to when
they use the telephone. ENUM is very useful for VoIP, and that is what this article focuses on.
The official ENUM domain is e164.arpa. However, at the time of writing this is only partially live for
the US, and not at all for most other countries in the world. In the UK, for example, they are still in the process
of selecting who is going to run the UK branch of that domain, so it could be a while before this will actually happen.
There are, however, a few unofficial ENUM domains. The most important one is e164.org.
How to set yourself up in there may be another article in the future, although it is pretty self-explanatory.
How does ENUM work?
An ENUM domain is a very large branched telephone directory, where each level represents a digit of a telephone number.
For example, UK telephone number 01908-234567 can be found in e164.org under:
Reading from right to left: The two digits '4' represent the UK's country code 44. The '1', '9', '0' and '8' represent
area code 01908 (We lose the first '0' as this is not used in international dialing). The remainng six levels represent
the number 234567 within that area code. Find yourself a number for someone that you know has ENUM set up, and do a lookup
for NAPTR records, and you'll see the record(s) stored.
Most important for Trixbox are SIP entries and IAX2 entries. If there is a SIP or IAX2 entry for a number, then your Trixbox
should be able to set up a VoIP connection directly to that SIP address, bypassing the PSTN. For PSTN calls you need an account
with a VSP (or a physical
telephone line), and such calls are (usually) not free. The beauty of ENUM is that if an entry exists for a
particular phone number, you just dial the normal PSTN telephone number from your phone, but get connected over VoIP.
It is possible to store multiple NAPTR records for a telephone number, which provides a fallback mechanism. Each entry has
a priority value. Entries are used in order of ascending priority value (i.e. priority '10' before priority '20').
Configuring Trixbox with ENUM
Trixbox has all the code that is needed to do ENUM lookups. I have seen some references on the net that tell you that Asterisk only
looks at the first entry it finds, but that just depends on the scripts. The scripts in Trixbox 2.2 try multiple entries in the
correct order. The scripts also look at multiple ENUM domains: e164.arpa, e164.info and e164.org.
You probably don't know (and don't want to know) who has an ENUM entry set up and who hasn't, but if someone you are going
to call has an ENUM entry, then you would want to use that, thus avoiding PSTN charges. If there is no ENUM, then you have no
other choice than to be routed through the PSTN. The Trixbox scripts make it very easy to use ENUM whenever possible and
fallback to PSTN otherwise
Step 1: Create an ENUM trunk
This should be the easiest part of it all, but I found a bug in the released version of Trixbox 2.2 (More on that later).
To set up an ENUM trunk, do the following:
- Click on "Setup" in the top bar.
- Click on "Trunks" in the left bar.
- Click on "Add ENUM Trunk" (4th option)
- In the Dial Rules box, enter "00|.".
- And click the "Submit Changes" button
You should now see a trunk on the right-hand side, called "ENUM/". (If not, see below for a fix)
Step 2: Set up an outbound route
You would normally want to integrate ENUM with your existing routes, but for now we are going to create a test route:
- Click on "Outboung Routes" in the left bar.
- Enter a Route Name ("Enum Test" would do nicely)
- In the Dial Patterns box, enter "95|." (I use '95' as a prefix to select this route. You may want to use another prefix)
- In the "Trunk Sequence", select "ENUM/" as the first and only trunk.
- And click the "Submit Changes" button
Finally, click the red "Apply Configuration Changes" bar at the top of the screen to reload your Trixbox configuration.
Test your ENUM trunk
To test your ENUM trunk, you will need to know someone who has ENUM set up. If you have already configured your own phone number
in e164.org, then you can use that. To test it, you will need to dial the prefix '95', followed by the full international phone
number including the '00'. So, the telephone number in the example above would be dialled as 9500441908234567.
Fine-Tuning the Configuration
It may be great to see your ENUM trunk working, but you (or your users) don't actually want to know about it... In this section,
we'll fine-tune the ENUM setup so that it integrates with your existing system.
Step 1: Tailor the trunk
The ENUM system is based on full international telephone numbers (but without the leading '00'). You will want to tailor the
dialing rules for the ENUM trunk to allow national and local dialing. You will need to go back to your ENUM trunk and change the
Dialing Rules to three lines. The following example shows what it would be for UK area code 01908:
||For international dialing. It strips the '00' from the number and passes the rest to the ENUM module.
||For national dialing. It strips the '0' from the number and replaces it with the UK country code '44'.
||For local dialing. The 'NXXXXX' makes it valid only for six-digit numbers starting with 2-9, and pre-pends the country and area code to it.
You will of course need to tailor this for whatever country and area code you are in.
Step 2: Tailor your outbound route(s)
You probably want ENUM to be as transparent as possible. If an ENUM record exists for a particular number, you want to use it.
But if no ENUM record exists, you will want to make the call over whatever you normally use for PSTN calls (either a preferred VSP
or a PSTN line). You configure this by simply adding the ENUM trunk to the existing routes. Make sure that ENUM comes before any
of the others: Add the ENUM trunk as a new entry in the Trunk Sequence for a route, and then use the arrow buttons to move it to the top.
You may want to be able to bypass ENUM in case you encounter problems with someone having set up their ENUM record badly. You can
do this by adding a new Outbound Route with the original Trunk Sequence of the main route, but with the dial patterns prefixed with
a special code, for example the '95' we used to set up the test ENUM route.
Once you are done, you can delete the ENUM test trunk we created earlier. Or leave it for testing purposes anyway.