After I posted Blink lights when your IP phone rings, I kept thinking “Why not use my IP phone to ‘say’ notifications?”

The way I did it was creating a Paging Group on my FreePBX server.

Paging and Intercom

Page Group

Then on Home Assistant I have the following.

  mauricio_arrived: printf 'Channel: Local/724464@from-internal\nApplication: Flite\nData: "*. Welcome home, Mauricio."' > `date +"%Y%m%d%H%M%S"`.call && scp *.call root@ && rm *.call

  - alias: Mark Mauricio as just arrived
      - platform: state
        entity_id: input_boolean.mauricio_home
        from: 'off'
        to: 'on'
      - service: shell_command.mauricio_arrived

It will generate a file with the content below and upload it via SCP to the directory /var/spool/asterisk/outgoing on the FreePBX server. Asterisk uses files in this directory to initiate calls automatically, see this and this.

Channel: Local/724464@from-internal
Application: Flite
Data: "*. Welcome home, Mauricio."

When I get home, the automation is triggered and I’m greeted with a robotic voice. 🤖

Note 1: You must set SSH to use keys for authentication, this will prevent the system from prompting for passwords every time shell command is executed.

Note 2: I inserted ‘*.’ in the text because my phone (Sangoma S500) has a two second beep that is played “before” the audio, but it overlaps the beggining of the text being ‘said’. I tried removing the beep in the phone configuration, but then I had a two second silence with the same problem.