FreePBX <--> Home Assistant

I am trying to create a pjsip trunk to my Home Assistant. On the Home Assistant (HA) side I am running the VoIP so it is appearing as something a sip phone can connect directly to. (This has been tested and working with a soft phone) When I write a trunk and outbound route, nothing goes through. I get the following error:

5370	[2025-09-25 11:10:26] ERROR[242860] res_pjsip.c: Endpoint 'HAAssist-Trunk': Could not create dialog to invalid URI 'HAAssist-Trunk'. Is endpoint registered and reachable?	
5371	[2025-09-25 11:10:26] ERROR[242860] chan_pjsip.c: Failed to create outgoing session to endpoint 'HAAssist-Trunk'	
5372	[2025-09-25 11:10:26] NOTICE[243773][C-00000006] app_dial.c: Unable to create channel of type 'PJSIP' (cause 3 - No route to destination)

Any ideas on what is going wrong?

A comment left on the HA site, by s9meone with little knowledge of FreePBX and asterisk:

So for my setup specifically I have Home Assistant and Asterisk running on the same machine, with Asterisk listening on port 5060, and HA listening on the non-standard port 5062. To get the calling to work in the extensions.conf file I referenced in the aforementioned thread I actually have sip:ha@<HA IP>:5062 for the URI for the HA extension.

Here is my big problem. I need to set up an pjsip trunk, IP addess 162.168.1.100 port 5060, UserID HA no password. I set this up in FreePBX and the trunk never connects.

Where is a good place to start looking, and what am I looking for?

This looks like a typo for 192.168.1.100, especially as it looks like an address, owned by T-Mobile, and with no reverse DNS, is unlikely.

What do you mean, in SIP terms, by UserID? I don’t think there is any way of meaningfully using a user ID, as understood by Asterisk, without an asociated password. Also, it is not clear whether your require inbound or outbound authentication/identification,

What do you mean by connects? You didn’t say this was TCP, so I assume there is no actual connection. Do you mean register? In which direction is the registration?

The logs, in particular the full log, with “pjsip set logger on” in effect.

Whether requests are arriving at their destination. Whether they contain correct addresses. Unexpected challenges for authentication. Other failure responses. Warning and error messages from Asterisk, explaining a rejection.

https://www.reddit.com/r/homeassistant/comments/1ipaw6b/guide_how_to_call_assist_from_a_freepbx_voip_phone/

Sorry, do most of my work in different systems:
UserID = Authentication ID, in this case HA is the user/authentifcation
Connect = Registar
registration is outbound (Ithink) FreePBX calls Home Assistant.

Will get the logs next.
yes was a type, 162 should have been 192

If you don’t have a password, there won’t be any authentication, so there will be no reason for the authentication ID ever to be sent. although I suppose it is possible that they challenge for authentication, even when they know there is none, and it is possible (would need to check) that Asterisk would accept, and send, an empty secret.

Have to thank you for your help David!! I am at the stage with FreePBX and Home Assistant that I know enough to be really dangerous. :slight_smile:

The Integration in Home Assistant I am using is VoIP can be found here: Voice over IP - Home Assistant. I have got it installed on my HA and have tested it out with the Android softphone, and it works. What I am trying to do is get my hard phones to be able to speeddial into FreePBX and be sent on to VoIP on HA. Basically do what a wake word would do, but it is a hardware press instead of voice command.

The ‘assumption’ I made is that a softphone connects to a trunk. This might be where I am going wrong. I know others are working on the same problem and having just as much ‘fun’ with making it all work seamlessly.

Should I be setting up FreePBX so that it is attaching to a trunk? Or should I be setting up FreePBX so it is connecting as some type of extension? I assumed trunk as it is FreePBX that needs to initiate the connection. Am I missing the mark entirely?

Greg

You appear to be connecting to an add-on, not directly to HA. It looks like it is only officially supported when used with an ATA (and only for two specific models), although there is no good reason why FreePBX wouldn’t mimic an ATA. The documentation is incomplete. All the important bits are only available on screen when you actually try to configure it.

I can’t find out how it handles SIP, at the detailed level, but I get the impression that it takes lots of short cuts and isn’t a general implementation of SIP.

Yes that is correct, it is an addon, that routes the incoming call directly to HA Voice Assistant. I have VoIP Assist (The addon) working with a generic softphone. The biggest problem with Voice Assist is that it only supports the codec OPUS.

And yes the writers only officially support two hard devices and a few softphones. I am guessing because that is all they have for testing.

As for how it handles SIP. Not sure myself, but I could try and get that information. I can only see by looking into the black box.

Is there anything in particular I need to find out?

Greg
P.S.
Looking at more forum threads talking about getting a trunk to work. Working on that as we type. Will post again as I know more.

Finally got everything working. Here is the install message. Again thank you for all your help in getting this to work.
Installing and configuring Voice Over IP for Home Assistant connecting to FreePBX: - FreePBX / Integration - FreePBX Community Forums