With the introduction of calling analog phones to play a predefined message in Home Assistant 2024.2.0, I decided to integrate it into my Asterisk setup.
The idea is to get notified about an event, in case I don’t have internet to get the alerts.
Setup
In order for this to work, you will have to own a VoIP number and have it setup under the pjsip.conf
. You will also have to change the following values:
- <ha_ip>: The IP address of your Home Assistant instance
- <my_number>: The phone number you want to call
- <voip_ip>: The entity id of the Voice over IP integration
Make a call
action: assist_satellite.announce
target:
entity_id: assist_satellite.<voip_ip>
data:
message: It's dinner time!
pjsip.conf
This will allow the Home Assistant to connect without authentication and make calls to the assist.
[homeassistant]
type=endpoint
transport=transport-udp
context=incoming-homeassistant
allow=!all,opus
aors=homeassistant
[homeassistant]
type=aor
contact=sip:<ha_ip>:5065
[homeassistant]
type=identify
endpoint=homeassistant
match=<ha_ip>
extensions.conf
This will call the voice assistant and the phone number you define.
[incoming-homeassistant]
exten => _X.,1,NoOP(${EXTEN})
exten => _X.,n,Answer()
exten => _X.,n,Dial(PJSIP/homeassistant&PJSIP/<my_number>,10)
exten => _X.,n,Hangup()