Two SIP Trunks


#1

Hello,

I have asterisk with one interface eth0. I’m trying to use Asterisk between two SIP trunks.

sip.conf

[general]
context = default
allowoverlap = no
udpbindaddr = 0.0.0.0
bindport = 5060
bindaddr = 0.0.0.0
tcpenable = yes 
tcpbindaddr = 0.0.0.0 
srvlookup = yes 
notifyhold = yes 
subscribecontext = default


[first_Trunk]
type = friend
port = 5068
host = 10.1.2.20
dtmfmode = rfc2833
context = from-first
qualify = yes
transport = tcp,udp

[pbx_Trunk]
type = friend
port = 5060
host = 10.10.1.10
dtmfmode = rfc2833
context = from-pbx
qualify = yes
transport = tcp,udp

extensions.conf


[general]
static=yes
writeprotect=no

[globals]

[default]

[from-first]

exten=>_.,1,Dial(SIP/pbx_Trunk/${EXTEN},20)
exten=>_.,n,hangup()

[from-pbx]

exten=>_.,1,Dial(SIP/first_Trunk/${EXTEN},20)
exten=>_.,n,hangup()

All the calls to outside (from-first) works fine, but incoming calls don’t :frowning:

== Using SIP RTP CoS mark 5 -- Executing [2190@from-pbx:1] Dial("SIP/pbx_Trunk-00000021", "SIP/first_Trunk/2190,20") in new stack == Using SIP RTP CoS mark 5 -- Called first_Trunk/2190 -- SIP/first_Trunk-00000022 is circuit-busy == Everyone is busy/congested at this time (1:0/1/0) -- Executing [2190@from-pbx:2] Hangup("SIP/pbx_Trunk-00000021", "") in new stack == Spawn extension (from-pbx, 2190, 2) exited non-zero on 'SIP/pbx_Trunk-00000021' -- Executing [h@from-pbx:1] Dial("SIP/pbx_Trunk-00000021", "SIP/first_Trunk/h,20") in new stack == Using SIP RTP CoS mark 5 -- Called first_Trunk/h == Spawn extension (from-pbx, h, 1) exited non-zero on 'SIP/pbx_Trunk-00000021'

Thx in adwance.


#2

Don’t use _.

It also matches h.

Do provide an example of a working call.


#3

I used _X. insted of _. - didnt help.

Now I have sth like this:

== Using SIP RTP CoS mark 5 -- Executing [2191@from-first:1] Dial("SIP/pbx_Trunk-00000006", "SIP/first_Trunk/2191,20") in new stack == Using SIP RTP CoS mark 5 -- Called first_Trunk/2191 -- SIP/first_Trunk-00000007 is circuit-busy == Everyone is busy/congested at this time (1:0/1/0) -- Executing [2191@from-pbx:2] Hangup("SIP/pbx_Trunk-00000006", "") in new stack == Spawn extension (from-pbx, 2191, 2) exited non-zero on 'SIP/pbx_Trunk-00000006'

Working calls:

 == Using SIP RTP CoS mark 5
    -- Executing [06035@from-first:1] Dial("SIP/first_Trunk-00000004", "SIP/pbx_Trunk/06035,20") in new stack
  == Using SIP RTP CoS mark 5
    -- Called pbx_Trunk/06035
    -- SIP/pbx_Trunk-00000005 is ringing
    -- SIP/pbx_Trunk-00000005 is making progress passing it to SIP/first_Trunk-00000004
    -- SIP/pbx_Trunk-00000005 answered SIP/first_Trunk-00000004
    -- Native bridging SIP/first_Trunk-00000004 and SIP/pbx_Trunk-00000005
  == Spawn extension (from-first, 06035, 1) exited non-zero on 'SIP/first_Trunk-00000004'

#4

Now use sip set debug on to find out the reason the other end is giving for rejecting the call.


#5

Debug result :

<------------>
    -- Executing [2191@from-pbx:1] Dial("SIP/pbx_Trunk-0000000c", "SIP/first_Trunk/2191,20") in new stack
  == Using SIP RTP CoS mark 5
Audio is at 10.1.2.34 port 12002
Adding codec 0x8 (alaw) to SDP
Adding codec 0x2 (gsm) to SDP
Adding codec 0x4 (ulaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 10.1.2.32:5068:
INVITE sip:2191@10.1.2.32:5068 SIP/2.0
Via: SIP/2.0/TCP 10.1.2.34:5060;branch=z9hG4bK494e9cf2;rport
Max-Forwards: 70
From: "Wwa.Tar.25" <sip:+6097@10.1.2.34>;tag=as67f81418
To: <sip:2191@10.1.2.32:5068>
Contact: <sip:%2b6097@10.1.2.34;transport=TCP>
Call-ID: 784b62bd29fee0e1587079ca2e6ae581@10.1.2.34
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.6.2.20
Date: Wed, 30 Nov 2011 07:41:46 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 275

v=0
o=root 1418302029 1418302029 IN IP4 10.1.2.34
s=Asterisk PBX 1.6.2.20
c=IN IP4 10.1.2.34
t=0 0
m=audio 12002 RTP/AVP 8 3 0 97
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:97 telephone-event/8000
a=fmtp:97 0-16
a=ptime:20
a=sendrecv

---
    -- Called first_Trunk/2191

<--- SIP read from TCP:10.1.2.32:5068 --->
SIP/2.0 100 Trying
FROM: "Wwa.Tar.25"<sip:+6097@10.1.2.34>;tag=as67f81418
TO: <sip:2191@10.1.2.32:5068>
CSEQ: 102 INVITE
CALL-ID: 784b62bd29fee0e1587079ca2e6ae581@10.1.2.34
VIA: SIP/2.0/TCP 10.1.2.34:5060;branch=z9hG4bK494e9cf2;rport
CONTENT-LENGTH: 0


<------------->
--- (7 headers 0 lines) ---

<--- SIP read from TCP:10.1.2.32:5068 --->
SIP/2.0 488 Not Acceptable Here
FROM: "Wwa.Tar.25"<sip:+6097@10.1.2.34>;tag=as67f81418
TO: <sip:2191@10.1.2.32:5068>;epid=9C2BBC7632;tag=91a1d5fe7
CSEQ: 102 INVITE
CALL-ID: 784b62bd29fee0e1587079ca2e6ae581@10.1.2.34
VIA: SIP/2.0/TCP 10.1.2.34:5060;branch=z9hG4bK494e9cf2;rport
CONTENT-LENGTH: 0
SERVER: RTCC/4.0.0.0 MediationServer


<------------->
--- (8 headers 0 lines) ---
Transmitting (no NAT) to 10.1.2.32:5068:
ACK sip:2191@10.1.2.32:5068 SIP/2.0
Via: SIP/2.0/TCP 10.1.2.34:5060;branch=z9hG4bK494e9cf2;rport
Max-Forwards: 70
From: "Wwa.Tar.25" <sip:+6097@10.1.2.34>;tag=as67f81418
To: <sip:2191@10.1.2.32:5068>;tag=91a1d5fe7
Contact: <sip:%2b6097@10.1.2.34;transport=TCP>
Call-ID: 784b62bd29fee0e1587079ca2e6ae581@10.1.2.34
CSeq: 102 ACK
User-Agent: Asterisk PBX 1.6.2.20
Content-Length: 0


---
    -- SIP/first_Trunk-0000000d is circuit-busy
  == Everyone is busy/congested at this time (1:0/1/0)
    -- Executing [2191@from-pbx:2] Hangup("SIP/pbx_Trunk-0000000c", "") in new stack
  == Spawn extension (from-pbx, 2191, 2) exited non-zero on 'SIP/pbx_Trunk-0000000c'
Scheduling destruction of SIP dialog 'd699540a3987ee96227620e70635e4cb@10.10.1.10' in 6400 ms (Method: INVITE)

<--- Reliably Transmitting (no NAT) to 10.10.1.10:5060 --->
SIP/2.0 488 Not Acceptable Here
Via: SIP/2.0/UDP 10.10.1.10;branch=z9hG4bK949745d7efa7846f63226e8650d3c853;received=10.10.1.10
From: "Wwa.Tar.25" <sip:+6097@10.10.1.10;user=phone>;tag=1aba470f9d3f6a065b2f2e373046b761
To: <sip:2191@10.1.2.34;user=phone>;tag=as64aa84dd
Call-ID: d699540a3987ee96227620e70635e4cb@10.10.1.10
CSeq: 2000430975 INVITE
Server: Asterisk PBX 1.6.2.20
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0


<------------>

<--- SIP read from UDP:10.10.1.10:5060 --->
ACK sip:2191@10.1.2.34;user=phone SIP/2.0
Call-ID: d699540a3987ee96227620e70635e4cb@10.10.1.10
From: "Wwa.Tar.25" <sip:+6097@10.10.1.10;user=phone>;tag=1aba470f9d3f6a065b2f2e373046b761
To: <sip:2191@10.1.2.34;user=phone>;tag=as64aa84dd
Via: SIP/2.0/UDP 10.10.1.10;branch=z9hG4bK949745d7efa7846f63226e8650d3c853
CSeq: 2000430975 ACK
Content-Length: 0


<------------->
--- (7 headers 0 lines) ---
Really destroying SIP dialog '784b62bd29fee0e1587079ca2e6ae581@10.1.2.34' Method: INVITE
Really destroying SIP dialog 'd699540a3987ee96227620e70635e4cb@10.10.1.10' Method: ACK
Reliably Transmitting (no NAT) to 10.1.2.32:5068:
OPTIONS sip:10.1.2.32 SIP/2.0
Via: SIP/2.0/TCP 10.1.2.34:5060;branch=z9hG4bK11260855;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@10.1.2.34>;tag=as7a3342e2
To: <sip:10.1.2.32>
Contact: <sip:asterisk@10.1.2.34;transport=TCP>
Call-ID: 57b806a673296a6773e6d7ac115b7a15@10.1.2.34
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 1.6.2.20
Date: Wed, 30 Nov 2011 07:41:54 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0


---

<--- SIP read from TCP:10.1.2.32:5068 --->
SIP/2.0 200 OK
FROM: "asterisk"<sip:asterisk@10.1.2.34>;tag=as7a3342e2
TO: <sip:10.1.2.32>;tag=40258ceadc
CSEQ: 102 OPTIONS
CALL-ID: 57b806a673296a6773e6d7ac115b7a15@10.1.2.34
VIA: SIP/2.0/TCP 10.1.2.34:5060;branch=z9hG4bK11260855;rport
ACCEPT: application/sdp
CONTENT-LENGTH: 0
ACCEPT-ENCODING: gzip
ACCEPT-LANGUAGE: en
ALLOW: NOTIFY
ALLOW: BENOTIFY
SERVER: RTCC/4.0.0.0 MediationServer


<------------->
--- (13 headers 0 lines) ---
Reliably Transmitting (no NAT) to 10.10.1.10:5060:
OPTIONS sip:10.10.1.10 SIP/2.0
Via: SIP/2.0/TCP 10.1.2.34:5060;branch=z9hG4bK452b275f;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@10.1.2.34>;tag=as3c1fd757
To: <sip:10.10.1.10>
Contact: <sip:asterisk@10.1.2.34;transport=TCP>
Call-ID: 02b1df39189d3a37028217d04f5e7e5e@10.1.2.34
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 1.6.2.20
Date: Wed, 30 Nov 2011 07:41:54 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0

#6

Maybe doesn’t like the + in front of something that is clearly not an international number.