The Linux Alphanumeric Pager Gateway Mini-HOWTO

Tanmoy Prasad

Expert Software Consultants Ltd.

C -17 Almora Bhawan
New Delhi
110 049
INDIA

Revision History
Revision 1.025 July 2001Revised by: Tanmoy Prasad
Originally Drafted By Chris Snell, Jun 23 17:55:14 MDT 1996
Legal Notice

This is Mini How-To, which discusses the compilation and installation of e-mail to Pager Gateway.

PREFACE & DISCLAIMER:

This document was lying un-maintained. As I am also working in similar field so I, decided to maintain this document. Originally Mr. Chris Snell wrote this document. Anybody who wants to refer to the older document can find it at the Pager FTP Site://ftp.cs.unm.edu/pub/chris/paging"

In spirit, this document is same as what Chris Snell wrote. I have only made minor modifications with the code to make it work with latest Kernel Version. I have mainly tried on Redhat Linux 6.0 , Kernel version 2.2.5 and Madrake Linux 7.2 and Kernel version 2.2.17.

If you blow up your computer/pager/modem or ruin your company network trying to set this up, don't blame me. Most likely, you won't mess up anything but I should warn you that sendmail is a tricky thing to play with and you will definitely be playing with it if you follow this document.

PURPOSE:

This mini-HOWTO will describe how to set up an Alphanumeric Paging Gateway on any linux machine. Your gateway will be able to send messages originating from both the World Wide Web and the Internet e-mail system to your alphanumeric pager. This is especially convenient, because no special skills are required for someone to send a message to your pager. All they must be able to do is use e-mail or the World Wide Web.

**SPECIAL NOTE: **

This document does not cover the setup of paging gateways, which are intended to send messages to non-alphanumeric (i.e. numbers-only) pagers or voice pagers. You'll need to look elsewhere for that information.

REQUIREMENTS:

ABOUT ALPHANUMERIC PAGERS:

Alphanumeric pagers are available from most reputable paging companies. You can get one at a very reasonable cost. Nowadays it comes bundled with the Pager subscription. Anyway cost varies from country to country and you can check with your Pager service provider.

Here are some things to look for when you go shopping for your pager:

I don't work for any pager manufacturers. I agree with Chris on recommending the Motorola line of pagers. As per Chris Snell " I own one myself and will testify to their reliability and durability. In fact, mine has been dropped onto the concrete on many occasions and did not sustain so much as a chipped case." You can find this line of pagers on Motorola's web site at: URL="http://www.mot.com/MIMS/MSPG/Products/Alpha/".

I have used one provided by my pager company along with subscription. I know it is not Motorola but in last one year I have to get it replaced once. So be sure of the brand and quality of the pager you buy.

THE DIALUP PAGING LINE

In order for your gateway to work, we need a way to deliver the messages to your paging company, which encodes them and transmits them over the air to your pager. This is done via a dial-up (modem) connection with your paging company. Without this connection, you cannot setup a paging gateway. Therefore, it is very important that your paging company have such a dial-up line. Unfortunately, many paging companies either do not have such a dial-up line or do not know about the line they have. When inquiring with a paging company about this line, I found it helpful to ask if they could provide "computer software to send an alphanumeric page with". If they make available such software, you can bet that they make the dial-up line available that is necessary to use it.

SPECIFICS ON THE DIALUP LINE

The dial-up line is simply a modem on a remote computer (or possibly some kind of specialized box). The modem usually connects at 33.6/56.6 KBPS but in case of modem dial-up line of paging companies it work at 300-1200bps. Some may provide connection using v.22b at speeds up to 2400bps. Once the connection is made, your computer sends the page to the Paging central by using a protocol known as TAP (formerly known as IXO). The Paging Central finally sends the message to the pager. For running the Paging gateway, you do not need to know the details of this protocol, but if you are interested, check out the following document on following ftp site:URL="ftp://ftp.cs.unm.edu/pub/chris/paging/ixo.txt"

HOW YOUR GATEWAY WILL WORK

Before we proceed, I am providing a brief explanation of how the e-mail->pager gateway will work. The WWW gateway is similar and will be explained later.

  1. Someone sends a message intended for your pager via e-mail to a special address on your linux machine.

  2. Your machine, using sendmail, accepts the message and routes it to a filter program, which strips the message of its header and parses out important information like the sender's name and e-mail address and the subject of the message. This filter also strips the message of any .signature lines so that they do not clog your pager with unimportant information.

  3. The paging filter passes the message onwards to the "sendpage" paging software, which queues it for delivery.

  4. Sendpage then dials your paging company's dial-up line and (using TAP) sends the message to the Paging Central.

  5. Paging Central of your paging company then beams the message to your pager over the radio waves.

BEGINNING THE SETUP

The setup of the Pager gateway consists of four parts:

GETTING THE SOFTWARE

Every piece of software necessary to set up this product can be obtained from the site, ftp://ftp.cs.unm.edu/pub/chris/paging. I will try to keep these files at some other alternate sites. In near future I will try to package this as an RPM so that installation becomes easy. Next revision of this document may see that change.

SENDPAGE SETUP

Sendpage is the most important component of your paging gateway. To get anywhere in this project, you will need to obtain this software and compile it on your machine. The sendpage software can be obtained via ftp at://ftp.net.ohio-state.edu/pub/pagers/sendpage7a.tar.Z" or from following machine: ftp://ftp.cs.unm.edu/pub/chris/paging/sendpage/sendpage7a.tar.Z".

Create a "paging" subdirectory on your machine. Fetch this software and unpack it using the command "tar zxvf" in the paging subdirectory created.

At this point, I would strongly suggest that you read all the configuration information and README and INSTALL files in the sendpage package. However, ignore all the discussions on the setup of sendmail, instead, rely on the procedure provided in the document. Follow the instructions in the INSTALL file for compiling sendpage.

Here are a few notes about the settings in the sendpage.h file, which you will need to edit:

*** If you are interested, my sendpage.cf is available in it's entirety from the following ftp site: ftp://ftp.cs.unm.edu/pub/chris/paging/sendpage/sendpage.h.example".

If your Linux kernel version is 2.2.x then do following changes, in following files:

  1. client.c

  2. config.c

  3. deamon.c

  4. deliver.c

  5. sendpage.c

  6. verify.c

Instead of #include DB.h put #include DB185.H DB185.H

CONFIGURING YOUR MODEM

I use a D-Link DFM-560 E which seems to work fine with sendpage. With other modems, your milage may vary (possibly for the better). Although your paging company's modem (referred to by sendpage as "Paging Central") could very well be different from mine, you may want to try this setup to see if it works. You should have your modem manual handy as a reference for the proper init string. Here is what I have set:

For sendpage to work, it must be able to access the modem. This requires read/write permissions to the modem device. On my system, sendpage is run with set-uid to the username "sendpage". In my /etc/group file, I have a group called "modem" of which the user "sendpage" is a member. The device file for my modem (/dev/ttyS1) is owned by user "root" and group "modem". It is readable and writeable by both the owner and the group (chown root.modem /dev/cua1 ; chmod ug+w /dev/cua1).

SENDPAGE MAKEFILE SETUP

Here are the build options I use for Linux:

*** If you are interested, Makefile is available in it's entirety at the following ftp site:ftp://ftp.cs.unm.edu/pub/chris/paging/sendpage/Makefile.example".

CONTINUING THE SETUP

Hopefully, you were able to get sendpage to compile correctly on the first try. Now you must set up sendpage for the initial testing. Following the INSTALL file's instructions, you will set up the queue directory and begin setting up the sendpage.cf file (I keep mine in /etc).

A few notes on setting up the /etc/sendpage.cf:

*** If you are interested, the sendpage.cf is available in it's entirety from the following ftp site:ftp://ftp.cs.unm.edu/pub/chris/paging/sendpage/sendpage.cf.example".

MOVING RIGHT ALONG...

At this point, I am assuming you have been able to at least send a page to your pager using sendpage's command-line interface. If you haven't been able to do this, re-read the INSTALL file and re-check your sendpage.h and sendpage.cf. If all else fails, do mail me.

SETTING UP A SPECIAL HOSTNAME

If you want to have a special virtual hostname for your paging gateway (i.e. pager.yourcompany.com), there are a few steps that you will need to follow. If you do not want to (or cannot) set up an extra virtual hostname, skip ahead to the section entitled "SETTING UP /etc/aliases".

Setting up a separate UP address (as described below) is not necessary if all you need is a mail->pager gateway [no www]. If this is all you need, follow the instructions found at: ftp://ftp.cs.unm.edu/pub/chris/paging/Sendmail-and-virtual-domains.txtto set up a MX entry for your paging hostname. When you've done this, skip ahead to the "SETTING UP SENDMAIL" section.

The first thing you need to do to set up your new hostname is to ask your network administrator to add a new IP address and hostname to the DNS tables. I would recommend using the hostname "pager" but it really doesn't matter. Now that you have your new address and the associated IP number, you need to add it to your machine. This will be done in one of two ways, depending on the type of your linux distribution.

If you use the Linux kernel 1.2.xx series. Get the IP aliasing patches from: ftp://ftp.cs.unm.edu/pub/chris/paging/ip_alias and follow the instructions in the file README.alias, substituting your newly-assigned IP address and gateway address for the ones mentioned in this README file.

* If you are using Linux kernel 2.0.xx and above, Enable the following options for your kernel and recompile: Network aliasing IP: aliasing support. In your startup scripts (/etc/rc.d/rc.inet1 for Slackware users, /etc/sysconfig/network-scripts/ifup-eth for RedHat users) add the following lines:

SETTING UP SENDMAIL

We need to make some aliases so that sendmail can distinguish between a message sent to you@somemachine.dink.com and you@pager.dink.com, when "somemachine" and "pager" are actually the same machine. To do this, we need to set up a sendmail alias database. The following information is based upon the info I got from Sendmail Link .

*** Create a file, /etc/domainalias with translations from the pager hostname to the "real" hostname. On my machine (mahavir), my translation file looks like this: . . That's it for that file. We are almost done now. I hope you have a sendmail binary that was compiled with the following switches: -DNDBM -DNEWDB. These are to enable the database-handling code needed to read the domainalias.db file that we are about to create.

Make sure that you have the makemap utility (part of the sendmail distribution). Compile it like this if you haven't already: (This may not be necessary, check to see if hash, dbm, or btree are supported or not, check next step on how to do this. )

Add a line to your /etc/sendmail.cf to make sendmail accept mail for the new virtual hostname: Cw pager.yourdomain.com Compile /etc/domainaliases into a database format: makemap btree domainaliases.db < domainalisaes

Add another line to your /etc/sendmail.cf to tell sendmail about the domainaliases.db translation file which we just compiled. Kdomainaliases btree/etc/domainaliases.db . Now for the rule-set, make sure you type it exactly into/etc/sendmail.cf..

The entries are separated by a TAB field NOT SPACES!!!! These are to be inserted INSIDE the S98 Ruleset.

PRE 8.7.1 R$+ < @ $+ . > $: $1 < @ $2 > . R$+ < @ $+ . > $* $: (domainaliases $1@$2 $: $1 < @ $2 > $3 $) R$+ < @ $+ . > $* $: (domainaliases $2 $: $1 < @ $2 > $3 $) R$+ < @ $+ > . $: $1 < @ $2 . >

POST 8.7.1 R$+< $+. > $1< $2 > R$+< $+ > $: < > $(domainaliases $1$2 $) R< > $+ @ $* $: < $1 > $(domainaliases * @ $2 $) R< $+ > * $* $: < > $1 $2 R< > $* $: $>3 $1

Now you must kill your sendmail daemon and restart it for the new configurations to take effect.

Finally, test your new configuration to make sure you did it correctly, Check /var/log/maillog for any possible error messages.

Enter <Ruleset> <Address> >0 tanmoy@PAGER.com

*** If this didn't work or you just don't understand, consult your local sendmail expert.

SETTING UP /etc/aliases

Now you need to set up your /etc/aliases file to handle the piping of the e-mail message to the filter which sends the message to sendpage. In the previous section, I demonstrated how I made tanmoy@pager.com point to pager@mahavir.esc.in. To make this work, I had to add a line to my /etc/aliases file to send all mail to esc-pager to the filter. That line is:esc-pager: "|/usr/local/bin/sendpagefilter tanmoy"^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^This is the This is the full path to the This is a username thatalias that paging filter. (see below) you defined in youryou created sendpage.cf

The filter used in this example can be obtained at: ftp://ftp.cs.unm.edu/pub/chris/paging/paging_filter.tar.gz. Read the instructions in the included README file, compile the filter, and place it in a directory such as /usr/local/bin.You must now run the 'newaliases' command to make sendmail re-read /etc/aliases for the current configurations to take effect.With this complete, your paging gateway should be working. Try sending mail first to the alias which you created in /etc/aliases (in my example, esc-pager). If this works, try sending mail to your virtual mail alias which you created in the previous section (in my example, tanmoy@pager.com). If this works, you are done!!!

THE WWW GATEWAY

I am not going to write much here. I'm assuming that you have some HTML skills and have used CGI scripts before. Your gateway will use a CGI script to communicate between the web browser and the sendpage program. An example script and HTML page available at: URL="ftp://ftp.cs.unm.edu/pub/chris/paging/example_www_gateway.tar.gz".

This script utilizes two additional programs, uncgi (to translate CGI data into shell environment variables for easy CGI programming) and d2utxt to strip out the ^M characters in a page message that make sendpage choke. These utilities are available in the same directory on the ftp site that the example HTML is found in. Read the instructions that come with them to compile them. This should be easy.

If you are using Apache web server then visit URL=" http://www.apache.org" or refer to WWW-HOWTO for more information to set the web server. In CGI script, i.e., in send_a_page file make appropriate changes in the modem number of your Paging Central and your Pager number.

GETTING MORE HELP

You can mail me at . Though I'm a busy employee but still you can ask for help. I hope i will be able to solve your problem. Still I cannot guarantee to solve your problem.

Tanmoy Prasad
Expert Software Consultants Ltd.
C -17 Almora Bhawan
New Delhi
110 049
INDIA