We're trialling a Asterisk Now server to take over from our ageing PBX system. One of the "nice to have" features would be the ability to pause or lower the volume on the office jukebox if an incoming call is detected.
We currently run a linux jukebox which plays music out of the speakers using mpd and can be controlled by the mpc client. We can manually issue the following command to achieve this:
mpc volume 20
Does anyone know how to get asterisk to execute this command or some action that we could hook into when a phone call is incoming to specific extensions?
What a novel idea! I've not done that but I think I can get you going down the right path. If your system is similar to mine you'll find the following files that will serve as examples:
For digital faxing:
For emails with audio message attachments:
We'll focus on the second action by taking a look at the part of the extensions_additional.conf file that deals with audio attachments:
You'll see that the /var/lib/asterisk/bin/audio-email.pl is referenced. The function runs line by line so if someone hangsup (ie line 8) then the .pl file is never fired off. But before this function can function it needs to be included like this:
I'm not going to print out the .pl file here. If you can write a pl file that will turn down the volume on your office jukebox when you manually run it, you can definitely set up Asterisk to fire off the pl when you get an incoming call.
Take a look at the /var/lib/asterisk/bin/fax-process.pl to see how asterisk fires off emails.
Now you'll probably want to adjust the first file I referenced above: /etc/asterisk/extensions.conf. This file tells Asterisk what to do when calls first come in. Take a look near the top of the file for this:
You could create something like "turn_down_music.pl" and include it in a function like [app-lower-music]. You would then include it with:
Note that the [ext-local] file is defined in the extensions_additional.conf file but referenced in the the extensions.conf file. You can create your own custom extensions file and reference it in the extensions.conf file like this:
Also note that # does not comment lines out. Instead ; comments lines out.
I have gained a lot from these two books:
Good luck!
If this AsteriskNow is similar to Elastix, you should define new section in extensions_custom.conf like:
First number is your incoming DID, "n" is the order of executing commands (this one usually goes to the start of the list, because from-pstn-custom is included at the top). This can also be solved with AGI scripts, but this may be an overkill for you.