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

You can keep it for yourself, is your option

nah, i want to share my info to help others, thats why i started this thread
But everyone has a different use case, i just shared mine

its up to you how you want to implement

Can you explain what is the register script? Because I think that might be the road for meā€¦ Is it the
https://gist.github.com/pergolafabio/9964ff2c2750fba447c5ca63382f4600
one? Can you explain a bit its use, for example:

python3 hikvision_register.py --ip 192.168.0.17 --domain 192.168.0.71 --username 10000000005 --extension 10000000005 --name Asterisk --password XXX --debug

ā€œ192.168.0.17ā€ is the Asterisk server?
ā€œ192.168.0.71ā€ is the indoor station?
ā€œā€“username 10000000005ā€ is the user of the extension already made in Asterisk?
ā€œā€“extension 10000000005ā€ is the extension number, already made in Asterisk?
ā€œā€“name Asteriskā€ I think it only is a descriptionā€¦
ā€œpassword XXXā€ What should it be? The admin password of the indoor panel?

all correct

i used to run it with a shell command, to run in background on HA start, because it needs to be running the whole time, otherwise your indoor will make 10000000005 unregister after 15 min. The script does a reggister , so it just needs to be started once, and it needs to be running the whole timeā€¦

just try it out in a SSH session first to see the output

on hikvision indoor panel, you can add up to 5 extensions, i used just 10000000005 its actually the 5th extensionā€¦ you can use another number if you want, like 10000000002 or - 10000000003

the password, is the SIP session password, i think also with older indoor stations, there is no sip password, so just fill in a random password , or maybe use your admin password from the outdoor/indoor station

1 Like

if it works in an SSH session , then create a shell command in HA and fire it with an automation when HA starts, to it starts in background, i used this shell_command:

hikvision_sip: nohup python3 /config/python_scripts/hikvision_register.py --ip 192.168.0.17 --domain 192.168.0.71 --username 10000000005 --extension 10000000005 --name Asterisk --password XXX $1 > /dev/null 2>&1 &

and then used this automation:

- alias: Hikvision Sip Sensor
  initial_state: 'off'
  trigger:
    - platform: homeassistant
      event: start
  action:
    - service: shell_command.hikvision_sip

edit: added above info also on my addon page, maybe indeed usefull :slight_smile:

1 Like

So we had some success!!
Firstly, I did the firmware upgrade as @Klagio proposed. So the menu ā€œExtension Settingsā€ appeared in the IVMS.
Then, I installed Asterisk addonā€¦ There, I have no idea at all what to do, so I just copied the configuration on the hikvision-sip2rtsp addon page, in the appropriate files, trying to match my configuration.
Then I ran the script, and it reported Registered !!
Then I installed Asterisk integration and sip-hass-card, now I am stuck there but I think I will figure it out, I need to understand Asterisk first without the GUI, probably I have to create some extensions so the SIP card has somewhere to register toā€¦

1 Like

Nice !! Yeah, PBX is indeed a learning fase , on that asterisk addon page are some wikisā€¦

Start easy, just start with creating 2 extension so you can make a call between 2 endpointsā€¦ā€™ donā€™t go to fast :+) keep the Hikvision stuff for the last

The asterisk add-on does make auto extensions, for the personā€™s you have in HAā€¦

The extensions for softphones you need to create manuallyā€¦ Donā€™t use my sip2rtsp addon, keep it also for futureā€¦ It makes it more complicated :slight_smile:

As I said before , itā€™s possible that you donā€™t need the script, maybe the trunk is enough, you should see it registering if you launch that sngrep tool, when you restart asterisk

1 Like

asterisk add on only, or also the asterisk integration from HACS?

Dont install the Asterisk integration, you dont need it, its just to make sensors, but the integration still has bugs

Only use the Asterisk Addon => its ths PBX server
optionally use the SIP lovelace card, if you want to make/receive calls with HA app
or use a softphone , like linphone

Softphones are always better to start, because the SIP card if you close the lovelace card, or browse away from it, or restart asterisk, the card gets unregisteredā€¦ there are work arounds like parking/conference setup in Asterisk, but thats already advances usage

start easy, start with a softphone client

on my sip2rtsp addon page, in the config, i posted an exmaple how to create an extension, like the number 7000

here is how to create an extension ā€˜7000ā€™ for a softphone, just create it and add a second one like 7001 , then try making calls between 2 clientsā€¦

[7000]
type=endpoint
context=default
disallow=all
allow=ulaw,alaw
allow=h264,vp8
auth=auth7000
aors=7000
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
direct_media=yes
max_audio_streams=10
max_video_streams=10
from_domain=mydomain.com

[auth7000]
type=auth
auth_type=userpass
password=1234
username=7000
 
[7000]
type=aor
max_contacts=1
remove_existing=yes
remove_unavailable=yes

No your instructions are too difficult to comprehend, very confusing

Yeah, you need to learn PBX first, have a look on the wiki pages, start simple follow tutorials, Google stuffā€¦ Then it will be easier

OK so I got my Asterisk registered in the indoor station with the script, as ext. 10000000002 (No 2),
I set up Asterisk with 2 extensions 7000 and 70001 that can call each otherā€¦
I installed sngrep and can see 7000 and 70001 registering and sending SIP invites from the one to the otherā€¦ It also catchesthe indoor station registering to Asterisk and senging a message with a sip headerā€¦ However when I press the outdoor button, nothing happens between indoor and Asterisk at least in sngrepā€¦
What do I do next?

You need to make a dialplan, that on incoming call of that trunk, some extension or group will ringā€¦

Or setup a conference, you need it if you start going to use the Lovelace card later, an example is added on my addon page

If you press the button , do you see the trunk invite in the addon log? Should be something like: no endpoint found for 10000000002

Try also without script to see if it register, some indoor station do not need the XML in the register header

@mechpanos , i updated my addon, use as a test my example 1 , that calls just 2 softphones:

No it doesnā€™t report anything when I ring the button.
I will try the updated addon with the example this evening.

By the way, the new Hikvision SDK doesnā€™t let me update to 1.5, it throws an error ā€œUnknown error, see supervisorā€ and in supervisor logs, I get ā€œ[supervisor.docker.addon] Invalid build environment, canā€™t build this add-on!ā€, so Iā€™m still in 4.1. It doesnā€™t have to do with SIP etc, but I thought to share given the opportunity.

Hi, delete the addon completely, I had to change it because of type errorsā€¦ Can you post the sngrep log when you do the door press button? The invite messageā€¦ Is it forwarding to 5061 or 5060?

Maybe itā€™s forwarding to the script that runs on another listening portā€¦

Btw, are you running on RPI?

no x64ā€¦

I will start over this evening, with asterisk, script and sip2rtsp setting up, and then try to make some calls, and see what happens in sngrep and asterisk logsā€¦

hmm, should run on x64 , using same here

Hi

I have one door panel (KV8213, IP 10.0.0.30), two indoors panels (KH6320) - everything is on latest firmware.
One indoor panel is my master (with number 10ā€¦02, IP 10.0.0.32) and there I have two ā€œregistration/clientsā€ defined. One registration for second indoor planel (number 10ā€¦01, IP 10.0.0.31), second registration for ā€œscriptā€ (number 10ā€¦04, IP 10.0.0.27).
Both clients are registered.

And here is something strange.
When I push door button, my master (10ā€¦02) and second (10ā€¦01) pannels are ringing, but ā€œscriptā€ is silent - no output from sctipt (but I can see something - INVITE msg):

When I start call from master to ā€œscriptā€ situation is similar (silent).

But when I start call from second panel (10ā€¦01) to script (10ā€¦04) I see that script receive it (there is output in console), and flow is like this:

With opensips configuration everything was OK.
Can You help me with that script?

Have you tried without the script? Just setting up an outbound trunk?

The script runs indeed on port 5061, the invite should come back to 5060, I believe itā€™s hardcoded on the indoor stationsā€¦
I see on your example the invite is going to 5060, so that looks goodā€¦ how did you define the trunk on asterisk?