etstudent
Members-
Content Count
3 -
Joined
-
Last visited
Community Reputation
0 Neutral-
Dahua VTO2000A, SIP Firmware and Asterisk
etstudent replied to Allodo's topic in Installation Help and Accessories
Hi rio, thanks for the links. I already had a look on it. I did some updates to my config and like too share it: [from-door] ;;;;;;;;;;;;;;;;;; exten => 9901,1,Ringing() exten => 9901,n,Answer() ;Get a snapshot and save locally, -y option is needed, otherwise Asterisk will hang because the system asks, whether it shall overwrite the old file exten => 9901,n,TrySystem(avconv -i 'rtsp://admin:admin@192.168.0.90' -f image2 -vframes 1 -pix_fmt yuvj420p /tmp/snapshot1.jpg -y) ;Send photo to telegram chat group "Haus" exten => 9901,n,TrySystem(/home/pi/tg_photo.sh Haus "/tmp/snapshot1.jpg") ;With this a text message can be sent to telegram chat group "Haus" ;exten => 9901,n,TrySystem(/home/pi/tg.sh Haus "Hello World") ;enable door open macro exten => 9901,n,Set(__DYNAMIC_FEATURES=door-open1) ;Call SIP clients exten => 9901,n,Dial(SIP/6001&SIP/610&SIP/6003,30) ;quit call exten => 9901,n,Hangup() ;;;;;;;;;;;;;;;;;; [macro-door-open1] ;Open door by using cgi exten => s,1,TrySystem(curl --user admin:admin --digest "http://192.168.0.90/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote") I tried to implement the Telegram solution, meaning the pi sends a snapshot too a telegram account, when someone pushes the door bell. Therefore I needed to install the telegram-cli on the pi. I was doing this according to this guideline https://pimylifeup.com/raspberry-pi-telegram-cli I installed the tool as user pi in the home directory. I also discovered, that in the line exten => 9901,n,TrySystem(avconv -i 'rtsp://admin:admin@192.168.0.90' -f image2 -vframes 1 -pix_fmt yuvj420p /tmp/snapshot1.jpg -y) the -y option is very important. It will make the shell overwrite the old file without asking. WIthout this option the asterisk was hanging. I also needed some time too realize that asterisk is run by the user asterisk and not pi. As I did all installation via SSH and user pi it's important too chmod the scripts tg_photo.sh and tg.sh to the user asterisk. A good way is to test the commands on the command line by using sudo -u asterisk BEFEHL where BEFEHL should be replaced by the command that you want to use. By this I also discovered that Telegram needs to be registered by the user asterisk, otherwise it will not work: You can do this by calling sudo -u asterisk /home/pi/tg/bin/telegram-cli -k tg-server.pub -W Then your going to be asked for your telephone number and so on... Next issue that I see with the telegram: The pi is sending the snapshot to my own telegram account, meaning I don't get any notification. Maybe someone has a workaround for this, I didn't find one so far. The last solution would be to get a separate cell phone number for this. -
Dahua VTO2000A, SIP Firmware and Asterisk
etstudent replied to Allodo's topic in Installation Help and Accessories
Hello, I'd like to share my current state of my setup. I have a VTO2000A-C, FreePBX asterisk server on a Raspberry PI 3 and I'm using Linphone to get the calls from the door station. The VTO is making a ringing sound, while the call is not responded. As soon I take the call on my Linphone the video stream is shown there. I can open the door with 777 command. The base for my configuration was this thread and this: https://ab-log.ru/smart-house/asterisk/sip-vto2000a Firmware Upgrade First of all I updated the firmware to SIP 1.2 in from the russian site. I did not found V1.2 on the Dahua servers. The only modification in this firmware is that the woman is talking russian. I used config tool 4.05 to update the firmware of the VTO2000A. In the config tool you have to push the icon in the down left corner, then select VDP config. I connected the VTO directly to my notebook and changed the IP of the interface to 192.168.1.100, as the standard IP of the VTO is 192.168.1.110. Then the config tool could connect to VTO. Asterisk Installation on RPi3 On this site you can download a FreePBX image: http://www.raspberry-asterisk.org/downloads/ Use Etcher to burn it to the sd Card. Don't forget the raspbx-upgrade. I used Putty to connect to the Raspberry. Asterisk Config via SSH The asterisk files are located under /etc/asterisk. The two files below were the only once I edited via SSH. All the rest I did via the FreePBX web interface (see next chapter) My extensions_custom.conf: [from-door] exten => 9901,1,Ringing() exten => 9901,n,Answer() exten => 9901,n,Set(__DYNAMIC_FEATURES=door-open1) exten => 9901,n,Dial(SIP/6001,30) ;6001 is the linphone client on my smartphone exten => 9901,n,Hangup() [macro-door-open1] exten => s,1,TrySystem(curl --user admin:admin --digest "http://192.168.0.90/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote") 192.168.0.90 is the IP of my VTO 192.168.0.132 is the IP of the RPi The features_applicationmap_custom.conf contains the macro to open the door via phone code: door-open1 => 777,self/callee,Macro,door-open1 Asterisk Config in the FreePBX WebInterface At first start you will need to register. At "Settings -> Asterisk SIP settings" you should set your network settings. At beginning I was trying to use PJSIP, but couldn't get this to work. So use normal SIP. There it's important to enable Video Support and select H264 codec https://ibb.co/i4yx87 Under Applications ->Extensions you can add the extensions. In my case it's 6001 for the smartphone. THe context is from-internal (see Advanced tab). The video support needs to be on or inherited from the main settings. DTMF Signaling needs to be on RFC2833 to make the unlock code work. Secret should be the password you use to connect from the linphone. The other extension is the VTO 01018001 in my case. I could not change this in the VTO webinterface. The context is from-door. Also enable the video support. https://ibb.co/gbjR1S https://ibb.co/gwtm1S https://ibb.co/eQqoFn https://ibb.co/if3m1S https://ibb.co/gtsDgS VTO-2000A settings https://ibb.co/kb7787 https://ibb.co/fb2UMS https://ibb.co/f9DEo7 https://ibb.co/miKXan https://ibb.co/ifg0T7 https://ibb.co/gHCw1S Logfile of operation: The FreePBX allows to view the logs in a convenient way. This is what I see when I push the door button: 2018-02-12 14:46:47] VERBOSE[6257] config.c: Parsing '/etc/asterisk/sip.conf': Found [2018-02-12 14:46:47] VERBOSE[31216] loader.c: Reloading module 'res_pjsip_notify.so' (CLI/AMI PJSIP NOTIFY Support) [2018-02-12 14:46:47] VERBOSE[31216] loader.c: Reloading module 'res_adsi.so' (ADSI Resource) [2018-02-12 14:46:47] VERBOSE[31216] loader.c: Reloading module 'app_confbridge.so' (Conference Bridge Application) [2018-02-12 14:46:47] VERBOSE[6257] config.c: Parsing '/etc/asterisk/sip_general_additional.conf': Found [2018-02-12 14:46:47] VERBOSE[31216] loader.c: Reloading module 'cel_manager.so' (Asterisk Manager Interface CEL Backend) [2018-02-12 14:46:47] VERBOSE[31216] loader.c: Reloading module 'cel_odbc.so' (ODBC CEL backend) [2018-02-12 14:46:47] VERBOSE[31216] config.c: Parsing '/etc/asterisk/cel_odbc.conf': Found [2018-02-12 14:46:47] VERBOSE[6257] config.c: Parsing '/etc/asterisk/sip_general_custom.conf': Found [2018-02-12 14:46:47] VERBOSE[31216] config.c: Parsing '/etc/asterisk/cel_odbc_custom.conf': Found [2018-02-12 14:46:47] VERBOSE[6257] config.c: Parsing '/etc/asterisk/sip_nat.conf': Found [2018-02-12 14:46:47] VERBOSE[6257] config.c: Parsing '/etc/asterisk/sip_registrations_custom.conf': Found [2018-02-12 14:46:47] VERBOSE[6257] config.c: Parsing '/etc/asterisk/sip_registrations.conf': Found [2018-02-12 14:46:47] VERBOSE[6257] config.c: Parsing '/etc/asterisk/sip_custom.conf': Found [2018-02-12 14:46:47] VERBOSE[6257] config.c: Parsing '/etc/asterisk/sip_additional.conf': Found [2018-02-12 14:46:47] VERBOSE[6257] config.c: Parsing '/etc/asterisk/sip_custom_post.conf': Found [2018-02-12 14:46:47] VERBOSE[31216] cel_odbc.c: Found CEL table cel@asteriskcdrdb. [2018-02-12 14:46:47] VERBOSE[31216] loader.c: Reloading module 'codec_speex.so' (Speex Coder/Decoder) [2018-02-12 14:46:47] VERBOSE[31216] loader.c: Reloading module 'app_voicemail.so' (Comedian Mail (Voicemail System)) [2018-02-12 14:46:47] VERBOSE[31216] config.c: Parsing '/etc/asterisk/voicemail.conf': Found [2018-02-12 14:46:47] WARNING[31216] app_voicemail.c: maxsilence should be less than minsecs or you may get empty messages [2018-02-12 14:46:47] VERBOSE[31216] loader.c: Reloading module 'app_playback.so' (Sound File Playback Application) [2018-02-12 14:46:47] VERBOSE[31216] loader.c: Reloading module 'app_queue.so' (True Call Queueing) [2018-02-12 14:46:47] NOTICE[31216] app_queue.c: No queuerules.conf file found, queues will not follow penalty rules [2018-02-12 14:46:47] VERBOSE[6257] netsock2.c: Using SIP TOS bits 96 [2018-02-12 14:46:47] VERBOSE[6257] netsock2.c: Using SIP CoS mark 4 [2018-02-12 14:46:47] VERBOSE[6257] config.c: Parsing '/etc/asterisk/sip_notify.conf': Found [2018-02-12 14:46:47] VERBOSE[6257] config.c: Parsing '/etc/asterisk/sip_notify_custom.conf': Found [2018-02-12 14:46:47] VERBOSE[6257] config.c: Parsing '/etc/asterisk/sip_notify_additional.conf': Found [2018-02-12 14:47:04] VERBOSE[6257][C-0000001b] netsock2.c: Using SIP VIDEO TOS bits 136 [2018-02-12 14:47:04] VERBOSE[6257][C-0000001b] netsock2.c: Using SIP VIDEO CoS mark 6 [2018-02-12 14:47:04] VERBOSE[6257][C-0000001b] netsock2.c: Using SIP RTP TOS bits 184 [2018-02-12 14:47:04] VERBOSE[6257][C-0000001b] netsock2.c: Using SIP RTP CoS mark 5 [2018-02-12 14:47:04] VERBOSE[31227][C-0000001b] pbx.c: Executing [9901@from-door:1] Ringing("SIP/01018001-00000031", "") in new stack [2018-02-12 14:47:04] VERBOSE[31227][C-0000001b] pbx.c: Executing [9901@from-door:2] Answer("SIP/01018001-00000031", "") in new stack [2018-02-12 14:47:04] VERBOSE[31227][C-0000001b] pbx.c: Executing [9901@from-door:3] Set("SIP/01018001-00000031", "__DYNAMIC_FEATURES=door-open1") in new stack [2018-02-12 14:47:04] VERBOSE[31227][C-0000001b] pbx.c: Executing [9901@from-door:4] Dial("SIP/01018001-00000031", "SIP/6001,30") in new stack [2018-02-12 14:47:04] VERBOSE[31227][C-0000001b] netsock2.c: Using SIP VIDEO TOS bits 136 [2018-02-12 14:47:04] VERBOSE[31227][C-0000001b] netsock2.c: Using SIP VIDEO CoS mark 6 [2018-02-12 14:47:04] VERBOSE[31227][C-0000001b] netsock2.c: Using SIP RTP TOS bits 184 [2018-02-12 14:47:04] VERBOSE[31227][C-0000001b] netsock2.c: Using SIP RTP CoS mark 5 [2018-02-12 14:47:04] VERBOSE[31227][C-0000001b] app_dial.c: Called SIP/6001 [2018-02-12 14:47:04] VERBOSE[31227][C-0000001b] app_dial.c: SIP/01018001-00000031 requested media update control 26, passing it to SIP/6001-00000032 [2018-02-12 14:47:05] VERBOSE[31227][C-0000001b] app_dial.c: SIP/6001-00000032 is ringing [2018-02-12 14:47:05] VERBOSE[31227][C-0000001b] app_dial.c: SIP/6001-00000032 is ringing [2018-02-12 14:47:06] VERBOSE[31227][C-0000001b] app_dial.c: SIP/6001-00000032 answered SIP/01018001-00000031 [2018-02-12 14:47:06] VERBOSE[31228][C-0000001b] bridge_channel.c: Channel SIP/6001-00000032 joined 'simple_bridge' basic-bridge <513c67dd-2239-4e95-ada7-39891d087f9a> [2018-02-12 14:47:06] VERBOSE[31227][C-0000001b] bridge_channel.c: Channel SIP/01018001-00000031 joined 'simple_bridge' basic-bridge <513c67dd-2239-4e95-ada7-39891d087f9a> [2018-02-12 14:47:28] VERBOSE[31228][C-0000001b] pbx.c: Executing [s@macro-door-open1:1] TrySystem("SIP/6001-00000032", "curl --user admin:admin --digest "http://192.168.0.90/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote"") in new stack [2018-02-12 14:47:32] VERBOSE[31228][C-0000001b] bridge_channel.c: Channel SIP/6001-00000032 left 'simple_bridge' basic-bridge <513c67dd-2239-4e95-ada7-39891d087f9a> [2018-02-12 14:47:32] VERBOSE[31227][C-0000001b] bridge_channel.c: Channel SIP/01018001-00000031 left 'simple_bridge' basic-bridge <513c67dd-2239-4e95-ada7-39891d087f9a> [2018-02-12 14:47:32] VERBOSE[31227][C-0000001b] pbx.c: Spawn extension (from-door, 9901, 4) exited non-zero on 'SIP/01018001-00000031' I'm wondering what the spawn extension at the end does mean. The hangup application does not occur there, maybe it's this one. Currently working on What I'm still searching for is way too show the camera picture before the call is accepted. Video or snapshot. Also I have two problems with the wiring. 1) I couldn't start the VTO with only one CAT wire attached. I have bought a NETgear POE switch, but does not work. Then I bought some passive POE adapters (https://www.amazon.de/DIGITUS-Professional-Kabelset-Splitter-Steckerdurchmesser/dp/B002NBN72C/ref=pd_sim_147_6?_encoding=UTF8&psc=1&refRID=Y930XJ3F30091BTZ1G1R). I used only one of them, but does also not work. The other problem is that the E-Opener is controlled by my SPS inside. I would need an additional cable from the VTO to my SPS to get the Open Door Command or use some spare wires of the CAT, but these are used for the power supply as I understood. I think I will need to get the command from the RPi somehow. -
Dahua VTO2000A, SIP Firmware and Asterisk
etstudent replied to Allodo's topic in Installation Help and Accessories
Hello, I'm new to this forum and was reading the whole thread. However one question is still open for me. You all use asterisk to call your phones, when someone rings the door bell. My question is: Can I use a simple android tablet without sim card to be called? Many thanks.