Use ARI to turn call flow on/off


Does anybody know if it’s possible to do this? I want to use my Home Assistant instance’s ability to know whether we’re in or not to basically forward calls straight to our mobiles if we’re not in rather than after a timeout.

Basically Home Assistant can be programmed to do a HTTP get or post, send an MQTT message etc etc if the house is emtpy and it would be pretty cool to be able to switch call flow on/off based on this.

Thank you

Easy way:

Write a PHP script that runs on your machine. When you HA system contact the script, you can use a system command and execute an “rasterisk …” command that does anything you can do from the command line. Something like setting CFW for your extension based on what the HA system sends…

if using call flow then

rasterisk -x 'database put DAYNIGHT C0 DAY'
rasterisk -x 'database put DAYNIGHT C0 NIGHT'

will toggle the first call control instance (C1 C2 etc. . .)

One solution, would be to install an mqtt broker on your PBX

apt/yum install mosquito mosquitto-clients

start the mosquitto service and then from bash something like :-

mosquitto_sub  -h localhost -t "(yourtopic)"|while read line; do  if [ "$line" == "(yourtopic) (yourpayload)" ] ;then rasterisk -x 'database put DAYNIGHT C0 DAY' ;(. . . . add other conditions as needed  here);
 ;fi; done &

You then just need a mqtt connector from your Home Assistant to the broker on the pbx and an agreed on topic/payload

If you have a currently available broker, you dont need mosquitto running just replace ‘localhost’ with the broker you are using

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.