Sie sind auf Seite 1von 10

http://www.asterisk.

org/applications/gateway

Gateways connect legacy phone equipment (PBXs, ACDs, voicemail systems, etc.) to modern
VoIP systems and services. Asterisk supports many different communications protocols from
both the modern world of VoIP and from the legacy PSTN. This makes it a powerful tool for
building gateways and protocol converters.

Below is a recipe for building a VoIP-to-PSTN gateway using Asterisk, an analog or digital
telephony interface card and a standard PC server. The steps are as follows:

1. Select your telephony interface hardware.


2. Select your computer hardware.
3. Install Asterisk
4. Configure your connections
5. Build your gateway dialplan

• Login or register to post comments

Voip Gateway

Submitted by cary113 on Fri, 03/12/2010 - 20:40.

I love Voip phone service. I use it to run my fish finders company. This is really cool because
my phone bills are virtually gone now. Thanks

• Login or register to post comments

hey

Submitted by raj7749 on Thu, 03/04/2010 - 08:46.


is it fesible to install asterisk on fedora core 12 unite....

• Login or register to post comments

we think the word ‘community’

Submitted by jinani7 on Thu, 03/04/2010 - 10:29.

we think the word ‘community’ better describes these cats. Calling them stray cats gives one the
impression that these cats don’t have a home and that they wander around -- but they do actually
have a home, which is the environment they live in! Some of these community cats have been
residents in the environment for much longer than some of the residents. pure term paper |
accounting assignment | annotated bibliography | assignments | computer programming
assignment

• Login or register to post comments

Step 1: Select Your Telephony


Hardware
Asterisk applications that connect with legacy telephony systems (PBXs
or the PSTN) require telephony interface hardware. Small system
generally use analog or ISDN BRI connections. Larger systems (more
than 12 lines) frequently use T1, E1 or J1 digital connections. If you're
new to telephony, check out the Asterisk telephony by clicking the "More"
link below.

Note that not every Asterisk implementation requires telephony hardware. Systems that are
connected only by VoIP connections communicate using the host computer's Ethernet port.

Connection Types

Analog connections are commonly used in small businesses and homes. Each analog connection
uses a single pair of copper wires. Asterisk connects with analog lines using an analog interface
card that converts the voice and signaling information into Asterisk's native digital format.

ISDN BRI connections are digital telephone lines that have replaced analog lines in some places.
BRI is very popular in Germany and is also common in businesses in the UK. BRI connections
can carry up to two conversations at the same time and support some advanced features not
available with analog connections. ISDN can use either a two-wire "U" interface or a four-wire
"S/T" interface.

T1, E1 and J1 are standards for high capacity telephony connections. T1 "trunks" or "spans" are
the standard in the United States. A T1 can carry as many as 24 simultaneous conversations. E1
is popular throughout much of the rest of the world. E1s are slightly higher bandwidth and can
carry up to 30 simultaneous calls. J1 trunks are essentially the Japanese version of the US T1
standard.

There are several different services offered over T1, E1 and J1 connections. The most popular
service type is ISDN PRI. PRI circuits use what is known as "out-of-band" signaling -- that is,
one of the 24 channels (T1) or two of the 32 channels (E1) is reserved for sending call
management messages.

T1/E1/J1 lines can also be used as data carriers for providing Internet or private data network
services using the HDLC protocol.

For more information on both BRI and PRI forms of ISDN, check out the Wikipedia article.

Interface Hardware

Asterisk connects with analog and digital telephony connections through either a gateway card
that is installed in the host computer (the computer running Asterisk) or through an external
gateway device. Internal gateway cards generally connect through the computer's internal
expansion bus. Cards are available in "PCI" and "PCI Express" (or PCIe) form factors. External
gateways connect with Asterisk over the local area network (LAN) or the PC's USB bus.

Internal gateway cards are the most common means of connecting Asterisk to the PSTN or to a
legacy telecom system. Cards typically fall into the same categories as telephony connections:
analog, ISDN-BRI, and T1/E1/J1 devices. (There are a few hybrid devices on the market that
support both analog and ISDN-BRI.)

Analog Cards

Analog cards are available in various capacities, ranging from a single port (which connects a
single analog telephone line and thus a single telephone call)
up to a maximum 24 ports.

Low density analog cards generally use the same kind of


connector as most home and small business phone devices:
the RJ-11 jack. Each jack on the back of the card takes a
single RJ-11 phone cable. The other end of the cable plugs
into a telco phone jack or an analog port on the legacy PBX.

Note in the image to the left that the card (an 8 port model
made by Digium) the red blocks to the right-hand side of the
card. These are daughter modules (small circuit cards that
attach to the main card) that determine the function of each of
the ports on the card. Analog ports can either connect to an
analog line from the telephone company using a port
connected to an "FXO" module, or can power and control an analog phone using an "FXS"
module.

Most analog card manufacturers build analog cards with interchangeable modules. By including
both FXO and FXS modules, a card can offer both FXO (line) and FXS (phone) capabilities.
This makes it simple to build an Asterisk-based application that can both connect to the PSTN
and control analog devices like fax machines, credit card terminals or TDDs.

High density analog cards often use an RJ-21 (or "amphenol")


connector and require an opposite gender RJ-21 connection from the
telco or PBX. Note the green modules on the card in the image to the left.
This 24 port card has been configured with three four-port FXS modules
(green) and three four-port FXO modules (red). This allows it to connect
12 analog devices and 12 analog phone lines.

FXS Ports In Analog Gateways

VoIP gateways built to connect legacy equipment (PBXs, key systems) with VoIP services
generally use FXS ports. FXS ports provide dial tone and line voltage to a phone, exactly like the
phone company's line does. This means that FXS ports can be connected to "line" or "trunk"
ports on the legacy system and can emulate telco analog lines.

FXO Ports In Analog Gateways

Using FXO (line) ports to connect analog PBX ports with VoIP phones or remote VoIP servers is
another common Asterisk gateway application. In this scenario, analog station ports on the PBX
are connected to FXO ports on the Asterisk gateway card. When the PBX sends a call to the
cross-connected analog station port, Asterisk forwards it as a VoIP call to the designated
endpoint.

The limitation of this arrangement is the one-extension/one-port nature of PBX analog stations.
The signaling capabilities of analog station ports are generally very limited. This means that the
port can only respond to calls to the single extension number with which it is associated. It
therefore cannot be used as a shared connection between the PBX and the Asterisk (and
whatever connects with the Asterisk).

Digital Cards

Digital cards allow Asterisk to connect with T1, E1 and J1 digital lines
(sometimes called "trunks"). Digital cards include one or more ports,
each of which connects to an individual digital circuit. Trunks are often
referred to as "spans", thus a single port card is a "single span" device,
while a four port card is a "quad span" device. Most digital cards connect
using RJ-45 jacks (the same kind of jack as is commonly used for
Ethernet connections). Connections between the card and a telephone
company T1 line are connected using a "straight-through" cable (exactly like the cables that
connect Ethernet ports). Connections between the card and a local PBX or other "CPE" device
require a "cross-over" cable or a straight-through cable with a cross-over adapter.

Digital spans can be configured to carry telephone calls in several formats. (Note that the RJ-45
format is the current standard in North America but that physical form factors vary depending on
region and telephone service provider.)
When selecting your PSTN interface device, be sure to find a model that supports hardware
echo cancellation. Phone lines and even short-distance tie line connections to legacy gear
frequently suffer from line and network echo. Hardware echo cancellation eliminates echo and
provides a significantly better caller experience.

[Hide]

Step 2: Select Your Computer Hardware


Asterisk can run on virtually any modern computer, but
when building a production telephony application server
you should follow a few basic best-practice guidelines.
Click the "More" link below to learn the basic
requirements for a solid Asterisk server.

Telephony systems are generally mission-critical


components and therefore need to be as reliable as possible. So while you can build an Asterisk
server using a Start with a reasonably powerful and reliable server-class system as your platform.
While not required, it's generally a good idea to use a system with redundancy features including
mirrored hard disk drives (RAID 1, 5 or 10) and dual power supplies.

Cooling is also an important issue. PSTN interface cards can add to the overall heat load of the
server. Failure to provide proper ventillation can cause stability issues and can lead to premature
failure of critical components.

CPU and memory requirements vary depending on the application. Small systems can be built on
embedded processors using only a few megabytes of memory. Large scale system that process
thousands of simultaneous calls require significantly more horsepower and memory. The safest
bet is to go with the most powerful CPU and the most memory that fits within your budget.

If your application calls for TDM hardware, be sure that your server includes the correct type of
card slot. Cards are available in PCI and PCI Express form factors and at a variety of voltages.
See the "Select Your Telephony Hardware" section for more information on the various
interconnect formats.

[Hide]
Step 3: Install Linux & Asterisk
Once you have your Asterisk hardware the next step is software. You will either need to install
Linux or use a ready-to-run distribution to install Linux, Asterisk and various related software
packages. Since these application tutorials are intended to help you create custom telephony
applications we will start with a generic installation of CentOS 5.3 and then install Asterisk from
the Yum repository. This make it relatively easy to keep Asterisk up to date and avoids the
complexities of hand compiling the Asterisk source code.

Download CentOS Linux 5.3


The first step is to download a copy of the CentOS 5.3 installation image. There are two
supported system architectures available, a 32-bit version of Linux and can run on either 32-bit
or 64-bit systems, and a 64-bit version that runs only on x86_64 hardware. If in doubt, download
the 32-bit version. Most CentOS mirrors offer the distribution as either 5 CD images or a single
DVD image. Either method works for the purposes of this tutorial. Use the CentOS 5 mirrors list
to select a mirror. Most mirrors host the CD images and a BitTorrent seed file for downloading
the DVD image. To download the DVD image use a BitTorrent client.

Download or copy the .iso image to a computer with a CD or DVD burner (writer). Keep in mind
that the images are roughly 700 MB each and the DVD image is over 3 GB.

Burn The CentOS .iso To CDs or DVD


Use your CD or DVD burner software to burn the ISO image to an actual CD. Note that if you
are installing on virtual machine you can generally use the ISO image without burning it to
physical media.

Install CentOS
To install CentOS Linux, insert the newly burned CD in the CD or DVD drive of the target
computer and boot. Be sure that your system is set to boot from the CD or DVD drive. (You can
either adjust the boot order in the system BIOS or use a one-time boot menu if your system
supports it.)

Full details of the CentOS installation are beyond the scope of this tutorial. Several excellent
quick-start tutorials can be found at Howto Forge, including this one. For more detailed
installation instructions you can also refer to the CentOS Installation Guide . In general it is safe
to select the default options throughout the installation process. Be sure to select a secure root
password when prompted. IP Telephony systems are a frequent target for hackers and
maintaining system security is extremely important.

Note that the installation of graphical environments (Gnome, KDE, etc.) is perfectly acceptable
on systems used for development or unit testing. When building production servers or systems
designed for load testing it is recommended that the graphical interfaces and subsystems (frame
buffers) be omitted.

Add Asterisk Yum Repositories


After the install is complete and your new CentOS Linux system is up and running, log in as the
root user with the password you set during the installation. (Note that you generally want to
avoid logging in as root. Create a non-privileged user account for day to day operations.)

Now, use the text editor of your choice to create a new file named "centos-asterisk.repo" in the
"/etc/yum.repos.d" folder. Add the following text to the file:

[asterisk-tested]
name=CentOS-$releasever - Asterisk - Tested
baseurl=http://packages.asterisk.org/centos/$releasever/tested/$basearch/
enabled=0
gpgcheck=0
#gpgkey=http://packages.asterisk.org/RPM-GPG-KEY-Digium

[asterisk-current]
name=CentOS-$releasever - Asterisk - Current
baseurl=http://packages.asterisk.org/centos/$releasever/current/$basearch/
enabled=1
gpgcheck=0
#gpgkey=http://packages.asterisk.org/RPM-GPG-KEY-Digium

Save the new file and create another named "centos-digium.repo" and insert the following text:

[digium-tested]
name=CentOS-$releasever - Digium - Tested
baseurl=http://packages.digium.com/centos/$releasever/tested/$basearch/
enabled=0
gpgcheck=0
#gpgkey=http://packages.digium.com/RPM-GPG-KEY-Digium

[digium-current]
name=CentOS-$releasever - Digium - Current
baseurl=http://packages.digium.com/centos/$releasever/current/$basearch/
enabled=1
gpgcheck=0
#gpgkey=http://packages.digium.com/RPM-GPG-KEY-Digium

Now you should be ready to install Asterisk. To start the installation, open a terminal window
and type the following:

[root@localhost~]# yum install asterisk16 asterisk16-configs asterisk16-


voicemail dahdi-linux dahdi-tools libpri

The system will connect with the Asterisk and Digium yum servers, download the necessary
packages for Asterisk 1.6 and install them. For a detailed view of sample output from the install
see the Yum installation page.
When the installation is complete, reboot your system to activate Asterisk and DAHDi. By
default DAHDi will start automatically. To enable auto-start of Asterisk, run the following
command:

[root@localhost~]# chkconfig asterisk on

To manually start Asterisk you can use the following:

[root@localhost~]# service asterisk start

To stop Asterisk, execute:

[root@localhost~]# service asterisk stop

Test Your Asterisk Installation


Once the Asterisk service is started you should be able to access the Asterisk command line
interface from the Linux command line as follows:

[root@localhost~]# asterisk -r

The system should respond with something similar to:

Asterisk 1.6.0.15, Copyright (C) 1999 - 2009 Digium, Inc. and others.
Created by Mark Spencer
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for
details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it
under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 1.6.0.15 currently running on localhost (pid = 3052)
Verbosity is at least 3
localhost*CLI>

Congratulations, you now have Asterisk installed and running. To exit from the Asterisk CLI,
simply type 'exit'.

[Hide]

Step 4: Configure Connections


Now that Asterisk is installed and running you need to edit the system configuration files to
implement connections to VoIP and PSTN services. Since this step is common to all applications
(Asterisk doesn't do much good if it is not connected to anything) it contains information on
creating both service connections (connections to VoIP or PSTN services) and endpoint
connections (connections to phones or terminal adapters). Some applications require both service
and endpoint connections (PBX, ACD) while others may require only service connections.

DAHDi Connections

DAHDi is the "Digium Asterisk Hardware Device Interface" project and is the standard means
for connecting Asterisk with PSTN interface cards. If your application doesn't require PSTN
connections (i.e. your solution is VoIP-only) you can skip to the VoIP Connections section.

To configure your DAHDi interfaces, be sure that your cards are installed and properly
connected to the computer. If you are using analog cards with FXS (station) ports, remember to
connect one of the power connectors from the PC's power supply with the molex coupler on the
edge of the card. FXS draws more power than the PCI and PCI Express buses can provide, so the
connection is mandatory. Analog with FXO (line) interfaces only don't need the power
connection.

To configure the cards you need to edit two files. This can be done using any standard text editor
(emacs, vi, vim, gedit, kedit, etc.). Note that you will need to be logged in as the root user to edit
these files (or use the sudo command if your Linux distribution uses sudo instead of direct root
access). The first file is the /etc/dahdi/system.conf file. This file configures the parameters for the
low-level card drivers. There are only a few options that need to be set in this file. Below are
configurations for both a system with one digital card (in T1 mode):

# Autogenerated by /usr/sbin/dahdi_genconf on Wed Sep 23 08:25:39 2009


# If you edit this file and execute /usr/sbin/dahdi_genconf again,
# your manual changes will be LOST.
# Dahdi Configuration File
#
# This file is parsed by the Dahdi Configurator, dahdi_cfg
#
# Span 1: TE2/0/1 "T2XXP (PCI) Card 0 Span 1" (MASTER)
span=1,1,0,esf,b8zs
# termtype: te
bchan=1-23
dchan=24
echocanceller=mg2,1-23

# Span 2: TE2/0/2 "T2XXP (PCI) Card 0 Span 2"


span=2,2,0,esf,b8zs
# termtype: te
bchan=25-47
dchan=48
echocanceller=mg2,25-47

# Global data

loadzone = us
defaultzone = us

VoIP Connections
Over the next few days we will be filling in the remainder of these tutorials. Sorry for any
inconvenience. Please check back soon.

Hide

Step 5: Build Your Gateway Dialplan


More info here...

Das könnte Ihnen auch gefallen