If you run an Asterisk PBX you can easily perform ENUM lookups to make direct peer-to-peer calls with other ENUM users. The way this works is a user dials a public telephone number (i.e. 1-718-555-1234). Your Asterisk box queries one or more e164 name servers for that number. If the number is listed, the lookup will return the dial string to connect directly over the Internet instead of going through the Public Switched Telephone Network. Can you say free? If the number is not listed, then go and process the call as usual with your telephone carrier.
Put these lines into your enum.conf file:
search => e164.org
search => e164.arpa
Here are the ENUM lines I insert in my extensions.conf just before my standard call to my telephone carrier.
This is for Asterisk version 1.4
[macro-dial_inet]
;
; Send call to selected Internet providers
; ${ARG1} - What to dial
;
exten => s,1,noop(macro-dial_inet)
;--- ENUM ---
;try enum first since it's free
exten => s,n,NoOp(Doing Enum lookup)
exten => s,n,Set(registrars=e164.arpa-e164.org-e164.info-enum.org-e164.televolution.net) ; place your registrars to search here
exten => s,n(regloop),Set(registrar=${CUT(registrars,,1)})
exten => s,n,Set(registrars=${CUT(registrars,,2-)})
exten => s,n,Set(protocols=SIP-IAX2) ; place your protocols to search here (i.e. SIP-IAX2-IAX-H323)
exten => s,n(protoloop),Set(protocol=${CUT(protocols,,1)})
exten => s,n,Set(protocols=${CUT(protocols,,2-)})
exten => s,n,Set(enumARG1=${ARG1})
exten => s,n,ExecIf($[ ${ARG1:0:3} = "011"],Set,enumARG1=${ARG1:3})
exten => s,n,Set(count=${ENUMLOOKUP(+${enumARG1},${protocol},c,,${registrar})})
exten => s,n,Set(counter=0)
exten => s,n(resultloop),GotoIf($[$["x${counter}"="x"]|$["${counter}" >= "${count}"]]?resultend)
exten => s,n,Set(counter=$[${counter}+1])
exten => s,n,Set(ENUM=${ENUMLOOKUP(+${enumARG1},${protocol},,${counter},${registrar})})
exten => s,n,GotoIf($["${LEN(${ENUM})}" = "0" ]?continue)
exten => s,n,Set(DIALSTR=${protocol}/${ENUM})
exten => s,n,Dial(${DIALSTR}|120)
exten => s,n,GotoIf($[$["${DIALSTATUS}"="CHANUNAVAIL"]|$["${DIALSTATUS}"="CONGESTION"]]?continue:hangup)
exten => s,n(continue),Goto(resultloop)
exten => s,n(resultend),GotoIf($["${protocols}"=""]?regend:protoloop)
exten => s,n(regend),GotoIf($["${registrars}"=""]?fallthrough:regloop)
exten => s,n(hangup),NoOp(Dial failed due to ${DIALSTATUS})
exten => s,n,Hangup
exten => s,n(fallthrough),NoOp(Found No Enum Entry)
;--- CONTINUE WITH TELEPHONE CARRIER ---
That’s all you need to check for and use ENUM records. Now you might want to return the favor by listing your own telephone number(s) in one of the e164 databases. If you are not a telephone carrier then the easiest way is to create an account on www.e164.org. Then add this to your iax.conf file so that anonymous connections can be made to your Asterisk PBX.
[guest]
type=user
context=anonymous
Then in your extensions.conf file, add an [anonymous] context that allows connections to your receptionist. Here is an example:
[anonymous]
exten => _X.,1,Dial(SIP/0) ;send the call to the receptionist
exten => _X.,n,Hangup