Francesco
2009-Mar-19 10:00 UTC
[asterisk-users] Extensions not found and 401 Unauthorized in realtime configuration (Long post)
Hi to all the ML. I'm new here. I start to use asterisk with realtime configuration, with pgsql backend connected via odbc. The connection between asterisk and pgsql works fine. I create a table sip_conf with 2 user (for testing purpose), 1401 and 1501. Those are the records: asterisk=> SELECT name,host,type,context,secret,defaultuser from sip_conf; name | host | type | context | secret | defaultuser ------+---------+--------+---------+--------+------------- 1401 | dynamic | friend | prova | fra | 1401 1501 | dynamic | friend | prova | 1501 | 1501 I create a table extensions_conf with this extensions: id | context | exten | priority | app | appdata ----+---------+-----------+----------+--------+---------------- 41 | prova | _1[1-5]XX | 1 | Dial | (SIP/${EXTEN}) 42 | prova | _1[1-5]XX | 2 | Hangup | the extconfig.conf is: [settings] extensions => odbc,dbasterisk,extensions_conf sipusers => odbc,dbasterisk,sip_conf sippeers => odbc,dbasterisk,sip_conf and extensions.conf is: [general] static=yes writeprotect=no autofallthrough=yes [prova] switch => Realtime I use x-lite for calling 1401 -> 1501 and vice-versa. The result is "404 Not Found". The phones correctly register on asterisk, and the table sip_conf register the userage, the ip ecc. Setting "sip set debug on" on asterisk console, i obtain: ------------------8<---------------------------8<---------------------------8<---------------------------8<---------------------------8<--------- Via: SIP/2.0/UDP 10.44.3.153:5060;rport;branch=z9hG4bK5591DE8FE488A6D64C4AA159B97BBC36 From: 1501 <sip:1501 at 10.44.9.0>;tag=990832587 To: <sip:1401 at 10.44.9.0> Contact: <sip:1501 at 10.44.3.153:5060> Call-ID: 448AFE95-423A-A081-85F3-AD0D70D0FB4D at 10.44.3.153 CSeq: 60784 INVITE Max-Forwards: 70 Content-Type: application/sdp User-Agent: X-Lite release 1105d Content-Length: 305 v=0 o=1501 503728492 503728510 IN IP4 10.44.3.153 s=X-Lite c=IN IP4 10.44.3.153 t=0 0 m=audio 8000 RTP/AVP 0 8 3 98 97 101 a=rtpmap:0 pcmu/8000 a=rtpmap:8 pcma/8000 a=rtpmap:3 gsm/8000 a=rtpmap:98 iLBC/8000 a=rtpmap:97 speex/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15 a=sendrecv <-------------> --- (11 headers 14 lines) --- == Using SIP RTP CoS mark 5 Sending to 10.44.3.153 : 5060 (NAT) Using INVITE request as basis request - 448AFE95-423A-A081-85F3-AD0D70D0FB4D at 10.44.3.153 Found peer '1501' for '1501' from 10.44.3.153:5060 <--- Reliably Transmitting (no NAT) to 10.44.3.153:5060 ---> SIP/2.0 401 Unauthorized Via: SIP/2.0/UDP 10.44.3.153:5060;branch=z9hG4bK5591DE8FE488A6D64C4AA159B97BBC36;received=10.44.3.153;rport=5060 From: 1501 <sip:1501 at 10.44.9.0>;tag=990832587 To: <sip:1401 at 10.44.9.0>;tag=as4b3729a3 Call-ID: 448AFE95-423A-A081-85F3-AD0D70D0FB4D at 10.44.3.153 CSeq: 60784 INVITE Server: Asterisk PBX 1.6.1-rc1-issue14292 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY Supported: replaces, timer WWW-Authenticate: Digest algorithm=MD5, realm="10.44.9.0", nonce="4685095b" Content-Length: 0 <------------> Scheduling destruction of SIP dialog '448AFE95-423A-A081-85F3-AD0D70D0FB4D at 10.44.3.153' in 32000 ms (Method: INVITE) itpbx01*CLI> <--- SIP read from UDP:10.44.3.153:5060 ---> ACK sip:1401 at 10.44.9.0 SIP/2.0 Via: SIP/2.0/UDP 10.44.3.153:5060;rport;branch=z9hG4bK5591DE8FE488A6D64C4AA159B97BBC36 From: 1501 <sip:1501 at 10.44.9.0>;tag=990832587 To: <sip:1401 at 10.44.9.0>;tag=as4b3729a3 Contact: <sip:1501 at 10.44.3.153:5060> Call-ID: 448AFE95-423A-A081-85F3-AD0D70D0FB4D at 10.44.3.153 CSeq: 60784 ACK Max-Forwards: 70 Content-Length: 0 <-------------> --- (9 headers 0 lines) --- itpbx01*CLI> <--- SIP read from UDP:10.44.3.153:5060 ---> INVITE sip:1401 at 10.44.9.0 SIP/2.0 Via: SIP/2.0/UDP 10.44.3.153:5060;rport;branch=z9hG4bK26FAB8569057F005F91285F58781AD32 From: 1501 <sip:1501 at 10.44.9.0>;tag=990832587 To: <sip:1401 at 10.44.9.0> Contact: <sip:1501 at 10.44.3.153:5060> Call-ID: 448AFE95-423A-A081-85F3-AD0D70D0FB4D at 10.44.3.153 CSeq: 60785 INVITE Authorization: Digest username="1501",realm="10.44.9.0",nonce="4685095b",response="290748094c61098ad389aaaadafa825e",uri="sip:1401 at 10.44.9.0",algorithm=MD5 Max-Forwards: 70 Content-Type: application/sdp User-Agent: X-Lite release 1105d Content-Length: 305 v=0 o=1501 503728492 503728510 IN IP4 10.44.3.153 s=X-Lite c=IN IP4 10.44.3.153 t=0 0 m=audio 8000 RTP/AVP 0 8 3 98 97 101 a=rtpmap:0 pcmu/8000 a=rtpmap:8 pcma/8000 a=rtpmap:3 gsm/8000 a=rtpmap:98 iLBC/8000 a=rtpmap:97 speex/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15 a=sendrecv <-------------> --- (12 headers 14 lines) --- Sending to 10.44.3.153 : 5060 (NAT) Using INVITE request as basis request - 448AFE95-423A-A081-85F3-AD0D70D0FB4D at 10.44.3.153 Found peer '1501' for '1501' from 10.44.3.153:5060 Found RTP audio format 0 Found RTP audio format 8 Found RTP audio format 3 Found RTP audio format 98 Found RTP audio format 97 Found RTP audio format 101 Peer audio RTP is at port 10.44.3.153:8000 Found audio description format pcmu for ID 0 Found audio description format pcma for ID 8 Found audio description format gsm for ID 3 Found audio description format iLBC for ID 98 Found audio description format speex for ID 97 Found audio description format telephone-event for ID 101 Capabilities: us - 0x50e (gsm|ulaw|alaw|g729|ilbc), peer - audio=0x60e (gsm|ulaw|alaw|speex|ilbc)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0x40e (gsm|ulaw|alaw|ilbc) Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x1 (telephone-event), combined - 0x1 (telephone-event) Peer audio RTP is at port 10.44.3.153:8000 Looking for 1401 in prova (domain 10.44.9.0) itpbx01*CLI> <--- Reliably Transmitting (no NAT) to 10.44.3.153:5060 ---> SIP/2.0 404 Not Found Via: SIP/2.0/UDP 10.44.3.153:5060;branch=z9hG4bK26FAB8569057F005F91285F58781AD32;received=10.44.3.153;rport=5060 From: 1501 <sip:1501 at 10.44.9.0>;tag=990832587 To: <sip:1401 at 10.44.9.0>;tag=as4b3729a3 Call-ID: 448AFE95-423A-A081-85F3-AD0D70D0FB4D at 10.44.3.153 CSeq: 60785 INVITE Server: Asterisk PBX 1.6.1-rc1-issue14292 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY Supported: replaces, timer Content-Length: 0 <------------> [Mar 19 10:19:52] NOTICE[31891]: chan_sip.c:19476 handle_request_invite: Call from '1501' to extension '1401' rejected because extension not found. Scheduling destruction of SIP dialog '448AFE95-423A-A081-85F3-AD0D70D0FB4D at 10.44.3.153' in 32000 ms (Method: INVITE) itpbx01*CLI> <--- SIP read from UDP:10.44.3.153:5060 ---> ACK sip:1401 at 10.44.9.0 SIP/2.0 Via: SIP/2.0/UDP 10.44.3.153:5060;rport;branch=z9hG4bK26FAB8569057F005F91285F58781AD32 From: 1501 <sip:1501 at 10.44.9.0>;tag=990832587 To: <sip:1401 at 10.44.9.0>;tag=as4b3729a3 Contact: <sip:1501 at 10.44.3.153:5060> Call-ID: 448AFE95-423A-A081-85F3-AD0D70D0FB4D at 10.44.3.153 CSeq: 60785 ACK Max-Forwards: 70 Content-Length: 0 <-------------> --- (9 headers 0 lines) --- itpbx01*CLI> <--- SIP read from UDP:10.44.14.251:5060 ---> <-------------> itpbx01*CLI> <--- SIP read from UDP:10.44.3.153:5060 ---> ------------------8<---------------------------8<---------------------------8<---------------------------8<---------------------------8<--------- I dont' know what can i do to solve this problem. First, i obtain 401 Unauthorize (and i don't understand why)....then 404 extension not found. Someone can help me? Many thanks!