Reminders with VoIP Phones, Asterisk & Crontab


Update: As it turns out, this solution causes people to get used to the ringing phone, causing not only the reminder to be ignored, but actual incoming calls as well. We have thus stopped using this solution.

It is considered best practice to regularly and often ventilate closed rooms due to SARS-CoV-2. But how can we make sure we remember to open the windows every now and then? We wanted to build some kind of visual or acoustic mechanism that would tell us when to open the windows.

I came up with the idea to abuse our already existing telephone system as a reminder system. This system consists of a central Asterisk server, and multiple SIP phones. The idea was to have Asterisk dial all the SIP phones, and set the reminder text as caller ID. The "secret" behind this is Asterisk's console calling feature. And here is how it's done:

First, we need to enable the chan_alsa module in Asterisk's /etc/asterisk/modules.conf:

load =>
; Comment out existing noload directives
;noload =>

Afterwards restart Asterisk.

In a default installation of Asterisk on Debian, this should be all that's required for console calling to work. In our case, Asterisk is running in a VM and the default audio device is a virtual sound card not used otherwise, so there was no need for additional configuration.

Next, we can configure the dialplan in /etc/asterisk/extensions.conf for our reminders:

exten => ventilate,1,NoOp()
same => n,Answer()
; Set the caller ID name to the reminder text
same => n,Set(CALLERID(name)=Lueften!)
; Dial all the phones
same => n,Dial(PJSIP/phone1&PJSIP/phone2)

To apply this change, we have to reload the dialplan:

# asterisk -rx 'dialplan reload'

We can then test our reminder by telling Asterisk to originate a call from its console context:

# asterisk -rx 'originate console/dsp extension ventilate@reminders'

Now your phones should start ringing, and display your reminder text as the caller ID.

Finally, in order to schedule the reminders, just put them into the crontab of the Asterisk server. In our case, I configured it to ring every full hour on Tuesdays between 8 and 11 PM:

0 20-23 * * 2 root /usr/sbin/asterisk -rx 'originate console/dsp extension ventilate@reminders'