Connecting two asterisk servers!

HI …
Im trying to connect two asterisk servers … as i have searched in the net most of the sites recommend IAX for this purpose … however, i would like to mention that im working in university network and both servers are in d same network but serving different departments… i did the configuration using IAX peer and user model … also used register command … but seems somthing wrong with my scripts cause im getting errors and im not able to register both servers …

my configurations goes like this …
server1 : 192.168.90.28 (static)
server2 : 192.168.90.41

iax.conf (in server 1 )
[general]
bindaddr = 0.0.0.0
bindport = 4569
tos = lowdelay
disallow = all
allow = ulaw
allow = gsm
bandwidth=low

register => root:pass2@192.168.90.41

[server2]
context = Incoming-calls
type = peer
host = 192.168.90.41
secret = pass1
qualify = yes
username =root
[root]
context = Incoming-calls
host = 192.168.90.41
secret = pass2
type = user
auth = md5
disallow = all
allow = gsm
trunk = yes
extensions.conf(server 1)
[from-internal-iax]
exten => _13XX,1,Answer;
exten => _13XX,2,wait(1)
exten => _13XX,3,Dial(IAX2/${EXTEN}@192.168­ .90.28:4569); 1300 extensions in iaxserver1
exten => _13XX,4,hangup()

[Incoming-calls]
exten => _14XX,1,Dial(IAX2/1300:4321@192.16­ 8.90.41/${EXTEN:1})
include => from-internal-iax

[outgoing-calls]
exten => _14XX,1,Dial(IAX2/${EXTEN:1})
exten => _14XX,2,Congestion

iax.conf(in server 2)
[general]
bindaddr = 0.0.0.0
bindport = 4569
tos = lowdelay
disallow = all
allow = ulaw
allow = gsm
bandwidth=low
register => root:pass1@192.168.90.28
[server1]
type = peer
context=Incoming-calls
host=192.168.90.28
secret=pass1
qualify=yes
username=root

[root]
context=Incoming-calls
host=192.168.90.28
secret=pass2
type=user
auth = md5
disallow = all
allow = gsm
trunk = yes

extensions.conf( server 2)
[from-internal-iax]
exten => _14XX,1,Answer;
exten => _14XX,2,wait(1)
exten => _14XX,3,Dial(IAX2/${EXTEN}@192.168­ .90.41:4569)
exten => _14XX,4,hangup()
[Incoming-calls]
exten => _14XX,1,Dial(IAX2/1400:123@192.168­ .90.28/${EXTEN}) ;1400 extension in iaxserver 2
include => from-internal-iax
[outgoing-calls]
exten => _13XX,1,Dial(IAX2/${EXTEN:1})
exten => _13XX,2,congestion

CLI warnings …in server 2
*CLI> [Mar 13 12:07:47] NOTICE[3860]: chan_iax2.c:5252 register_verify: No registration for peer ‘root’ (from 192.168.90.28)
[Mar 13 12:08:17] NOTICE[3855]: chan_iax2.c:7911 socket_process: Registration of ‘root’ rejected: ‘Registration Refused’ from: ‘192.168.90.28’
[Mar 13 12:08:37] NOTICE[3852]: chan_iax2.c:5252 register_verify: No registration for peer ‘root’ (from 192.168.90.28)
also it says that peer root is unreachable now…
the passwords im using are root passwords for each server …
can you tell me what is wrong with my scripts … how can i fix it ?
thanks in advance …

Hi,

Here are two working examples; one is using SIP and one IAX

;;;;;;;;;;;;;;;;;;
; IAX ;
;;;;;;;;;;;;;;;;;;
;I am using pattern matching _[1-3]XX and stripping off the last two
;digits :-2 and appending or concatinating it to -IAX-TRUNK. so if I dial 122
;Asterisk will call via 1-IAX-TRUNK
;
exten => _[1-3]XX,1,Set(IAXTRUNK=${EXTEN:0:-2}"-IAX-TRUNK")
exten => _[1-3]XX,2,Dial(IAX2/${IAXTRUNK}/${EXTEN},45,Tt)
exten => _[1-3]XX,3,Hangup()

iax.conf

;Inter-Office IAX
[1-IAX-TRUNK] ;Extensions starting with 1
type=peer
context=internal
host=192.168.0.10
disallow=all
allow=g729
qualify=no

[2-IAX-TRUNK] ;Extensions starting with 2
type=peer
context=internal
host=192.168.1.10
disallow=all
allow=g729
qualify=no

[3-IAX-TRUNK] ;Extensions starting with 3
type=peer
context=internal
host=192.168.5.10
disallow=all
allow=g729
qualify=no

;;;;;;;;;;;;;;;;;;
; SIP ;
;;;;;;;;;;;;;;;;;;
;Server1
;extensions.conf

exten => _1XX,1,Dial(SIP/1-sip-trunk/${EXTEN})
exten => _1XX,2,Hangup()

;sip.conf
[1-sip-trunk] ;extesions starting with 1
type=peer
context=internal
host=192.168.6.10
disallow=all
allow=g729
canreinvite=yes
qualify=no

;Server2
;extensions.conf

exten => _2XX,1,Dial(SIP/2-sip-trunk/${EXTEN})
exten => _2XX,2,Hangup()

;sip.conf
[2-sip-trunk] ;extesions starting with 1
type=peer
context=internal
host=192.168.4.10
disallow=all
allow=g729
canreinvite=yes
qualify=no