A more complete example

Extended example


Asterisk IAX - a Newbies Struggle Produces a How-To
IRC: Hubguru@irc.freenode.net/room:#Asterisk
E-mail: Jr.richardson@cox.net

Overview

Intrigued by the proposition of an Open Source PBX, I
jumped into Asterisk waters with a summersault. I have
years of experience in telecommunications, transport
(layer 1, 2&3), PSTN, Routers, Switches, OSS, ATM, TDM,
TCP/IP, etc. This was certainly to be an asset in getting
a working system up and running in no-time. That notion
couldnt have been farther from the truth. All of my
pre-conceptions of how I thought this system actually
works were used against me in my own mind. The sparse and
emergent documentation was not in a format I was used to
seeing and therefore made little sense when bringing
together the concepts of the dial plan or IAX setup. I
finally managed to get 2 *s up and running with an IAX
connection and successfully completed 4-digit call
connections between them. This only after hours of trial
and error, reading and re-reading documentation, searching
wiki pages http://voip-info.org/wiki-Asterisk and conversing
with friendly IRC users: kram, blitzrage & jtodd (thanks guys).

Scope

The scope of this document is to provide my own interpretation
of setting up a dial plan to route calls between 2 *s servers
with a 4 digit dial scheme. Included will be example configurations
files sip.conf, iax.conf and extentions.conf from each Asterisk
server and some explanatory notes within the pertinent context.
This document is supplementary to existing documents. Other
documentation referenced is a must-read.

Test Setup

Hardware:
2 Dell GXas, Pentium III 600, 256 Meg Ram, on-board video,
sound, NIC. Not using any Zaptel/Digium cards at this time.
1 Cisco 7960 w/SIP ver 4.4 image
1 Cisco ATA-186 w/ver 2.16 image

Software:
Sjphone and X-Lite softphones, Redhat Linux 9, Asterisk
(downloaded current version mid June 03)


The 2 computers are loaded with Linux and Asterisk using the
following how-to:
http://www.automated.it/guidetoasterisk.htm (Andy Powell)

Both computers/servers were on the same LAN segment with a
flat IP scheme.
Server 1 name Asterisk, IP Address 192.168.1.30
Server 2 name Asterisk2, IP Address 192.168.1.31

2 X-Lite soft phones installed on Win2K Workstations.
These are registered to Asterisk2 (Server #2), IP Address 192.168.1.3
extension 2001 and 192.168.1.4 extension 2002

Cisco 7960 phone is configured with 6 lines, 3 registered to
Asterisk and 3 registered to Asterisk2. IP Address 192.168.1.56
line 1 2010, line 2 2011, line 3 2012, line 4 1010, line 5
1011, line 6 1012

Cisco ATA-186 configured using:
http://www.loligo.com/asterisk/Cisco/ATA-186-guide.v20030628.txt
(John Todd)
Both analog ports have POTS phones attached. The device is registered
to Asterisk with 2 lines. IP Address 192.168.1.55 line 1 1861,
line 2 1862

Sample Configuration Files & Existing Documentation

These configuration files and existing documents are set forth with
experienced literature but when it comes to IAX, the example of
providing what is needed on the otherpeer, user or friend
server (the mate) is unclear, at least for me. Attempted below is
a reconciliation of such examples, offering configurations for both
servers.

Client Phone Registration
Here is the above mentioned configuration file for both asterisk and
asterisk2 denoting successful registration of the above mentioned
hardware and software SIP clients.

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

; SIP Configuration for Asterisk
;
[general]
port = 5060
bindaddr = 0.0.0.0
context = sip ;x changed from default to sip
;srvlookup = yes
;pedantic = yes
;tos=lowdelay
;tos=184
;maxexpirey=3600
;defaultexpirey=120
;notifymimetype=text/plain
;videosupport=yes
;disallow=all
;allow=ulaw
;allow=ilbc
;
;register => 1234@mysipprovider.com
;register => 2345@mysipprovider.com/1234


[1861] ; line 1 of ATA-186
type=friend
username=1861
secret=1945
canreinvite=no
host=dynamic
dtmfmode=rfc2833
qualify=200
mailbox=1861
nat=1

[1862] ; line 2 of ATA-186
type=friend
username=1862
secret=1945
canreinvite=no
host=dynamic
dtmfmode=rfc2833
qualify=200
mailbox=9999
nat=1

[1003] ; Laptop 1, X-Lite over WiFi
type=friend
username=1003
secret=1945
canreinvite=no
host=dynamic
dtmfmode=rfc2833
qualify=200
mailbox=1003
nat=1

[1004] ; Laptop 2, X-Lite over WiFi
type=friend
username=1004
secret=1945
canreinvite=no
host=dynamic
dtmfmode=rfc2833
qualify=200
mailbox=1004
nat=1


[1010] ; 7960 line 4
type=friend
username=1010
secret=1945
nat=yes
host=dynamic
dtmfmode=rfc2833
canreinvite=no
qualify=200
mailbox=1010

[1011] ; 7960 line 5
type=friend
username=1011
secret=1945
nat=yes
host=dynamic
dtmfmode=rfc2833
canreinvite=no
qualify=200

[1012] ; 7960 line 6
type=friend
username=2012
secret=1945
nat=yes
host=dynamic
dtmfmode=rfc2833
canreinvite=no
qualify=200

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

; SIP Configuration for Asterisk2
;
[general]
port = 5060
bindaddr = 0.0.0.0
context = sip ;x changed from default to sip
;srvlookup = yes
;pedantic = yes
;tos=lowdelay
;tos=184
;maxexpirey=3600
;defaultexpirey=120
;notifymimetype=text/plain
;videosupport=yes
;disallow=all
;allow=ulaw
;allow=ilbc
;
;register => 1234@mysipprovider.com
;register => 2345@mysipprovider.com/1234

[2001] ; X-Lite Client
type=friend
username=2001
secret=1945
canreinvite=no
host=dynamic
dtmfmode=rfc2833
qualify=200
mailbox=2001
nat=1


[2002] ; X-Lite Client
type=friend
username=2002
secret=1945
canreinvite=no
host=dynamic
dtmfmode=rfc2833
qualify=200
mailbox=2002
nat=1

2010 ; 7960 line 1
type=friend
username=2010
secret=1945
nat=yes
host=dynamic
dtmfmode=rfc2833
canreinvite=no
qualify=200
mailbox=2010

[2011] ; 7960 line 2
type=friend
username=2011
secret=1945
nat=yes
host=dynamic
dtmfmode=rfc2833
canreinvite=no
qualify=200

[2012] ; 7960 line 3
type=friend
username=2012
secret=1945
nat=yes
host=dynamic
dtmfmode=rfc2833
canreinvite=no
qualify=200
[root@Asterisk2 asterisk]#

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

IAX Configuration

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

; Inter-Asterisk eXchange driver definition (asterisk)
;

[general]
port=5036
;bindaddr=192.168.0.1
;amaflags=default
;accountcode=lss0101
bandwidth=low
;allow=all
;allow=g723.1
disallow=lpc10
allow=gsm ;x uncommented to allow gsm
;jitterbuffer=no
;dropcount=3
;maxjitterbuffer=500
;maxexccessbuffer=100
;trunkfreq=20

register => asterisk:1945@192.168.1.31:5036

;x Above is the entry to establish an IAX register (connection)
;x with a remote IAX server, i.e. another Asterisk server. This
;x is not necessary unless this server is dynamic, the IP Address
x changes. Notice
register => name:password@192.168.1.31:5036.
;x This local asterisk is registering with remote asterisk2.
;x Asterisk2 must have an entry in its iax.conf to recognize this
;x server and authenticate it (allow it to pass traffic).

register => joe@remotehost
5656
register => marko
torkey@tormenta.linux-support.net
tos=lowdelay

;x Below is the entry to allow asterisk2 to connect to asterisk
;x with the IAX protocol. The context is local, allowing asterisk2
;x to contact, call or use any client or interface within the local
;x context in this server (asterisk) depicted within the dial plan.

[asterisk2]
type=friend
auth=md5
secret=1945
context=local
host=dynamic
defaultip=192.168.1.31
qualify=yes
;trunk=yes

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

;Inter-Asterisk eXchange driver definition (asterisk2)
;

[general]
port=5036
;bindaddr=192.168.0.1
;amaflags=default
;accountcode=lss0101
bandwidth=low
;allow=all
;allow=g723.1
disallow=lpc10
allow=gsm ;x uncommented to allow gsm
;jitterbuffer=no
;dropcount=3
;maxjitterbuffer=500
;maxexccessbuffer=100
;trunkfreq=20

register => asterisk2:1945@192.168.1.30:5036

;x Above is the entry to establish an IAX register (connection)
;x with a remote IAX server, i.e. another Asterisk server. This
;x is not necessary unless this server is dynamic, the IP Address
x changes. Notice
register => name:password@192.168.1.30:5036.
;x This local asterisk2 is registering with remote asterisk.
;x Asterisk2 must have an entry in its iax.conf to recognize this
;x server and authenticate it (allow it to pass traffic).

register => joe@remotehost
5656
register => marko
torkey@tormenta.linux-support.net
tos=lowdelay

;x Below is the entry to allow asterisk to connect to asterisk2
;x with the IAX protocol. The context is local, allowing asterisk
;x to contact, call or use any client or interface within the local
;x context in this server (asterisk2) depicted within the dial plan.


[asterisk]
type=friend
auth=md5
secret=1945
context=local
host=dynamic
defaultip=192.168.1.30
qualify=yes
;trunk=yes

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Extension Configuration

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
; This file is from asterisk server #1
;x Included are the only entries added or altered from the
;x original sample file.
;
[local]
;
; Master context for local, toll-free, and iaxtel calls only
;
ignorepat => 9
include => default
include => parkedcalls
include => trunklocal
include => iaxtel700
include => trunktollfree
include => iaxprovider
include => sip ;x included sip

;x include sip here because the iax.conf entry of context
;x was (local) so if any inbound call from IAX wants to
;x contact a sip extension, it must be included here. For
;x security reasons, you may want to specify sip in the
;x (context =) portion in iax.conf.


[sip]
exten => 55,1,VoicemailMain

exten => 1861,1,Dial(SIP/1861,20,tr)
exten => 1861,2,VoiceMail,u1861
exten => 1861,102,VoiceMail,b1861

exten => 1862,1,Dial(SIP/1862,20,tr)
exten => 1862,2,VoiceMail,u9999
exten => 1862,102,VoiceMail,b9999

exten => 1001,1,Dial(SIP/1001,20,tr)
exten => 1001,2,VoiceMail,u1001
exten => 1001,102,VoiceMail,b1001

exten => 1002,1,Dial(SIP/1002,20,tr)
exten => 1002,2,VoiceMail,u1002
exten => 1002,102,VoiceMail,b1002

exten => 1003,1,Dial(SIP/1003,20,tr)
exten => 1003,2,VoiceMail,u1003
exten => 1003,102,VoiceMail,b1003

exten => 1004,1,Dial(SIP/1004,20,tr)
exten => 1004,2,VoiceMail,u1004
exten => 1004,102,VoiceMail,b1004

exten => 1010,1,Dial(SIP/1010,20,tr)
exten => 1010,2,VoiceMail,u1010
exten => 1010,102,VoiceMail,b1010

exten => 1011,1,Dial(SIP/1011,20,tr)

exten => 1012,1,Dial(SIP/1012,20,tr)

exten => _2XXX,1,Dial(IAX/asterisk:1945@192.168.1.31/${EXTEN}@local)

;x This statement above tells the local server if any SIP
;x extension dials a pattern of 2XXX, then forward that request
;x to the IAX channel interface called asterisk. When the call
;x request gets to the other asterisk server (in this case
;x asterisk2), register with username (asterisk) and password
;x (1945). The desired asterisk server (asterisk2) is @ IP
;x Address 192.168.1.31. When the request for connection is
;x authenticated and established from asterisk to asterisk2,
;x asterisk2 forwards the request for connection to extension
;x 2XXX within the local context.

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
; This file is from asterisk2 server #2
;x Included are the only entries added or altered from the
;x original sample file.

[local]
;
; Master context for local, toll-free, and iaxtel calls only
;
ignorepat => 9
include => default
include => parkedcalls
include => trunklocal
include => iaxtel700
include => trunktollfree
include => iaxprovider
include => sip ;x included sip

;x include sip here because the iax.conf entry of context
;x was (local) so if any inbound call from IAX wants to
;x contact a sip extension, it must be included here. For
;x security reasons, you may want to specify sip in the
;x (context =) portion in iax.conf.

[sip]
exten => 55,1,VoicemailMain

exten => 2001,1,Dial(SIP/2001,20,tr)
exten => 2001,2,VoiceMail,u2001
exten => 2001,102,VoiceMail,b2001

exten => 2002,1,Dial(SIP/2002,20,tr)
exten => 2002,2,VoiceMail,u2002
exten => 2002,102,VoiceMail,b2002

exten => 2003,1,Dial(SIP/2003,20,tr)
exten => 2003,2,VoiceMail,u2003
exten => 2003,102,VoiceMail,b2003

exten => 2004,1,Dial(SIP/2004,20,tr)
exten => 2004,2,VoiceMail,u2004
exten => 2004,102,VoiceMail,b2004

exten => 2010,1,Dial(SIP/2010,20,tr)
exten => 2010,2,VoiceMail,u2010
exten => 2010,102,VoiceMail,b2010

exten => 2011,1,Dial(SIP/2011,20,tr)

exten => 2012,1,Dial(SIP/2012,20,tr)

exten => _1XXX,1,Dial(IAX/asterisk2:1945@192.168.1.30/${EXTEN}@local)

;x This statement above tells the local server if any SIP
;x extension dials a pattern of 1XXX, then forward that request
;x to the IAX channel interface called asterisk2. When the call
;x request gets to the other asterisk server (in this case
;x asterisk), register with username (asterisk2) and password
;x (1945). The desired asterisk server (asterisk) is @ IP
;x Address 192.168.1.30. When the request for connection is
;x authenticated and established from asterisk2 to asterisk,
;x asterisk forwards the request for connection to extension
;x 1XXX within the local context.

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX



Closing

All that is left is to reload both servers with the added
configurations and proceed to test 4-digit dialing between 2 * servers

through an IAX link.

Another good document to read is the /usr/src/asterisk/README.iax file
located on the asterisk server.

I encourage those with pre-conceptions embedded from years of working
with Nortel, Cisco and the like to shed them prior to diving into the
documents, have an open mind and keep things simple, because it really
is simple to setup IAX. Hope this helps.

JR
Created by: miguelrvs, Last modification: Tue 12 of Apr, 2005 (21:38 UTC)


Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - support@voip-info.org

Page Changes | Comments

 

Featured -

Search: