Software development techniques behind the magic user interface

Multi-Touch Developer Journal

Subscribe to Multi-Touch Developer Journal: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get Multi-Touch Developer Journal: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Multi-Touch Authors: Ben Bradley, Qamar Qrsh, Suresh Sambandam, Jayaram Krishnaswamy, Kevin Benedict

Article

Installing a text-messaging gateway on Debian

Part 10 in our 'Linux for peanuts' series, we serve QuickPage for the first time with Debian's fresh Potato!

(LinuxWorld) -- My view of Debian probably derives from the fact that the Debian community doesn't rename a release every time it updates the operating system. The truth is, Debian "stable" (codenamed Potato) is considerably different today than it was a year ago. Now at release 2.2.5r, Debian stable is about as close to the bleeding edge as I want to get with a production machine, and in fact, sufficiently different from it's earlier versions that it has been necessary to make a few changes in the configuration details of our Text Messaging Gateway.

Nevertheless, that is part of the beauty of Debian, and a fact if you install Debian by way of the Internet. If we had chosen Red Hat 6.1 or Slackware 4.0 as our platform, and; if we built our Text Messaging Gateway from increasingly older versions of the applications, then; the details of configuration would never change. Our Gateway, however, would not benefit from the latest security updates and improvements.

If you get to feel sorry for yourself because Debian does change, and that you are forced to occasionally change procedures with it, just be glad that you are working as a sysadmin. You are, by necessity, working indoors where it is both dry and warm (or else your servers aren't going to last very long). If you read my bio at the end of each of the articles in this series, you will notice that:

  • I am only a part-time administrator and that my real job is in radio.
  • I live and work in Idaho, which is located in the Mountain west.

Then, if you look at the calendar, you might note that it is winter in the Northern Hemisphere. Much of my December was spent outdoors, on a mountain, in the snow, doing whatever was necessary to get a new transmitter building ready for occupancy by a customer who waited until the last minute to meet an FCC construction permit deadline. The customer was warned that Idaho's winter weather is unpredictable, and they were caught. It cost them, because it necessitated an "all hands" effort to save their license. I spent my holidays driving ground rods in frozen soil and rotten basalt bedrock, wiring outlets, and helping carry spools of 7/8-inch diameter coax.

That left little time to write this installment, but that's okay, because the past month permitted Debian to update stable to 2.2.5r. It's always good to document a procedure with the latest version so that the documentation doesn't become obsolete quickly.

Before we return to the task of configuring our Text Messaging Gateway, it is a good time for you to login as root and open /etc/apt/sources.list with your favorite text editor to make sure you have the necessary lines uncommented to fully update your machine. Here are the three lines I uncomment (remove the leading hash mark "#") to ensure that apt-get can access any files we need:

deb http://security.debian.org stable/updates main contrib non-free
deb http://http.us.debian.org/debian/ stable main non-free contrib
deb http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free

After saving any changes to the sources.list file, you should then run:

apt-get update

Followed by:

apt-get upgrade

And for good measure:

apt-get dist-upgrade

See man apt-get for additional information about the update and upgrade features of Debian's package management tool.

Now, we are all reading from the same page and are all updated to Debian Potato 2.2.5r, so without further ado, let's get busy and get QuickPage up and running:

Step 1. Get an old modem

In Part 9 of this series, I advised you to obtain a modem for this machine. The purpose of this modem is to establish a connection with the TAP/IXO modems of the various paging, PCS and cell phone services you wish to send text messages through. Shut down the machine and install that modem now.

I grabbed an old 9600-baud ISA modem and set it's jumpers to com 3 and irq 4. Internal or external makes no difference as long as it is Linux compatible and doesn't conflict with any other hardware. Speed is of little importance because the communications vendors don't typically support speeds above the 1200~4800 baud range.

Step 2. Get QuickPage

Once the modem is installed, power up the computer and login as root. You just ran apt-get update and apt-get upgrade, so you are ready to install QuickPage. The following command will fetch the latest binary from Debian's server:

apt-get install qpage

As soon as apt-get is finished with it's magic, we can begin to configure QuickPage to permit basic command line operation.

Step 3. Tell QuickPage & Linux about the old modem

We need our modem to work with QuickPage and odds are you will need to open /etc/serial.conf with a text editor and uncomment the appropriate line.

In my case, I set the modem for com 3, which corresponds with /dev/ttyS2, so I open /etc/serial.conf with Easy Editor (ee) and uncomment the line that reads:

/dev/ttyS2 uart 16450 port 0x3E8 irq 4

You will need to uncomment (remove the "#") the line appropriate for your modem which may, or may not, be /dev/ttyS2.

Now, reboot the machine so that the serial port is activated.

Step 4. Muck around in the tty files

Login as root again, and change to the /dev directory:

cd /dev

Pipe ls -l through less so you can scroll down to /dev/ttyS2 (or whatever serial device is correct for your modem).

ls -l | less

If you forgot to install less with the apt-get utility, now is a good time! (apt-get install less).

You will notice the permissions for /dev/ttyS0 through ttyS3 are set at:

rw-rw----

Unfortunately, that won't let QuickPage dial out. The easiest way to give QuickPage access to the modem is to change the permissions of this file:

chmod 666 /dev/ttyS2

Run ls -l | less again and the permissions should now be:

rw-rw-rw-

Step 5. Configure the first QuickPage config file

There are two configuration files that are created under /etc when QuickPage is first installed. They are qpage.cf and qpage.servers.

Configuring qpage.servers is the easier task, so we will get that out of the way first. Open the file with a text editor and remove the sole entry:

pager

Replace that entry with:

localhost

Save this change to the file. Easy, huh? This simply tells the QuickPage client to look no further than this machine for the QuickPage server.

Step 6. Gather some information

Configuring qpage.cf isn't particularly difficult, but it does require some information that I cannot supply for you. Therefore, Step 6 involves gathering some information. You need to know:

  • The seven digit or, in many cases, ten digit phone number assigned to each alphanumeric pager/phone you intend to send text messages to.
  • The TAP/IXO modem phone numbers of each paging/phone service provider you must access.
  • Connection speed supported by each paging/phone service provider you will access.

The first one is easy. Ask the person carrying the pager!

The second item is a bit more involved. You may be able to call each provider's local office and get the number. It is just as likely their newly hired sales staff will tell you they don't have any such number, or that they don't understand your request. You can look at http://www.qpage.org/phone-numbers.html for a list of numbers thoughtfully provided by Mr. Thomas Dwyer III, the developer of this excellent package. While not 100-percent complete or up-to-date, this list is an excellent starting point.

The third item, connection speed, can be problematic. I suggest you begin by attempting to connect at 1200 baud and experiment as needed. Mr. Dwyer's list contains some hints for some services and if you can reach some one in tech support or maintenance at the paging or cell phone company you need to connect with, you may (and I emphasize may) get an authoritative answer. In many instances, experimentation is the only practical solution.

Step 7. Configure the other QuickPage config file

With the information you obtained in Step 6, we set out to configure /etc/qpage.cf. My suggestion is to rename the default qpage.cf to something like oldqpage.cf with the mv command like so:

cd /etc
mv qpage.cf  oldqpage.cf

That way, you can refer to Dwyer's comments and examples at your convenience without having to worry about an overlooked line remaining to interfere with your own configuration.

Then, with your favorite text editor, create a new qpage.cf file. I'll use Easy Editor:

ee qpage.cf

In this file, you must define the following items (an explanation for each is found in the oldqpage.cf you just created with the mv command):

  • The administrator (we will use root).
  • The queue directory.
  • Time outs.
  • The modem.
  • Names, phone numbers, and baud rate for each paging/phone service provider.
  • A user name, phone number and service provider for each pager/phone user you will send messages to.

If you refer back to Part 9 of this series, you will find good 'ol Tom Smith in the shipping department. In the screen shot, Tom just got an unpleasant message from the head of personnel, Basil Buffoon. We will configure /etc/qpage.cf to work with Tom's PCS phone and Basil's alphanumeric pager. There will be two service providers defined and only these two users, so that we don't obscure the essential details with repetition.

Here is our example /etc/qpage.cf file:

# Configuration file for QuickPage.
#
###########################################
# Who runs this show? Where do we put stuff?
#
[email protected]
queuedir=/var/spool/qpage
#
###########################################
#
# How long do we beat our head against the wall?
#
identtimeout=5
snpptimeout=60
#
###########################################
#
# Where did we hide the modem and what makes it tick?
#
modem=ttya
             device=ttyS2
             initcmd=ATZ
#
###########################################
#
# Who are we paying for pager and/or phone service? What is the connection speed? 
# What number do we dial to connect to their TAP/IXO modem?
#
service=AlwaysBusyPCS
             device=ttya
             baudrate=2400
             parity=even
             allowpid=yes
             maxtries=10
             phone=1-800-555-1212

service=PagersDon'tWork device=ttya baudrate=1200 parity=even allowpid=yes maxtries=6 phone=555-1212 # ########################################### # # Who packs a pager or phone? Names, please. What's the phone number of their # pager or PCS phone? Who provides their service? And when you add new users, will # you at least try to keep them in alphabetical order? # pager=basilbuffoon pagerid=404-3771 service=PagersDon'tWork

pager=tomsmith pagerid=412-555-1212 service=AlwaysBusyPCS

########################################### # End of qpage.cf

Save this file, reboot the machine, and refill your coffee cup. When you get back, we will test QuickPage.

Step 8. Test your handiwork

Make sure your Text Messaging Gateway's modem is plugged into a phone line, then get ready to send Tom Smith the message guaranteed to calm his frazzled nerves. At the command line, enter:

qpage tomsmith

Quickpage responds with:

Enter the message; end with '.' on a line by itself

So, you type:

Hi, Tom. Basil was just kidding about firing you. We are just testing the text messaging system.
.

When you press Enter you are returned to the command prompt. QuickPage then dials the TAP/IXO phone number for AlwaysBusyPCS, identifies the intended recipient as Tom Smith (or rather, Tom's PCS phone number: 412-555-1212) and passes on the text message for transmission to Tom's phone. Depending upon the service, and traffic, Tom should get the message within a minute or two.

Now that you have QuickPage up and running, it is a good time to add your remaining users and additional service providers (if any). In Part 11 we will integrate QuickPage and a local mail server, and I promise you won't have to wait as long for the next installment as you did this one!

More Stories By Colin Mattoon

When not buried under his real job in commercial two-way radio system design and sales, Colin Mattoon is a part-time Linux system administrator at Northwest Communications in Lewiston, ID.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.