Hik-Connect

I thought it so, I found your posts about this in some PBX forums. I was even considering recompile asterisk with this functionality, but…

This would be perfect in my case, I will give a shot!! :slight_smile:

I created a very simple script just for debug the sip registration process, making small changes to the request to find-out where/why asterisk was failing. From your code I copied some parts, such as the Packet class, the method http_auth, etc.

Thank you.

ah, that makes sense, its still strange tough that it fails on your end, when i dont add the device firsr in IVMS, i cant register, i believe with an 401 error, when i added the device with a fake SN , then it indeed registers, the username is the only important one, it should match with the register
Also whats important, that you run asterisk on 5060 , i think the comm from indoor back to client, is always hardcoded on 5060 (probably not changable on indoor devices)

you can use indeed my script, its complete, it even intercepts invite messages

I was also think into compiling extra headers in Asterisk, but thats beyond my knowledge :slight_smile:
I also have another addon, based on OpenSips, that one is able to send extra body headers in the REGISTER, buts its offcourse an overkill vs the script

But remember, video is not forwarding , i dont know why, was not able to find the root cause, but for me the most important one, was that i still have EARLY video on my indoor… if you configure the default SIP settings on the device, this was not possible

I am using Linhome/Linphone, and i modified it, to inject manually an RTSP stream in the call as early preview and while in call…
i used this project : GitHub - alexeyvasilyev/rtsp-client-android: Lightweight RTSP client library for Android

So now i have early video on INDOOR as well on my softphone client… And even if asterisk/HA is down, my indoor stay working :slight_smile:

Also have a thread opened here below, what the issue could be that video is not going to the registered endpoint… it should work, because my second indoor station does have video, on the asterisk registered doesnt have video

but never got any response :slight_smile:

Here the same, I also want keep the normal Hikvision functionalities working, independently if HA is up and running or not.

Good news: your suggestion of registering asterisk as extension of the main indoor station using the py script in HA worked!! :slight_smile: I had to configure an automation to execute the script every 10 min, otherwise the “extension” gets unregistered.

Pressing the button on the door station (DS-KD8003) sends an INVITE request to Asterisk, but I still don’t have the dialplan configured for this endpoint. So Asterisk just logs the following:

[Oct 25 12:45:08] WARNING[422][C-00000001]: pjsip/dialplan_functions.c:1018 pjsip_acf_dial_contacts_read: Specified endpoint '10000000002' was not found
[Oct 25 12:45:08]     -- Executing [10000000002@default:1] Dial("PJSIP/hikvision-00000000", "") in new stack
[Oct 25 12:45:08]     -- No devices or endpoints to dial (technology/resource)
[Oct 25 12:45:08]     -- Auto fallthrough, channel 'PJSIP/hikvision-00000000' status is 'CHANUNAVAIL'

Do you mind to also share the dialplan config for this case?

Thanks in advance.

Regarding the video: I am already using the RTSP stream from KD8003, this should be enough for my use case. Anyway, I will take a look on the linked thread as soon as I get the asterisk fully working for voice call.

Yeah, you can also setup a shell sensor with a scan interval like any 15 min… Or use my script, it has an reregister included…

For the dialplan , it’s easy, just start with 100000002 and then the rest… I can share offcourse later

Is your usecase to call to softphones? Or use the sip Lovelace card? Then indeed the rtsp is enough

Lovelace card. Just want be able to answer the intercom remotely.

The dialplan syntax is new for me, still trying to understand. This is what I have so far:

exten => 10000000002,1,Dial(${PJSIP_DIAL_CONTACTS(100)},30)

Basically I want redirect a call from the intercom to an asterisk user, in this case the user 100.

However, despite the add-on have created the user 100 automatically, ${PJSIP_DIAL_CONTACTS(100)} is returning an empty string. Here is the log:

[Oct 25 14:54:04]     -- Executing [10000000002@default:1] Dial("PJSIP/hikvision-00000000", ",30") in new stack
[Oct 25 14:54:04]     -- No devices or endpoints to dial (technology/resource)
[Oct 25 14:54:04]     -- Auto fallthrough, channel 'PJSIP/hikvision-00000000' status is 'CHANUNAVAIL'

It must be something wrong with this dialplan.

NVM - the dialplan is correct. The issue was with lovelace card configuration. The ‘person’ must have password, without it does not register with asterisk.

yes , iindeed
but dont use that dialplan for the lovelace card, the biggest problem, ff you browse away from the view, the card gets unregistered, of when you restart asterisk, it doesnt register, so you wont receive the call

for sip card, and door intercom purposes, use the parking function as explained here:

So just change the 444 to 1000000002 , then the call gets in a hold position
from the card itself, dial 555 or use the auto dial function of the card, and you can pickup the call

the second problem you have, when using the parked funtion in my reply above, is the call get picked up, and i think your indoor station doesnt ring anymore, because the call gets in a “answered” state, i think its better to use a conference maybe and the use the originate to invite 100 to the call , maybe in combination with the parking option

see an example here:

here i start a conference, and i originate 6000 (ask 6000) to the call in your case its 100
disregard the 7000 in that dialplan, thats the RTSP user, but not needed if you use the rtsp camera feed

But join the discord channel maybe of the asterisk addon, we are going way off-topic here… all though still interesting for @tomasbedrich , because all this SIP stuff is usable for him too, because you don’t need to have access to outdoor station, this is all based on indoor station and forwarding the call…
In appartements, most users don’t have admin access to outdoor station

You are right that I don’t have access to outdoor station. But my indoor station does not support Wi-Fi. :slight_smile: not even mentioning, that I am supposed not to touch indoor station at all by contract signed with building maintenance company :slight_smile:

Ow, that’s a bummer indeed. I thought all indoor devices had wifi

You are right, hopefully all we discussed can be of some help to others HA/Hikvision users. At my end got almost everything working perfectly :slight_smile: the parking extension, as you suggested, may be the final piece on this puzzle. Answering intercom/doorbell calls on HA was the final thing to finish my dreamed home automation. Thank you very much for your help.

1 Like

Good luck :slight_smile:
Would be great if you could find out why video is not forwarded… That’s the only thing I’m missing

Anyway, the best approach for you is to setup a conference, advantage is that the card doesn’t need to be registered, you just join the call, and also the door/indoor keeps ringing

Too bad, I discovered yesterday a way to access ISAPi on indoor panel, but using the SDK on port 8000
Seems 80 is not open…
I can now retrieve the events and can even drop/answer the call, usefull with a ZigBee sensor at the door

I thought all indoor panels have wifi?

Hi @J2Kbr , how is your asterisk setup now? The only part missing for me when register as extension is the video… And sometimes I don’t have two way audio…

You?

Hi, folks. I’m using Scrypted to export my doorbell to HomeKit. With Scrypted I can create group devices and build a complete doorbell.

To trigger this doorbell I need to use this link http://192.168.2.XX:11080/endpoint/48/public/ . Just open this page do the doorbell ring at HomeKit.

How can I create an automation on Home Assistant to detect when Call State changes to ringing and “open” this web page? Just a quickly check on this page is enough to ring the doorbell

Guys all the same, tell me how to integrate the Hikvision DS-KH6320-WTE1 video panel into Homeassiatant. It can use 8 alarm inputs (sensors) and 2 alarm outputs (relays). All this can be used as a home alarm system. Please tell me.

Hi, my KV6113 is constantly changing from idle to Unavailable. What could be happening?


Indisponível = unavailable

@Krasimir_Stanev
Hey. I would very much appreciate your help with getting me an API for my intercom (HikVision). Thanks