VoIP calls from HA to analog phone with Grandstream device

I would like to actually ring the analog phone attached to by grandstream or any other phone really setup.

Use case is sort of like a doorbell chime or additional alarm siren or critical alert from ha.

It would be even better if upon answering the call ha spoke the tts alert to me, but i’d settle for a ring to begin with and i’d know to investigate.

Been looking at asterisk and ha-sip, but neither seem to actually ring the phone. Can’t find anything in the grandstream docs either for ringing the attached device. Seemingly i need an SIP server and that’s fine, but i can’t seem to make asterisk work.

Any ideas? It seems like the next logical step in year of the voice to me, having assist reach out to you, but again i’ll start with just ringing the phone and working from that point forward.

literally i find no info on doing it.

@George1422 - tagging you as requested.


I have a Obihai VOIP phone system and added the Obihai Integration. Unfortunately, while it shows the phone lines in HA, I have not seen how to use it for outgoing calls from within HA.

There are a couple of things you can do here if you really want to stick with sip/pstn calling there is a ha add on called ha-sip (gateway). GitHub - arnonym/ha-plugins: Home-Assistant SIP Gateway you need plugins, the hassio.addon_stdin service will manage the outbound calling. Understand you will need a sip based pbx (like FreePBX, or a sip carrier like voip.ms) to complete the connection. I imagine that is the bit that was missing in your testing.

There is another option you can pick, which is an ESPHome media player. Or a traditional ip speaker like a sonos. If you are crafty with electronics you can use an esp32 and a audio codec/amp for about 15 dollars plus the cost of a speaker and build you an “internet speaker”. From there HA in combination with a text to speech plugin can send alerts, play mp3 files, or beep or boops the esphome media player. If you are not too crafty with electronics then you can still use ESPHome media player, but get from amazon a “ESP32 audio kit” for about $23 USD plus some speakers to make your ip speaker.
The benefit of the esphome media player is that you can do more than just ring a bell or make a call. I have these in my house. I’m a bit crafty with electronics so I repurposed several JBL google home speakers as esp32 media players.

The phone i’m using does have a traditional speaker driver so i did consider just putting a esp32 board with audio driver/amp in there and running it like that exactly as you suggest. I can certainly build it and it certainly is more versatile than a limited sip integration. Converting text to mp3 is easy enough for a finite set of text alerts or even dynamically. So everything you say will work.

You are correct i didn’t include an actual sip account so my voip device didn’t have an actual sip address and is likely what is missing.

The only reason i tried this sip route first, even though it is harder, is the act of picking up the receiver to hear the audio. Sort of feels strange to pick up the line to talk to HA, but not picking it up to answer HA. Sort of like an incomplete solution.

The whole analog phone to/from HA is at best a gimmick and i totally get that, but a fun project for < $40 all in.

$3 at local Garage sale and i bargained down from $10.

Ok fair enough lets look into the sip route first. For the PBX you can use out of the box asterisk but you need to configure every things via config files (there is asterisk now, but…). Freepbx is what I know so I can speak in freepbx terms and if you have something else you will need to translate. (Understand I have not done this bit myself yet, but I’m putting together the bits)

So from your analog phone you will need an FSX ATA, a grandstream ht801 (1 FSX) or ht813 (1 FXS and 1 FXO) adapter will work. Before I moved to voip.ms I placed the ht813 between the PTSN house line and the phones internallly. This allowed my pbx to intercept incoming calls and drive them to an IVR before the house phone actually rang. I did this to thwart the robo dialers. but back on point. Get this ata connected to your pbx.

Once that’s connected the next step is to follow what I posted in the other tread about connecting your pbx to home assistant, assistant. I just thought of a problem. That sip-ha gateway also uses port 5060, what voip assist is using. Not sure how they will interact.

Back on point, for the sip-ha gateway you will need to create an extension in asterisk. For example lets say you create extension 1000 in freepbx. Once that extension is created go back into the extension page and pick up the auto generated password. The user name will be the extension number.

If you look at the ha-sip github site you will see this section

    port: 5060
    log_level: 5 # log level of pjsip library
    name_server: '' # comma separated list of name servers, must be set if sip server must be resolved via SRV record
    enabled: true
    registrar_uri: sip:fritz.box
    id_uri: sip:[email protected]
    realm: '*'
    user_name: homeassistant
    password: secure
    answer_mode: listen  # "listen" or "accept", see below
    settle_time: 1 # time to wait for playing the message/actions/etc. after call was established
    incoming_call_file: "" # config and menu definition file for incoming calls, see below

The important fields are these

    registrar_uri: sip:fritz.box
    id_uri: sip:[email protected]
    user_name: homeassistant
    password: secure

You want to adjust them as

    registrar_uri: sip:1000@<freepbx_ip>
    id_uri: sip:homeassistant@<ha_ip>
    realm: '*'
    user_name: 1000
    password: <password_from_freepbx_exten>

My confidence level for registrar and id_uri is about 50% I might need to look that bit up.

In the next section on the github site

service: hassio.addon_stdin
    addon: c7744bff_ha-sip
        command: dial
        number: sip:**[email protected]

The important value is

        number: sip:**[email protected]

So the value could be just the extension number of the phone such as

        number: <grandstream_exten_no>

Or the sip_uri of the extension, it depends on how they coded their program

        number: sip:<grandstream_exten_no>@<pbx_ip>

The only complication I can see in my mind is if both Assistant and sip-ha are listening on port 5060 then the first service to boot wins that port. Now if we could shift the listening port of either to 5061 then there wouldn’t be a conflict. I see that’s possible with the sip-ha gateway

    port: 5060

So in my mind it looks possible.

1 Like