Playing (unsuccessfully) with a Panasonic IP camera

just received a new Panasonic KX-NTV150 communication camera
It includes a SIP client to be registered to a (Panasonic) PBX
SIP configuration has the usual parameters, user, pass, registrar ip and port, proxy ip etc etc
Anyway it can’t register to FreePbx, nothing displayed on asterisk cli
Just exchange few bytes between camera and pbx:

tcpdump:

14:13:13.151619 IP 172.16.16.218.sip > 172.16.16.120.sip: SIP, length: 614
14:13:13.152121 IP 172.16.16.120.sip > 172.16.16.218.sip: SIP, length: 533

(218=camera, 120=FreePbx)

nothing more, probably camera has something proprietary to exchange with Panasonic pbx

How can I debug this further ?

The most likely solutions include using Wireshark to gather the packets or using the SIP debug options that are included in Asterisk.

Keep in mind that the problem you’re having is not FreePBX problem, it’s a problem with Asterisk, so if you don’t get a lot of support here, that might be the reason why.

For more information, Google the term “debug SIP protocol asterisk” and see what comes up. There should be a couple of articles from asterisk.org and a few from some of the other VOIP friendly websites.

Thank you for info
Here is the only dialog two machines exchange :

<— SIP read from UDP:172.16.217.218:5060 —>
REGISTER sip:172.16.16.120 SIP/2.0
Via: SIP/2.0/UDP 172.16.16.218;rport;branch=z9hG4bKyMjI8tKCiRAJVi6goH3b34o
Max-Forwards: 70
From: sip:[email protected];tag=12ZidG
To: sip:[email protected]
Call-ID: uLoBzKpV7fRRrKFY
CSeq: 1 REGISTER
Contact: sip:[email protected]:5060;transport=UDP;+g.3gpp.smsip;+g.3gpp.icsi-ref=“urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel”;+g.gsma.rcs.telephony="cs,volte"
Allow: INVITE,ACK,CANCEL,BYE,PRACK,INFO,UPDATE,OPTIONS,MESSAGE,NOTIFY,REFER
Expires: 3600
Supported: path
User-Agent: Panasonic-KX-NTV150/0101d (0002D13FC3F9)
Content-Length: 0

<------------->
— (13 headers 0 lines) —
Sending to 172.16.16.218:5060 (no NAT)
Sending to 172.16.16.218:5060 (no NAT)

<— Transmitting (NAT) to 172.16.16.218:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 172.16.16.218;branch=z9hG4bKyMjI8tKCiRAJVi6goH3b34o;received=172.16.16.218;rport=5060
From: sip:[email protected];tag=12ZidG
To: sip:[email protected];tag=as2fe90c87
Call-ID: uLoBzKpV7fRRrKFY
CSeq: 1 REGISTER
Server: FPBX-13.0.190.7(13.12.2)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="094993f1"
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘uLoBzKpV7fRRrKFY’ in 32000 ms (Method: REGISTER)
Really destroying SIP dialog ‘hq.MNxlkvaWz5Ji2T3vLR4s7JCMF’ Method: REGISTER

Asterisk replies with SIP/2.0 401 Unauthorized

What could the cause be ??

Is a normal stage of the REGISTER procedure. You need to capture the full trace.

CAM REGISTER---> Asterisk
CAM <----Unauthorized ASTERISK In this step asterisk send a challenge including a NONCE to get the MD5 auth.
CAM ACK -----> ASTERISK
CAM REGISTER----> ASTERISK In this step the peer send the result of the challenge to register

The problem is the IP camera after receiving back the Unauthorized answer from asterisk does nothing other than restarting the Register procedure…
(the pasted dialog repeated endlessly)

From “sip show channels”:

Peer             User/ANR         Call ID                Format           Hold     Last Message    Expiry     Peer
172.16.16.218   (None)           25c2qRxQABg      (nothing)        No       Rx: REGISTER               <guest>   
172.16.16.218   (None)           6ede82f9413f719  (nothing)         No       Init: OPTIONS                  5015      
172.16.16.218   (None)           aPfPrVF2dsKLdqm  (nothing)      No       Rx: REGISTER               <guest>   
172.16.16.218   (None)           0Wz4MClhk1AhdJI  (nothing)      No       Rx: REGISTER               <guest> 

Tried to change to NO nat on extension with no results.
Any suggestion (other than give up…) ??

Check in the manual of the cam the sip supported stack, and also check the sip debug not the channels to see if the cam send all.

Anyway you can add a peer without authentication, but you add the HOST with the ip address of the camera, the PERMIT, DENY fields and use another context to avoid hacks using that peer.

1 Like

This is what I get with “core set debug 7” and “sip set debug on” :

<--- SIP read from UDP:172.16.16.218:5060 --->
REGISTER sip:172.16.16.120 SIP/2.0
Via: SIP/2.0/UDP 172.16.16.218;rport;branch=z9hG4bKPXaRQROeyBv6N
Max-Forwards: 70
From: <sip:[email protected]>;tag=e3RMH
To: <sip:[email protected]>
Call-ID: fs.U0Lyf.5e4r
CSeq: 1 REGISTER
Contact: <sip:[email protected]:5060;transport=UDP>;+g.3gpp.smsip;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel";+g.gsma.rcs.telephony="cs,volte"
Allow: INVITE,ACK,CANCEL,BYE,PRACK,INFO,UPDATE,OPTIONS,MESSAGE,NOTIFY,REFER
Expires: 3600
Supported: path
User-Agent: Panasonic-KX-NTV150/0101d (0002D13FC3F9)
Content-Length: 0

<------------->
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:9870 parse_request:  Header  0 [ 35]: REGISTER sip:172.16.16.120 SIP/2.0
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:9870 parse_request:  Header  1 [ 65]: Via: SIP/2.0/UDP 172.16.16.218;rport;branch=z9hG4bKPXaRQROeyBv6N
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:9870 parse_request:  Header  2 [ 16]: Max-Forwards: 70
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:9870 parse_request:  Header  3 [ 41]: From: <sip:[email protected]>;tag=e3RMH
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:9870 parse_request:  Header  4 [ 29]: To: <sip:[email protected]>
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:9870 parse_request:  Header  5 [ 22]: Call-ID: fs.U0Lyf.5e4r
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:9870 parse_request:  Header  6 [ 16]: CSeq: 1 REGISTER
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:9870 parse_request:  Header  7 [161]: Contact: <sip:[email protected]:5060;transport=UDP>;+g.3gpp.smsip;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel";+g.gsma.rcs.telephony="cs,volte"
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:9870 parse_request:  Header  8 [ 75]: Allow: INVITE,ACK,CANCEL,BYE,PRACK,INFO,UPDATE,OPTIONS,MESSAGE,NOTIFY,REFER
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:9870 parse_request:  Header  9 [ 13]: Expires: 3600
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:9870 parse_request:  Header 10 [ 15]: Supported: path
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:9870 parse_request:  Header 11 [ 52]: User-Agent: Panasonic-KX-NTV150/0101d (0002D13FC3F9)
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:9870 parse_request:  Header 12 [ 17]: Content-Length: 0
--- (13 headers 0 lines) ---
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:9396 __find_call: = Looking for  Call ID: fs.U0Lyf.5e4r (Checking From) --From tag e3RMH --To-tag   
[2017-01-05 08:47:05] DEBUG[3573]: acl.c:946 ast_ouraddrfor: For destination '172.16.16.218', our source address is '172.16.16.120'.
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:3903 ast_sip_ouraddrfor: Setting AST_TRANSPORT_UDP with address 172.16.16.120:5060
[2017-01-05 08:47:05] DEBUG[3573]: netsock2.c:172 ast_sockaddr_split_hostport: Splitting '172.16.16.218' into...
[2017-01-05 08:47:05] DEBUG[3573]: netsock2.c:226 ast_sockaddr_split_hostport: ...host '172.16.16.218' and port ''.
Sending to 172.16.16.218:5060 (no NAT)
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:8983 __sip_alloc: Allocating new SIP dialog for fs.U0Lyf.5e4r - REGISTER (No RTP)
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:28627 handle_incoming: **** Received REGISTER (2) - Command in SIP REGISTER
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:28449 handle_request_register: Initializing initreq for method REGISTER - callid fs.U0Lyf.5e4r
[2017-01-05 08:47:05] DEBUG[3573]: netsock2.c:172 ast_sockaddr_split_hostport: Splitting '172.16.16.218' into...
[2017-01-05 08:47:05] DEBUG[3573]: netsock2.c:226 ast_sockaddr_split_hostport: ...host '172.16.16.218' and port ''.
Sending to 172.16.16.218:5060 (no NAT)
[2017-01-05 08:47:05] DEBUG[3573]: netsock2.c:172 ast_sockaddr_split_hostport: Splitting '172.16.16.120' into...
[2017-01-05 08:47:05] DEBUG[3573]: netsock2.c:226 ast_sockaddr_split_hostport: ...host '172.16.16.120' and port ''.

<--- Transmitting (no NAT) to 172.16.16.218:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 172.16.16.218;branch=z9hG4bKPXaRQROeyBv6N;received=172.16.16.218;rport=5060
From: <sip:[email protected]>;tag=e3RMH
To: <sip:[email protected]>;tag=as2a404a98
Call-ID: fs.U0Lyf.5e4r
CSeq: 1 REGISTER
Server: FPBX-13.0.190.7(13.12.2)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="1106760e"
Content-Length: 0


<------------>
[2017-01-05 08:47:05] DEBUG[3573]: chan_sip.c:3746 __sip_xmit: Trying to put 'SIP/2.0 401' onto UDP socket destined for 172.16.16.218:5060
Scheduling destruction of SIP dialog 'fs.U0Lyf.5e4r' in 32000 ms (Method: REGISTER)
[2017-01-05 08:47:05] DEBUG[3529]: manager.c:5858 match_filter: Examining AMI event:
Event: ChallengeSent
Privilege: security,all
EventTV: 2017-01-05T08:47:05.947+0100
Severity: Informational
Service: SIP
EventVersion: 1
AccountID: 5015
SessionID: 0x7f0fdc273318
LocalAddress: IPV4/UDP/172.16.16.120/5060
RemoteAddress: IPV4/UDP/172.16.16.218/5060
Challenge: 1106760e


[2017-01-05 08:47:07] DEBUG[3573]: chan_sip.c:4351 __sip_autodestruct: Auto destroying SIP dialog '2MYCCwTZqmqoiIxv1RRaRt220B'
[2017-01-05 08:47:07] DEBUG[3573]: chan_sip.c:6579 sip_pvt_dtor: Destroying SIP dialog 2MYCCwTZqmqoiIxv1RRaRt220B
Really destroying SIP dialog '2MYCCwTZqmqoiIxv1RRaRt220B' Method: REGISTER
[2017-01-05 08:47:09] DEBUG[3577]: res_pjsip_registrar_expire.c:78 check_expiration_thread: Woke up at 1483602429  Interval: 30
[2017-01-05 08:47:09] DEBUG[3577]: res_pjsip_registrar_expire.c:85 check_expiration_thread: Expiring 0 contacts

[2017-01-05 08:47:13] DEBUG[30260]: manager.c:6313 process_message: Running action 'Command'
[2017-01-05 08:47:13] DEBUG[30260]: manager.c:6313 process_message: Running action 'Command'
[2017-01-05 08:47:13] DEBUG[30260]: manager.c:6313 process_message: Running action 'Command'
[2017-01-05 08:47:13] DEBUG[30260]: manager.c:6313 process_message: Running action 'Command'
[2017-01-05 08:47:13] DEBUG[30260]: manager.c:6313 process_message: Running action 'Command'
[2017-01-05 08:47:13] DEBUG[30260]: manager.c:6313 process_message: Running action 'Command'
[2017-01-05 08:47:13] DEBUG[30260]: devicestate.c:369 _ast_device_state: No provider found, checking channel drivers for PJSIP - 5020
[2017-01-05 08:47:13] DEBUG[30260]: manager.c:6313 process_message: Running action 'Command'

Challenge is sent but probably ignored by camera…
Then the thing repeats to infinite…

If I set host ip address into extension setting, debug tells me that peer wants/needs to register but it is not possible as “host” isn’t set as “dynamic”…

Of course camera registers ona Panasonic PBX :wink: something proprietary ??

That’s a pretty simple change. In your extension settings, change the type to “Dynamic” and try it.

Probably not, but there is clearly a step in the configuration that we need to emulate.