Voice over IP and asterisk. Multiple languages possible

working vanilla asterisk configuration

pjsip.conf

[homeassistant]
type=endpoint
transport=transport-udp
context=mycontext
allow=opus
aors=homeassistant

[homeassistant]
type=aor
contact=sip:[email protected]:5060

I needed to install asterisk-opus for my voip phone to make a translation between ulaw and opus.

If you want to connect to multiple different languages. you can create an additional IP address on your asterisk server. and explicit use those IP addresses for the home assistant connection,

get the dockers running with the additional language.
https://hub.docker.com/r/rhasspy/wyoming-whisper
https://hub.docker.com/r/rhasspy/wyoming-piper

edit /etc/network/interfaces where enp1s0 is the interface
notice no hotplug but auto

auto enp1s0:0
iface enp1s0:0 inet dhcp

auto enp1s0:1
iface enp1s0:1 inet static
address 192.168.5.8
netmask 255.255.255.0

pjsip.conf

[transport-HA-nl]
type=transport
protocol=udp
bind=192.168.5.43:5062

[transport-HA-en]
type=transport
protocol=udp
bind=192.168.5.8:5062

[homeassistant-nl]
type=endpoint
transport=transport-HA-nl
context=mycontext
allow=opus
aors=homeassistant-nl

[homeassistant-nl]
type=aor
contact=sip:[email protected]:5060

[homeassistant-en]
type=endpoint
transport=transport-HA-en
context=mycontext
allow=opus;
aors=homeassistant-en

[homeassistant-en]
type=aor
contact=sip:[email protected]:5060

extentions.conf

exten => 4020,1,Log(NOTICE,home assistant nl)
exten => 4020,n,Dial(PJSIP/homeassistant-nl,20)
exten => 4020,n,Hangup()

exten => 4021,1,Log(NOTICE,home assistant en)
exten => 4021,n,Dial(PJSIP/homeassistant-en,20)
exten => 4021,n,Hangup()
1 Like

i got a bit further, first i tried with a extension and a fixed dial string of PJSIP/192.168.178.35/47 but this did not work, so i created a trunk without registration and without auth to the homeassistant ip.
i got it working twice from my mobile phone to my landline which terminated on my fritzbox router. freepbx has a trunk to the fritzbox and accepts all calls with callerid of my mobile phone. the inboud route forwards to outbund trunk to homeassistant. after two sucessfull calls it no longer works and asterisk shows:

5061[2023-05-05 19:25:52] ERROR[29773] res_pjsip.c: Endpoint 'to-assist': Could not create dialog to invalid URI 'to-assist'. Is endpoint registered and reachable?
5062[2023-05-05 19:25:52] ERROR[29773] chan_pjsip.c: Failed to create outgoing session to endpoint 'to-assist'

btw i had to set DTMF Mode of the HA trunk to RFC 4733 to remove a warning because i moved opus to the top of the codecs.

not sure what is wrong now or if this is the correct approach, but i would realy like to have my landline connected to homeassistant as well .-)

i got it working, had to add an AOR string to the trunk of sip:[email protected]:5060

can you provide the config please?

i think i got it working. for the sip connection. I hear beeps.

could you explain exactly how you got this working and where you put the configuration. I am running FreePBX with asterisk.

you need to create a account in pjsip for home assistant as my starter topic suggests.
(/etc/asterisk/pjsip.conf)
then you can create a extent to dial the home assistant
/etc/asterisk/extentions.conf

[mycontext]
exten => 1234,1,Log(NOTICE, dailing home assistant)
exten => 1234,n,Dial(PJSIP/homeassistant,20)
exten => 1234,n,Hangup()

with freepbx I can’t directly edit those files so I am trying to figure out how to add these configurations

It’s been a while since I played with freepbx so only going off memory here, but I think there is a pjsip_custom.conf & extensions_custom.conf that you can add custom configurations without freepbx overwriting the files.

i think you need to add a trunk.

This is how I got Freepbx to work with HA -

I followed your instructions and seem to have made progress but when I dial the extension all I get is a busy signal.

Is the identity created. And did you assign an assistant?

Not sure what you mean by Identity created or assigning an assistant

Never mind I finally got it to work following this guide

If someone wants to run multiple languages or other multiple featured assistants.
I edited the opening post.

1 Like