Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

{{Box Important|This page was written in 2005 and is a bit out of date. Most of the reasons why you would want to interconnect sipX with Asterisk have gone away as sipX has not only caught up in terms of supported features, but in more and more areas has taken the lead, is more robust and easier to use. We expect therefore that this page will be deleted early 2007 after we finish sipX release 3.8.|}} -Still here as of Oct. 2014. 

 

Another thing to note that as of Asterisk version 1.6 the refer method for transferring calls is not supported in sipX. Please refer to Asterisk documentation regarding SIP Refer method used by Asterisk. An untested work around since transfers worked in Asterisk version 1.4 is to use the option in sip.conf called pedantic, which will either make Asterisk pay more attention to SIP "call-IDs", "to", and "from" or just "call-IDs" alone. 

pedantic = yes|no : Enable slow, pedantic checking of Call-ID:s, multiline SIP headers and URI-encoded headers. Default no (in Asterisk 1.8 default yes)

 

Basically, you can think of the pedantic setting as being one that is important
to SIP purists or those who do make use of more advanced/less used nuances of
the SIP protocol.

 

For instance, RFC 3261 plainly spells out that the way to identify whether an
incoming message belongs to a specific dialog is to check the call-id, to tag,
and from tag. With pedantic mode disabled, all we look at is the call-id because
in the majority of situations, the call-id is suitable for identifying which
dialog the request belongs to. However, if you know that tag checking is
important, then it will be enabled by turning on pedantic mode.

 

There are other RFC-mandated operations which will only occur if pedantic mode
is enabled. Typically, the reason why we restrict these operations to when
pedantic mode is enabled is because it is a lot easier/more efficient not to
perform the operations and because in most cases things work fine without
performing the operations.

 

Mark Michelson


Introduction - Interconnecting sipXecs IP PBX with the Asterisk PBX

There are many reasons for interconnecting sipXecs with Asterisk. This Wiki explores some of them giving you detailed instructions of how to get to a combined system that works. Intentionally the use cases described here are as simple as possible. There are many more things you could do; however, the instructions that follow will get you to a working system combining sipXecs IP PBX with Asterisk. It allows you to explore advantages and disadvantages of both system and is meant to educate and amuse.

Why interconnect sipX with Asterisk ?

The sipX system is the next generation IP PBX - a comprehensive Enterprise Communications server fully standards based, extendable, and interoperable. One of the project's major design goals is ease of installation and use. If you already have an Asterisk PBX installed, you might want to consider adding the sipX SIP server for the following advantages:

*A native SIP proxy: Asterisk is not a SIP proxy but a Back-to-back User Agent (B2BUA). The sipX system allows you to add a standards compliant SIP server that supports a large number of business telephony features implemented according to the latest IETF RFCs and draft RFCs.

*Web-based plug & play system management: Is easy of use a priority or yours? The sipX Configuration Server provides comprehensive management of the entire system including all server components as well as phones and gateways. Users and devices are easily created and administered; users are assigned to devices; dial plans are created and maintained; and system diagnostics, backup and recovery are all performed using the sipX Configuration Server Web interface.

*Comprehensive support for phones and gateways: In its current release sipX supports plug & play management for Polycom, Snom, Cisco, and Grandstream phones as well as for Audiocodes gateways. This means that the sipX Configuration server provides a comprehensive and unified management interface for all the phone's capabilities. We aim at supporting all the phone's features including advanced calling features, presence, and call state notifications. A simple plug-in framework allows you to easily add additional phones or gateways.

*Distributed system architecture: Want to learn more about how a SIP system works? The sipX server solution provides a great way to learn more about how to build an advanced SIP standards compliant system. Interested in dialog event packages, subscribe / notify, NAT traversal, SIP security, and other advanced SIP functionality? The sipX system got it all.

*Documentation: Need documentation for your system? The sipX community provides comprehensive documentation both from a user perspective as well as for developers.

*Interested in participating in a great effort? Follow the sipX core developers and learn about best industry practices in terms of coding standards, use of modern languages such as C++, Java, and XML, automated build environments based on auto-tools and ant, unit test frameworks for automated regression testing, embedded documentation using doxygen, Web technologies and application middleware, as well as Web services technologies such as SOAP and XML RPC.

Use Cases considered

The following use cases shall be considered and will be described below. They intentionally are kept as simple as possible:

*Use Case 1: Interconnect Asterisk and sipX as two independent PBX systems with an integrated dial plan
*Use Case 2: Substitute SER with sipX as a SIP proxy front-end to Asterisk
*Use Case 3: Use Asterisk as a conferencing server for sipX (the sipX Conferencing Server will become available in release 3.1/3.2 as a stand-alone server managed by the sipX Configuration Server)
*Use Case 4: Use Asterisk as a PSTN gateway

For production installations it shall be recommended to use two different systems for Asterisk and sipX. By using different ports for SIP signaling it is possible to run both applications on the same machine. However, don't expect great performance from either in this case.

Installing sipX and Asterisk on Fedora Core

Two independent servers were chosen as the test setup. The Asterisk server runs Fedora Core 2 while the sipX server runs Fedora Core 3. The following represents detailed instructions of getting both systems to work as intended.

Installing sipX 3.0 on Fedora Core 3

First, install sipX on FC3.

Installing Asterisk on Fedora Core 3

Install Fedora Core 3 on an empty system

Install Fedora Core (minimum system, no X server) following the instructions provided by Red Hat.

Insert boot CD and restart your system
Choose "Text Mode" by typing 'linux text' at the boot prompt
Chose "Custom" among the options "Personal Desktop", "Workstation", "Server", "Custom"
Choose a fixed IP address if possible (specify IP address, netmask, and gateway)
Define a hostname manually (we use asterisk here)
Choose "No Firewall"
Remove ALL packages from the screen that allows you to custom select packages
Let the installation finish

Assuming your Internet connection is up and working after the install, proceed as follows:

Optional: Update FC3 Installation to the latest patch level:
{{Box Code|Update FC3 System|

yum update
answer "y"

}}

Add additional packages required to build Asterisk from source:
{{Box Code|Install additional required packages|

yum install cvs
yum install gcc
yum install bison
yum install openssl-devel

}}

Define proper domainname in /etc/hosts. Add the following line:

ip.addr.of.host asterisk.your.domain asterisk

Compile Asterisk from Source

There are binaries available for Asterisk from a variety of sources; however, the most reliable approach in our experience is to compile it from source. The following commands check out the latest stable version of both Asterisk and the zaptel drivers from the cvs repository at Digium. In this example we assume that there is no hardware card from Digium present in the system and therefore applications like Meetme have to rely on the dummy driver ztdummy to derive timing from the USB circuit.

Note: Is is not quite clear why a system like Asterisk would have to rely on an external timing source such as a clock circuit on a Digium gateway card for best performance. It would be fairly simple to design the media framework in a way that it runs as a software application without relying on external clocks (unless it is your objective to sell gateway cards).
{{Box Code|Checkout Source code for Asterisk, libpri and zaptel|

cd /usr/src
export

CVSROOT=:pserver:anoncvs@cvs.digium.com:/usr/cvsroot

cvs login

<--- This command will prompt for a password, use "anoncvs"

Current stable release:

cvs checkout -r v1-0_stable zaptel libpri asterisk

CVS Head of the current release:

cvs checkout -r v1-0 zaptel libpri asterisk

}}
Note: You can browse the Asterisk CVS repository.

Note: There are no other dependencies. Asterisk is pretty much a self-contained appliation.

The default configuration provided assumes that you have a Digium card which will serve as the required timing source. If you do not have such a card and would like to use the dummy driver ztdummy instead, please uncomment ztdummy from the following line in the Makefile.
{{Box File|/usr/src/zaptel/Makefile|

#Remove the hash (#) character in the line below (before the word ztdummy at the end of the line)

MODULES=zaptel tor2 torisa wcusb wcfxo wcfxs \{noformat}
 

ztdynamic ztd-eth wct1xxp wct4xxp # ztdummy

 

}}
The following set of commands compiles and installs both the zaptel drivers as well as Asterisk for a 2.6 Linux kernel (Fedora Core 3).
{{Box Code|Compile zaptel, libpri and Asterisk|

cd /usr/src/zaptel
make clean
make linux26
make install

cd /usr/src/libpri

make clean
make
make install

cd /usr/src/asterisk

make clean
make
make install

modprobe zaptel

modprobe ztdummy

}}

Asterisk Configuration Files

There are lots of configuration files that can be used with Asterisk. In this example we only use the minimum set of configuration files and parameters required to start Asterisk and accomplish the use cases as defined above. Please refer to the Asterisk documentation for more advanced configurations or different applications. Necessary modifications to these sample configuration files are described below.
{{Box Code|Install required configuration files|

mkdir /etc/asterisk
cd /usr/src/asterisk/configs/
cp ./modem.conf.sample /etc/asterisk/modem.conf
cp ./modules.conf.sample /etc/asterisk/modules.conf
cp ./phone.conf.sample /etc/asterisk/phone.conf
cp ./voicemail.conf.sample /etc/asterisk/voicemail.conf
cp ./zapata.conf.sample /etc/asterisk/zapata.conf
cp ./sip.conf.sample /etc/asterisk/sip.conf
cp ./extensions.conf.sample /etc/asterisk/extensions.conf

}}
{{Box Code|Start Asterisk|

/usr/sbin/asterisk -cvvv

}}

Note: This is a console interface, so that you will end up with a lot of comments printed on your screen, a couple of errors for config files that are not found (that's ok), and a command prompt at the end.

Connecting Phones

Configuring phones to be used with sipX

The sipX configuration server allows fully automated remote management of supported phones and gateways using a Web UI or SOAP access (Simple Object Access Protocol, part of Web Services).

A growing number of phones is plug & play managed by the sipX Configuration Server, such as Polycom SIP phones, Snom phones, Grandstream phones, as well as Cisco 79xx SIP phones.

In addition the Xten eyeBeam softphone provides some very interesting presence and call state capabilities in conjunction with Polycom phones.

Every SIP phone can be used with the sipX system. Additional phones are being added to the plug & play management capability and if you would like to have a particular phone supported, please have a look at the sipX config server project at SIPfoundry or the developer documentation about Adding support for managed phones.

Configuring sipXphone to register with Asterisk

In this particular example we used sipXphone to connect to Asterisk as this is a configuration not that often described. sipXphone is a solid SIP softphone licensed under the LGPL open source license and downloadable from SIPfoundry. sipXphone is documented on the sipX Wiki. sipXphone has a phone like skin.

We also made tests using sipXezPhone, a new SIP softphone based on the sipXtapi user agent software development kit (SDK) and also licensed under the LGPL open source license from SIPfoundry.

Additional information about sipXphone and its configuration is available from the sipX Wiki. Configuring sipXphone to register with Asterisk requires manual configuration using sipXphone's Web UI configuration screens.

Required Parameters for the SIP phone with the extension "320":

Administration / Phone Configuration / SIP Servers:
Call Addressing: Dialplan length: 3
SIP Directory Server: <ip.addr.of.Asterisk.server or FQDN>

Preferences / Lines:

Device Line:
SIP URL: sip:320@asterisk.your.domain
Registration: Register
Authentication Credentials:
Realm: asterisk
User ID: 320
Password: <secret defined in sip.conf>

Configuration Examples

For all the different use cases, the following general settings were used:

1. DNS Configuration

Two independent hosts are used:

host 1: sipx.your.domain
host 2: asterisk.your.domain

DNS entries (A records) are defined for both hosts. DNS resource records (DNS SRV) for SIP for your.domain point at the sipX host:
{{Box File|DNS Records|

sipx A ip.add.re.ss
asterisk A ip.add.re.ss

_sip._udp IN SRV 100 1 5060 sipx
_sip._tcp IN SRV 200 1 5060 sipx

Test DNS setup:

dig -t SRV _sip._tcp.your.domain
dig -t SRV _sip._udp.your.domain

}}

2. Asterisk General Configuration

Two SIP phones will be registered with Asterisk. Assigned numbers are "320" and "321", respectively.

{{Box File|sip.conf|

general

port      = 5060     ;Asterisk uses port 5060 for SIP signalling
srvlookup = no       ;Disable DNS SRV lookups
context   = internal ;Default context for incoming calls

320

type = friend
secret = password
username = 320
host = dynamic      ; phone uses DHCP
dtmfmode = rfc2833  ; sipx likes that

321

type = friend
secret = password
username = 321
host = dynamic      ; phone uses DHCP
dtmfmode = rfc2833  ; sipx likes that

}}

3. sipX General Configuration

Asterisk is defined as an unmanaged gateway in sipX. This allows the creation of a custom dialing rule to forward calls to Asterisk similarly to calls that are forwarded to any other gateway:
<center>

</center>

The dial plan is extended by an additional entry for a new rule to forward 3XX extensions to the gateway defined as Asterisk:
<center>

</center>

Configuration of the new dial plan rule for Asterisk:
<center>

</center>

Use Case 1: Interconnect Asterisk and sipX as two independent PBX systems with an integrated dial plan

1. Dial Plan

The following dial plan was chosen for this setup:

Extensions Comments
2xx Extensions reachable through sipX
3xx Extensions reachable through Asterisk
100 Extension for the auto-attendant (on sipX)
101 Extension for the voice mail system (on sipX)

2. Asterisk Configuration Files

{{Box File|extensions.conf|

general

static=yes
writeprotect=yes

;
#All calls sent from sipX to Asterisk need to have an extension configured:
#After a 20 second timeout, the call is sent back to sipX voicemail
;
internal

exten => 320,1,Dial(Sip/320,20)
exten => 320,2,Dial(Sip/2320@asterisk.your.domain,20,t)
exten => 320,3,Hangup()

;

exten => 321,1,Dial(Sip/321,20)
exten => 321,2,Dial(Sip/2321@asterisk.your.domain,20,t)
exten => 321,3,Hangup()

#To transfer the call from Asterisk to sipX, the dialplan was setup as follows:

  1. 2XX calls the SIP extension of the domain directly (using DNS SRV call goes to sipX)
  2. 100 calls the auto-attendant on sipX
  3. 101 calls directly into sipX voicemail
    ;
    outgoing

    exten => _2XX,1,Dial(Sip/${EXTEN}@your.domain,30,t)
    exten => 100,1,Dial(Sip/${EXTEN}@your.domain,30,t)
    exten => 101,1,Dial(Sip/${EXTEN}@your.domain,30,t)
    exten => t,1,Hangup()

default

include => internal
include => outgoing

}}

These settings mean that if a 2xx extension is dialed from an Asterisk phone, a SIP call is placed to 2xx@your.domain. The parameter '1' means priority 1; the parameter '30' means to have the call time out after 30 seconds and the parameter 't' means allow transfer. Timeouts have to be set carefully in order to allow for the appropriate time for the call to roll over to voice mail if not picked up. The last command assures that a call is terminated after a timeout.

Use Case 2: Substitute SER with sipX as a SIP proxy front-end to Asterisk

SER and Asterisk have been a good combination in many cases already as is documented in a variety of places. This example shows how SER can be substituted for sipX. Primary objective is not to replace SER as a highly scalable SIP proxy, but to use sipX's additional capability of remotely managing SIP phones and gateways using the sipX Configuration Server.

Use Case 3: Use Asterisk as a conferencing server for sipX

The following sets up three extensions for conferencing: 500, 501, and 502. The pin code for each is '12345'. No special features, such as music on hold are used here.
{{Box File|meetme.conf|

rooms
;

; Usage is conf => confno[,pin]

;

conf => 500,12345
conf => 501,12345
conf => 502,12345

}}
{{Box File|extensions.conf|

conference

exten => 500,1,Meetme(500|M)
exten => 501,1,Meetme(501|M)
exten => 502,1,Meetme(502|M)

;
default

include => conference

}}

Use Case 4: Use Asterisk as a PSTN gateway

The following illustrates how to use Asterisk to connect to FWD for SIP trunking services. The configuration is derived from the Asterisk Wiki. In order for this to work a whole needs to be punched into the NAT/Firewall making the Asterisk host an 'exposed host'. This is quite a hack and we are still trying to find out how the FWD STUN server could be used with Asterisk. Comments welcome.

{{Box File|/etc/asterisk/sip.conf|

general

externip=extern.ip.addr
localnet=intern.ip.0
localmask=255.255.255.0

;

register => fwd-number:secret@fwd.pulver.com/fwd-number

fwd

type=friend
secret=secret
username=fwd-number
fromuser=fwd-number
fromdomain=fwd.pulver.com
host=fwd.pulver.com
dtmfmode=inband
nat=yes
canreinvite=no

}}

{{Box File|/etc/asterisk/extensions.conf|

fwd-out

exten => _8.,1,SetCallerID(fwd-number)
exten => _8.,2,SetCIDName(Your Name)
exten => _8.,3,Dial(Sip/${EXTEN:1}@fwd,70)
exten => _8.,4,Macro(fastbusy)
exten => _8.,5,Hangup()

;
default

include=fwd-out

}}

  • No labels