Tuesday, April 23, 2013

Bells via Asterisk Paging

As a few of our sites don't have a traditional PA system, and no way to play bell noises to signal class breaks, we decided to use the asterisk paging system to play bell noises through the handsets in each classroom. There are a few different ways of doing this, but here's the solution we came up with

1) Create a paging group with the extensions you want to play the sound (our sites are currently using Trixbox, so this is under the Paging and Intercom section). Let's call that extension XXXX

2) Create a dummy extension to play the bell noise.
This involves editing /etc/asterisk/extensions_custom.conf and creating an extension that just plays the sound and then hangs up. Let's call that extension YYYY. Add the following near the end of the file:

[ext-paging-custom]
exten => YYYY,1,Answer
exten => YYYY,n,Wait(3)
exten => YYYY,n,Background(hello-world)
exten => YYYY,n,HangUp()

Replace hello-world with the name of a sound file in your asterisk system. If the sound takes too long to start, or has already started when the page happens, you'll need to adjust the value for Wait() as well.

3) Create a cron job to make the bells ring. You can use the following command
asterisk -rx 'originate Local/YYYY@ext-paging extension XXXX@ext-paging'
This will originate the page from the YYYY extension, which will play the bell noise and hang up.

It's also not a bad idea, if you're running trixbox or freepbx or similar, to add the YYYY extension to the "custom extensions" (trixbox: PBX -> PBX Settings -> Tools tab -> custom extensions, freepbx: Admin -> Custom extensions) so that you don't accidentally assign extension YYYY.

1 comment: