Asterisk Integrated Services Digital Network

Asterisk

Integrated Services Digital Network

ISDN is a twisted-pair, digital multiplexing standard for PSTN and data applications. Although used widely around the world, it is not well known in North America. For most data applications, ISDN has been displaced by ADSL, coaxial cable, and FTTH (fiber-to-the-home) technologies, which offer much larger bandwidth at competitive rates. It remains in use for voice and video applications. We’ll look at those here.

ISDN itself is a giant topic, and because it is an older technology, it is well covered in other texts. Do not expect much depth here. We discuss ISDN only in the context of its relevance to Asterisk.

ISDN Basics

An ISDN connection provides two basic channel types: B and D. (More specialized channel types exist but are not in wide use, and are not covered here.) A single B (bearer) channel can be equated, roughly, with a single analog telephone line: You can carry on one conversation on that channel. Where it differs is that a single physical line pair can carry multiple B channels, making better use of the existing wiring. The data is transported in digital and not analog format, which means you can’t connect an analog telephone to the line and expect to hear anything. The digital transport usually delivers better sound quality when everything is properly configured.

The D (data) channel carries signaling information about the B channels on the circuit.

The differences between the B and D channels are as follows:

    • The B channel is, for our purposes, a voice channel. (In a non-Asterisk installation, it could carry data.) A B channel provides 64kbps of bandwidth.
    • The D channel is data only, but is dedicated for signaling purposes. Depending on the interface type, the D channel can be 16kbps or 64kbps. The ISDN device—be it a telephone, PBX, or interface card—uses the D channel for call setup and teardown.

The following sections cover the two major types of ISDN connection: the basic rate interface and primary rate interface.

ISDN Basic Rate Interface

The entry-level ISDN service is called basic rate interface, or BRI, and is used in homes (in the world outside of North America) and small businesses. It provides two 64kbps B channels and one 16kbps D channel (which is why some refer to it as 2B+D) over a single line pair (two wires). You can attach ISDN phones, BRI ports on PBX devices, ISDN-BRI terminal adapters (which provide FXS ports for analog telephones), or ISDN-BRI adapter cards to a BRI.

To install and use BRI, you need to know what signaling type the carrier expects. There are two types:

    • 2B1Q

This (2 binary, 1 quaternary) is the signaling type used in North America. It is a linear coding type that supports a loop length of up to 5,500 meters (about 18,000 feet).

    • 4B3T

This (4 binary, 3 ternary) is the signaling type used in the rest of the world, including Europe. It is a block coding type that supports a loop length of up to 4,200 meters (about 13,700 feet).

BRI in the United States

ISDN never really caught on at the subscriber level in North America. Although there are many opinions why, the most common explanation given is that the size of the existing network made implementing ISDN to the suburbs prohibitively expensive. In North America, average loop lengths are much longer when compared to Europe, where ISDN circuits now make up more than 80% of installations.

Still, sometimes BRI makes sense, and in most jurisdictions it is a tariffed service, which means that some carrier (usually the incumbent telephone company) must provide it if it is technically feasible. Here are some reasons why you might consider BRI:

    • You are faxing and your analog lines are poor quality.

Faxing does not work well over IP, Analog is an option, but if your analog lines are noisy, you should consider BRI.

    • You need the sound quality and call-signaling features that only ISDN provides, but don’t need enough channels to justify PRI.

Features such as Explicit Call Transfer, DNIS (Dialed Number Identification Service), and COLP (COnnected Line identification Presentation) are ISDN services that can’t easily be replicated on analog lines. If you need these but don’t need more than six to ten channels, BRI is a real option. One thing is beyond dispute: In the circuit-switched, PSTN world, ISDN offers unparalleled sound quality.

Of course, the economics will vary depending on your location and the carrier. Be warned that most carriers that offer BRI don’t actively market it, so you may face challenges in getting anyone in the sales department to acknowledge that the service exists.

ISDN Primary Rate Interface

You can think of the PRI as the bigger, flashier brother of the BRI. In North America, PRI is provided over a T1 (23 B channels, 1 64kbps D channel) with 2 or 3 pairs (4 or 6 wires); in Europe, the E1 (30 B channels, 1 64kbps D channel). Again, you can only connect ISDN devices to a PRI circuit. Examples include the PRI interface on a PBX, a channel bank (which provides FXS ports for analog telephones), or an ISDN-PRI interface card. The PRI is intended for larger installations.

Nothing says a PRI must use all 24 channels. Some carriers provide partial PRI service (usually ten channels), sometimes at considerable cost savings.

PRI always implies ISDN. PRI service is supplied via a T1, but not all T1 circuits are PRI. Non-ISDN T1 circuits (also called in-band T1) can still be found in North America. In such circuits, call setup and teardown signaling is sent in the channel (CAS, or channel associated signaling) instead of via a separate D channel. This steals some bandwidth from each channel but makes all 24 channels available.

For voice applications, PRI is on its way to replacing non-PRI T1 connections completely. Its broad support and extremely fast signaling make it the easy choice.

Choosing an ISDN Card

This is a difficult question, and the answer depends on your specific circumstances and requirements. Here are some things you need to consider:

    • A card that’s excellent today may be mediocre tomorrow, particularly when compared with newer product in the marketplace.
    • Card performance can depend heavily on the driver software, which can change over time.
    • Support quality is subjective.
    • Performance requirements will depend on the intended use. Some products that would not be a good choice for the business market may be perfectly acceptable for the residential market.

Actually using an ISDN card in an Asterisk server is really quite simple, even if installation and configuration aren’t always trivial. There are a few different ways to get an ISDN card running with Asterisk. We touch on a few variations below.

Important

All the installation examples in this book use a Debian Linux system. The installation procedure will differ on other Linux systems and may not work at all on BSD systems. If you are starting out, we recommend you follow the instructions completely and begin with a fresh Debian installation.

Determining Your Quality Needs

Most private Asterisk users are not hung up on sound quality and availability. Cost is likely the primary consideration here. If you aren’t planning to fax over the card, and you only need two B channels, any generic HFC-based BRI card will do. The cards are cheap and widely available. You’ve been warned, however: Installation can be challenging with these cards, and you shouldn’t expect amazing sound quality. If you can live with these limitations, this is a real option.

For business systems, the bar rises substantially. If you are replacing an older system you must at least match it in quality, unless you like doing battle with users and clients. If you value your career in this business, you’d best steer clear of generic cards.

Hardware Echo

Sadly, the echo problem remains. Any professional system connected to the outside world must have the highest-quality echo cancellation available, and this is generally achieved through a hardware echo canceler integrated into the card itself. The advantage over software echo cancellation is clear: The performance of hardware echo cancelers is historically better, and they don’t need to steal CPU cycles to achieve it.

Because echo cancellation is not easy to do well, these modules are accordingly more expensive. Nevertheless, in business applications, hardware echo cancellation is not negotiable for any system you intend to connect to the PSTN. Cards providing PRI to internal servers can get away without it because echo in local trunks is rare, but if you’re buying a card anyway, spend the extra money. You never know how you might need to use the card in the future.

Tail length is a performance parameter to consider when evaluating hardware echo cancelers. It determines the length of the reference sample when calculating echo cancellation. The rule of thumb is that the longer the tail length, the better the echo cancellation. In practice, it’s difficult to hear a difference beyond 128 milliseconds.

Server Load and Interrupts

In the early years of Asterisk, there was no affordable echo cancellation, so Mark Spencer and others wrote software to perform the cancellation. This necessitated breaking the in- and outbound audio streams into 1ms chunks. For this reason, all the standard ISDN cards in use today set interrupts at 1ms intervals for each B channel.

This historical artifact can lead to problems in some applications. You probably won’t notice this if you use a single PRI or BRI connected to modern server hardware. If you’re using a compact, embedded system, however, even a simple BRI with two B channels can cause problems under load. If you have a large system with multiple PRIs and interface cards, similar problems can occur. Enough interrupts can bring the most powerful system to its knees.

If you are faced with either of these circumstances, you have these options:

    • Find out how much a single system can handle and cluster them.
    • Install an ISDN-SIP gateway. These are black-box systems with an ISDN interface on one side and a SIP interface on the other, which connects to your Asterisk server. Be careful, though: Some of these systems are just Asterisk boxes themselves! You want real, dedicated translation.
    • Buy an ISDN card that solves the interrupt problem at the driver level. For example, Sangoma produced a special driver for its cards that sets an interrupt at 10ms intervals on a by-port, rather than by-B-channel, basis.
Internal Analog Fax Devices

If you’re connected to the PSTN via an ISDN connection but still use analog fax devices internally, you might run into another timing problem, particularly with long faxes. This is caused by different clock timings on the audio channels. The ISDN cards use the PSTN for their clock source; the analog interface cards use their own, usually internal (and often cheap and unstable) clock source. The result is a clock differential that is managed using a buffer. After two pages (on average), the buffer empties, and you lose a bit of audio, often enough to overwhelm the fax error correction. The result is usually a black line or gap in the fax image. In the best case, nothing is visible; in the worst case, the transmission ends prematurely.

Here are some things you can do to address faxing problems:

    • If you can do without a fax machine, going to software faxing on the server is a cost-effective alternative.
    • An ISDN terminal adapter attached to the same ISDN card as the incoming service will also solve the problem. If you attach the device to a different ISDN card in the same machine, you need to verify that the cards will operate in sync.
    • Cards from some manufacturers can be synced to each other via an internal cable that provides the clock signal from the ISDN card to the analog card.
Manufacturers and Drivers

There seem to be as many ISDN card manufacturers as people with an opinion about them. The products described here are a subjective selection, but have been chosen because they are used widely. Further exploration of the subject could fill another book.

Important

Hardware and driver information provided here was current at the time of printing. Check this book’s website (www.the-asterisk-book.com), where we will post updates.

Digium

As the parent company and home of Asterisk, Digium (www.digium.com) has offered digital interface cards for several years now. (The early cards were analog only.) The advantage for the Digium cards is obvious: You always have drivers updated for the most current Asterisk release. In the past, these drivers have been middling in quality and there have been problems. With the new DAHDI driver generation, Digium is promising better performance.

Sangoma

Sangoma (www.sangoma.com) is a popular alternative manufacturer in North America, and was, until recently, purely a hardware company. They make both analog and ISDN interface cards and have a reputation for good technical support.

Open source purists may take exception to Sangoma’s use of a binary-only ISDN stack (for BRI). Sangoma’s response is that the commercial stack is certified for ISDN and has demonstrably fewer issues than the open source mISDN stack.

Generic HFC-Based BRI Cards

These cards have been sold in Europe for many years now, usually at bargain-basement prices. Support is rarely if ever provided, and at $100 to $150, it can hardly be expected. They are almost always used with mISDN.

Media Gateways

Just as you might use an ATA in place of an analog interface card for regular phones, you could use a “media gateway” for ISDN connections. This gateway converts an ISDN connection into one or more SIP accounts and vice versa. These are usually “black box” solutions, which are configured via a web GUI or over SSH.

Purely analog media gateways are simply ATAs (analog telephone adapters).

Advantages

One major advantage is that a media gateway is often easier to configure than an interface card. You don’t have to open up the server and install the card, either. Configuring Asterisk is simpler because you only have to configure SIP. Finally, you don’t have to run telephone lines of any kind to the server; you install the gateway device in the wire room, connect it to the network patch panel, and put the server anywhere on the network that is practical.

Disadvantages

Media gateways are generally sold on price and not on the quality of installed components, so manufacturers are tempted to use lower-quality interface cards, which can be problematic. Asterisk works best when using the ISDN clock; the clock signal is very stable, and a stable clock signal is vital, especially for conferencing. A media gateway does not pass this signal over Ethernet; the Asterisk server must rely on the system clock, which will vary in stability. Updating a media gateway is also more difficult, if it’s possible at all.

Whether one should choose an interface card or a media gateway is a regular topic of discussion in the Asterisk community. Both sides make good arguments, and you can run a successful system with either. What is best for you depends on the circumstances. If you need stable clock (you are conferencing or you have existing ISDN cards in your system), you’ll need an ISDN card. If you have physical access problems, or you need to maximize the simplicity of the system, go with a media gateway.