Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting rid of Asterisk #1

Open
moskovskiy82 opened this issue Jun 12, 2024 · 42 comments
Open

Getting rid of Asterisk #1

moskovskiy82 opened this issue Jun 12, 2024 · 42 comments

Comments

@moskovskiy82
Copy link

Found a link for this solution on one of the telegram channels. Is asterisk required only for the button pressed event?

As this is easily achieved with the dahua integration or i get something wrong? Would love to have the same set up but setting up an asterisk for this seems will take too much time

trigger:

  • platform: state
    entity_id: binary_sensor.kalitka_vto_button_pressed
    from: 'off'
    to: 'on'
@felipecrs
Copy link
Owner

You can see in my automation.yaml that I already use such sensor:

trigger:
- platform: state
entity_id:
- binary_sensor.doorbell_dahua_button_pressed
to: "on"

But on my tests, unless the VTO is connected to a SIP server (that's why Asterisk), such sensor won't fire.

@felipecrs felipecrs changed the title Getting rid of asteriks. Getting rid of Asterisk Jun 12, 2024
@moskovskiy82
Copy link
Author

Well strange as for me it works without any flow. I have a VTO3211D

Haven't almost touched any settings but if it helps here is the setup

image

image

image

image

image

image
Seems here room no doesn't do ....t

UPnP enabled but all failed :) And everything works including DMSS

image

image

image

@felipecrs
Copy link
Owner

Thank you. I had tested before using the VTO's own SIP Server and it didn't work. But I will test again. You are not the first one who says it works.

I have some questions though:

image

The IP address you blurred is the VTO's IP address?

And everything works including DMSS

That is one difference. I purposely disabled cloud access on my VTO.

Also, can you please explain what happens when you press the doorbell button with this setup?

What audio does it play? If the sensor is working correctly, I would expect it to play "Calling now, please wait a moment" and then nothing else.

@moskovskiy82
Copy link
Author

  1. Yes VTO's. As you can see when the SIP Server check box is checked all options are not available for change. I guess IP is put up automatically.
  2. As soon as the button is pressed "Calling now, please wait a moment" is played on VTO. DMSS shows an incoming call and the integration in HA fires an event. So i get an announcement "Someone is calling at the gate" on my smart speaker

@felipecrs
Copy link
Owner

  1. Yes VTO's. As you can see when the SIP Server check box is checked all options are not available for change. I guess IP is put up automatically.

Yes, intuitively that's what it does, but I read somewhere that these options can be changed, but you need to change them with "Enable SIP Server" unticked, save, and then tick it. Not sure if it's true anyway.

  1. As soon as the button is pressed "Calling now, please wait a moment" is played on VTO. DMSS shows an incoming call and the integration in HA fires an event. So i get an announcement "Someone is calling at the gate" on my smart speaker

Amazing. I wish I could replicate that. I will do some tests this weekend. I hope I don't need to enable cloud function for this to work though.

@convicte
Copy link

To add another point of data for your consideration @felipecrs my setup is identical to this of @moskovskiy82 as it comes to the VTO.
Mine is a different model (VTO2101E), which could point to the fact it's a universal behavior for these VTOs.
In addition, I am using https://github.com/rroller/dahua integration for triggering an HA automation, to have a T2S announcement from my Google speaker.

Pressing the button will trigger an Opened/Closed event in HA for the button entity:
image

The automation is as simple as:

alias: Doorbell-cast-notification - through integration Dahua VTO
description: ""
trigger:
  - platform: state
    entity_id: binary_sensor.vto_button_pressed
    from: "off"
    to: "on"
condition: []
action:
  - service: media_player.volume_set
    data:
      volume_level: 1
    target:
      device_id:
        - REDACTED
  - repeat:
      count: "2"
      sequence:
        - service: tts.cloud_say
          data:
            entity_id: media_player.living_room_clock
            message: Ding-Dong, someone is at the door!
            language: en-IE
            cache: true
        - delay:
            hours: 0
            minutes: 0
            seconds: 5
            milliseconds: 0
  - service: media_player.volume_set
    data:
      volume_level: 0.5
    target:
      device_id:
        - REDACTED
mode: single

As for the VTO side, the announcement would at first be something to the effect of "Calling now, please wait a moment", but don't remember the exact wording, followed by another announcement when the call fails (since I don't have anything set up to actually pick it up). I don't remember the wording verbatim, but something like "Call was not picked up...". This announcement is made after 20–30 seconds of ringing.

I hope this helps! Would really love to recreate your setup without needing to deal with Asterisk, etc.

@felipecrs
Copy link
Owner

followed by another announcement when the call fails (since I don't have anything set up to actually pick it up)

You can solve that by cancelling the call as soon as possible after it starts ringing. Check my automation:

- service: dahua.vto_cancel_call
target:
entity_id: camera.doorbell_dahua

@felipecrs
Copy link
Owner

felipecrs commented Jun 13, 2024

But hey guys, if the button_pressed sensor is working for you with the built-in SIP server, you don't need Asterisk. As mentioned in my setup, that's the only reason why I needed it.

You can just skip setting up Asterisk in this case, and proceed with everything else. :D

@Cr4z33
Copy link

Cr4z33 commented Jul 4, 2024

Well strange as for me it works without any flow. I have a VTO3211D

Haven't almost touched any settings but if it helps here is the setup
Tell me what did you setup then in Home Assistant to be able to get the VTO calls?

@moskovskiy82 can you please extend the details?

I am trying to get this working without the need of Asterisk.

@Cr4z33
Copy link

Cr4z33 commented Jul 5, 2024

OK while waiting for @moskovskiy82 reply I would like to give Asterisk a try therefore @felipecrs can you please give me some further details? 🙏🏼

Like what "SIP Domain" did you enter to connect the VTO to Asterisk?

Did you leave "VDP" or did you enter "asterisk" (as suggested by someone in another issue I cannot remember about)?

Also what extension number is Home Assistant then? 801?

I've got by the way a VTO2202F-P-S2.

@felipecrs
Copy link
Owner

@Cr4z33 check the files in this repository, I believe everything is explained there.

@Cr4z33
Copy link

Cr4z33 commented Jul 8, 2024

@felipecrs tell me did you have to enter the "5060" port and the "admin" SIP server username in the Asterisk integration config?

Actually would you mind copying&pasteing the YAML config here please? 😬

I still can't get it working. 🥲

@felipecrs
Copy link
Owner

felipecrs commented Jul 8, 2024

tell me did you have to enter the "5060" port and the "admin" SIP server username in the Asterisk integration config?

Where? I didn't understand it.

Anyway, the config is pretty much default as far as I remember:

ami_password: secretpass
auto_add: false
auto_add_secret: secretpass
video_support: false
generate_ssl_cert: true
certfile: fullchain.pem
keyfile: privkey.pem
additional_sounds: []
mailbox: false
mailbox_port: 12345
mailbox_password: ""
mailbox_extension: "100"
mailbox_google_api_key: ""
log_level: info

@Cr4z33
Copy link

Cr4z33 commented Jul 8, 2024

@felipecrs thanks for sharing, but I got Asterisk working at last by editing sip.conf.

I had to change the default port to 5060.

After that my VTO calls got accepted by Asterisk.

Now I have to keep adapting your Frigate card code to my entities and devices so it's still a long journey... 🥵

I hope you won't mind if I will reply here again?

At the end of the day I think it's useful for everybody interested into it. 😅

@felipecrs
Copy link
Owner

I had to change the default port to 5060.

I think you messed up with something. You didn't need to do this. sip.conf is for the deprecated chan-sip support. And 5060 is already the default for pjsip (pjsip.conf).

Furthermore, chan-sip (sip.conf) comes even disabled by default unless you enable it on modules.conf. So... what you are describing makes no sense to me.

I hope you won't mind if I will reply here again?

Absolutely not, please do it.

@Cr4z33
Copy link

Cr4z33 commented Jul 8, 2024

Well before I was getting errors in the Asterisk addon logs when pressing the VTO button and also the Asterisk integration was accepting 5038 port only.

As soon as I changed the port to 5060 in sip.conf the integration accepted it too (and the errors were gone).

@Cr4z33
Copy link

Cr4z33 commented Jul 10, 2024

@felipecrs so far I got FINALLY working the Frigate card! 😁

I am replying this just to leave it here as a note for everybody out there.

The main misunderstanding (if you are an average Home Assistant user like me hehe) in the Frigate Card code provided by Felipe is that camera.doorbell at line 6 is NOT a Home Assistant entity ID, but actually the name of one of the go2rtc streams entered in Felipe's Frigate config (see line 6)!

Now all I have to do is adapt your automations to my house.

@felipecrs
Copy link
Owner

Hey @Cr4z33, in fact camera.doorbell is a Home Assistant entity. It's created by the Frigate integration for Home Assistant.

@Cr4z33
Copy link

Cr4z33 commented Jul 10, 2024

Hey @Cr4z33, in fact camera.doorbell is a Home Assistant entity. It's created by the Frigate integration for Home Assistant.

Oh even more at risk of misunderstanding then lol!

OK I take back what I said about go2rtc. 😅

@felipecrs
Copy link
Owner

But it's true, even though camera.doorbell is a true entity, I am still overriding its go2rtc stream URL in this line:

@Cr4z33
Copy link

Cr4z33 commented Jul 10, 2024

But it's true, even though camera.doorbell is a true entity, I am still overriding its go2rtc stream URL in this line:

Yeah I noticed it.

Right now I am dealing with your ringing doorbell automation: first thing is that I replaced Fully Kiosk with Browser Mod that allows me to use more devices (ie. I've got a tablet running Linux), but generally speaking it's really a nice project for the Dahua VTOs! 👏🏼

Most of all I am happy I didn't have to setup a pfSense machineto deal with WebRTC SSL issues and others as needed with other projects.

It works even with the Amcrest AD410 video doorbell so I guess it might work with HikVision and IMOU (they all belong to the same company after all) too!

@felipecrs
Copy link
Owner

It should work with any camera that go2rtc can 2-way audio with. For Hikvision, you'll need @pergolafabio's add-on to stop the call and receive the events.

@felipecrs
Copy link
Owner

felipecrs commented Aug 12, 2024

A piece of news, Dahua released a new firmware for my VTO:

https://www.dahuasecurity.com/pt/products/All-Products/Video-Intercoms/IP-Series/Villa-Door-Station/Pro-Series/VTO2202F-P-S2

V4.600.0000000.2.R.240802

I already upgraded to it, and everything remains working. I will test getting rid of Asterisk soon to see if something changed.

@convicte
Copy link

Just to reiterate @felipecrs , as I've managed to get SIP working on my house alarm panel - Dahua integration https://github.com/rroller/dahua is working just fine in detecting button presses without the SIP server running on the VTO.
Haven't looked into specific EVENTS though - to be honest.

I was treating over needing it to run SIP server on the VTO, since it didn't work with my Satel alarm system (it wouldn't recognize the VTO SIP), so was glad to see it works just fine with any SIP server setup thus far (more specifically mine is on INT-TSI panel from Satel).

image

The issue I am having is I don't know if the VTO2101E-P-S1 (https://www.dahuasecurity.com/ceen/products/All-Products/Discontinued-Products/Video-Intercoms/VTO2101E-P-S1) has any chance of working with your setup, as the audio encoding doesn't seem to be adjustable (I believe).

The thing I would like to work is to have the option to pick up SIP connections from HA phone APP, as I have a SIP wall alarm panel serving as the permanent reception device.
Any ideas how to easily get this part working for VTO which is unlikely to have ACC audio compression?
Help will be greatly appreciated.

@convicte
Copy link

FYI, Events are also being received:
image

@felipecrs
Copy link
Owner

felipecrs commented Aug 12, 2024

The issue I am having is I don't know if the VTO2101E-P-S1 (https://www.dahuasecurity.com/ceen/products/All-Products/Discontinued-Products/Video-Intercoms/VTO2101E-P-S1) has any chance of working with your setup, as the audio encoding doesn't seem to be adjustable (I believe).

I advise you to test the solution to change the codec in fix_vto_codecs.sh anyway. Or have you tried already and it doesn't work?

Otherwise, if you want to keep using SIP, then you can use the SIP hass card: https://github.com/TECH7Fox/sip-hass-card

BTW the purpose of this issue is to drop the dependency on an external SIP server. If I am understanding correctly, you still depend on an external SIP server and that's why the Dahua integration works. If that's not the case, i.e. if you are using the VTO embedded SIP server, please clarify.

@convicte
Copy link

  1. For me the situation is a bit more convoluted with the codec (and I must admit I didn't look into it yet), since my Frigate is running as a separate container under Unraid and not HA addon, so I am a bit lost where the script would have to copied into and how to set up privilages in the said location. If you can point me in the right direction, I'd love to test it out.
    HA OS is running in a VM on the same Unraid server, btw.
  2. I've tried the https://github.com/TECH7Fox/sip-hass-card but thusfar have not been able to figure it out - as there doesn't seem to be an option to provide a SIP server password, which would allow the card to connect. The documentation is very inconsistent as to how a password protected SIP server would be handled.
  3. While I am using a SIP server to connect my VTO with a Satel INT-TSI wall pannel, this, I believe has nothing to do with the integration sending the button presses to HA. More specifically HA has no clue the SIP server exists and the SIP server is running on the wall pannel for the purpose of VTO to pannel connection. I hope that clarifies things.

Thanks!!

@felipecrs
Copy link
Owner

felipecrs commented Aug 12, 2024

  1. Copy the script to the same directory where you have frigate.yaml. Then, you can call it within Frigate/go2rtc using /config/fix_vto_codecs.sh.

image
3. It's easy to test: power off your SIP server, reboot the VTO, and check if the button press event still works (it will not, I bet). But don't worry, you don't need to test this for me, I'm not asking you to. This is just in case you are curious lol.

@convicte
Copy link

  1. Thanks, I'll test it out, but it may need to wait until I am back from vacation. Looks simple enough, though! Will report here.
  2. Sorry, that doesn't help. The secret is specific to a person entity, which I wouldn't have at all. Technically, I probably wouldn't be using extensions, but the card requires it.
    If you have experience setting these up, how would you operate the following setup:
  • VTO call no. 8001
  • Wall panel no. 101 (i.e. Villa Call no.)
  • SIP server 192.168.1.7
  • port 5060
  • SIP password: 12345
  • VTO door open code: 22 (i.e. main lock)
  • VTO gate open code 4321 (i.e. second lock)
  1. I am very curious so will check it out.

@felipecrs
Copy link
Owner

felipecrs commented Aug 12, 2024

  1. No worries. I am very hopeful it will work though. And in my experience, this is the best option ever you'll get. Frigate Card is million times a better frontend than the SIP Card.

  2. It has been a long time since I don't use the SIP Card. However, what I think is gonna be your problem is that the SIP Card can't connect directly to the SIP port. It needs to connect to the WSS port (SIP over WebSocket). Asterisk SIP Server supports it, but it's likely your SIP server doesn't.

    It's pointless trying to configure it unless you are sure your SIP server has WebSockets support.

  3. :)

@convicte
Copy link

  1. Thanks, as am I.
  2. Yeah... that explains it... no way this server is supporting WSS... it's the absolute bare-bones setups for calling into a wall panel of an alarm system. So I can as well scratch the card all together.

Thanks for all the help!

@Cr4z33
Copy link

Cr4z33 commented Aug 13, 2024

  1. Thanks, I'll test it out, but it may need to wait until I am back from vacation. Looks simple enough, though! Will report here.

    1. Sorry, that doesn't help. The secret is specific to a person entity, which I wouldn't have at all. Technically, I probably wouldn't be using extensions, but the card requires it.
      If you have experience setting these up, how would you operate the following setup:
    • VTO call no. 8001

    • Wall panel no. 101 (i.e. Villa Call no.)

    • SIP server 192.168.1.7

    • port 5060

    • SIP password: 12345

    • VTO door open code: 22 (i.e. main lock)

    • VTO gate open code 4321 (i.e. second lock)

    1. I am very curious so will check it out.

Keep us updated as I'm using Felipe's solution and I am trying to include also my VTH touch panel to get the VTO SIP calls (at the same time with the Asterisk server).

@Cr4z33
Copy link

Cr4z33 commented Sep 15, 2024

@convicte so has there been any success? 🙂

@esand
Copy link

esand commented Sep 25, 2024

Came here to mention that Asterisk should hopefully not be necessary. I don't have a Dahua/Amcrest, but a similar Lorex and found a repo called DahuaVTO2MQTT that speaks the Dahua API and publishes messages to MQTT. Since Frigate usually means you've got an MQTT broker, this may be a simpler solution (if I understand correctly, the Dahua Home Assistant add-on is probably the same thing... so this is if you can't use add-ons, or if it isn't working for you for any other reason).

The main repo is here: https://gitlab.com/elad.bar/DahuaVTO2MQTT
I found that at one point, that version wasn't working for me so I had to use this one: https://github.com/baudneo/dahuavto2mqtt

Take your pick and hopefully one works for you (they're both docker containers). They should publish all the events you'll need - motion, button press, etc...

@felipecrs
Copy link
Owner

@esand, do you use a VTH?

@esand
Copy link

esand commented Sep 25, 2024

@esand, do you use a VTH?

No, I do not. I only have the Lorex doorbell which is built using Dahua stuff and a tweaked API that the DahuaVTO2MQTT app seems to still work with enough that I can get doorbell button press events (all I need it for).

@felipecrs
Copy link
Owner

felipecrs commented Sep 25, 2024

Got it. I'm very unoptimistic about it, considering rroller/dahua#359, but I'll give it a try once I get to it.

Thank you!

@pedromrg
Copy link

Got rid of Asterisk and found another trigger.

Used: https://github.com/arnonym/ha-plugins ha-sip

Config:

enabled: true
registrar_uri: sip:192.168.1.XX #VTO IP
id_uri: sip:9901#2@192.168.1.25 # used 99001#2 to connect to VTO ( #0 and #1 is used for my 2 VTH's)
realm: "*"
user_name: 9901#2 # as mentioned above
password: "123456" # default password
answer_mode: listen
settle_time: 1
incoming_call_file: ""

Now ha-sip is connected to the SIP Server running inside the VTO hence my HA now has an extension number.

To trigger the automation I used a webhock trigger, creating an automation with the webhook trigger and adding the webhook ID generated on the automation to the ha-sip config:

webhook:
id: sip_call_webhook_id

https://github.com/arnonym/ha-plugins ha-sip

I was forced to find this since my binary_sensor.door_new_button_pressed of the VTO4202FB-P-S3 simply does not work with or without SIP server enabled on the VTO.

Anyway @felipecrs , thanks for the automation, and the other insights.... it was a huge help to finish my environment.

@felipecrs
Copy link
Owner

Great. This saves everyone from the pain of having to configure Asterisk.

I will also try it and update the guide accordingly if all works fine.

@pedromrg
Copy link

Also you might be able to play with this and answer the call after X seconds with a recorded message or.... need some more time to investigate...

@felipecrs
Copy link
Owner

I was able to play audio (like Google TTS) to the doorbell using Alexxit's WebRTC integration media player.

So, as long as the call is not ongoing, it can be used to play any audio back, including a message.

@thelittlechef
Copy link

Long time listener, first time caller.

Using HA-SIP and the VTO acting as SIP server, as well as VTO2MQTT, I can now reliably* get MQTT messages when the button is pressed. I have a VTO 2211G-WP.

I had no luck at all with Asterisk. Entirely user error, I suspect, with TLS proving somewhat beyond my skills...

*Well - the VTO2MQTT container crashed and needed a "systemctl docker restart" to get going again, so maybe not so reliable...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants