[Asterisk-Users] sip registration problems

Juha Heinanen jh at lohi.eng.song.fi
Fri Apr 11 07:57:27 MST 2003


Mark Spencer writes:

thanks for getting to back to this.

 > > register => uri:username:password
 > 
 > Is this something like the ;user=phone thing?  How is this supposed to be
 > applied?  You can send me a sip dump off-list of what this should look
 > like.

no, this is not user=phone thing (although adding user=phone would be ok
if the user part of the uri is known to be a phone number).

as an example, here is how i have configured my sip phone:

uri:		sip:+358333983950 at testi.fi
username:	jh
password:	xxxxx

it tries to register as follows:

REGISTER sip:testi.fi SIP/2.0
Via: SIP/2.0/UDP 195.10.149.20:5062
CSeq: 253 REGISTER
To: "Juha Heinanen" <sip:+358333983950 at testi.fi>
Expires: 900
From: "Juha Heinanen" <sip:+358333983950 at testi.fi>
Call-ID: 1697793338 at 195.10.149.20
Content-Length: 0
Event: registration
Allow-Events: presence
Contact: "Juha Heinanen" <sip:jh at 195.10.149.20:5062;transport=udp>;methods="INVITE, MESSAGE, INFO, SUBSCRIBE, OPTIONS, BYE, CANCEL, NOTIFY, ACK"

and gets back a challenge:

SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 195.10.149.20:5062
CSeq: 253 REGISTER
To: "Juha Heinanen" <sip:+358333983950 at testi.fi>;tag=471585ff27087f38b6354e2831a569aa.e8fc
From: "Juha Heinanen" <sip:+358333983950 at testi.fi>
Call-ID: 1697793338 at 195.10.149.20
WWW-Authenticate: Digest realm="testi.fi", nonce="3e96d34f72e9e6a694878f7627027145839aedb8", qop="auth"
Server: Sip EXpress router (0.8.11pre15-new_parse_uri (i386/linux))
Content-Length: 0

to which it replies with an authorization header based on the configured
username and password: 

REGISTER sip:testi.fi SIP/2.0
Via: SIP/2.0/UDP 195.10.149.20:5062
CSeq: 254 REGISTER
To: "Juha Heinanen" <sip:+358333983950 at testi.fi>
Authorization: Digest username="jh", realm="testi.fi", nonce="3e96d34f72e9e6a694878f7627027145839aedb8", uri="sip:195.10.149.20", qop=auth, cnonce="abcdefghi", nc=00000001, response="c20cd09a2283eeb2d41b473fd7099bf4", opaque=""
Expires: 900
From: "Juha Heinanen" <sip:+358333983950 at testi.fi>
Call-ID: 1697793338 at 195.10.149.20
Content-Length: 0
Event: registration
Allow-Events: presence
Contact: "Juha Heinanen" <sip:jh at 195.10.149.20:5062;transport=udp>;methods="INVITE, MESSAGE, INFO, SUBSCRIBE, OPTIONS, BYE, CANCEL, NOTIFY, ACK"

 > > and then asterisk should make an srv lookup on _sip._udp + the host part
 > > of the uri prefixed by to figure out where to send the registration
 > > request.
 > 
 > Is this just a regular gethostbyname() or is this something more complex?
 > Do you have a spec you can point to?

the resolver procedure is documented in rfc 3263.  it is quite complex,
because first an naprt lookup should be done and then an srv query.  if
asterisk only support udp, it could skip the naptr query and just query
the svr record of _sip._udp.domain-in-question or if it supports both
tcp and udp and possibly also sips (tls), it could try the names in the
order it prefers.  here is an example from the rfc:

  As an example, consider a client that wishes to resolve
   sip:user at example.com.  The client performs a NAPTR query for that
   domain, and the following NAPTR records are returned:

   ;          order pref flags service      regexp  replacement
      IN NAPTR 50   50  "s"  "SIPS+D2T"     ""  _sips._tcp.example.com.
      IN NAPTR 90   50  "s"  "SIP+D2T"      ""  _sip._tcp.example.com
      IN NAPTR 100  50  "s"  "SIP+D2U"      ""  _sip._udp.example.com.

   This indicates that the server supports TLS over TCP, TCP, and UDP,
   in that order of preference.  Since the client supports TCP and UDP,
   TCP will be used, targeted to a host determined by an SRV lookup of
   _sip._tcp.example.com.  That lookup would return:

   ;;          Priority Weight Port   Target
       IN SRV  0        1      5060   server1.example.com
       IN SRV  0        2      5060   server2.example.com

if implementing srv lookup sounds too complex, the replacement is to
allow manual configuration of the so-called outbound proxy to which ALL
requests are sent and that then knows how to make the proper queries.

so the following should be fine to start with:

outboundproxy =	ip-address-or-domain-name[:port]

register => uri-to-be-registered-as:authentication-username:password

 > That's all extensions.conf.

thanks, i'll take a look at it.

-- juha



More information about the asterisk-users mailing list