The exploration of the digital revolution, the mind, and powerful ideas.

P2P SIP dialing!

There are thousands of people that operate their own Asterisk based PBX systems, yet they do not enable any method to allow for p2p sip URI dialing. These sip "targets" are very easy to enable and allow you to dial anyone that has also enabled the function. Dialing with SIP URI completely avoids toll calling and forces your Asterisk server to create P2P sip connections when you dial someone's SIP URI. It makes a less complex phone call without a system administrator configuring a peer and best of all: It gets rid of phone numbers and your telco!

Thank you to BitGravity for the Flash hosting! To play the flash it requires Flash8.

How does it work?

By creating a SRV record in DNS for your domain you can help remote PBX systems establish P2P calls for a specific extensions. For example, when someone calls me, my URI is resolved to my PBX ( When the call comes into my Asterisk box, blyon is setup as a extension, and that extension is connected to a phone or a context. As a result, if someone uses something like Xten to call, I get a normal ring and phone call. When I use my Cisco 7960 phone and dial someone's SIP URI it completes like a normal phone call.

Why is this cool?

This is great because it takes away any central control for locating people. The ENUM standard is nice, but gives someone else control over the mapping database and it keeps an ugly old phone numbers in place. I really don't want to dial phone numbers 10 years from now, I much rather just give someone my email address and have that map to my phone. If I need to call a business, I much rather just call then find some obscure phone number.

If more people adopt this as a standard, it will be the method of choice for calling people and it puts power into the end user's hands!

Configuring the DNS SRV Record

Much like an MX record that defines mail servers for a domain, you can use an SRV record to define your PBX server for a domain. My domain has a PBX and I simply created the SRV record for it:

In bind it would look something like this:

_iax._udp               SRV     10 10 4569
_sip._udp               SRV     10 10 5060

SIP and IAX2 are also host names that point to my PBX. When someone dials my URI, their client or PBX will do a DNS lookup and see that sip is available on port 5060 at

IAX records are not needed to make SIP URI dialing work. It is listed here to show that you can use other protocols like IAX.

Create a whitepage TXT record

To make it easy on others to locate your public extensions you should also create a protocol whitepage listing. I suggesst you map your user's email addresses to extensions. If you do enable extensions to email addresses, you will want to include "email_addr" in your TXT record. A sample in bind looks like this:

sip.whitepage		TXT	"email_addr, home, echo, pbx"

"sip.whitepage" is the SIP protocol whitepages txt record, the first "email_addr" tells people that email addresses are mapped to extensions, and other non-email address extensions are listed. You should list each extension seperated by a comma.

This TXT record is not a standard RFC, it's something I thought would be helpful for people to establish SIP communications. This is not needed to make the system work.

Configuring Asterisk to accept inbound URI calls:

Under [general] in sip.conf make sure the following is allowed:

context=in                      ; Context for incoming calls
allowguest=yes                  ; Allow or reject guest calls (default is yes, this can also be set to 'osp'
bindport=5060                   ; UDP Port to bind to (SIP standard port is 5060)
srvlookup=yes                   ; Enable DNS SRV lookups on outbound calls

My specific context is "in" that's where these calls go in the extensions.conf, this is the same place that I send inbound calls from a telco or another sip peer. Under your version of the "in" context just define your username mapping:

exten => blyon,1,Macro(doDialExten,${BARRETT-VM},${BARRETT-HOME})

I have BARRETT-VM and BARRETT-HOME setup so that it rings my home office and then sends the caller to voicemail if I don't answer. So rather than putting my extension there, I just define my username that will be picked apart by Asterisk and matched.

Configuring Asterisk to accept outbound URI calls:

When you define a sip proxy for things like a Cisco 7960 or Xten, they forward all URI calls to the proxy. Asterisk does not have any idea what to do with them so they usually 404 error and as a result you can't make your free calls to your buddy that also set this up and operates Asterisk. There is a simple fix however, in your dial plan after you have defined your local extensions and usernames, and after your _1XXX... toll definitions simply add this uri context or the exten directly into your dialplan:

exten => _[a-z].,1,Macro(uridial,${EXTEN}@${SIPDOMAIN})
exten => _[A-Z].,1,Macro(uridial,${EXTEN}@${SIPDOMAIN})
exten => _X.,1,Macro(uridial,${EXTEN}@${SIPDOMAIN})

Next make sure you add the macro into the extensions.conf in the area where you have your other macros defined:

exten => s,1,NoOp(Calling remote SIP peer ${ARG1})
exten => s,n,Dial(SIP/${ARG1},120,tr)
exten => s,n,Congestion()

After local extensions are not matched and toll extensions are not matched it will then take the call and make a SIP connection and away you go! Asterisk splits everything past the "@" in the call and makes an ${EXTEN} variable and a ${SIPDOMAIN} variable. If we match an lowercase alpha character in the ${EXTEN} then we simply just dial the EXTEN@SIPDOMAIN and away you go!

Dialing with a free "Soft Phone"

Any "soft phone" that can dial sip numbers including Micscrewsoft NetMeeting can now be used to make free inbound calls to your Asterisk box. If you setup an extension called pbx that goes to your main phone tree, and someone calls, they would get your main tree just as if they called via a toll system. You can also do SIP calls without any fancy DNS by specifying the full hostname to the Asterisk/PBX:

This requires you to know the exact IP or hostname of the Asterisk PBX, rather it would be more simple to have the one time DNS record and then you can give your

Dialing the URI with DNS is simply:,, or foo@bar given there are functioning SRV records.

Use Xten without any provider or special settings to call a SIP URI

If you would like to directly dial to another URI without setting up a SIP proxy, X-Lite allows for this option. To configure the direct dialing just go to System Settings -> SIP Proxy menu:

Enabled: Choose "Yes"
Display Name: Your calling name, maybe Joe Daly's PC
Domain/Realm: Just put your ISP or local domain
Direct Dial IP: choose "Yes"

To make a call, simply specify the URI and away you go!

This works great for dialing out, I have not spent any time to figure out how to accept P2P URI calls just via a raw softphone client, but I am sure they support it. If you know how to do this email me and I will add it to this doc.

SIP URI and Vonage

When I was a vonage user people could dial me by calling: sip:{Vonage_Phone Number 10 digits} This is a SIP URI but it would be much more clean if they had created SRV records for

Dialing URI with an ATA

This is doable but a little more complex, but for a free call, who cares? The '@' is dialed as "**", and '.' and ':' are dialed as a '*'. If you were to dial, it would be dialed like this: 10000000000**12*144*47*38

To keep it easy we have replaced the hostname of with the IP address (12*144*74*38). This really sucks having to dial using an IP address, so you may want to setup an exten for old phones that don't support URI. Someone may also be kind and give us some clue on how to dial alpha with a standard phone, I am sure you can do it somehow.

To setup an exten for the URI to make it simple (if you are using Asterisk):

; Bob
exten => 1100,1,DIAL(SIP/,120,tr);

Test it!!!

I have setup an echo test so you can just call into the system and see how it goes, just dial:

You can also test your SRV and TXT records by running the dig command:
# dig SRV

;; ANSWER SECTION:    1200    IN      SRV     10 10 5060

# dig TXT

;; ANSWER SECTION: 408 IN    TXT     "email_addr, home, echo, pbx"

You can also use my test form to see if your domain or others are configured for SIP URI.

I also want to thank Victor Oppleman over at Vostrom for his help and research on this fun quick project, he's a really smart guy!