Dahua VTO doorbell call to computed

cibernox

n3wb
Dec 30, 2020
4
1
Coruña, Spain
Hi!

This is probably a newbie question, but I couldn't find a good explanation online of the SIP protocol anywhere. I bought a dahua intercom kit (the outdoor unit is a VTO 2202 specifically, the indoor unit is a 7inch touch screen). It came preconfigured so both units speak to each other just fine.

I'd like however to be able to receive SIP calls on my computer too when someone rings the front gate. FWIW, the end goal is not really to receive calls on my computer but on a raspberry PI so I can integrate it into smart home stuff.

What kind of software would I need to run on a computer to receive calls from the outdoor unit (the computer receiving the call would be on the same LAN)? If anyone knows a tutorial for this please share, I couldn't find any.

Thanks
 
Hi and welcome to the forum!
Install asterisk (free SIP server) on your RPi and let all VTO/VTH devices register on it. With some AGI scripts, etc. you can let it communicate with your smart home system.
On you (windows?) PC install any SIP client that support SIP video (like e.g. Jitsi) and hook it up to you asterisk as well.
This is how I run it since a couple of years.
 
Hi and welcome to the forum!
Install asterisk (free SIP server) on your RPi and let all VTO/VTH devices register on it. With some AGI scripts, etc. you can let it communicate with your smart home system.
On you (windows?) PC install any SIP client that support SIP video (like e.g. Jitsi) and hook it up to you asterisk as well.
This is how I run it since a couple of years.
Hey, nice to see you here!

To clarify on your setup, you have disables the SIP server on your outdoor unit and instead you have it connect to asterisk or you keep the SIP server on the VTO running and configure asterisk as a "room" to call like if it was an indoor screen?
 
In fact, asterisk is my only SIP server. All my sip phones (not only VDP devices) are connected to it.
Due the big compatibility and the flood of possibilities asterisk is perfect for this.
 
I might have to read about asterisk and install it on docker. What makes me wary of that approach is that my RPI might fail, I might be restarting it, while the SIP server on the VTO it's guaranteed to be running 24/7.
 
  • Like
Reactions: R7r7
Off course you could interconnect it in another way: Let asterisk register as a stn. on VTO's SIP server. With the group call function, asterisk will be informed about any visitor and this call can be forwarded to e.g. any internal SIP stn. on asterisk or a mobile phone
 
@riogrande75 if it doesn't contain sensitive data, could you paste your asterisk config file (sip.conf or any other you deem relevant)? I'm going to play with it on a virtual machine before putting it on a raspberry PI. In fact ideally I'd like to put it on a docker inside my home assistant installation and the use something like sipML5 - The world's first open source HTML5 SIP client to create a UI component to answer calls inside the web UI.
 
Last edited:
@riogrande75 if it doesn't contain sensitive data, could you paste your asterisk config file (sip.conf or any other you deem relevant)? I'm going to play with it on a virtual machine before putting it on a raspberry PI. In fact ideally I'd like to put it on a docker inside my home assistant installation and the use something like sipML5 - The world's first open source HTML5 SIP client to create a UI component to answer calls inside the web UI.
If you figure out how to install Asterisk on the docker container inside HA could you please share as this is what i am trying to do also.
 
Well - you have to setup your asterisk to meet your needs. In my case, I have lots of phones and functions built with it.
But when it comes to VDP devices, this entries are working fine since a long time in my asterisk 1.6.2.1 with (old) chan_sip:
Code:
[general]
language=de
useragent=RiosPBX
localnet=192.168.1.0/255.255.255.0
transport=udp
qualify=no
srvlookup=no
allowguest=yes
nat=no
context=local
registerattempts=0
registertimeout=60
defaultexpiry=3600
maxexpiry=7200
disallow=all
allow=alaw
allow=ulaw
allow=h264
allow=h263
videosupport=yes

[19]
type=friend
host=dynamic
secret=password
qualify=yes
language=de
username=19
callerid="VTO" <19>
disallow=all
canreinvite=yes
allow=alaw
allow=ulaw
allow=h264
videosupport=yes
insecure=invite
dtmfmode=info

[20]
type=friend
host=dynamic
secret=password
qualify=yes
language=de
username=20
callerid="VTH" <20>
disallow=all
canreinvite=yes
allow=alaw
allow=ulaw
allow=h264
videosupport=yes
insecure=invite
dtmfmode=info
I let VTO call nr. 111 to get a group call, get a special ringing tone on my SIP phones in this case (doorbell sound) and do some other stuff (e.g. switch my TV channel on my enigma2 box to VTO's ip-cam-stream, so I can see the visitor on my TV while I'm watching...)
So the part in my extensions.conf looks like this:
Code:
; *** DOORBELL INCOMING ***;
exten => 111,1,SIPAddHeader("Alert-Info:doorbell") ; Doorbell Ringing Tone
exten => 111,n,system(/var/www/tuerklingelTV.sh ${CALLERIDNUM} &)
exten => 111,n,Dial(SIP/11&SIP/12&SIP/15&SIP/18&SIP/20)
 
  • Like
Reactions: Duc998
Hi riogrande thanks for sharing the setup.
In vto the settigns would be
Asterisk
Ip address of asterisk pbx

wht about the rest of parameters?

thanks

i guess you are the most advanced vto user in the world ... all posts related to sip vto lead to you :-)
 
I have the same vto setup. I was able to add a sip phone (Linphone) on my desktop with these settings. Works great.


1615874616791.png
When it request the username/password, I just put:
Username: 9901#0
Password: 123456 (which is the default)

Note in the SIP Address above: sip:9901%230@192.168.1.210 the %23 is a URL encoded #.
 
@dvbit What other parameters do you mean exactly? Most of them are either self describing or clearly explained in the manual or here.
SIP server must be disabled on the VTO if you use an external one (like asterisk).
 
@riogrande75 whats the main features you get from running your own SIP server? Is it just for Home automation and access via Win/Mobile sip clients? Would be interested to hear to advantages you get over using the built-in sip server.

For example, I'd like to group call all the VTH upstairs from the Kitchen VTH to tell the kids dinner is ready. Would I be able to achieve this by running asterisk? I already have a few z-net z-wave extenders running on RPi3+ and docker in windows for the Dahua VTO mqtt. Depending on your answer I may explorer running asterisk sip server as well.
 
  • Like
Reactions: runraid
Well... I was running asterisk at home for my telephone stuff before I got involved into the IP doorbell story. Actually that's exactly why I chose dahua (SIP connectivity).
Asterisk gives you tons of options - your doorbell / wall terminals will act like standard SIP (video) phones. You can set specific ring groups, configure dependencies (e.g. don't ring inside when nobody is at home but forward call to mobile,...), set forwardings on no reply/not reachable,...
With astersk you can start linux system scripts on specific events.

What I configured so far for my doorbell on asterisk('s):
  • video-calls with vto/vth, android devices and soft clients. Got it working on my mobile via LTE too (even with video), but that's not 100% stable and I don't really need it. Anyhow, it would be calling your mobile without having to use (chineese/us) p2p/cloud services and get the chance to open the door remotely (but safer!)
  • Set a special ringing tone on my house phones when someone is at the door (distinctive ringing)
  • Set specific ring groups depending on daytime (@night: No ringing, that would wake up my kids so I forward it to a voicemail)
  • Switch tv station to VTO's cam stream on ring to see (and hear) visitor (VTO' sends h.264 streams, tv sets can show that natively)
  • Send a pic of the visitor to my mobile via signal messenger (ok, thats not directly asterisk but some extra script)
  • Send a pic and info of used finger of the user who opens the door with the fingerprint
  • Let a (loud) external bell signal visitors when I'm outsinde in my garden via a relay switched on a RPi
  • Reboot my devices automatically on faults (not reachable / de-reg'd)
  • The status (home/away/night,...) can be set very comfortable when misusing the VTH's built in alarm system settings :cool:
  • ...
What I played arround with was speech recognition: Visitor calls, get some questions and you can start actions based on this. I tested it with Google's Cloud Speech-to-Text, buth that would go too far here.
 
I have the same vto setup. I was able to add a sip phone (Linphone) on my desktop with these settings. Works great.

When it request the username/password, I just put:
Username: 9901#0
Password: 123456 (which is the default)

Note in the SIP Address above: sip:9901%230@192.168.1.210 the %23 is a URL encoded #.
I got the VTO and plan to connect it with Android tablet with Home Assistant. Tried to make things work several times with 5 different SIP clients with the settings you described (even with Linphone). For some reason VTO SIP server returns "403 Forbidden" error.
Linphone log is below:

2021-03-21 16:56:13:426 [/belle-sip] MESSAGE channel [139A49B0]: message sent to [UDP:/192.168.0.99:5060], size: [800] bytes
REGISTER sip:192.168.0.99 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.116:5060;branch=z9hG4bK.ImAr8v33M;rport
From: <sip:9901%239@192.168.0.99>;tag=2zKzZvfEz
To: sip:9901%239@192.168.0.99
CSeq: 27 REGISTER
Call-ID: NvjXu~5cpG
Max-Forwards: 70
Supported: replaces, outbound, gruu
Accept: application/sdp
Accept: text/plain
Accept: application/vnd.gsma.rcs-ft-http+xml
Contact: <sip:9901%239@192.168.0.116;transport=udp>;message-expires=604800;+sip.instance="<urn:uuid:a32c570e-640c-004d-b358-7b547fd50a13>"
Expires: 600
User-Agent: Linphone Desktop/4.2.5 (Windows 10 Version 2009, Qt 5.14.2) LinphoneCore/4.4.19
Authorization: Digest realm="VDP", nonce="bf5a82bcb9f1a287d0b1734a0aa2e8bd", algorithm=MD5, username="9901#9", uri="sip:192.168.0.99", response="607663773450219221a309ac39bbc859"

2021-03-21 16:56:13:455 [/belle-sip] MESSAGE channel [139A49B0]: received [401] new bytes from [UDP:/192.168.0.99:5060]:
SIP/2.0 401 Unauthorized
Call-ID: ES1fMtgeHI
Content-Length: 0
CSeq: 25 REGISTER
From: <sip:9999@192.168.0.99>;tag=SZ5FUwr9W
To: <sip:9999@192.168.0.99>;tag=5255a61f398911186015fb862c998360
User-Agent: Dahua UAS/3.0 VTO2202F
Via: SIP/2.0/UDP 192.168.0.116:5060;rport=5060;branch=z9hG4bK.5VEUbCzGI
WWW-Authenticate: Digest realm="VDP", nonce="830231ba494ddf834033ca4f839dc463",algorithm=MD5
 
The REGISTER (number 9901#0) and the 401 Unauthorized (number 9999) do not belong together.
Actually this is a basic SIP issue and has not a lot to do with dahua VTO.
If you want someone to help you, pls. open a new thread, post complete setup (with IP scheme) and add a wireshark trace.
 
  • Like
Reactions: redfive
Hello everybody.
I am in the same situation, I am trying to use a SIP client with DAHUA's SIP server, since with Asterisk it does not work on my VTH 5321 GW.
When I call from the SIP client to the VTO it works perfectly, but when I call from the intercom, and answer from the SIP client, the intercom hangs and restarts.
Any ideas?
 
Too less information (by far) to analyze this problem.

If you consider "playing" with SIP and different devices, there is no other option but asterisk.
Read some stuff to "understand" how the SIP protocol works in general will get you on the right track.
Setup asterisk, register your SIP client/phone on it and if this works, have a look to get dahua devices included.

If you still have problems turn sip debugging on (@cli: "sip set debug on") and post it with config.

Once again, my advise is not to use dahua's internal SIP server. It lacks almost all SIP config options and there is no chance for log/debug afaik.
 
Hello,
This is my first time to try Asterisk , I installed it from "Asterisk for Raspberry Pi" on Raspberry Pi, and tried to make a call from "Linphone" from 2 different android phones.
But I don't know exactly how to configure sip on Asterisk.

@riogrande75
I tried your configuration in sip.conf but also didn't work. Kindly help what else shall I configure

Can you explain in details how can I make a call between 2 android phone?
My next step to use Asterisk for VTO calls with android app, but lets try the configuration first on 2 phones
 
@riogrande75 if it doesn't contain sensitive data, could you paste your asterisk config file (sip.conf or any other you deem relevant)? I'm going to play with it on a virtual machine before putting it on a raspberry PI. In fact ideally I'd like to put it on a docker inside my home assistant installation and the use something like sipML5 - The world's first open source HTML5 SIP client to create a UI component to answer calls inside the web UI.

How did you end up going? there are now some addons and sip clients being developed for HA