login | register
Fri 09 of May, 2008 [14:41 UTC]

voip-info.org

Search with Google
Search this site with Google. Results may not include recent changes.
 
Google Ads
Shoutbox
  • Nick Barnes, Fri 09 of May, 2008 [11:36 UTC]: Christopher - yesterday I tried an Asterisk install on a CentOS 5.1 box with stock GUI and it all worked fine. Sorry I can't help.
  • aero, Fri 09 of May, 2008 [08:20 UTC]: can someone help me out on this, i tried to play some sound files on my asterisk box and this is the error message i got. WARNING[4429]: format_wav.c:169 check_header: Unexpected freqency 22050 May 8 11:17:39 WARNING[4433]: codec_gsm.c:194 gsmtolin_fra
  • Christopher Faust, Thu 08 of May, 2008 [14:15 UTC]: I beleive that I may have to change something in the xserver configuration. Please advise
  • Christopher Faust, Thu 08 of May, 2008 [14:14 UTC]: Everything was perfect. In the bios I have increased the memory allocated Still receive input not supported on my display.
  • Christopher Faust, Thu 08 of May, 2008 [14:13 UTC]: This would not be my main box. I am doing some testing to see if I can install zaptel and asterisk 1.4 on a full centos 5.1 box with development software Its bizzare, because before I went through the asterisk and zaptel installation everything was perfe
  • Nick Barnes, Thu 08 of May, 2008 [13:44 UTC]: Christopher - I can't see any way in which an Asterisk installation would muck your GUI, but remember that it is advised not to use a GUI on an Asterisk box anyway.
  • Christopher Faust, Wed 07 of May, 2008 [15:28 UTC]: When I try to startx I ge input not supported. Though before installing asterisk I had no video issue to start the GUI
  • Christopher Faust, Wed 07 of May, 2008 [15:26 UTC]: Hi Nick, I got centos 5.1 and asterisk up But now I cannot start startx I have set the depth from 24 to 16 for the video i810 driver for the i845 on my netvista machine but I cannot start GNOME. Please advise
  • Nick Barnes, Wed 07 of May, 2008 [10:01 UTC]: Howard - You'll need to provide a lot more information if you really want help.
  • Nick Barnes, Wed 07 of May, 2008 [10:00 UTC]: Christopher - Search the Wiki and you'll find a page I wrote detailing exactly what you have to do for Asterisk 1.4 + CentOS 5.1.
Server Stats
  • Execution time: 0.46s
  • Memory usage: 2.26MB
  • Database queries: 33
  • GZIP: Disabled
  • Server load: 1.68

Asterisk - dual servers

Connecting two Asterisk servers

Overview


Of course you can also use SIP or H.323 (but not MGCP) to interlink two Asterisk servers, however IAX is the most common approach (Note: SIP > IAX > SIP does not currently work for video calls as of Jan 08). In order to share a dialplan you can

  • intelligently design the dialplan on each server so that it becomes immediately clear when an extension on the other server is dialed, e.g. use 3xxx for server A, 4xxx for server B, and 5xxx for extensions on server C.
  • use the "switch" statement to make server A lookup locally unknown extensions on server B (both boxes must be permanently on-line, if that is not the case you'll experience large delays when dialing!)
  • use DUNDi: Distributed Universal Number Directory (DUNDi)
  • use EnumLookup (e.164)


SIP methods

Unlike with IAX there is no clean distinction between type=peer and type=user when it comes to sip.conf. You can start out with type=friend on both sides, and if you get that working you'll probably want to split the entry into a peer and a user. Also take a look at the sip.conf parameters "insecure=very" and maybe "autocreatepeer=yes".

  • server A with static IP, server B with dynamic IP: Register server B with server A in sip.conf
  • both servers with static IP: No need to register at all
  • both servers with dynamic IP: That's a bit tricky, you'll need to resort to a service like dyndns.org in to be able to register the servers with each other; in any case this is not a good setup as during IP change connectivity will be lost until the update has been propagated through dyndns.
  • both servers behind their own NAT: Don't use SIP, turn to IAX2 instead

IAX setup details

An IAX connection between two Asterisk servers is setup in steps:

  • Configure Asterisk servers at both ends in iax.conf, one as peer and the other as user.
  • Set up the user's dialplan in extensions.conf so that calls can be made from the user to the peer.
  • Optionally, register the peer with the user (for when the peer's ip is dynamic and therefore unknown by the user.)
  • Repeat the previous steps in the opposite direction (swap peer and user) if you want to be able to place calls in both directions.


Declaration of IAX2 user

A peer receives calls. The following would be needed in iax.conf on the peer machine to verify (authenticate) the identify of the user before allowing calls from that user.

[username]
 type=user
 auth=md5
 secret=secretword
 context=iax2users


The "context" is important as it sets the local context in which to place any calls incoming from this user (see extensions.conf ).

This setup lets the remote user register to your system from any host. If you want to restrict which IP-address or hostname the remote user connects from, add permit or deny settings when describing the user in the peer's iax.conf.



Declaration of IAX2 peer

A user makes calls. The following would be needed in iax.conf on the user machine to identify (authenticate) itself to the peer before the peer will take the call.

[peername]
 type=peer
 host=hostname.domain.tld (or "dynamic" which would then require a "register" command by the peer.)
 auth=md5
 secret=secretword                  ; redundant when already embedded in Dial string
 username=username-at-the-peer       ; redundant when already embedded in Dial string



Please note:
  • a type=user is to authenticate an incoming call
  • a type=peer is someone you send a call to
  • type=friend, of course, is both

Using type=friend makes life easier, but treat it as a shortcut. If you add both type=friend and host=hostname, domain.ext you limit the hosts your peer can place calls from, which may not be what you want.



For instructions on using auth=rsa, see Asterisk IAX RSA authentication wiki page.

Now that we have completed steps 1 and 2 the only thing left is to set up the dialplan. Read the examples below for how to accomplish that.


Connecting the dial plans

Example 1


extensions.conf:
 exten => _7XXX,1,Dial(IAX2/myserver:passwordA@IAXserverA/${EXTEN:1},30,r)
 exten => _7XXX,2,Dial(SIP/myserver:passwordA@SIPserverA/${EXTEN:1},30,r)
 exten => _7XXX,3,Congestion

 exten => _8XXX,1,Dial(IAX2/myserver:passwordB@IAXserverB/${EXTEN:1},30,r)
 exten => _8XXX,2,Dial(SIP/myserver:passwordB@SIPserverB/${EXTEN:1},30,r)
 exten => _8XXX,3,Congestion

Of course we'll need matching entries like [IAXserverA] etc. in iax.conf and sip.conf in order for the above to work as intended. The example uses SIP as a fallback in case we have problems with your IAX connection.
Note that with this approach username and password will be shown in the CDR records (you might want to use the second example or to look at using keys instead of a username/password combination)!

Example 2

This example doesn't show the username and secret in the CDR.
Note: As if 1.0.9 this shortcut is still not part of the Asterisk Stable branch, so still requires the user and password as part of the dial string in extensions.conf. e.g.
 exten => _7XXX,1,Dial(IAX2/username:pass@serverB/${EXTEN:1},30,r)


(serverA)
iax.conf
 [general]
 register => <username>:<password>@<serverB hostname or IP>

 [serverB]
 type=friend
 user=<username>
 secret=<password>
 host=<serverB hostname or IP>

extensions.conf
 exten => _7XXX,1,Dial(IAX2/serverB/${EXTEN:1},30,r)
 exten => _7XXX,2,Congestion

(serverB)
iax.conf
 [serverA]
 type=friend
 user=<username>
 secret=<password>
 host=<dynamic> | <serverA hostname or IP>

extensions.conf
exten => _8XXX,1,Dial(IAX2/serverA/${EXTEN:1},30,r)
exten => _8XXX,2,Congestion

In some cases the serverA and serverB, will be the usernames of the server.

Example 3

With the Switch object in extensions.conf you may connect two Asterisk servers and the other servers dial plan. In this case our own box "server C" will either connect to "server A" or "server B":

 [default]
 exten => _801XXX,1,Goto,srvA|${EXTEN}|1
 exten => _802XXX,1,Goto,srvB|${EXTEN}|1

  [srvA]
  exten => _801XXX,1,StripMSD,3
  exten => _XXX,2,Goto,1
  switch => IAX/serverA

  [srvB]
  exten => _802XXX,1,StripMSD,3
  exten => _XXX,2,Goto,1
  switch => IAX/serverB

Notes: You may not establish circular links by switching serverA to serverB and serverB to serverA! Also take a look at the (new) iax.conf setting "autokill=" to prevent a long hang when the remote server is down or disconnected.

Example 4


In extensions.conf: (on master)

[outbound]
switch => IAX2/master:secret@iax-gw1.company.net/outbound

In iax.conf (on master):

[slave]
type=user
auth=plaintext
context=outbound
context=outbound2 ; (can have multiple if you want)
secret=secret
host=dynamic
callerid="slave"
trunk=yes
notransfer=yes

[slave]
type=peer
auth=plaintext
context=outbound-nuphone
secret=secret
host=dynamic
trunk=yes
notransfer=yes

In extensions.conf (slave):

[assigned-dids]
; uncomment a dial mechanism, first one goes to specific extension
; other one goes to dial parameter s.

;exten => 7046446999,1,Dial,IAX2/master@slave/${EXTEN}
;exten => 7046446999,1,Dial,IAX2/master@slave

In iax.conf (slave):

register => slave:secret@iax-gw1.company.net

[master]
type=peer
host=iax-gw1.company.net
secret=secret
context=outbound
trunk=yes
canreinvite=no

[master]
type=user
secret=secret
context=acontext
trunk=yes
canreinvite=no



The register command

When the ip of the peer is unknown, a user has no way to place a call (e.g. when an office/user calls a teleworker/peer at home, where the teleworker has only a dynamic ip or is behind NAT.) To compensate for this, the teleworker/peer actively registers with the office/user by providing its identity and ip location.

On the peer, in the [general] section of iax.conf, add a registration entry:

 register => user:password@hostname.domain.ext

The continually updates the user so it will always know how to reach the peer even if the peer's ip changes.

The "register" statement only works if you want to hook up a server with a dynamic IP to a server with a static (public) IP, i.e. on the user you must add "host=dynamic" in the iax.conf for that peer. If both servers are at known, static IPs then there is no need for a register statement as you'd use host=hostname on both ends.
--
Back to asterisk tips and tricks
Created by oej, Last modification by Ransak on Thu 10 of Jan, 2008 [10:50 UTC]

Comments Filter

by Jhonny Velasquez C. on Tuesday 01 of April, 2008 [19:43:19 UTC]

ejemplo completo de iax trunk

by Jhonny Velasquez C. on Tuesday 01 of April, 2008 [19:37:54 UTC]
Hola a todos me interesa el ejemplo4, de maestro esclavo, pero alguien me puede pasar los archivos de configuracion completos? donde defino mis extensiones? en cada servidor?

asterisk

by aymen on Thursday 17 of May, 2007 [10:06:52 UTC]
is what this trunk is bidirectional.
thanks

asterisk

by aymen on Thursday 17 of May, 2007 [09:58:10 UTC]
is what this trunk is bidirectional.
thanks

connect with two servers multiple time

by Arjan Kroon on Tuesday 05 of September, 2006 [07:20:01 UTC]
I have two server. One for the inbound calls and one for the outbound calls.
When a call somes on the inbound server, I pas this call with a switch statement through to the outbound server.
On this outbound server I make a outbound call with the Dial statement. (this works perfect.
If the outbount call is not answersed, I hangup the outbound call, and signilling the innbound server that the outbound call is not answered.
The inbound call then tries after a couple of seconds (say 5 seconds) to connect again to the outbound server with the switch statement.
The outbound server than makes a outbound call. (This works also perfect)
But if the outbound call is not answered for the second time, the outbound server signalling the inbound server that the call is not answered.
Now the problem is that the inbound server doesn't pick up this second signal.

Does anybody got an idee?

These are my setting on the inbound server

iax.conf
outbound_server
type=peer
username=outboundserver
host=server_outbound

extensions.conf
outbound_server
switch => IAX2/outbound_server

These are my setting on the outbound server
iax.conf
outboundserver
type=user
username=outboundserver
context=outbound_dial_conf

extensions.conf
outbound_dial_conf
exten => _X.,1,Dial(Zap/g1/${tel_outdial},30,${Dial_variables})

Everyone is busy/congested at this time (1:0/0/1)

by JaTorres on Tuesday 18 of July, 2006 [10:34:30 UTC]
Sorry for double posting, and thanks for newbie helping!! :-)

Everyone is busy/congested at this time (1:0/0/1)

by JaTorres on Tuesday 18 of July, 2006 [10:31:57 UTC]
Hello, I'm trying to connect 2 asterisk servers and there's no way to make it work.
1 server (172.16.0.2) is running the latest version of trixbox, the other machine (172.16.0.196) is a SGI altix 350 with Intel ia64 architecture, is running asterisk 1.2.9.1, zaptel 1.2.6 and libpri 1.2.3, AMP version 2.1.1

There's no way to place a call from server to server via IAX, I've got this error:
   — Executing Dial("SIP/201-099c", "trixbox:1234@172.16.0.2/500@ext-local|90|Ttr") in new stack
 == Everyone is busy/congested at this time (1:0/0/1)
   — Executing Macro("SIP/201-099c", "hangupcall") in new stack
   — Executing ResetCDR("SIP/201-099c", "w") in new stack
   — Executing NoCDR("SIP/201-099c", "") in new stack
   — Executing Wait("SIP/201-099c", "5") in new stack
   — Executing Hangup("SIP/201-099c", "") in new stack
 == Spawn extension (macro-hangupcall, s, 4) exited non-zero on 'SIP/201-099c' in macro 'hangupcall'
 == Spawn extension (macro-hangupcall, s, 4) exited non-zero on 'SIP/201-099c'

I can't urderstand this madness, why IAX is not working???

My setup on Altix:

iax.conf --

general
bindport = 4569 ; Port to bind to (IAX is 4569)
bindaddr = 0.0.0.0 ; Address to bind to (all addresses on machine)
disallow=all
allow=ulaw
allow=alaw
allow=gsm
mailboxdetail=yes

; Aqui se entran los detalles para la interconexion de Altix con Trixbox mediante IAX

allow=ilbc ; Permite el codec ilbc 3kb/s
amaflags=default
bandwidth=high
tos=lowdelay
trunk=yes

; Hacemos login en el servidor asterisk de nuestra oficina remota
; Para poder comunicar nuestros asterisk y que no pierdan su conexión
register => altix:1234@172.16.0.2

; Asignamos un nombre de usuario para que nuestra oficina remota se conecte
; a nuestro servidor asterisk
trixbox
type=friend
username=trixbox
secret=1234
auth=plaintext
context=telsip
host=dynamic
disallow=all
allow=ilbc

extensions.conf --

telsip

; Ext 20 prioridad 1 llamar al teléfono sip por durante 90 segundos.
exten => 20,1,Dial(SIP/500,90,Ttr)
; En caso de no contestar en 90 segundos ejecutar segunda prioridad el voicemail.
exten => 20,2,VoiceMail2

; Ext 21 prioridad 1 llamar al teléfono sip por durante 90 segundos.
exten => 21,1,Dial(SIP/510,90,Ttr)
; En caso de no contestar en 90 segundos ejecutar segunda prioridad el voicemail.
exten => 21,2,VoiceMail2

trixbox

; Le asignamos la extensión 22 y utilizamos una variable para no hacer tan larga las lineas, en la oficina remota la
;extensión es 1000 en el contexto telsip. Nosotros queremos marcar 22 para accesar a la extensión 1000 de esa
;oficina.
exten => 22,1,Dial(trixbox:1234@172.16.0.2/500@ext-local,90,Ttr)

My setup on Trixbox:

iax.conf --

general
bindport = 4569 ; Port to bind to (IAX is 4569)
bindaddr = 0.0.0.0 ; Address to bind to (all addresses on machine)
disallow=all
allow=ulaw
allow=alaw
allow=gsm
mailboxdetail=yes


; Aqui se entran los detalles para la interconexion de Altix con Trixbox mediante IAX

allow=ilbc ; Permite el codec ilbc 3kb/s
amaflags=default
bandwidth=high
tos=lowdelay
trunk=yes

; Hacemos login en el servidor asterisk de nuestra oficina remota
; Para poder comunicar nuestros asterisk y que no pierdan su conexión
register => trixbox:1234@172.16.0.196

; Asignamos un nombre de usuario para que nuestra oficina remota se conecte
; a nuestro servidor asterisk
altix
type=friend
username=altix
secret=1234
auth=plaintext
context=telsip
host=dynamic
disallow=all
allow=ilbc

extensions.conf --

telsip

; Ext 20 prioridad 1 llamar al teléfono sip por durante 90 segundos.
exten => 20,1,Dial(SIP/500,90,Ttr)
; En caso de no contestar en 90 segundos ejecutar segunda prioridad el voicemail.
exten => 20,2,VoiceMail2

; Ext 21 prioridad 1 llamar al teléfono sip por durante 90 segundos.
exten => 21,1,Dial(SIP/510,90,Ttr)
; En caso de no contestar en 90 segundos ejecutar segunda prioridad el voicemail.
exten => 21,2,VoiceMail2


altix

; Le asignamos la extensión 22 y utilizamos una variable para no hacer tan larga las lineas, en la oficina remota la
;extensión es 1000 en el contexto telsip. Nosotros queremos marcar 22 para accesar a la extensión 1000 de esa
;oficina.
exten => 22,1,Dial(altix:1234@172.16.0.2/500@ext-local,90,Ttr)




Finally, I've tried all I can do. And there's no way to find a solution. I've also tried to mix de dialplans of two servers as said on sourceforge (http://sourceforge.net/docman/display_doc.php?docid=26418&group_id=121515) but it's still not working.
I've seen some documents with SIP and IAX interconnection, but not working.

If somebody got this error, and can find a solution I would be really, really pleased!!!
Thanks to everybody, thanks in advance for your comprension.


Clarify please!

by Gustavo Berman on Friday 07 of July, 2006 [21:25:45 UTC]
We have the following topology:<br>

Site A <br>
sipphones -> asterisk -> firewall (nat) -> internet<p>

Site B <br>
sipphones -> asterisk -> firewall (nat) -> internet<p>

The connection between sipphones and asterisk at each sites is ok. Every sipphone in Site A can talk between them. The same with Site B.<br>

But I really can't follow your explanation of iax between both asterisks.<br>

What I need to do is to every sipphone in Site A be able to talk to every sipphone in Site B and viceversa.<br>

Please can somebody send some example?<br>
Thanks!

IAX and the "Register" command demistified

by Axel Masok on Wednesday 15 of March, 2006 [05:46:31 UTC]
This is the minimum to make this registration succeed for all of you with the cryptic "authentication rejected" messages.

"SERVER A" in iax.conf
register => specialusername:specialpassword@serverb-ip

"SERVER B" in iax.conf
[specialusername] ; Must be the username sent by SERVER A above
type=friend ; Must be friend
host=dynamic ; Must be dynamic - whole idea behind registering
secret=specialpassword ; No password means no authentication. MD5 used by default

Re: SIP -> * *

by hmkxlokes on Monday 12 of September, 2005 [19:53:04 UTC]
Hey there I know its been a few months since you did this but in your guide it just says general, adelaide, general, internal, sip where exactly are these files? Please let me know and thanks in advance for your help.

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

Page Changes | Comments

Sponsored by:

Terms of Service Privacy Policy
© 2003-2008 VOIP-Info.org LLC

Powered by bitweaver