Friendly SIP URIs in Asterisk
I have typed this info into several irc privmsgs in the last month, so I’ll write up how to setup ‘friendly’ sip uris with Asterisk.
Firstly let’s look at DNS. Say my email address is abc@example.com. The A record for example.com probably points to example.com’s webserver, so that people who skip the www can still see your website. Therefore, if you don’t run Asterisk on the web-server, how do you redirect packets to your voip server ?
The answer is the service (SRV) record. If example.com’s voip server was ‘voip-in.example.com’, your SRV record would look something like this :
_sip._udp IN SRV 1 0 5060 voip-in.example.com.
You then need to configure Asterisk to handle the sip packets properly. The default domain on this asterisk box is probably ‘voip-in.example.com’. Fortunately, multi-domain support is pretty easy, you just have multiple ‘domain’ lines, thus :
domain=example.com,visitors
…which would send requests for abc@example.com to the ‘abc’ extension in the [visitors] context in your dialplan.
The easy thing to do here is to just force requests to for the email-form sip uris to ‘goto’ the right section of the dialplan in your ‘normal’ phone dialplan, e.g.
[visitors]
exten => abc,1,Goto(default,1001,1)
This avoids lots of duplication. Ensure that your default/unauthenticated sip contexts do not allow access to your pstn gateway!
Posted: May 15th, 2007 under Sys Admin, voip.
Comments: none

Write a comment
You must be logged in to post a comment.
Related articles