Roberto Piola
2004-Nov-11 05:45 UTC
[Asterisk-Users] Problems in autnenticating with SER / PortaSIP
We have a problem in authenticating with a SIP server running PortaSIP. first, my exten.conf says: exten => _396262X.,1,Dial(SIP/${EXTEN:2}@to-uni) exten => _39064040.,1,Dial(SIP/${EXTEN:2}@to-uni) and sip.conf: register=390645416983:XXXXXX@sip.uni.it/390645416983 [to-uni] type=peer secret=XXXXXX ; i tried also using md5secret=.... instead of secret=... but it's the same username=390645416983 fromuser=390645416983 host=sip.uni.it nat=yes our asterisk pbx correctly registers on sip.uni.it (it is displayed as "registered" in sip show registry, and if I issue a sip debug I see the answer to the registration, correctly reporting the name of the remote server and our balance: SIP/2.0 200 OK Via: SIP/2.0/UDP 217.18.104.75:5060;branch=z9hG4bK1bd57ff9 From: <sip:390645416983@sip.uni.it>;tag=as4fb9a73e To: <sip:390645416983@sip.uni.it>;tag=a4a48d8b20978897d8e0f5c399e6cc29.fbc4 Call-ID: 7acae8557efdc1c01d7fed7e70ddbad5@10.196.1.18 CSeq: 103 REGISTER PortaBilling: available-funds:5.00 currency:EUR Contact: <sip:390645416983@217.18.104.75>;q=0.00;expires=115 Server: Sip EXpress router (0.8.14 (i386/freebsd)) Content-Length: 0 The problem is when I try to call a number on the othere side (390640409999): the call is correctly routed, the remote server asks us for the proper credentials, and it seems to me that asterisk answers their challenge: Authorization: Digest username="390645416983", realm="sip.uni.it", algorithm=MD5, uri="sip:0640409999@sip.uni.it", nonce="419358e858969bef4a5c77326f2b205b97c672bf", response="188824ee848f9ed095990999fb2e3893", opaque="" but for some reason it seems that the remote server does not like the answer. the helpdesk of uni.it says that this is an old bug of asterisk (actually, the account works with an X-Lite softphone ). I'm using CVS-v1-0-11/08/04-10:57:05. I hoped that the latest version corrected this problem as well, but it appears that it is not the case I enclose the sip debug trace of the call -- Executing Dial("IAX2/rpiola@rpiola/3", "SIP/0640409999@touni") in new stack We're at 217.18.104.75 port 10880 Answering with preferred capability 0x4(ULAW) Answering with non-codec capability 0x1(G723) 12 headers, 10 lines Reliably Transmitting: INVITE sip:0640409999@sip.uni.it SIP/2.0 Via: SIP/2.0/UDP 217.18.104.75:5060;branch=z9hG4bK2f983a20;rport From: "Roberto Piola" <sip:390645416983@sip.uni.it>;tag=as2fb0ecc6 To: <sip:0640409999@sip.uni.it> Contact: <sip:390645416983@217.18.104.75> Call-ID: 2aefee4e736a4aea18f8499e3ce6d47c@sip.uni.it CSeq: 102 INVITE User-Agent: Asterisk PBX Date: Thu, 11 Nov 2004 12:14:52 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER Content-Type: application/sdp Content-Length: 218 v=0 o=root 12361 12361 IN IP4 217.18.104.75 s=session c=IN IP4 217.18.104.75 t=0 0 m=audio 10880 RTP/AVP 0 101 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - (NAT) to 217.72.100.4:5060 -- Called 0640409999@touni janis*CLI> Sip read: SIP/2.0 401 Unauthorized Via: SIP/2.0/UDP 217.18.104.75:5060;branch=z9hG4bK2f983a20;rport=5060 From: "Roberto Piola" <sip:390645416983@sip.uni.it>;tag=as2fb0ecc6 To: <sip:0640409999@sip.uni.it>;tag=a4a48d8b20978897d8e0f5c399e6cc29.b98a Call-ID: 2aefee4e736a4aea18f8499e3ce6d47c@sip.uni.it CSeq: 102 INVITE WWW-Authenticate: Digest realm="sip.uni.it", nonce="419358e858969bef4a5c77326f2b205b97c672bf" Server: Sip EXpress router (0.8.14 (i386/freebsd)) Content-Length: 0 9 headers, 0 lines Transmitting: ACK sip:0640409999@sip.uni.it SIP/2.0 Via: SIP/2.0/UDP 217.18.104.75:5060;branch=z9hG4bK2f983a20;rport From: "Roberto Piola" <sip:390645416983@sip.uni.it>;tag=as2fb0ecc6 To: <sip:0640409999@sip.uni.it>;tag=a4a48d8b20978897d8e0f5c399e6cc29.b98a Contact: <sip:390645416983@217.18.104.75> Call-ID: 2aefee4e736a4aea18f8499e3ce6d47c@sip.uni.it CSeq: 102 ACK User-Agent: Asterisk PBX Content-Length: 0 (NAT) to 217.72.100.4:5060 We're at 217.18.104.75 port 10880 Answering with preferred capability 0x4(ULAW) Answering with non-codec capability 0x1(G723) Reliably Transmitting: INVITE sip:0640409999@sip.uni.it SIP/2.0 Via: SIP/2.0/UDP 217.18.104.75:5060;branch=z9hG4bK588b0624;rport From: "Roberto Piola" <sip:390645416983@sip.uni.it>;tag=as2fb0ecc6 To: <sip:0640409999@sip.uni.it> Contact: <sip:390645416983@217.18.104.75> Call-ID: 2aefee4e736a4aea18f8499e3ce6d47c@sip.uni.it CSeq: 103 INVITE User-Agent: Asterisk PBX Authorization: Digest username="390645416983", realm="sip.uni.it", algorithm=MD5, uri="sip:0640409999@sip.uni.it", nonce="419358e858969bef4a5c77326f2b205b97c672bf", response="188824ee848f9ed095990999fb2e3893", opaque="" Date: Thu, 11 Nov 2004 12:14:52 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER Content-Type: application/sdp Content-Length: 218 v=0 o=root 12361 12362 IN IP4 217.18.104.75 s=session c=IN IP4 217.18.104.75 t=0 0 m=audio 10880 RTP/AVP 0 101 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - (NAT) to 217.72.100.4:5060 janis*CLI> Sip read: SIP/2.0 401 Unauthorized Via: SIP/2.0/UDP 217.18.104.75:5060;branch=z9hG4bK588b0624;rport=5060 From: "Roberto Piola" <sip:390645416983@sip.uni.it>;tag=as2fb0ecc6 To: <sip:0640409999@sip.uni.it>;tag=a4a48d8b20978897d8e0f5c399e6cc29.5919 Call-ID: 2aefee4e736a4aea18f8499e3ce6d47c@sip.uni.it CSeq: 103 INVITE WWW-Authenticate: Digest realm="sip.uni.it", nonce="419358e858969bef4a5c77326f2b205b97c672bf" Server: Sip EXpress router (0.8.14 (i386/freebsd)) Content-Length: 0 9 headers, 0 lines Transmitting: ACK sip:0640409999@sip.uni.it SIP/2.0 Via: SIP/2.0/UDP 217.18.104.75:5060;branch=z9hG4bK588b0624;rport From: "Roberto Piola" <sip:390645416983@sip.uni.it>;tag=as2fb0ecc6 To: <sip:0640409999@sip.uni.it>;tag=a4a48d8b20978897d8e0f5c399e6cc29.5919 Contact: <sip:390645416983@217.18.104.75> Call-ID: 2aefee4e736a4aea18f8499e3ce6d47c@sip.uni.it CSeq: 103 ACK User-Agent: Asterisk PBX Content-Length: 0 (NAT) to 217.72.100.4:5060 We're at 217.18.104.75 port 10880 Answering with preferred capability 0x4(ULAW) Answering with non-codec capability 0x1(G723) Reliably Transmitting: INVITE sip:0640409999@sip.uni.it SIP/2.0 Via: SIP/2.0/UDP 217.18.104.75:5060;branch=z9hG4bK2dae1f5b;rport From: "Roberto Piola" <sip:390645416983@sip.uni.it>;tag=as2fb0ecc6 To: <sip:0640409999@sip.uni.it> Contact: <sip:390645416983@217.18.104.75> Call-ID: 2aefee4e736a4aea18f8499e3ce6d47c@sip.uni.it CSeq: 104 INVITE User-Agent: Asterisk PBX Authorization: Digest username="390645416983", realm="sip.uni.it", algorithm=MD5, uri="sip:0640409999@sip.uni.it", nonce="419358e858969bef4a5c77326f2b205b97c672bf", response="188824ee848f9ed095990999fb2e3893", opaque="" Date: Thu, 11 Nov 2004 12:14:52 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER Content-Type: application/sdp Content-Length: 218 v=0 o=root 12361 12363 IN IP4 217.18.104.75 s=session c=IN IP4 217.18.104.75 t=0 0 m=audio 10880 RTP/AVP 0 101 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - (NAT) to 217.72.100.4:5060 janis*CLI> Sip read: SIP/2.0 401 Unauthorized Via: SIP/2.0/UDP 217.18.104.75:5060;branch=z9hG4bK2dae1f5b;rport=5060 From: "Roberto Piola" <sip:390645416983@sip.uni.it>;tag=as2fb0ecc6 To: <sip:0640409999@sip.uni.it>;tag=a4a48d8b20978897d8e0f5c399e6cc29.3ee7 Call-ID: 2aefee4e736a4aea18f8499e3ce6d47c@sip.uni.it CSeq: 104 INVITE WWW-Authenticate: Digest realm="sip.uni.it", nonce="419358e858969bef4a5c77326f2b205b97c672bf" Server: Sip EXpress router (0.8.14 (i386/freebsd)) Content-Length: 0 9 headers, 0 lines Transmitting: ACK sip:0640409999@sip.uni.it SIP/2.0 Via: SIP/2.0/UDP 217.18.104.75:5060;branch=z9hG4bK2dae1f5b;rport From: "Roberto Piola" <sip:390645416983@sip.uni.it>;tag=as2fb0ecc6 To: <sip:0640409999@sip.uni.it>;tag=a4a48d8b20978897d8e0f5c399e6cc29.3ee7 Contact: <sip:390645416983@217.18.104.75> Call-ID: 2aefee4e736a4aea18f8499e3ce6d47c@sip.uni.it CSeq: 104 ACK User-Agent: Asterisk PBX Content-Length: 0 (NAT) to 217.72.100.4:5060 Nov 11 13:14:52 NOTICE[12366]: chan_sip.c:6774 handle_response: Failed to authenticate on INVITE to '"Roberto Piola" <sip:390645416983@sip.uni.it>;tag=as2fb0ecc6'