Hikvision Doorbell / Videointercom integration

I didn’t test that one , was just posting the info :slight_smile:

I’ve got everything set up and working except I’m not getting early media. I’m not sure whether the problem is the server side configuration or my SIP client.

I’m using FreePBX and I manually compiled app_rtsp_sip and integrated it into Asterisk. I put all the configuration into extensions_custom.conf and pjsip_custom.conf. It mostly worked, the only thing I really needed to change was changing the dial context from default to from-internal.

With MicroSIP on Windows, I get a popup telling me I have an incoming call from the doorbell with three options: accept with video, accept, or decline. If I click accept with video I do see the doorbell video, but only after answering the call.

MizuDroid on Android gives me no video at all, even after answering the call. I’m pretty sure it’s a limitation of this particular client though. Does anyone have a suggestion for an Android client that will work?

I haven’t tested Linphone and would prefer to avoid it. I want to do everything locally without touching the internet.

Linphone is a client you can use local too, no need for internet

I gave Linphone a shot in local mode but had the same sort of behaviour. After downloading the H264 plugin, incoming calls from the doorbell have an answer button and an answer with video button. Clicking the answer with video button shows me the doorbell stream but I’m still not getting any early media.

Does it definitely work using local mode in Linphone? When I created the local SIP account it told me that some features aren’t available unless using an online account.

Are you using the Ami script as I use in my dialplan?
Hoi is your dialplan , cause if you use groupcall , early doesn’t work, it onli works on 1 to 1 call… That’s why I created that workaround

Yep, I’m using the same agi.php script. The only change I made to it was changing the dial context from default to from-internal (which is the standard context FreePBX uses).

Pretty sure I’m using 1 to 1 calling too. This is the line in the 9001 extension that dials my phone (local extension on the same PBX):

same => n,Dial(PJSIP/outgoing/4003)

Well, if you see video afterwards, the rtsp app is ok…
I know on linphone, early video is disabled by default, you need to turn it on…

I’m starting to wonder if the issue is simply just the configuration in Linphone, or me not knowing how to use it. I can’t see anywhere to enable early media in the Linphone Windows version. I manually added this line to the [sip] section in .linphone rc:

incoming_calls_early_media=1

This gave me early audio but I still can’t see the video until I answer the call. Do you actually need to do something when the incoming call popup appears in the bottom right corner of the screen to get the video to appear, like click somewhere?

In the Linphone Android app I can see the option to enable early media in the settings and I’ve turned it on. But I see literally no video or audio at all, even after answering the call. It’s just a black screen. Surely it wouldn’t be a codec issue? The camera is using H264 and it’s a modern Android device.

Is there an idiot’s guide to configuring/using Linphone with this setup?

It’s a long time ago since I used it , but linphone on windows doesn’t have early video, I only got it working on Android… I too had the black screen, reported that on GitHub and it was fixed with a new library back then, maybe the issue is back…

Look on play store for "acrobits voip sip ", that’s also a good app to test and that one had early video with no black screen

Make sure to use also this in your dialplan…

same => n,Progress()

Also try asterisk , then you can rule out maybe a free PBX issue? The rtsp app is already compiled on the HA asterisk addon

It works! The problem was a combination of two things:

  1. Linphone on Android is broken, or at least it’s broken on my particular phone. I managed to get audio working but couldn’t solve the black screen. I tried Acrobits which works nicely with early video. Unfortunately it’s a paid app which cost me $12, but that’s a small price to pay to finally solve this problem.

  2. Also, in the 9001 dialplan I had to change

same => n,Dial(PJSIP/outgoing/4003)

to

same => n,Dial(PJSIP/4003)

I do have outgoing defined in pjsip_custom.conf. Not sure why having it in the dial string was breaking the video, but it works now that I’ve removed it.

Thanks for your help and also your work in creating this whole thing. It makes the doorbell so much more useful.

1 Like

Yeah outgoing is not needed ,I added it there to call linphone services directly @linphone.org

Is it possible that tweaking this integration would work on Akuvox R20?
I bought a unit months ago, and trying to get it working on HA, but no avail :frowning:

this is designed based on Hikvision SDK

1 Like

Hi, Hikvision DS-KD9633-WBE6 is compatible?

Hello @pergola.fabio, I have installed a DS-KH6320-WTE1 + DS-KV6113-WPE1(C), it works fine with your addon, but sometimes all entities of both units go unavailable and I have to restart the addon. I am still trying to find something on the logs,I’ll post here next time it happens, any tips? It seems my all other MQTT entities are working fine.

Hmm, not sure, maybe a resource issue on your host?

Can you please be more precise? I forgot to say that the RSTP flow is active and stable.

Maybe your host has an issue , causing the addon to restart

I don’t think so, more likely could be a connection issue, but the addon stop working (even if it0s running)and never come back online, maybe you can do something about this?

2025-09-22 17:12:16.033 | INFO     | doorbell:authenticate:84 - Connected to doorbell: doorbell-outdoor
2025-09-22 17:12:16.086 | INFO     | doorbell:authenticate:84 - Connected to doorbell: doorbell-indoor
2025-09-22 17:12:16.086 | INFO     | event:__init__:87 - Setting up event handler: Console stdout
2025-09-22 17:12:16.086 | INFO     | mqtt:__init__:115 - Setting up event handler: MQTT
2025-09-22 18:30:15.868 | INFO     | event:video_intercom_alarm:120 - Video intercom alarm from doorbell-outdoor
2025-09-22 18:30:15.868 | INFO     | mqtt:video_intercom_alarm:427 - Alarm <sdk.hcnetsdk.NET_DVR_VIDEO_INTERCOM_ALARM_INFO_UNION object at 0x7fe5156fb240> detected on door 0
2025-09-22 18:30:15.910 | INFO     | mqtt:handle_device_trigger:490 - Invoking device trigger automation{'name': 'door_not_closed_0', 'type': 'not closed', 'subtype': 'Door 1'}
Exception in thread Thread-2 (_thread_main):
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 3591, in _thread_main
    self.loop_forever(retry_first_connection=True)
  File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 1756, in loop_forever
    rc = self._loop(timeout)
  File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 1164, in _loop
    rc = self.loop_read()
  File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 1556, in loop_read
    rc = self._packet_read()
  File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 2439, in _packet_read
    rc = self._packet_handle()
  File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 3033, in _packet_handle
    return self._handle_publish()
  File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 3327, in _handle_publish
    self._handle_on_message(message)
  File "/usr/local/lib/python3.10/site-packages/paho/mqtt/client.py", line 3570, in _handle_on_message
    on_message(self, self._userdata, message)
  File "/app/mqtt.py", line 211, in door_switch_callback
    doorbell.unlock_door(door_id)
  File "/app/doorbell.py", line 144, in unlock_door
    self._call_isapi("PUT", url, requestBody)
  File "/app/doorbell.py", line 194, in _call_isapi
    output = call_ISAPI(self._sdk, self.user_id, http_method, url, requestBody)
  File "/app/sdk/utils.py", line 163, in call_ISAPI
    raise SDKError(sdk, f"Error while calling ISAPI {url}")
sdk.utils.SDKError: ('Error while calling ISAPI /ISAPI/AccessControl/RemoteControl/door/1', 7, 'Failed to connect to the device. The device is off-line, or connection timeout caused by network.')
2025-09-23 08:30:50.393 | INFO     | event:video_intercom_alarm:120 - Video intercom alarm from doorbell-outdoor
2025-09-23 08:30:50.393 | INFO     | mqtt:video_intercom_alarm:427 - Alarm <sdk.hcnetsdk.NET_DVR_VIDEO_INTERCOM_ALARM_INFO_UNION object at 0x7fe5156fb6c0> detected on door 0
2025-09-23 08:30:50.393 | INFO     | mqtt:handle_device_trigger:490 - Invoking device trigger automation{'name': 'door_not_closed_0', 'type': 'not closed', 'subtype': 'Door 1'}
2025-09-23 22:24:03.968 | INFO     | __main__:main:85 - Shutting down
2025-09-23 22:24:12.858 | INFO     | sdk.utils:loadSDK:44 - Using OS: Linux with architecture: x86_64
loop[2] find 2 mac and 1 ip
2025-09-23 22:24:12.994 | INFO     | doorbell:authenticate:84 - Connected to doorbell: doorbell-outdoor
2025-09-23 22:24:13.047 | INFO     | doorbell:authenticate:84 - Connected to doorbell: doorbell-indoor
2025-09-23 22:24:13.047 | INFO     | event:__init__:87 - Setting up event handler: Console stdout
2025-09-23 22:24:13.047 | INFO     | mqtt:__init__:115 - Setting up event handler: MQTT
2025-09-23 22:24:22.127 | INFO     | doorbell:unlock_door:153 -  Door 1 unlocked by SDK
2025-09-23 22:24:22.241 | INFO     | event:video_intercom_event:109 - Video intercom event from doorbell-outdoor
2025-09-23 22:24:22.241 | INFO     | mqtt:update_door_entities:303 - Door 1 unlocked by 979899100 , updating sensor and device trigger
2025-09-23 22:24:22.254 | INFO     | mqtt:handle_device_trigger:490 - Invoking device trigger automation{'name': 'Door unlocked', 'type': 'door open', 'subtype': 'door 0', 'payload': {'control_source': '979899100'}}

At the moment I have made an automation that restart the addon in case one o the station does not ping fo 2 minutes.

Hmm it normally reconnects when devices are back online, if I reboot my Hikvision, I don’t have to restart the addon