Matt G. Watson

Just another geek
Add to Technorati Favorites
June 22nd, 2008

HowTo: Sending SMS Text Messages via sendpage SNPP server

Synopsis

Sendpage is a SNPP server available for Linux (and other UNIX varients probably) that allows you to send SMS text messages to either your cellular phone or pager.  How does it differ than using the SMTP gateway that your cell carrier probably already provides?  Well the biggest benefit is that it does not require Internet access to deliver pages.  Instead Sendpage delivers pages to your device through Paging Central servers that most cellular carriers offer - many of which for free.  Paging Central servers implement a protocol called TAP which is used for one-way text messaging.  This means if you are using paging to notify support employees about server outages and such, your monitoring/alerting solution does not require internet access to deliver pages… which means if your internet connection is the device that dies on you, your support people will know about it.  For instance, we use sendpage in combination with ZenOSS core for alerting our support staff of problems.  ZenOSS has native support for SNPP built right in.

What You Will Need

  1. Linux Server (I’ll be using a Gentoo-based server)
  2. Dialup Modem
  3. the dialup TAP number for your Paging Central gateway (ask your Cell Carrier, or google)

Install sendpage

To begin, you’ll first need to install sendpage.  Most Linux distributions have packages for sendpage in their repositories, simply install sendpage from there.  In the case of Gentoo, this is what you need to do:

Unmask the sendpage package - if you are already running a ~x86 (or ~amd64) machine, then skip this step, if you are running “stable” gentoo you’ll need to do this as sendpage is only available in the unstable branches.

wind ~ # echo “net-dialup/sendpage ~x86″ >> /etc/portage/package.keywords

Install sendpage

wind ~ # emerge sendpage

Configure Gentoo to start sendpage at boot:

wind ~ # rc-update add sendpage default
* sendpage added to runlevel default

If you are not using Gentoo, then you’ll need to replace the above commands with your distributions package system commands - on Debian and its derivatives you should be able to get it through ‘apt-get’, and for RedHat and its derivatives you should be able to use ‘yum’.  If none of these options work for you, you can resort to downloading the source yourself from http://www.sendpage.org and compiling / installing it manually.

Configuring Sendpage

Now that we have sendpage configured, we need to setup sendpage to use our dialup modem, as well as configure who and where to send pages to.

All of this configuration will be done by editing /etc/sendpage.cf. There are many options in this file, but we’ll stick to the important ones that are needed just to get things running.

If you want other computers on your network to be able to send pages through your SNPP server you’ll need to uncomment this line:

snpp-addr=0.0.0.0

This tells sendpage to bind to all IP addresses on your machine.

Additionally, you’ll need to uncomment and configure this line to specify which IP addresses are allowed to send pages:

snpp-acl=”10.20.1.0/255.255.255.0:ALLOW”

This tells sendpage that any machine with an address of 10.20.1.x may access this server.

Configuring Your Modem in Sendpage

The next section of sendpage.cf tells sendpage how to talk to our modem - you may need to adjust these settings to match your Paging Central number:

[modem:dialup1]
data = 7
parity = even
stop = 1
flow = rts
baud = 9600
strict-parity = false
dev = /dev/ttyS0
init = ATZ
dial = ATDT
areacode = -
dialwait = 60

Most Paging Central gateways use 9600 7E1 so those settings will work for most.  If you are in a country that always dials an area code, leave the areacode as “-”.  You will need to change the dev= line to point to the correct serial port your modem is connected to.

Configuring the Paging Central gateway

The next section of sendpage.cf controls the specific parameters for this Paging Centre:

[pc:gateway1]
enabled = true
modems = dialup1
data = 7
parity = even
stop = 1
flow = rts
baud = 9600
strict-parity = false
phonenum = 9057082246
answerwait = 30
answerretries = 3

Make sure you change the phonenum = line to the correct TAP number for your area.  The one there is for Rogers Wireless for the city of St. Catharines.

Configuring Paging Recipients

Last but not least, in sendpage.cf we need to configure our recipients:

[recip:matt]
dest = 905401XXXX@gateway1

All this does is tell sendpage that when a page is sent to ‘matt’, the page should be delivered to 905401XXXX through the Paging Centre ‘gateway1′ that we configured earlier. Each sendpage server can be configured to use multiple modems and handle multiple paging centres.

Start Sendpage

The last thing to do, is to start up sendpage, on Gentoo and most other distributions:

/etc/init.d/sendpage start

Optional: Configure ZenOSS to use SNPP Paging

If you happen to be running ZenOSS and want to configure it using SNPP, well you are in luck, it is very easy.  If you are running a version of ZenOSS earlier than 2.2, on the settings page you’ll find a section to put in the hostname / IP of your SNPP server, if you are running 2.2 or higher, this section has changed to “Page Command”.  By default in 2.2, pages are sent to localhost on port 444, if your sendpage server is the same server as your ZenOSS server, then you are already done on the settings page, otherwise just change the ‘Page Command’ to suite your configuration.  The only other thing you need to do is fill in the ‘Pager’ boxes on each of your users profile on ZenOSS.  You should fill in the same value that you used in the [recip:<XXX>] configuration of sendpage.cf, in my case simply putting in ‘matt’ does the trick.

4 Responses to “HowTo: Sending SMS Text Messages via sendpage SNPP server”

  1. what type of device (usb modem) are you using for this

  2. Hi Fab,

    I;m actually not using a USB modem, I;m using an old fashioned serial port modem.

    Theres no reason that a USB modem will not work however, you’ll just might have to do a few extra things to get Linux to “see” it. Like making sure your kernel has the proper modules compiled into it - or figuring out which ones you need to load at bootup for your particular modem.

  3. I stumbled across this article while researching setting up SMS with out zenoss install. I’m going to try it now, but wondering if the steps are still valid (due to the age of the posting). Are you still using this method?

  4. Hi George,

    Yep, the method is still valid and I am still using it.

    The only thing that I may have changed over time is the phone number i’m using to dial into.

Leave a Reply