Voice-Over IP for Linux

Greg Herlein

Ed Okerson

Issue #65, September 1999

Make your long-distance calls over the Internet using this new technology for Linux.

We've all got friends, family and Linux collaborators scattered around the world, and we all like to talk. We love to pick up the phone and gab—but the costs for long-distance phone calls are high, and international rates are worse. Many, if not all, of the people we would like to call have Internet access. We can now use our normal phone over the Internet to make phone calls using Linux.

Voice-over IP is the answer, but it is a technology that has been slow to migrate to Linux. Sure, applications are available that can already do this using a sound card, but frankly, the headset and sound card solution is a kludge. Headsets don't ring when an incoming call comes in, and most sound cards do half-duplex voice that, at best, is annoying and cards don't connect to your personal or business phone system. Other technologies have been available for Win32 platforms, but not for Linux. That is changing quickly, especially with the recent pre-alpha release of new Linux drivers for the Internet PhoneJACK and Internet LineJACK voice-interface cards from Quicknet Technologies, Inc.

The Hardware

Quicknet's Internet PhoneJACK card provides a low-cost, full-duplex audio interface and telephone-line interface to a normal phone. The card has a POTS (plain old telephone service) interface (RJ-11), where you plug in a normal analog telephone and use it to make phone calls over the Internet. When calls come in, the phone rings. When you want to make an outgoing call, you can dial the digits from the phone or from software control. In all respects, it is a phone—it just works over the Net. If you are calling a party that also has an Internet PhoneJACK/LineJACK, or compatible software, then your call is free! If you want to call someone on their normal phone line (not over their computer), you can do that too, via a PC-to-Phone service like Net2Phone. In that case, you would have already set up an account with the provider (via a browser), your call would go over the Net to them and they would get the call to your party over their system, charging you a low rate for the service. Obviously, the best case is if both parties have Quicknet cards, because then you avoid the costs of the PC-to-Phone service provider and get the highest quality. Another way to get it free is by using a Quicknet Internet LineJACK card.

A huge advantage of Internet PhoneJACK/LineJACK cards is the audio-compression capabilities (CODECs) built into the cards. These include G.711 (64Kbps), G.723.1 (6.3Kbps and 5.3Kbps) and TrueSpeech (8.5/4.8/4.1Kbps) audio compression in hardware. These compression technologies may be used with no royalties or fees whatsoever—the license cost is part of the hardware cost. This is a big deal, because it allows small developers to build compressed-speech applications without having to spend thousands of dollars on licensing the CODECs. In other words, it makes it free to use the same technological advantages as the big boys.

The Internet LineJACK card adds an extra twist: it has a PSTN (public switched telephone network) interface. The PSTN plug (RJ-11) is connected to your normal phone line, allowing you to place and receive normal phone calls using the card. All DTMF and tone-generation capabilities are built into the Internet LineJACK. It is also designed for software-controlled compatibility with different phone networks around the world. (Different countries have different electrical and tone signals with which the Internet LineJACK is capable of interfacing by selecting the appropriate parameter set.) With the appropriate software, you can use the Internet LineJACK to create a one-line gateway between the Internet and the normal phone system. To solve the problem of not being able to make PC-to-phone calls without an applicable service provider, all you need to do is set up an Internet LineJACK card on a system in the area you want to call. Your voice call “hops on” the Internet at your computer, then “hops off” at the remote Internet LineJACK and out onto the local PSTN in that community to complete the call—all for free.

It is important to realize that a single G.723.1 compressed audio “call” uses only 6.4Kbps. Even on a normal 33.6Kbps modem call, there is sufficient bandwidth for multiple simultaneous calls over a single link.

Until recently, drivers for these cards were available only for Windows 95/98/NT. However, Quicknet has recently released some early pre-alpha versions of their Linux drivers, along with a sample application to provide an example of how it all works.

Getting the Driver

You can get the Linux drivers at www.quicknet.net/develop.htm. Be warned: these are still early, pre-alpha releases and are not for the faint of heart. At this early stage, these are recommended only for people who wish to play with new technology and are not afraid to fiddle around with their system. Of course, that is most Linux people, but we had to warn you. The driver is distributed in a compressed tar file that includes sample application source code and a simple HOWTO.

Licensing

Many Linux folks may criticize Quicknet because their device driver is not Open Source. Quicknet has made a carefully reasoned business decision to keep their device driver binary-only and not reveal the source code. A full API will be published to detail how to use the device driver, but the source code will be closed. To their credit, Quicknet realizes the tremendous opportunities with Linux and has made the investments needed to get the Linux drivers written. Quicknet has also continued to invest in this area by hiring Linux developers to work in-house.

However, the sample code accompanying the device driver is released under the Lesser GNU Public License (LGPL). While there may be some who demand the drivers be released Open Source, Quicknet believes strongly that having stable, reliable binary-only drivers is good enough for most users, and Quicknet is committed to supporting such a driver.

Requirements

The device driver for the cards requires a 2.2-series kernel, because some of the low-level features take advantage of changes in the new kernel. The latest modules are compiled with MODVERSIONS support, so assuming your kernel is, the kernel will load the module if the symbol tables are compatible between the module and the kernel. At the time of this writing, we are using 2.2.10 kernels for development.

Our modules have a dedicated “major number” so they can be used with the normal module tools such as insmod and modprobe. All you have to do is add a few lines to your conf.modules file, and the normal modules tools work with our device driver. See below for more information on how to perform the initial configuration.

You will need at least one Internet PhoneJACK/LineJACK card on each end of the connection. Note that the initial release of the Linux driver supports only the Internet PhoneJACK card, though by the time you read this, the Internet LineJACK will be supported as well. These cards are ISA bus devices that use Plug-n-Play for configuration and use no IRQs. The driver will support up to 16 cards in any one system, of any mix between the two types.

Since the Quicknet cards are Plug-n-Play devices, you will need the isapnp tools package to configure the cards. This package probably came with your Linux distribution. Documentation is available on-line at metalab.unc.edu/LDP/HOWTO/Plug-and-Play-HOWTO.html.

Configuration

The Internet PhoneJACK has only one configuration register that requires 16 I/O ports. The Internet LineJACK card has two configuration registers. Isapnp reports that I/O 0 requires 16 I/O ports and I/O 1 requires 8. The Quicknet driver assumes these registers are configured to be contiguous, i.e., if I/O 0 is set to 0x340, then I/O 1 should be set to 0x350.

If you are new to the isapnp tools, you can jump-start yourself by doing the following:

  • Run pnpdump to get a blank isapnp.conf file

        pnpdump > /etc/isapnp.conf
  • Edit the /etc/isapnp.conf file to set the register I/O addresses.

  • If you have multiple Quicknet cards, make sure you do not have any overlaps. Be especially careful if you are mixing Internet PhoneJACK and Internet LineJACK cards in the same system.

Use of the Driver

To install and load the driver, perform the following:

  • Unpack the distribution file using tar.

  • Run the included ixj_dev_create script to create the device files in the /dev directory. This script will create /dev/ixj0 through ixj16.

  • Run the isapnp configuration utility to configure the cards properly.

  • Edit the /etc/conf.modules file to add a line that specifies the I/O (input/output) port(s) for the cards you just configured with isapnp, and a line to map the device number to the name of our device. You will need to add the following two lines:

        options ixj io=0x300 ixjdebug=a0
        alias char-major-159 ixj

This example assumes you have one card at I/O address 0x300; you will need to modify that value if you assigned card(s) to different ports.

  • Load the module with insmod or modprobe, as you would for any other module.

  • Verify the module loaded by running lsmod.

  • Execute an application that uses the module (tpjack or tpjackd).

Example Code

Sample applications are included with the driver to demonstrate its use. The following are some of the immediately useful ones:

intercom.c: demonstrates the driver's capability to pass audio between multiple cards without passing the audio data through user space. The application only has to indicate which cards will talk to each other—the driver does the rest.

inter2.c: the same concept as intercom.c, only it passes the data through user space. In this example, the application has to deal with reading and writing to the device files to pass data between cards.

tpjackd.c: this is the server side of a very basic IP Telephony application. It simply waits on a TCP port for an incoming connection. When received, the phone rings. When the phone is lifted, it starts passing UDP packets with audio data to the tpjack.c program.

tpjack.c: this is the client side, corresponding to tpjackd.c.

Test Applications

tpjackd is the daemon application which listens for an incoming call. To use it, type this:

tpjackd dev port

dev is the name of the device and is usually /dev/ixj0, although if multiple cards are in the system, it might be /dev/ixj1, etc. port is the name of the port on which the daemon will listen for an incoming ring.

The daemon application now runs as a true daemon. It disconnects from the controlling terminal upon startup and runs only in the background, logging messages to syslog. Typical use during development is watching the logging in an xterm window by using the command:

tail -f /var/log/messages

tpjack is the calling application and is used by typing the following:

tpjack dev host port
dev is the name of the device and is usually /dev/ixj0, although if multiple cards are in the system, it might be /dev/ixj1, etc. host is the name of the host running the daemon (name, not IP address). Note that the names of both hosts need to be resolvable, either by DNS or the local host's files. port is the port at which the daemon will listen for an incoming ring.

These sample programs provide an example of how to use the driver, and have the added advantage of actually working well over the Internet. The authors have used it to converse between San Francisco, California and (roughly) Dallas, Texas. The voice quality was not as good as expected using real-time protocols (RTP), but it was certainly good enough to have an intelligible conversation.

Known Limitations

Work is progressing rapidly on the driver, so check the web site often for new versions. By the time you read this, we should be in beta testing with full support for all the card's features.

The sample code is crude and does not follow any of the standards for Voice-over IP (H.323, SIP, etc.). Support for such protocols will come later, though probably not in source code form, due to other licensing restrictions. The purpose of the initial sample code is to provide a simple means of exercising the drivers and doing simple voice.

Currently, no software for Linux supports the use of any PC-to-Phone gateway service providers (such as Net2Phone). Of course, that will also change soon.

The Future

The sky is the limit for what can be done with these cards. With the availability of Linux drivers, we can craft all manner of servers to perform telephony functions—over the Internet and with or without the normal phone network. Some of the things we might soon see include VoIP PBXs, voice-mail services, and PC-to-PC and PC-to-Phone gateways. However, the most exciting applications for this technology have probably not even been imagined yet. This is a wide-open area that is begging for the Linux crowd to start putting out cool new applications. Quicknet Technologies wants to put the device drivers in place, along with some simple libraries, to facilitate this innovation.

More Information

Additional information is available on the Quicknet web site at http://www.quicknet.net/. A new mailing list has been started to provide developers with a forum for discussing the development and use of the device driver. To subscribe, send e-mail to majordomo@linux.quicknet.net; in the body of the message, type

subscribe linux -sdk your_email_address

After verifying your subscription, you can send mail to linux-sdk@linux.quicknet.net. If you have any problems with it, please send e-mail to linux@quicknet.net, and we will help you however we can.

Internet PhoneJACK and Internet LineJACK are registered trademarks of Quicknet Technologies, Inc.

Greg Herlein (gherlein@quicknet.net) co-authored the sample applications above and wrote the documentation for the release. He is a long-time Linux programmer who has crafted Linux solutions on the high seas, remote mountaintops and in corporate offices. He just recently joined Quicknet Technologies, Inc. as a Member of the Technical Staff, developing Voice-over IP solutions (especially for Linux).

Ed Okerson (eokerson@quicknet.net) is the author of the Quicknet device drivers and is also a long-time Linux guru. He's built out and run an ISP in Texas and continues to build innovative Linux-based networking, voice and video solutions. He recently joined Quicknet Technologies, Inc. as a Member of the Technical Staff.