Answer query about call flow

I’m looking for either…

a) a script which would check the state of call flow (day/night mode) periodically and report it to an MQTT broker
or
b) a script which would ANSWER a query from another script with the state of call flow with a 0 or a 1…

anyone know if this is doable?

The reason I’m asking is I want to tie it in to my Home Assistant install on another Pi so HA “KNOWS” whether day/night mode is activated or not.

Thank you!!

I have no idea about the MQTT broker part, but you can check the status of Day/Night mode with something from the shell like the following:

dmode=`rasterisk -x "show hints" | grep "Day" | cut 'something cool happens here'`

then check the value of $dmode and there you go.

From bash, you can identify the condition with:-

rasterisk -x ‘database show DAYNIGHT’

you can get the particular one with :-

rasterisk -x ‘database get DAYNIGHT CN’

and set it with

rasterisk -x "database put DAYNIGHT CN DAY "

I posted a couple of ways of making an mqtt ‘connector’

So with mosquitto-clients installed, you get an easy KISS solution with :-

mosquitto_pub -h YOUR_BROKER -t YOUR/TOPIC -m $(rasterisk -x “database get DAYNIGHT C0”)

I will leave the reciprocal

mosquitto_sub . . . .

and the mapping of DAY|NIGHT to 1|0 as an exercise for the poster to add as a cron job

1 Like

Thanks @cynjut and @dicko much appreciated!!

I’ll see how I get on

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