Voice over IP Integration - Call from Any SIP Softphone

Same procedure with IncrediblePDX although I already seemed to have OPUS enabled.

I also managed to configure FreePBX to call HomeAssistant from any of my SIP phones, but I used a Trunk and an Outbound Route. Details at Call Home Assistant from FreePBX | LectroLeevin

Using a PBX like 3CX mentioned by @BigHomie or FreePBX mentioned by @George1422 is probably overkill for voice assist only. But if you already have a PBX, it enables you to call Home Assistant from any of your registered SIP phones. Even if they do not support the opus codec because asterisk can convert the audio stream codec on the fly.

I agree about setting up a PBX just to communicate with HA is a bit of an overkill. In my case I already use freepbx at home to cut down on the volume of spam calls that actually get through to my house phone, plus I use voip.ms as my pstn carrier so I already had it setup. I also found it interesting that there are a few HA integrations already with Asterisk like having HA call you over the pstn network and TTS a notification. Now that’s just cool.

I thought about going the trunk route too, but the setup just seemed more complex than necessary, where as if you just create a custom extension with a uri dial string (still somewhat complicated) then HA just becomes another extension on your pbx that you manage just like any other extension.

If it works then there is no right or wrong way to go about it (extension vs trunk, vs creating a misc destination and hand coding a dial plan vs using a sip softphone [which is probably more achievable to the general population than a pbx] ). The key is whatever method you choose, if it works then its the right way.

2 Likes

I would like to actually ring the phone. Sort of like a doorbell chime or additional alarm siren or critical alert from ha. It would be even better if upon answering ha spoke the tts alert, but i’d settle for a ring to begin with.

Been looking at asterisk and ha-sip, but neither seem to actually ring the phone. Grandstream device btw. Can’t find anything in GS docs either. Any ideas? It seems like the next logical step in year of the voice to me, but literally i find no info on doing it.

1 Like

@blindguynar I don’t know how the mods are on the HA forums, but on the other opensource projects I’ve worked with and for, the general rule is one topic per thread (I realize I didn’t follow my own advice). But I suggest that you create a new topic with a subject line to catch the right attention to your idea. Make sure you tag me in your new thread, I do have a few ideas you can try not relevant to SIP Softphones.

I wanted to share with anyone who is using regular Asterisk and PJSIP that I was finally able to get calling to HA working. Here is what I had to do:

Install opus codec - basically follow the directions from Asterisk Tutorials: How to install and use Opus codec in Astersik

Add pjsip endpoint to pjsip.conf

[5000]
type=endpoint
context=users
disallow=all
allow=opus
callerid="Home Assistant"

I think the endpoint name (5000) can be whatever you want, it will get used in the next step.

Create an entry for dialing HA in the dialplan extensions.conf

exten => 5000,1,Dial(PJSIP/5000/sip:ha@<HA IP>:5060)

Replace with the IP address homeassistant is running on.

After that I was able to dial 5000 from my office phone and tell homeassistant to do stuff. Maybe this is obvious to people that have been using Asterisk for awhile but it took me a long time to realize I needed the PJSIP endpoint.

1 Like

I haven’t had a landline in several decades but suddenly I have two very compelling reasons to set one up.

  1. teach my two little girls how to pick it up and dial 911 (emergency dispatch in the US) in the case of a real emergency.
  2. use it to control my smart home and take my nerdiness to the next level just for fun.

I bought a grandstream and a vintage phone and quickly accomplished #2. I’m a bit stumped on accomplishing #1. Looks like I probably need to subscribe to a voip service provider and provision my grandstream to connect to it. This presents the issue of whether it’s possible to even do both since the grandstream is currently set to auto-dial strait to my HA server for Assist. Obviously, I’d prioritize the 911 for less confusion to the little ones. Maybe reach the Assist through some other dial sequence?

Is this even possible to have both with one phone line? Any advice greatly appreciated.

1 Like

Hi, why would this not work?!
#1 uses the grandstream to set up a phonecall with your VoIP service
#2 uses the grandstream to communicate locally to your HA assist

Instructions for connecting FusionPBX with the Home Assistant Voice over IP integration:

  1. Setup FusionPBX, provision a SIP device, and verify with a test call. The specifics for completing this step are outside of the scope of these instructions.
  2. Enable Opus module: Advanced menu > Modules option > Codecs header - Set “Opus” to Enabled = True and Start the module.
  3. Add Opus codec to the list of preferred codecs: Advanced menu > Variables option > Codecs header – Add “OPUS” to the beginning of global_codec_prefs and outbound_codec_prefs. Set media_mix_inbound_outbound_codecs to true.
  4. Adjust the SIP Profiles: Advanced menu > SIP Profiles option > Settings section > Internal profile – ensure the following settings are set properly.

inbound-late-negotiation=true,true
inbound-codec-negotiation=generous,true

  1. On your SIP device, add Opus as an active and preferred codec. The process for accomplishing this varies by device and manufacturer. If you are using FusionPBX to provision your SIP device, you may have to adjust the appropriate variables within Advanced menu > Default Settings option > Provision header.
  2. Add the Outbound Dialplan: Dialplan menu > Outbound Routes option. Create a new dialplan with the following settings.

Gateway = enum (we will change this in a moment)
DIalplan Expression = ^111$ (replace 111 with the number you wish to use to reach HA)
Enabled = true
Description = Home Assistant

  1. Edit the dialplan: Dialplan menu > Outbound Routes option > enum.### dialplan.
    a. Change the name of the dialplan to something like “Home Assistant.###” (with ### matching the extension number you chose).
    b. Configure the following settings. For settings where a > true is at the end, this signifies the Enabled column within the Dialplan.

action > set > hangup_after_bridge=true > true action > set > callee_id_name=Home Assistant > true action > set > callee_id_number=### > true (number of the extension you chose) action > bridge > sofia/internal/sip:<HA IP Address> > true (insert IP addr of Home Assistant)

  1. Reboot FusionPBX to ensure everything has taken effect (optional step).
  2. Attempt to call Home Assistant using the extension number you defined above.

so I’ve managed to call from my mac softphone, via FreePBX to Home Assistant.

It plays the ‘go’ sound (the two tones), but when I speak, nothing happens.

When I look in debug, it looks like this, even minutes later (see circle spinning next to STT)

Screenshot 2023-09-12 at 12.51.16

I got mine working using microsip via asterisk to the point where I could hear the ‘This is your home assistant’ loop, I then clicked ‘allow calls’ in hass but when i call it back, i get a ‘not available’ error from my freepbx. Did you have any issues like that/

this is exactlly what i’m looking for. I would like to have like an entitiy in the VOIP integration, to ring the phone. The hook is already detected. So I asume that this would not a big deal for the creator. Did you manage to start a new topic/request this feature?

Maybe this is completely off-topic… I will try nevertheless. I have a VoIP phone in the house of my mum and I would like to use it as an alarm clock to wake her up because her hearing is very bad. Would it be possible to ring the voip phone from HA???

1 Like

If you find a solution for this, please let me know. I’m interested in the exact same feature. Maybe we should contact the developer

1 Like

I tried to build a call flow app for the 3CX pbx that is hosting the phone, but I can’t get it to work… For now I just send her a notification to her iPhone through HA. But it would be so much better if I could call her VoIP phone.

For years I have used Home Assistant and various pbx systems, e.g. 3cx, freepbx, VitalPBX which was good until they limited the extensions to only 10?? Now I have built MikoPBX, which is made by Russian developers and is free to use, no restrictions, but you get paid support and add-ons.

VitalPBX had support for Home Assistant, I would like the same for the MikoPBX system. I just got the Goip adapter working. Or it would also be good if someone developed support for Home assistant in the Goip adapter.

Any of you guys figured out an easier way to broadcasting TTS generated from HA on your SIP phones? :slight_smile: Thanks!

hey @gravyflex did you ever find a solution for this? I’m in the same boat as you… I can issue voice commands and they work great, but all I ever hear is buzzing.

1 Like

Exactly the same here. DP750, voice commands work, but I hear only buzzing.

Thanks for posting this! I was really surprised to see such a specific device mentioned on the docs rather than showing that anything with SIP URI dialing can call into it.

I was able to get one or two calls to go through before realizing I had to ‘allow calls’ on the VoIP device in the Integration, but ran into an issue after enabling that:

  • Experiencing dead air on the SIP call, but it connects and shows the call timer.
  • I used tcpdump on haos after installing it through the SSH add-on, and pulled it into wireshark.
  • Capture from haos shows the RTP being received, but nothing being sent out.
  • I believe that since the capture is on the interface level, there might be some sort of firewall blocking the RTP from coming in or out of the homeassistant application on the server.

Has anyone run into this, or at least familiar enough with HAOS to know where to look for an internal firewall or allowing a port range being blocked?

Thanks!

1 Like