ENUM or “peer-to-peer” IP telephony 
You are now an IP telephony user and have installed an Asterisk. You are using an IP Centrex link to a SIP or IAX operator. Go to the next level with peer-to-peer telephony with ENUM.
ENUM is a telephony directory system based on DNS infrastructure and allowing an association between a traditional phone number (using E.164 format) and Internet oriented information. It is possible to store information related to email address, URL but more important for us today: SIP, IAX or H.323 addresses that could be used to be reached through.
ENUM can authorize a smooth transition between the traditional telephony system, where we are using phone numbers, towards pure IP telephony where we will manipulate URI (as email addresses). We are today in between, using IP telephony with traditional phone numbers.
How is ENUM working
As said previously, ENUM is based on DNS. It stores information accessible through this protocol and highly used over the Internet to translate names to IP addresses. With ENUM we are translating phone numbers to internet information like a SIP address for example. The key used in the ENUM base is a traditional phone number but these ones are mostly used nowadays, no issue.
Whenever an IP PBX wants to route a call to a traditional phone number, it could check first if a SIP (or IAX or H.323) record is available in the ENUM base. If such information exists, it could use it to establish a peer-to-peer telephony call, directly over the Internet or any other IP network. If the information isn’t available, the call will be routed through a standard operator (PSTN or Centrex).
How to register
Prior being able to get direct call on your IP PBX, it requires you register your phone number into one of the ENUM databases. Effectively there are multiple ENUM databases, some are maintained by providers, other are free, you can also build your own one for a closed user group. We can consider today that ENUM is not yet widely deployed by telcos since it authorize peer-to-peer calls that will not be billed, nor even supervised.
The easiest way to start is by using the e164.org free service1. Once your account created, you can register two different entries:
- from a PSTN valid number you can link one or multiple IP telephony records (ie a SIP uri),
- from an IP PBX connected to the Internet (directly or through an SBC2 ) get virtual numbers that can be called by any ENUM user. For example, e164.org is providing you with 10.000 numbers for each server you register, enough to start with, isn’t it?
Warning: any ENUM SIP entry at e164.org requires a valid PBX. A validation call will be issued during register in order to avoid fake entries.
How to check a record
Once registered in the system, your ENUM information will be propagated in the DNS system and can be queried by DNS client tool. If you haven’t the dig DNS client on your system, it is a good time to install it.
In order to query the ENUM system, we have to provide it a phone number. The request is similar to a reverse IP address query, we have to rewrite the phone number in reverse for this (try to make it without pen and paper, it is good for brain training). Last, since we are looking for a specific information and not a domain name or an IP address, we will specify the NAPTR type of record. A typical query could looks like:
dig 9.9.9.9.8.7.3.5.0.0.9.9.2.8.8.e164.org. NAPTR
This request query the ENUM database for an IP telephony way to reach the user with the phone number : 88299 005378 9999. This number is not a PSTN number but one from my personal number out of the e164.org range. The answer is:
;; ANSWER SECTION:
9.9.9.9.8.7.3.5.0.0.9.9.2.8.8.e164.org. 600 IN NAPTR
100 10 "u" "E2U+IAX2"
"!^\+88299005378(.*)$!iax2:guest@cislyon.homeip.net/88299005378\1!" .
It is an IAX record followed by a URI that can be directly used through the Asterisk Dial() command.
When your record is in the ENUM database and available through your DNS client, any IP PBX using the ENUM would be able to place a peer-to-peer call to your place.
Asterisk configuration for ENUM
You will find some literature over the Internet to set up your ENUM configuration in Asterisk, but for a quick test, here are the main points.
Receiving calls with IAX
IAX is the Asterisk protocol used to interconnect PBX. This solution has a big advantage: the signalling and voice parts are sharing the same media path, only one UDP port is used for a phone conversation, which is good for firewall and NAT boxes. Once your security infrastructure allows IAX calls to flow in, we have to add few things in the Asterisk configuration.
In iax.conf we add a specific section corresponding to the entry registered in the ENUM. In the previous example, my number 88299 005378 9999 is associated to a user called guest located behind a server called cislyon.homeip.net. The section to add in the configuration is:
[guest]
type=user
context=fromiax
This one is very basic and will probably need some adjustment if needed (ie codec). From a security standpoint, since calls from anywhere over the Internet needs to be accepted, there is no host line3. Any call towards this user will be presented to the fromiax context in the dial plan.
The dial plan is configured in the extensions.conf file and contains any action required to handle a call. The configuration could look like
[fromiax]
; echo pour Enum IAX
exten => 882990053789999,1,Answer()
exten => 882990053789999,n,Echo()
Here, we have an entry corresponding to the phone number and the service proposed is an echo of anything you would say, ideal for testing service, quality and latency4.
Receiving calls with SIP
When dealing with SIP, even if the principle remains the same, we have more things to do and the configuration is a bit different. But first we assume that you can receive SIP calls from the Internet with regards to security measures (firewall, NAT, …).
If you plan using e164.org, you have to set-up the call validation part. One approach is to create a dedicated context in sip.conf. This could differ based on the ENUM provider you may choose. You can add something like:
[enumsip-e164]
type=peer
host=e164.org
qualify=no
context=from-e164org
insecure=very
In the call plan, we have to add a section for this call validation, but since only an INVITE is sent, we limit it to something like:
[from-e164org]
exten => _.,1,Answer()
exten => _.,2,Hangup()
Now we need the specific configuration to accept SIP calls. This part is not trivial since Asterisk wants to validate any peer establishing a SIP session and link it to a context in sip.conf. In our ENUM case, we would like any call to be accepted, by definition we don’t know by advance who will place it. We will for this part use the fallback test proposed by the SIP Asterisk implementation: if a call could not be linked to a context, send it to the dial plan default context. Since any call will arrive in this context we have to be careful on our dialling rules. For example you could do in extensions.conf:
[default]
; echo pour ENUM SIP
exten => 882990065339999,1,Answer()
exten => 882990065339999,n,Echo()
A SIP call to 88299 006533 99995, will arrive to the Echo() application.
Now our Asterisk system is able to get calls, let’s move to the dialling part.
Dialling with ENUM
The idea here is to check whether an ENUM entry exists before using a standard PSTN or SIP provider. The function used is called ENUMLOOKUP and available in the func_enum.so module. This one should be present in the module configuration and the associated enum.conf file in the configuration directory.
The ENUMLOOKUP performs the DNS query to the ENUM provider specified, by default e164.arpa.
Our proposal to add in the extensions.conf file is a macro:
; callENUM *****
; --- get address in ENUM DNS record and dial
; args:
; 1: extension
; 2: domain to lookup
; 3: iax2 or sip
;
[macro-callENUM]
exten => s,1,Set(count=${ENUMLOOKUP(+${ARG1},${ARG3},c,,${ARG2})}|counter=0)
exten => s,n(start),GotoIf($["${counter}" >= "${count}"]?end)
exten => s,n,Set(counter=$[${counter}+1])
exten => s,n,Set(ENUM=${ENUMLOOKUP(+${ARG1},${ARG3},,${counter},${ARG2})})
exten => s,n,GotoIf($["${LEN(${ENUM})}" = "0" ]?start)
exten => s,n,Set(DIALSTR=${ARG3}/${ENUM})
exten => s,n(dodial),Dial(${DIALSTR},30)
exten => s,n,GotoIf($["${DIALSTATUS}"=="CHANUNAVAIL"]?start)
exten => s,n,GotoIf($["${DIALSTATUS}"=="CONGESTION"]?start)
exten => s,n(end),Verbose(Dial failed due to ${DIALSTATUS})
The way it works is: first we check that at least one record is present in the ENUM database (there could be more than one for redundancy purpose). Then we look for a specific record matching a signalling protocol that could be IAX or SIP, then use the answer to perform a Dial(). If the call is not working, we try the next record and return if success-less.
In order to use this macro one could use something like:
exten => _X.,1,Macro(callENUM,${EXTEN},e164.org,iax2)
exten => _X.,2,Macro(callENUM,${EXTEN},e164.org,sip)
exten => _X.,3,Macro(callENUM,${EXTEN},e164.arpa,sip)
Here we try an IAX the SIP call with ENUM record in e164.org. If not working, we try in SIP only with the e164.arpa ENUM database.
Conclusion
We could see here that peer-to-peer IP telephony is technically ready but not yet widely used since the PSTN network is still highly used. The migration towards IP telephony is in progress and initiatives such as ENUM are very good since will allow “operator less IP telephony”. It will remain some issue to solve with regards to regulation and legal monitoring of phone calls which are technically difficult to put in place with peer-to-peer telephony.
Don’t expect to receive a lot of phone calls through your ENUM registery, but the more will use it the more we will have a chance to place free calls using our IP PBX.
|
Posted by: Alexandre Chauvin-Hameau, on 10/19/2007 Trackback | Popularity: 29% tagged centrex, ENUM, extensions.conf, security, SIP, sip.conf and ToIP |
|





