6

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...

ircmaxell
  • 1,201
  • 8
  • 20
  • just wondering if you ever got it to work properly. I am looking at setting up exactly the same thing - a dialer for server monitoring. In my situation, I cannot (not do no want to) use SMS; I need an actual phone call. –  Oct 08 '10 at 13:24
  • Well, yes and no. I got it to work on a normal voice modem, but the system that I needed it on only had a win-voice modem. The drivers that were available didn't support voice operations, and the company wanted like $50 for the full driver. So rather than buying a new modem, I just implemented another method. But it is possible (and quite easy, as long as you have the drivers)... – ircmaxell Oct 08 '10 at 15:25

6 Answers6

3

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.

Callme script

In the examples subdirectory of the source distribution there is a callme.pl script. This dials the given number and plays the given message. Use the following command to run it:

    vm shell -S /usr/bin/perl callme.pl <number> <message>.rmd
TonyUser
  • 428
  • 2
  • 4
  • So far looks good. But I'm having a hell of a time getting it to work. It's dialing out fine, but the second it goes to play the .rmd file, it hangs up... I've been watching the logs, and I'm not sure where to go from here, I guess I'll just keep permuting until I find something that works... Thanks! – ircmaxell Jun 18 '10 at 19:18
  • package is called `libmodem-vgetty-perl` on Ubuntu – Janus Troelsen Feb 03 '13 at 23:26
2

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.

Warner
  • 23,440
  • 2
  • 57
  • 69
2

I found this during a quick search:

Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148
1

If you had a dial-up internet account, it could connect to the internet send a text via e-mail then disconnect.

BillN
  • 1,503
  • 1
  • 13
  • 30
  • Sure, but that would require getting (and paying for) a dial up account... It's an option, but unless there's some free service I don't think I could justify it (when a dial out is free)... Thanks tho... – ircmaxell Jun 17 '10 at 20:23
  • 1
    @ircmaxell: Actually a lot of cell providers will give you a free backup dial-up account if you have a data plan in one of the top 2 tiers of service (I know Verizon does this for their "unlimited" data plans) – Zypher Jun 17 '10 at 23:44
  • Or you could try netzero, free for 10 hours/month, if you use more than 10 hours in a month, you have bigger problems. http://www.netzero.net/start/landing.do?page=www/free/index – BillN Jun 18 '10 at 15:26
1

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:

AT+CMGF=1\r

AT+CMGS="07123456789"\r
some message here.<Ctrl-Z>
shearn89
  • 3,143
  • 2
  • 14
  • 39
1

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 the mgetty_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:

message.sh 5551212 message.rmd

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.

techraf
  • 4,163
  • 8
  • 27
  • 44