[Asterisk-Users] how does a sip://user@dom.ain url come in

John Todd jtodd at loligo.com
Wed May 19 01:13:14 MST 2004


At 5:58 PM -0400 5/18/04, James H. Cloos Jr. wrote:
>  >>>>> "Randy" == Randy Bush <randy at psg.com> writes:
>
>Randy> how does a call to sip://user@my.dom come in to asterisk so i
>Randy> can route it?
>
>I beleive it comes in to extension user in the default context:
>
>[default]
>exten => user,1,whatever...
>
>You'll need to look in the variable ${SIPDOMAIN} to differentiate
>eg user at my.dom from user at dom.ain.
>
>-JimC

This is correct, but perhaps not enough information to get started.

The important part is that if you're expecting SIP users on the "wild 
Internet" to be sending in SIP requests to your host, then you need 
to funnel them in from whatever context is specified in the [general] 
section of sip.conf.  At the moment, let's not care about the my.dom 
part of the URI, and we'll assume that we're just matching against 
the "user" portion of the URI.  If you want to match on domain, 
you'll need to get clever with the ${SIPDOMAIN} variable and 
GotoIf's, but that's for the truly masochistic.  Example of a simple 
config:


[general]
srvlookup = yes
disallow=all
allow=ulaw
allow=alaw
allow=g729
allow=gsm
allow=ilbc
port = 5060                     ; Port to bind to
bindaddr = 0.0.0.0              ; Address to bind to
context = from-sip              ; Default for incoming calls
; etc. etc.


Now, in extensions.conf:

[from-sip]
;
; let's assume billy at this.asterisk.server maps to a phone
;  which is known as "1234" somewhere in sip.conf
;
exten => billy,1,Dial(SIP/1234)
;
; same for jane, but she's at phone 2229
;
exten => jane,1,Dial(SIP/2229)
;
; let's add some aliases for Jane, which simply loop
;  back into the same context, but with a new ${EXTEN}
;  of the "canonical" name for jane.
;
exten => jane.smith,1,Goto(from-sip,jane,1)
exten => janesmith,1,Goto(from-sip,jane,1)
;
; end

Now, if you were using SRV records you could map things inbound to 
your domain (my.dom) to actually point to your Asterisk server 
(asterisk.my.dom) so long as the remote side respects SRV records. 
Furthermore, your ENUM entries (if you have them somewhere) could 
point to your SIP URI (billy at my.dom)   For what should be a working 
example, see jtodd at loligo.com (dig @ns.fox-den.com SRV 
_sip._udp.loligo.com)

JT




More information about the asterisk-users mailing list