Tips

Linux asterisk 第5回

SIPクライアントからのレジストでの失敗

asterisk側で SIPの debugを有効にした状態で SIPクライアントからレジストをしてみる
すると以下のような表示が出てきた。
192.168.10.127はasteriskである。
192.168.10.152はSIPクライアント(X-Lite)である。

asterisk*CLI> sip set debug on
SIP Debugging enabled

<--- SIP read from UDP:192.168.10.152:63430 --->
REGISTER sip:192.168.10.127 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.152:63430;branch=z9hG4bK-d8754z-08fa7e7ab503473b-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:2001@192.168.10.152:63430;rinstance=6040588e5f55cc52>
To: "2001"<sip:2001@192.168.10.127>
From: "2001"<sip:2001@192.168.10.127>;tag=ae356513
Call-ID: ODU2NTczMzM5MTdmMTI3NjU5YjRiYjc2ZGRjZmVhMTE
CSeq: 1 REGISTER
Expires: 3600
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: X-Lite release 4.5 stamp 69607
Content-Length: 0

<------------->
--- (12 headers 0 lines) ---
Sending to 192.168.10.152:63430 (NAT)

<--- Transmitting (NAT) to 192.168.10.152:63430 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.10.152:63430;branch=z9hG4bK-d8754z-08fa7e7ab503473b-1---d8754z-;received=192.168.10.152;rport=63430
From: "2001"<sip:2001@192.168.10.127>;tag=ae356513
To: "2001"<sip:2001@192.168.10.127>;tag=as1d0f49fb
Call-ID: ODU2NTczMzM5MTdmMTI3NjU5YjRiYjc2ZGRjZmVhMTE
CSeq: 1 REGISTER
Server: Asterisk PBX 1.8.20.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="6a4acfb8"
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog 'ODU2NTczMzM5MTdmMTI3NjU5YjRiYjc2ZGRjZmVhMTE' in 32000 ms (Method: REGISTER)

<--- SIP read from UDP:192.168.10.152:63430 --->
REGISTER sip:192.168.10.127 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.152:63430;branch=z9hG4bK-d8754z-9ef0263fdaa08d5d-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:2001@192.168.10.152:63430;rinstance=6040588e5f55cc52>
To: "2001"<sip:2001@192.168.10.127>
From: "2001"<sip:2001@192.168.10.127>;tag=ae356513
Call-ID: ODU2NTczMzM5MTdmMTI3NjU5YjRiYjc2ZGRjZmVhMTE
CSeq: 2 REGISTER
Expires: 3600
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: X-Lite release 4.5 stamp 69607
Authorization: Digest username="2011",realm="asterisk",nonce="6a4acfb8",uri="sip:192.168.10.127",response="c6f777062056030d4d183df76d736a33",algorithm=MD5
Content-Length: 0

<------------->
--- (13 headers 0 lines) ---
Sending to 192.168.10.152:63430 (NAT)
[Mar 26 15:46:10] WARNING[31239]: chan_sip.c:14907 check_auth: username mismatch, have <2001>, digest has <2011>

<--- Transmitting (NAT) to 192.168.10.152:63430 --->
SIP/2.0 403 Forbidden (Bad auth)
Via: SIP/2.0/UDP 192.168.10.152:63430;branch=z9hG4bK-d8754z-9ef0263fdaa08d5d-1---d8754z-;received=192.168.10.152;rport=63430
From: "2001"<sip:2001@192.168.10.127>;tag=ae356513
To: "2001"<sip:2001@192.168.10.127>;tag=as1d0f49fb
Call-ID: ODU2NTczMzM5MTdmMTI3NjU5YjRiYjc2ZGRjZmVhMTE
CSeq: 2 REGISTER
Server: Asterisk PBX 1.8.20.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
upported: replaces, timer
Content-Length: 0


<------------>
[Mar 26 15:46:10] NOTICE[31239]: chan_sip.c:25575 handle_request_register: Registration from '"2001"<sip:2001@192.168.10.127>' failed for '192.168.10.152:63430' - Username/auth name mismatch
Scheduling destruction of SIP dialog 'ODU2NTczMzM5MTdmMTI3NjU5YjRiYjc2ZGRjZmVhMTE' in 32000 ms (Method: REGISTER)

<--- SIP read from UDP:192.168.10.126:3115 --->

よく見ると SIPクライアントである X-Liteの Authorization name が 2011 になっていた。
これが sip.conf内の defaultuser=2001 になっていたため、異なったためと思われる。
ためしに defaultuser=2011 にしてみる。

そしてSIPクライアントからもう一回接続してみる(sip.conf は変更したが asteriskの再起動はしていない)

<--- SIP read from UDP:192.168.10.152:44586 --->
REGISTER sip:192.168.10.127 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.152:44586;branch=z9hG4bK-d8754z-587d083f0f71016a-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:2001@192.168.10.152:44586;rinstance=a6ad652a9005a6b9>
To: "2001"<sip:2001@192.168.10.127>
From: "2001"<sip:2001@192.168.10.127>;tag=6010c203
Call-ID: YWJkZDUzNzU3YTJlMTkxMGJlZDZhNTA2ODc1ZGRiZTk
CSeq: 1 REGISTER
Expires: 3600
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: X-Lite release 4.5 stamp 69607
Content-Length: 0

<------------->
--- (12 headers 0 lines) ---
Sending to 192.168.10.152:44586 (NAT)

<--- Transmitting (NAT) to 192.168.10.152:44586 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.10.152:44586;branch=z9hG4bK-d8754z-587d083f0f71016a-1---d8754z-;received=192.168.10.152;rport=44586
From: "2001"<sip:2001@192.168.10.127>;tag=6010c203
To: "2001"<sip:2001@192.168.10.127>;tag=as489faef2
Call-ID: YWJkZDUzNzU3YTJlMTkxMGJlZDZhNTA2ODc1ZGRiZTk
CSeq: 1 REGISTER
Server: Asterisk PBX 1.8.20.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="6b4b65ba"
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog 'YWJkZDUzNzU3YTJlMTkxMGJlZDZhNTA2ODc1ZGRiZTk' in 32000 ms (Method: REGISTER)

<--- SIP read from UDP:192.168.10.152:44586 --->
REGISTER sip:192.168.10.127 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.152:44586;branch=z9hG4bK-d8754z-298413f390fd369d-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:2001@192.168.10.152:44586;rinstance=a6ad652a9005a6b9>
To: "2001"<sip:2001@192.168.10.127>
From: "2001"<sip:2001@192.168.10.127>;tag=6010c203
Call-ID: YWJkZDUzNzU3YTJlMTkxMGJlZDZhNTA2ODc1ZGRiZTk
CSeq: 2 REGISTER
Expires: 3600
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: X-Lite release 4.5 stamp 69607
Authorization: Digest username="2001",realm="asterisk",nonce="6b4b65ba",uri="sip:192.168.10.127",response="aa5f4d578c9629cb3ad53d3c4c16f585",algorithm=MD5
Content-Length: 0

<------------->
--- (13 headers 0 lines) ---
Sending to 192.168.10.152:44586 (NAT)
    -- Registered SIP '2001' at 192.168.10.152:44586
       > Saved useragent "X-Lite release 4.5 stamp 69607" for peer 2001

<--- Transmitting (NAT) to 192.168.10.152:44586 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.10.152:44586;branch=z9hG4bK-d8754z-298413f390fd369d-1---d8754z-;received=192.168.10.152;rport=44586
From: "2001"<sip:2001@192.168.10.127>;tag=6010c203
To: "2001"<sip:2001@192.168.10.127>;tag=as489faef2
Call-ID: YWJkZDUzNzU3YTJlMTkxMGJlZDZhNTA2ODc1ZGRiZTk
CSeq: 2 REGISTER
Server: Asterisk PBX 1.8.20.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Expires: 3600
Contact: <sip:2001@192.168.10.152:44586;rinstance=a6ad652a9005a6b9>;expires=3600
Date: Tue, 26 Mar 2014 06:53:34 GMT
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog 'YWJkZDUzNzU3YTJlMTkxMGJlZDZhNTA2ODc1ZGRiZTk' in 32000 ms (Method: REGISTER)

<--- SIP read from UDP:192.168.10.152:44586 --->
SUBSCRIBE sip:2001@192.168.10.127 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.152:44586;branch=z9hG4bK-d8754z-78ffce72ad35b2e7-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:2001@192.168.10.152:44586>
To: "2001"<sip:2001@192.168.10.127>
From: "2001"<sip:2001@192.168.10.127>;tag=4040be83
Call-ID: YmNlOWEzNWE0MjM4OGE2YzYzOWMwOTYxZGU3NTA3NDM
CSeq: 1 SUBSCRIBE
Expires: 300
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: X-Lite release 4.5 stamp 69607
Event: message-summary
Content-Length: 0

<------------->
--- (13 headers 0 lines) ---
Creating new subscription
Sending to 192.168.10.152:44586 (NAT)
list_route: hop: <sip:2001@192.168.10.152:44586>
Found peer '2001' for '2001' from 192.168.10.152:44586

<--- Transmitting (NAT) to 192.168.10.152:44586 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.10.152:44586;branch=z9hG4bK-d8754z-78ffce72ad35b2e7-1---d8754z-;received=192.168.10.152;rport=44586
From: "2001"<sip:2001@192.168.10.127>;tag=4040be83
To: "2001"<sip:2001@192.168.10.127>;tag=as55631bca
Call-ID: YmNlOWEzNWE0MjM4OGE2YzYzOWMwOTYxZGU3NTA3NDM
CSeq: 1 SUBSCRIBE
Server: Asterisk PBX 1.8.20.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="77d5f4ca"
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog 'YmNlOWEzNWE0MjM4OGE2YzYzOWMwOTYxZGU3NTA3NDM' in 32000 ms (Method: SUBSCRIBE)

<--- SIP read from UDP:192.168.10.152:44586 --->
SUBSCRIBE sip:2001@192.168.10.127 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.152:44586;branch=z9hG4bK-d8754z-c49999d0f06259ba-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:2001@192.168.10.152:44586>
To: "2001"<sip:2001@192.168.10.127>
From: "2001"<sip:2001@192.168.10.127>;tag=4040be83
Call-ID: YmNlOWEzNWE0MjM4OGE2YzYzOWMwOTYxZGU3NTA3NDM
CSeq: 2 SUBSCRIBE
Expires: 300
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: X-Lite release 4.5 stamp 69607
Authorization: Digest username="2001",realm="asterisk",nonce="77d5f4ca",uri="sip:2001@192.168.10.127",response="e5dfb7c754162efbca75e0cce20a9bbb",algorithm=MD5
Event: message-summary
Content-Length: 0

<------------->
--- (14 headers 0 lines) ---
Creating new subscription
Sending to 192.168.10.152:44586 (NAT)
Found peer '2001' for '2001' from 192.168.10.152:44586

<--- Transmitting (NAT) to 192.168.10.152:44586 --->
SIP/2.0 404 Not found (no mailbox)
Via: SIP/2.0/UDP 192.168.10.152:44586;branch=z9hG4bK-d8754z-c49999d0f06259ba-1---d8754z-;received=192.168.10.152;rport=44586
From: "2001"<sip:2001@192.168.10.127>;tag=4040be83
To: "2001"<sip:2001@192.168.10.127>;tag=as55631bca
Call-ID: YmNlOWEzNWE0MjM4OGE2YzYzOWMwOTYxZGU3NTA3NDM
CSeq: 2 SUBSCRIBE
Server: Asterisk PBX 1.8.20.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


<------------>
[Mar 26 15:53:34] NOTICE[31239]: chan_sip.c:25391 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 2001
Really destroying SIP dialog 'YmNlOWEzNWE0MjM4OGE2YzYzOWMwOTYxZGU3NTA3NDM' Method: SUBSCRIBE

<--- SIP read from UDP:192.168.10.126:3115 --->

すると、asteriskにSIPクライアントがレジストされた。
どうやら認証する際に defaultuser と Authorization name の値を比較するらしい。
そして sip.conf を編集しても asteriskの再起動は必要ないという事がわかった。

Linux認定資格 LPICを取るなら・・

Linux資格 「LPIC Lv1」徹底解説 連載目次

Recent News

Recent Tips

Tag Search