SIP Doorbell, android tablet and HA integration

Hi, did anybody accomplish this with only self-signed certificate on FreePBX side? I have HA with NabuCasa (so shouldn’t be an issue here) and fully working FreePBX (WebRTC client via UCP works as well). But no matter what i try, i’m getting only constant Loading SIPPhone in browser developer tools, sometimes doordroid-card.js?v=0.0.1:198 Uncaught TypeError: Cannot read property 'offsetParent' of null.
Or have you saw such behaviour with a trusted certificate as well and i’m only missing something? Thanks!

Looking at the code of doordroid-card.js, this offsetParent is within the isVisible routine.
Have you tried to change isVisible to remove the offsetParent calls as a test? Just let the routine return true.
This is not a solution but to check whether you are chasing a red herring or not…
Maybe that will give you some clues.
I am using an official cert from cloudflare. If you have your domain name, it is free and valid for 15 years.

Unfortunately removing that part doesn’t seem to change anything. :cry:

I’ll probably have to look for a demo server online with trusted cert to test my client against to find out whether it’s client’s or my FreePBX’s fault.

I hadn’t realised that. Is there a reference for it?

Yes, there is: https://www.fully-kiosk.com/en/#remoteadmin
You can e.g. load a URL, set screen brightness, get battery level,…
A very good REST interface!

1 Like

hi folks, you look very knowledgeable on SIP/PBX systems (and I am not!) and wondered if you could possibly provide some guidance.

I’m looking at using a dahua Doorbell as you can specify a SIP server, and someone has written an MQTT component for HA to pick up its actions.

Based on the above it seems I can install the doorbell, the MQTT component, FreePBX docker and lovelace card.

It seems based on this manual, I am able to configure the doorbell to use a SIP server (Asterisk) and assign it an extension/number.

Then when the doorbell is rung it will start a call (either specified on the device to group call, OR, on the SIP server) so that the extensions ‘ring’ (i’m thinking then to use the MQTT dahua component to pick up the button press, and the use browser_mod.popup to open the lovelace doordroid.js card on the devices - lineageOS wall tablets and phones).

So now a lovelace card pops up on the wall tablets, or phones.

At this point I will see and hear who is at the door :slight_smile: and then the button on the card allows me to talk back to the doorbell (I think this will only work on Android however) - so I may need a parallel process to call a SIP client app on the iOS phones in the house.

I have a few questions though:

  1. How an earth do you configure FreePBX? I’ve read a bunch of materials and still can’t figure out if I need to register it OR given its only using a bunch of extensions internally and HA is doing the lifting to the outside world via the UI.
  2. the extensions mentioned SIP Doorbell, android tablet and HA integration are a manual .conf file, but FreePBX is all GUI based.
  3. How does this work externally (i’m using NGINX with a reverse proxy) but assume the call is actually between the lovelace doorcard and the doorbell - and its HA that is bringing the audio from the phone into my network? (the tablets are all internal).

Any more details or if you have come across some guides to get someone up to speed would be hugely appreciated :slight_smile: (there is some serious depth in the PBX/SIP world and its a little confusing/daunting)

ahhh it seems in the FreePBX docker the pjsip.conf file is broken up into:

pjsip.transport.conf & pjsip.transport_custom.conf
pjsip.aor.conf & pjsip.aor_custom.conf
pjsip.auth.conf & pjsip.auth_custom.conf
etc
If i manage this I may pull a guide together using FreePBX :slight_smile:

1 Like

Correct. Most of the config is done through GUI. But, there are “stuff” that you can add into text files that are loaded and not erased by the GUI.

First step, create an extension for your dahua. The first hurdle is to be able to register the doorbell with the server. When done, make a call (that is press the doorbell, I guess) on the dahua. Putting your PBX in debug mode asterisk -vvvvvvvv and things should be seen on your screen.

Second step, with a normal softphone, register it on the PBX. Then call again from dahua to this extension. I don’t know how in dahua you configure the extension to dial. If OK, it should ring on the softphone.

Third step, have video and audio between the doorbell and the softphone. You will probably have to select the “correct” codec. Again, trial and error here.

Fourth step, replace the softphone with the lovelace card on HA. This was for me the hardest part.
Asterisk is rather difficult but you have plenty of logs to play with. With lovelace, apart from the chrome debug console you are blind. Or at least, I am!

So, you will need three extensions:

  • doorbell
  • softphone (used for testing only in my case)
  • lovelace card

Have fun!! I must say this was quite a challenging stuff to do, but the result is pretty cool.

GV

1 Like

Is it possible to run freePBX on a venv? Can’t find anywhere with instructions on how to get it up and running this way. Any help is much appreciated.

I don’t think so… venv seems to be only for python stuff with my (very limited) understanding of venv.
You can use it in an LXC container, with docker or a “real” VM.

FreePBX uses Asterisk and Asterisk is C code…so no, venv can’t be used as its only for a Python environment.

I love this project. I built the DoorPI, but I wasn’t happy with how wide the camera view was and could make a professional enough cover, so I have now purchased the GDS 3710, wow, what a great device. Sorry for my ignorance, but I am getting the message in my lovelace card “camera not defined”. I assumed I have to define it in the doordroid card. I have a camera entity, in hassio entities and it works fine, but when I put that into the doordriod card it doesn’t work. I would appreciate any assistance.
Thank you @greengolfer and @rdehuyss for this amazing project.
image

Can you copy the part of your configuration.yaml where the camera.grandstream_door_camera is defined?
Are you able to see the camera in another card?

@greengolfer, thank you for your quick reply.
Yes I can see the camera in a picture glance card.
My config is

I also have streem in the config file.

Can you try a simpler name? Here you are relying on HA “magic” to change G to g and replace " " with “_”. Try with something like gds. Not fancy but no hidden rewriting.
Not sure it is the problem though, but worth a try. IMHO.

Thank you. I have changed the name to gds.
I think the problem was more simpler. I had to delete my old doorpi installation and I got past that message. I am having a syntex issue with the camera name in doordroid card.

Sorry, as explained above my knowledge in javascript is close to null… I don’t know what it means.
Have you tried to clear the cache of the browser and all stuff like that?

I think the Java code should be (or originally was) something like:

    setConfig(config) {
        if (!config.camera_entity) {
            throw new Error('You need to define a camera entity');

And in your lovelace config try something more like:

    cards:
      - type: 'custom:doordroid-card'
        camera_entity: camera.gds
        style: |
            ha-card {
              display: block;
              margin-left: auto;
              margin-right: auto;
              width: 88%;
            }

Hi Tommy,
Thank you so much for your response. I have made the changes as suggested, but I am still getting an error. I am woundering if it is to do with ssl? I am using NGINX manager in Hassio? The camera entity feed works in a picture card.