SIP Trunk working but cross server calls dont

Hi, i have 2 asterisk boxes, they have a sip trunk, which works, sip show peers show that it has register, there is ping connectivity, but every time i try to make a call from server1 to an extension on server 2 it always shows an error message saying that the call is forbidden, any help is much appreciated

Hi,
can you specify what is your asterisk version and show your trunk configuration (sip.conf , users.conf), and the dialplan configuration (extensions.conf) ?

Im using version 1.8 on ubuntu 11.10 (X 2). I have no users.conf config, as im only doing this as a module for my university degree. My configs are basically replicas but with the obvious changes.

SIP.CONF
[general]

;register sip trunk with server 1
register=SRV1:welcome@192.168.137.2/SRV1

;register picocell
[sip-trunk-pmn]
type=peer
host=192.168.2.1
allow=gsm
canreinvite=no
context=phones

;register server 2
[SRV2]
type=friend
secret=welcome
context=SRV2_incoming
host=dynamic
disallow=all
allow=ulaw

;register server 1
[SRV1]
type=friend
secret=welcome
context=SRV1_incoming
host=dynamic
disallow=all
allow=ulaw

;register 1001
[1001]
type=friend
username=1001
context=phones
host=dynamic

;register 1002
[1002]
type=friend
username=1002
context=phones
host=dynamic

;register 1003
[1003]
type=friend
username=1003
context=phones
host=dynamic

;register IPAQ
[4034]
type=friend
username=4034
context=phones
host=dynamic

extensions.conf

[globals]

[general]
autofallthrough=yes

;strip first 3 digits from picocell

exten => _137.,1,set(callerid(num)=137${callerid(num)})
exten => _137.,2,dial(SIP/sip-trunk-pmn/${EXTEN:3},20,rt)

[phones]
include=> internal
include=> remote

;voicemail number
exten => 901,1,VoiceMailMain()

;strips first 3 digits for picocell
exten => _137.,1,set(callerid(num)=137${callerid(num)})
exten => _137.,2,dial(SIP/sip-trunk-pmn/${EXTEN:3},20,rt)

;phone numbers with voicemail inbox
exten => _1001,1,Verbose(someone is calling 1001)
exten => _1001,n,dial(SIP/1001, 30)
exten => _1001,n,voicemail(1001@default)
exten => _1001,n,hangup

exten => _1002,1,Verbose(someone is calling 1002)
exten => _1002,n,dial(SIP/1002,30)
exten => _1002,n,voicemail(1002@default)
exten => _1002,n,hangup

exten => _1003,1,Verbose(someone is calling 1003)
exten => _1003,n,dial(SIP/1003,30)
exten => _1003,n,voicemail(1003@default)
exten => _1003,n,hangup

;IAX number

exten => _1004,1,Verbose(someone is calling 1004)
exten => _1004,n,dial(IAX2/1004,30)
exten => _1004,n,voicemail(1004@default)
exten => _1004,n,hangup

;ipaq number
exten => _4034,1,Verbose(someone is calling 4034)
exten => _4034,n,dial(SIP/4034,30)
exten => _4034,n,voicemail(4034@default)
exten => _4034,n,hangup

;auto attendant
;press number for * menu
exten => 1001,1,Dial(SIP/1001,15,r) ;ring for 15 seconds
exten => 1001,2,GoTo(phones,s,1); go to if phone isnt answered
exten => s,1,Background(press-1&for&extension&1&0&0&1)
exten => s,2,Background(press-2&for&extension&1&0&0&2)
exten => s,3,Background(press-3&for&extension&1&0&0&4)
exten => s,4,Background(press-4&for&conference&room&6&0&0)

;playback the above soundfile
exten => s,n,WaitExten(5)
; wait 5 secs for a response
exten => 1,1,Playback(digits/1)
; playback the soundfile of the digit entered
exten => 1,n,Goto(phones,1001,1)
exten => 2,1,Playback(digits/2)
exten => 2,n,Goto(phones,1002,1)
exten => 3,1,Playback(digits/3)
exten => 3,n,Goto(phones,1004,1)
exten => 4,1,Playback(digits/4)
exten => 4,n,Goto(phones,600,1)
exten => i,1,Playback(pbx-invalid)
exten => i,n,Goto(phones,234,1)
exten => t,1,Playback(vm-goodbye)
exten => t,n,Hangup()

;conference calls
exten => 600,1,MeetMe(600,i,54321)

;room count
exten => 601,1,Playback(conf-thereare)
exten => 601,n,MeetMeCount(600)
exten => 601,n,Playback(conf-peopleinconf)

; limit the conference room to 10 participants
exten => 600,1,MeetMeCount(600,CONFCOUNT)
exten => 600,n,GotoIf($[${CONFCOUNT} <= 10]?meetme:conf_full,1)
exten => 600,n(meetme),MeetMe(600,i,54321)
exten => conf_full,1,Playback(conf-full)

;tells server where to find the extensions

[internal]

exten => _1XXX,1,Verbose(someone is calling 1001)
exten => _1XXX,n,dial(SIP/${EXTEN},30)
exten => _1XXX,n,hangup

;tells server where to find the extensions

[remote]

exten => _2XXX,1,Verbose(someone is calling 2001)
exten => _2XXX,n,dial(SIP/SRV2/${EXTEN})
exten => _2XXX,n,hangup

[SRV2_incoming]
include=> internal

[SRV1_incoming]
include=> internal

Thanks for your help.

I would start with simplifying the dialplan to the bare minimum
I suspect the problem is at level.

in the general section you don’t have to put an exten=>

You don’t have to put the _ in front of the number. There is no expression following.

no need to include internal in phones… doesn’t add logic.

ok thanks, the tutorials we were given were confusing, thanks for the help i will give that a go and get back to you

here are the sip conf and dialplan for server 2, i get a sip turnk connection registered, but apart from that nothing else seems to work, i can call an extension on server 2 but it refuses to leave the actula server if i try to call a server 1 connection still

[globals]

[general]
autofallthrough=yes

[default]

[phones]
include =>remote

;extensions
exten => 2001,1,Verbose([0]<someone is calling 2001>)
exten => 2001,n,dial(SIP/2001)
exten => 2001,n,hangup

exten => 2002,1,Verbose([0]<someone is calling 2002>)
exten => 2002,n,dial(SIP/2002)
exten => 2002,n,hangup

exten => 2004,1,Verbose([0]<someone is calling 2004>)
exten => 2004,n,dial(IAX2/2004)
exten => 2004,n,hangup

[internal]
;location of extensions starting with 2
exten => _2XXX,1,Verbose([0]<someone is calling 2001>)
exten => _2XXX,n,dial(SIP/${EXTEN},30)
exten => _2XXX,n,hangup

[remote]
;location of extensions starting with 1
exten => _1XXX,1,Verbose([0]<someone is calling 1001>)
exten => _1XXX,n,dial(SIP/SRV1/${EXTEN})
exten => _1XXX,n,hangup

;location of where to find extensions

[SRV1_incoming]
include=> remote

[SRV2_incoming]
include=> internal

[general]

;register sip trunk with server 1

;register=SRV2:welcome@192.168.137.1/SRV2
register=SRV2:welcome@192.168.0.81/SRV2

; register detail of server 1

[SRV1]
type=friend
secret=welcome
context=SRV1_incoming
host=dynamic
disallow=all
allow=ulaw

; register detail of server 2

[SRV2]
type=friend
secret=welcome
context=SRV2_incoming
host=dynamic
disallow=all
allow=ulaw

;register extension 2001
[2001]
type=friend
context=phones
host=dynamic

;register extension 2002
[2002]
type=friend
context=phones
host=dynamic