DS-KD8003 - DS-KV8113 - DS-KV8213 - DS-KV6113 - DS-KV8413 and .... integration Hikvision HikConnect Video intercom doorbell

Hi @pergola.fabio ,

So, 10.10.10.244/24 is my FreePBX and 10.10.70.6/24 is my indoor. The following screenshot is from sngrep:

The second REGISTER command has the following content:

2022/10/30 23:57:26.026212 10.10.70.6:5065 -> 10.10.10.244:5060
REGISTER sip:10.10.70.6:5065 SIP/2.0
Via: SIP/2.0/UDP 10.10.10.244:5060;rport=5060;branch=z9hG4bKPj535f48e8-6096-4b43-a498-068df6df7a42
From: <sip:[email protected]>;tag=33653787-b932-4f45-97c4-fd172ab8c5c3
To: <sip:[email protected]>
Call-ID: 29584947-bf63-4dde-bdd8-20d13a15c310
CSeq: 59113 REGISTER
Contact: <sip:[email protected]:5060>
Allow: OPTIONS
Allow: REGISTER
Allow: SUBSCRIBE
Allow: NOTIFY
Allow: PUBLISH
Allow: INVITE
Allow: ACK
Allow: BYE
Allow: CANCEL
Allow: UPDATE
Allow: PRACK
Allow: MESSAGE
Allow: REFER
Expires: 3600
Max-forwards: 70
User-agent: FPBX-15.0.24(16.28.0)
Content-Length: 0

It’s like the indoor unit sending back a copy of the SIP REGISTER command.

Thanks for your assistance!

Yeah I have seen that 404:error too, what you can do , just use my script, run it on your freepbx server , so the regxml is sended and registered… Then setup an trunk based on IP auth instead of register request, so the invite gets send to freepbx, because it’s the same IP…

Are you running freepbx for a special reason? Otherwise you can make use of the asterisk addon, and use my script as a shell command…

Not sure why you have that 404 not found error, maybe the indoor doesn’t like different subnets? Seems the indoor isn’t able to find freepbx…
Are you running freepbx on 5060 ,? I think 5060 must be hardcoded

Ok thnx I will try this next week.

1 Like

Well, I would expect that only FreePBX should send the REGISTER command to the indoor, not the other way round (this is how your script works from what I see from sngrep). Error 404 is probably expected, as the trunk is set to do outbound auth only.

About your suggestion, your hikvision_register.py script is set to port 5061. So, the INVITE from the indoor would go to port 5061, and not 5060 which is my FreePBX. I had FreePBX for many years, for the communication needs of the apartment block that I manage.

It doesn’t appear to be a network issue, as when I run the hikvision_register.py at the FreePBX server, it registers successfully.

Probably as a last resort I could use the asterisk addon+your_script and then build a trunk between asterisk add-on and FreePBX. But I would prefer to avoid this complexity.

Br,
George

Hi, no the reason I used 5061, is offcourse 5060 is already in use by freepbx or asterisk, but the invite is hardcoded on indoor… Even if my script uses 5061, the invite will be send to 5060…

So if you setup a trunk on freepbx, based on IP auth , you will receive it on freepbx … That should solve it… But you need to run the script on your freepbx server, but that shouldn’t be an issue…

It’s indeed strange… Maybe you indoor expects the regxml in the register header… Mine does not (If I add it manually first with ivms) otherwise I get an 401

Hey @J2Kbr you had the same 404 error as @digeorgeous … Did you figure out? Or are you also using the script? Or an customized version? Maybe you can share your latest info with us? Also interested in this one…

@digeorgeous see discussion here:

Hi. i Have a sensors.yaml file in my configuration for entity like sensors. I add as show in new addon vaule like this:

- platform: template
  - sensor: 
      - name: hikvision_door
        state: "off"
      - name: hikvision_callstatus
        state: "off"

but HA tell me that config is wrong. Why ? How add this ?

Look here , added new version, based on templating, also extra sensors… Remove old addon…

But i add this as show in new addon.

Look here also:

The new addon is based on the new template in HA, just copy paste, also uninstall old addon, I removed it from my repo… Install 1.5, a new one

yes uninstalled old addon and add new tempolate as show and still have error, i have specific file for sensors name sensors.yaml and in this file i added it but show me error.

- platform: template
  sensor: 
    - name: hikvision_door
      state: "off"
    - name: hikvision_callstatus
      state: "off"

Again, look at readme, it’s different now, it’s based on the new platform template, there are also 5 sensors now

Ok but i must use 5 sensors ? I want use only this 2 sensors.

Yeah, it’s just part of the addon, just configure them, just don’t use it :slight_smile:

Maybe in a future update, I make them optional, but for now it’s hardcoded that it will try to update them in case of those 5 events

Still no luck. On both of my DS-KD8003 units (with Firmware 2.0.8 and 2.2.52) when typing the command in terminal on my Mac:

curl -i --digest -u admin:xxxxx http://192.168.x.xxx/ISAPI/VideoIntercom/callStatus?format=json

I get the response:

zsh: no matches found: http://192.168.x.xxx/ISAPI/VideoIntercom/callStatus?format=json

I think your syntax is wrong , try with quotes or from the ssh addon … All 8003 devices do have ISAPi , 100% sure

You changed the IP address , right?
Look here:

It’s probably because of the ? In the url, out the url between quotes

1 Like

Many thanks! Yes I changed the IP address. Now seems I’m a step further. When I wrapped the url within ’ I get:

with newest firmware 2.2.52:
HTTP/1.1 401 Unauthorized

with older firmware 2.0.8 :
curl: (7) Failed to connect to 192.168.1.xxx port 80 after 8 ms: Connection refused

I’m trying with the correct admin account which has all the rights :frowning:

curl -i --digest -u admin:password ‘http://IPADDRESS/ISAPI/VideoIntercom/callStatus?format=json

(samething without the ?format=json)

yeah, maybe the old firmware, the port 80 is closed, check it first with an port scan or something
the 401 is a step closer, probably you are entering the wrong admin password

But remember, the isapi callsatus, if you get it to work, will never give you back the real call status, always idle… That doesn’t work on 8003 models…
The open door command does work…

If you want callstatus, you need to run my addon, if you have the password, my addon uses the SDK to get callstatus, not ISAPi…

Maybe that’s also why you received error 29 on the addon? Because you don’t have the correct admin credentials?

1 Like