[Asterisk-Users] SIP register problem

Cyrille Demaret cyrille at easynet.be
Tue Nov 16 11:39:28 MST 2004


Hi,

Thank you for your answer.

Unfortunately, pedantic does not help.  

Here's an ngrep dump of the corresponding packet.

U 212.3.244.8:5060 -> 123.123.123.123:5060
  53 49 50 2f 32 2e 30 20    34 30 31 20 55 6e 61 75    SIP/2.0 401 Unau
  74 68 6f 72 69 7a 65 64    0d 0a 56 69 61 3a 20 53    thorized..Via: S
  49 50 2f 32 2e 30 2f 55    44 50 20 32 31 33 2e 31    IP/2.0/UDP 213.1
  38 36 2e 35 34 2e 37 35    3a 35 30 36 30 3b 62 72    86.54.75:5060;br
  61 6e 63 68 3d 7a 39 68    47 34 62 4b 32 34 62 64    anch=z9hG4bK24bd
  32 34 32 31 0d 0a 46 72    6f 6d 3a 20 3c 73 69 70    2421..From: <sip
  3a 30 30 33 32 32 34 30    33 30 37 39 36 30 40 73    :0032240307960 at s
  69 70 2e 61 71 75 61 6e    74 61 2e 63 6f 6d 3e 3b    ip.aquanta.com>;
  74 61 67 3d 61 73 32 33    38 65 31 66 32 39 0d 0a    tag=as238e1f29..
  54 6f 3a 20 3c 73 69 70    3a 30 30 33 32 32 34 30    To: <sip:0032240
  33 30 37 39 36 30 40 73    69 70 2e 61 71 75 61 6e    307960 at sip.aquan
  74 61 2e 63 6f 6d 3e 3b    20 74 61 67 3d 39 6c 21    ta.com>; tag=9l!
  68 43 32 5a 71 38 5a 66    57 47 39 21 70 57 47 63    hC2Zq8ZfWG9!pWGc
  4a 46 41 0d 0a 43 61 6c    6c 2d 49 44 3a 20 36 62    JFA..Call-ID: 6b
  38 62 34 35 36 37 33 32    37 62 32 33 63 36 36 34    8b4567327b23c664
  33 63 39 38 36 39 36 36    33 33 34 38 37 33 40 32    3c986966334873 at 2
  31 33 2e 31 38 36 2e 35    34 2e 37 35 0d 0a 43 73    13.186.54.75..Cs
  65 71 3a 20 31 30 32 20    52 45 47 49 53 54 45 52    eq: 102 REGISTER
  0d 0a 44 61 74 65 3a 20    54 75 65 2c 20 31 36 20    ..Date: Tue, 16 
  4e 6f 76 20 32 30 30 34    20 31 38 3a 33 38 3a 33    Nov 2004 18:38:3
  39 20 47 4d 54 0d 0a 53    65 72 76 65 72 3a 20 53    9 GMT..Server: S
  49 50 71 75 65 73 74 2d    53 49 50 2d 53 65 72 76    IPquest-SIP-Serv
  65 72 2f 32 2e 32 0d 0a    43 6f 6e 74 65 6e 74 2d    er/2.2..Content-
  4c 65 6e 67 74 68 3a 20    30 0d 0a 57 57 57 2d 41    Length: 0..WWW-A
  75 74 68 65 6e 74 69 63    61 74 65 3a 20 44 69 67    uthenticate: Dig
  65 73 74 20 72 65 61 6c    6d 3d 22 73 69 70 2e 61    est realm="sip.a
  71 75 61 6e 74 61 2e 63    6f 6d 22 2c 0d 0a 09 6e    quanta.com",...n
  6f 6e 63 65 3d 22 4c 30    6d 61 51 56 75 67 48 54    once="L0maQVugHT
  6e 7a 66 33 42 61 56 49    58 57 72 74 77 58 39 4a    nzf3BaVIXWrtwX9J
  6b 3d 22 2c 0d 0a 09 73    74 61 6c 65 3d 46 41 4c    k=",...stale=FAL
  53 45 2c 0d 0a 09 61 6c    67 6f 72 69 74 68 6d 3d    SE,...algorithm=
  4d 44 35 2c 0d 0a 09 71    6f 70 3d 22 61 75 74 68    MD5,...qop="auth
  22 0d 0a 0d 0a

The characters at the beginning of the "WWW-Authenticate" lines are CR LF
and TAB.

Sincerely,

Cyrille Demaret


-----Message d'origine-----
De : asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] De la part de Karl Brose
Envoyé : mardi 16 novembre 2004 19:05
À : Asterisk Users Mailing List - Non-Commercial Discussion
Objet : Re: [Asterisk-Users] SIP register problem

Is the SIPquest server sending the 401 Unauthorized message verbatim as 
you printed it here?
I.e. is the WWW-Authentcate header broken up into several lines like that?
If so, how man spaces are actually at the beginning of each new line?
Continuation lines are allowed in SIP, but I think it's only one space 
at the beginning of each new line.
To make Asterisk parse this correctly you need to turn on
pedantic=yes

It's silly that Asterisk doesn't turn this header parsing on by default, 
no reason not to.
If this fixes your problem, you should edit the sip source code and 
remove the if clause
before calling lws2sws(blah blah)  there is only one instance in the code.
pedantic=yes may break other things for you.


Cyrille Demaret wrote:

> Hi,
>
>  
>
> I'm trying to register Asterisk with my sip provider but I've a 
> problem. Here's the log file :
>
>  
>
> REGISTER sip:sip.aquanta.com SIP/2.0
>
> Via: SIP/2.0/UDP 123.123.123.123:5060;branch=z9hG4bK2810ee43
>
> From: <sip:0032123456789 at sip.aquanta.com>;tag=as2e43c573
>
> To: <sip:0032123456789 at sip.aquanta.com>
>
> Call-ID: 6b8b4567327b23c6643c986966334873 at 123.123.123.123
>
> CSeq: 105 REGISTER
>
> User-Agent: Asterisk PBX
>
> Expires: 120
>
> Contact: <sip:s at 123.123.123.123>
>
> Event: registration
>
> Content-Length: 0
>
>  
>
>  (no NAT) to 212.3.244.8:5060
>
> ziki5*CLI>
>
>  
>
> Sip read:
>
> SIP/2.0 401 Unauthorized
>
> Via: SIP/2.0/UDP 123.123.123.123:5060;branch=z9hG4bK2810ee43
>
> From: <sip:0032123456789 at sip.aquanta.com>;tag=as2e43c573
>
> To: <sip:0032123456789 at sip.aquanta.com>; tag=lPaMk9ATvmCVvvGpOPJFkg
>
> Call-ID: 6b8b4567327b23c6643c986966334873 at 123.123.123.123
>
> Cseq: 105 REGISTER
>
> Date: Tue, 16 Nov 2004 17:23:15 GMT
>
> Server: SIPquest-SIP-Server/2.2
>
> Content-Length: 0
>
> WWW-Authenticate: Digest realm="sip.aquanta.com",
>
>         nonce="hDeaQQR5yOCHgx8YjKqI5zOcB1w=",
>
>         stale=FALSE,
>
>         algorithm=MD5,
>
>         qop="auth"
>
>  
>
>  
>
> 14 headers, 0 lines
>
> 12 headers, 0 lines
>
> Reliably Transmitting:
>
> REGISTER sip:sip.aquanta.com SIP/2.0
>
> Via: SIP/2.0/UDP 123.123.123.123:5060;branch=z9hG4bK06fcb9f0
>
> From: <sip:0032123456789 at sip.aquanta.com>;tag=as2e43c573
>
> To: <sip:0032123456789 at sip.aquanta.com>;tag=lPaMk9ATvmCVvvGpOPJFkg
>
> Call-ID: 6b8b4567327b23c6643c986966334873 at 123.123.123.123
>
> CSeq: 106 REGISTER
>
> User-Agent: Asterisk PBX
>
> Authorization: Digest username="0032123456789", 
> realm="sip.aquanta.com", algorithm=MD5, uri="sip:sip.aquanta.com", 
> nonce="", response="854c3960f84b454af9d25fcfdb0aaee4", opaque=""
>
> Expires: 120
>
> Contact: <sip:s at 123.123.123.123>
>
> Event: registration
>
> Content-Length: 0
>
>  
>
>  (no NAT) to 212.3.244.8:5060
>
> ziki5*CLI>
>
>  
>
> Sip read:
>
> SIP/2.0 401 Unauthorized
>
> Via: SIP/2.0/UDP 123.123.123.123:5060;branch=z9hG4bK06fcb9f0
>
> From: <sip:0032123456789 at sip.aquanta.com>;tag=as2e43c573
>
> To: <sip:0032123456789 at sip.aquanta.com>;tag=lPaMk9ATvmCVvvGpOPJFkg
>
> Call-ID: 6b8b4567327b23c6643c986966334873 at 123.123.123.123
>
> Cseq: 106 REGISTER
>
> Date: Tue, 16 Nov 2004 17:23:15 GMT
>
> Server: SIPquest-SIP-Server/2.2
>
> Content-Length: 0
>
> WWW-Authenticate: Digest realm="sip.aquanta.com",
>
>         nonce="hDeaQQR5yOCHgx8YjKqI5zOcB1w=",
>
>         stale=TRUE,
>
>         algorithm=MD5,
>
>         qop="auth"
>
>  
>
>  
>
> 14 headers, 0 lines
>
> 12 headers, 0 lines
>
> Reliably Transmitting:
>
> REGISTER sip:sip.aquanta.com SIP/2.0
>
> Via: SIP/2.0/UDP 123.123.123.123:5060;branch=z9hG4bK05c0559b
>
> From: <sip:0032123456789 at sip.aquanta.com>;tag=as2e43c573
>
> To: <sip:0032123456789 at sip.aquanta.com>;tag=lPaMk9ATvmCVvvGpOPJFkg
>
> Call-ID: 6b8b4567327b23c6643c986966334873 at 123.123.123.123
>
> CSeq: 107 REGISTER
>
> User-Agent: Asterisk PBX
>
> Authorization: Digest username="0032123456789", 
> realm="sip.aquanta.com", algorithm=MD5, uri="sip:sip.aquanta.com", 
> nonce="", response="854c3960f84b454af9d25fcfdb0aaee4", opaque=""
>
> Expires: 120
>
> Contact: <sip:s at 123.123.123.123>
>
> Event: registration
>
> Content-Length: 0
>
>  
>
>  (no NAT) to 212.3.244.8:5060
>
> ziki5*CLI>
>
>  
>
> Sip read:
>
> SIP/2.0 401 Unauthorized
>
> Via: SIP/2.0/UDP 123.123.123.123:5060;branch=z9hG4bK05c0559b
>
> From: <sip:0032123456789 at sip.aquanta.com>;tag=as2e43c573
>
> To: <sip:0032123456789 at sip.aquanta.com>;tag=lPaMk9ATvmCVvvGpOPJFkg
>
> Call-ID: 6b8b4567327b23c6643c986966334873 at 123.123.123.123
>
> Cseq: 107 REGISTER
>
> Date: Tue, 16 Nov 2004 17:23:15 GMT
>
> Server: SIPquest-SIP-Server/2.2
>
> Content-Length: 0
>
> WWW-Authenticate: Digest realm="sip.aquanta.com",
>
>         nonce="hDeaQQR5yOCHgx8YjKqI5zOcB1w=",
>
>         stale=TRUE,
>
>         algorithm=MD5,
>
>         qop="auth"
>
>  
>
>  
>
> 14 headers, 0 lines
>
> Nov 16 18:19:49 NOTICE[26352]: chan_sip.c:6768 handle_response: Failed 
> to authenticate on REGISTER to 
> '<sip:0032123456789 at sip.aquanta.com>;tag=as2e43c573'
>
> Destroying call '6b8b4567327b23c6643c986966334873 at 123.123.123.123'
>
>  
>
>  
>
> It's seems that the nonce is not sended back to the server with de 
> REGISTER packet.
>
>  
>
> I don't know if it's due to the \n in the "WWW-Authenticate" response. 
> Do you think it's possible?
>
>  
>
> Thank you,
>
>  
>
> Sincerely,
>
>  
>
> Cyrille Demaret
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Asterisk-Users mailing list
>Asterisk-Users at lists.digium.com
>http://lists.digium.com/mailman/listinfo/asterisk-users
>To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>  
>

_______________________________________________
Asterisk-Users mailing list
Asterisk-Users at lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list