I've got an interesting one for you. I've been going over my server monitoring and notification systems (Nagios based), and realized that if our internet connection goes down, there's no way for it to notify me. I already have a modem listening (Via CentOS 5) on a spare POTS line so that I can dial-in in case our internet goes down. I was wondering if I could come up with a script (Shell, Python, etc) that can dial out and play a recorded message (wave file I'm guessing) when it's picked up. I know Windows supports voice calls over a voice modem, I was wondering if a solution existed for Linux...
I know asterisk can probably do it, but isn't that overkill (A full blown VOIP system just for a notification mechanism that will hopefully never be used)? And wouldn't it interfere with the modem's primary function as a backup network interface (PPP spawned via mgetty)?
I've done some searching, and haven't really come up with much. I know how to dial out from the command line, but only as a modem (not as voice). Worst case, I could set it up to dial out as a modem, and then just realize that if I get a call with modem sounds from that number that it's the notification... Any insight would be appreciated...
Linux uses
vgetty
for voice data over a modem (mostly as an answering machine). It looks like there's a perl module over at CPAN that comes with an example script like what you want.I use an external server for running an additional instance of Nagios, which is a last resort notification in case of complete failure.
I wish I had an answer for your modem audio playback question. I want to say it should be simple but my knowledge of that stuff is getting rusty. There used to be Voice Modems sold specifically for playback of audio.
If I were you, I would be trying to redirect audio playback using console software. I'd think this could be very simple. I might research more later when I have a moment.
I found this during a quick search:
If you had a dial-up internet account, it could connect to the internet send a text via e-mail then disconnect.
Came across this question whilst Googling, and figured that although I specifically want to capture/replay a voice sample, a simple SMS might be suitable for your situation.
I used a Huawei modem (USB dongle) as an SMS center on my raspberry pi with a free SIM from a CSP, so that I can text it and it responds with basic info about the system. I'd guess it could easily be modified to send an SMS in response to Nagios detecting internet failure!
Note that you need a regular phone SIM (not a data-only/tablet SIM) to be able to send SMS.
I used the blog post here: http://hristoborisov.com/index.php/projects/turning-the-raspberry-pi-into-a-sms-center-using-python/
...which specifically uses this sample code on github.
In the interests of preventing link-rot, the gist is to use the
serial
library in python (import serial
) and send regular modem AT commands to the modem. Put the modem in text mode and then send a test message using the following strings:In addition to the Perl module and script, Vgetty includes a Bash script
message.sh
which can similarly call out and play a message. It can be found in themgetty_src_1.1.37/voice/scripts
directory. It may be installed with the mgetty/vgetty documentation depending on your distro. On OpenSuSE 42.1 it can be found in/usr/share/doc/packages/mgetty/voice/scripts/message.sh
.To use it:
It does not require vgetty to be running, only installed and configured correctly for your modem. The phone number can be a local number (555-1212) or full number (1-942-555-1212) but without any hyphens (-).
message.rmd
must be in a format your modem understands - or be prepared for an earful of hiss and pop.