Voice over IP Integration - Call from Any SIP Softphone

Two settings to look for on MicroSIP: Under “Enabled Codecs” you need “Opus 24kHz” to be the top “enabled” codec. Two, you need to check "Enable Local Account (sounds like this one is checked).

I also have “Opus 2ch” checked. Does any of that help you?

1 Like

I wonder if it’s the payload type issue. On the Grandstream instructions it wants us to make sure that the payload in the header is 123.

I don’t know how to change that parameter in Linphone, though. Anyone more skilled with Linphone able to confirm or refute?

That is almost certainly an issue, it appears to be sending 96 for the payload type. I unfortunately don’t know how to get linphone to change that.

If anyone is interested, it works with 3CX (basically it can work with any pbx). Asterisk etc. Create a generic sip trunk based on ip auth. Create an outbound rule for specific extensions or groups to route calls via the generic sip trunk. Also make sure that at generic sip trunk options —> codecs only opus is listed. Finally, dial ANY number from your extension you defined in the outbound rule and it will work.

1 Like

I’d update the top post, but I know absolutely nothing about 3CX or pbx in general. Could you do a general “How To (VOIP Hardphone)” or a set of instructions for the softphone adaptation of 3CX? Happy to put it at the top so that it’s easy to find.

This procedure is recommended for people who already have 3CX installed and want to keep their current extensions/ring groups etc. and use them to interract with ha voice assistant.

Maybe it’s overkill to install 3CX just for this but it’s up you. If you only need a pbx for this purpose, try asterisk add-on from @TECH7Fox Ha - Asterisk Addon.
1.


2.
2
3.

4.

4.1

4.2

5.

6.

7.

You can use 3CX softphone for easy config using the qr code to register, or any other sip client.
Voip Phones also work as good as softphones.

Finally, open your 3CX app, dial any 1 digit number (if you followed my example) and ha voice assistant will auto respond.

**There are plenty videos of 3CX installation on web and it’s a straight forward procedure. Recommended installation : on premise.

5 Likes

I am connected with my Grandstream DP750.

I am still troubleshooting why I am not hearing anything. I can give commands tho.

@gravyflex Check the audio codec. It must be “opus”.

Yea, I have OPUS selected and no audio.

Same here. I can connect with my DP750/720 setup and give verbal commands that are followed, but there’s no voice feedback - just a buzzing sound in the background.

1 Like

This is awesome. Got it working tonight with Mizudroid.
I had to do a couple of things, which may help with troubleshooting.

  1. Expose port 5060 in docker-compose.yaml
  2. Correct the TTS engine to piper (it was set to Google)
  3. Go into Mizudroid, through a couple of layers of “advanced settings” to set codex to Opus instead of “optimal”.

Then it finally worked. My phone even talks back “turned off light”.

For those that might want to do this, I was able to call Assistant via FreePBX with the following settings.

  1. Make sure you have the OPUS codec enable (I didn’t see the above posts and debugged with asterisk to find out the missing codec). This is under Settings->Asterisk SIP Settings and then Codecs section, tick opus.
  2. Create a Custom Extension. Application->Extensions->Add Extension->Custom Extension. Set the Extension number and Display Name.
  3. Select the Advanced tab, in the Dial field enter “SIP/[email protected]”, where 192.168.1.102 is the IP address of your HA server. Hint: The called extension number, #1 in the example, didn’t seem to matter or I just got lucky.
  4. Update your FreePBX configuration
  5. Dial your Custom Extension and you should hear the HA Assistant

While these are pretty simple steps, it took me some searching on how to dial a SIP URI with FreePBX

4 Likes

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