Trunk between Asterisk

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Trunk between Asterisk

Postby c20xh2 » Sun Jul 30, 2017 8:57 pm

I'm trying to setup a SIP trunk between two vicidial asterisk box:

Vicidial:
VERSION: 2.14-620a
BUILD: 170623-2142

Serveur A:
Account Entry:
Code: Select all
[Server_B]
type=friend
host=192.168.1.212
context=Server_B
allow=all
qualify=yes
nat=force_rport,comedia


Global String:
Code: Select all
SIPTRUNK = SIP/Server_B


Dial plan:
Code: Select all
[Server_B]
exten => _+1NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _+1NXXNXXXXXX,2,Dial(${SIPTRUNK}/+${EXTEN},,tTor)
exten => _+1NXXNXXXXXX,3,Hangup

exten => _NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _NXXNXXXXXX,2,Dial(${SIPTRUNK}/+1${EXTEN},,tTor)
exten => _NXXNXXXXXX,3,Hangup

exten => _1NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _1NXXNXXXXXX,2,Dial(${SIPTRUNK}/+${EXTEN},,tTor)
exten => _1NXXNXXXXXX,3,Hangup


sip show peers:
Code: Select all
Name/username             Host                                    Dyn Forcerport Comedia    ACL Port     Status      Description
Server_B                  192.168.1.212                               Yes        Yes            5060     OK (1 ms)
gs102/gs102               192.168.1.60                             D  Yes        Yes            55385    OK (5 ms)



Server B ( I want calls going out from this one):

Serveur B:
Account Entry:
Code: Select all
[Server_B]
type=friend
host=192.168.1.232
context=Server_A
allow=all
qualify=yes
nat=force_rport,comedia


Global String:
Code: Select all
SIPTRUNK = SIP/Server_B


Dial plan:
Code: Select all
[Server_A]
exten => _+1NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _+1NXXNXXXXXX,2,Dial(${SIPTRUNK}/+${EXTEN},,tTor)
exten => _+1NXXNXXXXXX,3,Hangup

exten => _NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _NXXNXXXXXX,2,Dial(${SIPTRUNK}/+1${EXTEN},,tTor)
exten => _NXXNXXXXXX,3,Hangup

exten => _1NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _1NXXNXXXXXX,2,Dial(${SIPTRUNK}/+${EXTEN},,tTor)
exten => _1NXXNXXXXXX,3,Hangup


sip show peers:
Code: Select all
Name/username             Host                                    Dyn Forcerport Comedia    ACL Port     Status      Description
Server_A                  192.168.1.232                               Yes        Yes            5060     OK (1 ms)
twilio                    54.172.60.1                                 Yes        Yes            5060     OK (26 ms)


I'm pretty sure my problem is coming from the dialplan since that's what I get when trying to send a call:
[Jul 30 21:51:53] NOTICE[1180][C-0000000f]: chan_sip.c:26002 handle_request_invite: Call from 'gs102' (192.168.1.60:55385) to extension '4389241847' rejected because extension not found in context 'default'.


But I don't see where my config is wrong :(, if anyone have an idea
c20xh2
 
Posts: 95
Joined: Mon Feb 20, 2017 2:28 am

Re: Trunk between Asterisk

Postby c20xh2 » Sun Jul 30, 2017 9:05 pm

Omg, had to remove

Code: Select all
[Server_B]

From the dialplan

Now I have:
Jul 30 21:59:33] NOTICE[1180][C-00000012]: chan_sip.c:23309 handle_response_invite: Failed to authenticate on INVITE to '"Test Admin Phone" <sip:gs102@192.168.1.232>;tag=as3e1c5b9e'


But I made sure the registration password for gs102 is the same on both vicidial server, any clue ?

Sip debug from Server_B (the one who need to send the call)

Code: Select all
[Jul 30 22:10:51]
[Jul 30 22:10:51] <--- SIP read from UDP:192.168.1.232:5060 --->
[Jul 30 22:10:51] INVITE sip:+14389191747@192.168.1.212 SIP/2.0
[Jul 30 22:10:51] Via: SIP/2.0/UDP 192.168.1.232:5060;branch=z9hG4bK36128eb2;rport
[Jul 30 22:10:51] Max-Forwards: 70
[Jul 30 22:10:51] From: "Test Admin Phone" <sip:gs102@192.168.1.232>;tag=as3fe99d70
[Jul 30 22:10:51] To: <sip:+14389191747@192.168.1.212>
[Jul 30 22:10:51] Contact: <sip:gs102@192.168.1.232:5060>
[Jul 30 22:10:51] Call-ID: 038f98e43077252f52a5f7d1200f7ff4@192.168.1.232:5060
[Jul 30 22:10:51] CSeq: 102 INVITE
[Jul 30 22:10:51] User-Agent: Asterisk PBX 11.25.1-vici
[Jul 30 22:10:51] Date: Mon, 31 Jul 2017 02:10:51 GMT
[Jul 30 22:10:51] Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
[Jul 30 22:10:51] Supported: replaces, timer
[Jul 30 22:10:51] Remote-Party-ID: "Test Admin Phone" <sip:gs102@192.168.1.232>;party=calling;privacy=off;screen=no
[Jul 30 22:10:51] Content-Type: application/sdp
[Jul 30 22:10:51] Content-Length: 1300
[Jul 30 22:10:51]
[Jul 30 22:10:51] v=0
[Jul 30 22:10:51] o=root 1656182948 1656182948 IN IP4 192.168.1.232
[Jul 30 22:10:51] s=Asterisk PBX 11.25.1-vici
[Jul 30 22:10:51] c=IN IP4 192.168.1.232
[Jul 30 22:10:51] t=0 0
[Jul 30 22:10:51] m=audio 18164 RTP/AVP 0 3 4 8 112 5 7 18 110 97 111 9 102 115 116 117 96 100 107 108 10 118 119 101
[Jul 30 22:10:51] a=rtpmap:0 PCMU/8000
[Jul 30 22:10:51] a=rtpmap:3 GSM/8000
[Jul 30 22:10:51] a=rtpmap:4 G723/8000
[Jul 30 22:10:51] a=fmtp:4 annexa=no
[Jul 30 22:10:51] a=rtpmap:8 PCMA/8000
[Jul 30 22:10:51] a=rtpmap:112 AAL2-G726-32/8000
[Jul 30 22:10:51] a=rtpmap:5 DVI4/8000
[Jul 30 22:10:51] a=rtpmap:7 LPC/8000
[Jul 30 22:10:51] a=rtpmap:18 G729/8000
[Jul 30 22:10:51] a=fmtp:18 annexb=no
[Jul 30 22:10:51] a=rtpmap:110 speex/8000
[Jul 30 22:10:51] a=rtpmap:97 iLBC/8000
[Jul 30 22:10:51] a=rtpmap:111 G726-32/8000
[Jul 30 22:10:51] a=rtpmap:9 G722/8000
[Jul 30 22:10:51] a=rtpmap:102 G7221/16000
[Jul 30 22:10:51] a=fmtp:102 bitrate=32000
[Jul 30 22:10:51] a=rtpmap:115 G7221/32000
[Jul 30 22:10:51] a=fmtp:115 bitrate=48000
[Jul 30 22:10:51] a=rtpmap:116 G719/48000
[Jul 30 22:10:51] a=fmtp:116 bitrate=64000
[Jul 30 22:10:51] a=rtpmap:117 speex/16000
[Jul 30 22:10:51] a=rtpmap:96 SILK/8000
[Jul 30 22:10:51] a=fmtp:96 maxaveragebitrate=10000
[Jul 30 22:10:51] a=fmtp:96 usedtx=0
[Jul 30 22:10:51] a=fmtp:96 useinbandfec=1
[Jul 30 22:10:51] a=rtpmap:100 SILK/12000
[Jul 30 22:10:51] a=fmtp:100 maxaveragebitrate=12000
[Jul 30 22:10:51] a=fmtp:100 usedtx=0
[Jul 30 22:10:51] a=fmtp:100 useinbandfec=1
[Jul 30 22:10:51] a=rtpmap:107 SILK/16000
[Jul 30 22:10:51] a=fmtp:107 maxaveragebitrate=20000
[Jul 30 22:10:51] a=fmtp:107 usedtx=0
[Jul 30 22:10:51] a=fmtp:107 useinbandfec=1
[Jul 30 22:10:51] a=rtpmap:108 SILK/24000
[Jul 30 22:10:51] a=fmtp:108 maxaveragebitrate=30000
[Jul 30 22:10:51] a=fmtp:108 usedtx=0
[Jul 30 22:10:51] a=fmtp:108 useinbandfec=1
[Jul 30 22:10:51] a=rtpmap:10 L16/8000
[Jul 30 22:10:51] a=rtpmap:118 L16/16000
[Jul 30 22:10:51] a=rtpmap:119 speex/32000
[Jul 30 22:10:51] a=rtpmap:101 telephone-event/8000
[Jul 30 22:10:51] a=fmtp:101 0-16
[Jul 30 22:10:51] a=ptime:20
[Jul 30 22:10:51] a=sendrecv
[Jul 30 22:10:51] <------------->
[Jul 30 22:10:51] --- (15 headers 50 lines) ---
[Jul 30 22:10:51] Sending to 192.168.1.232:5060 (NAT)
[Jul 30 22:10:51] Sending to 192.168.1.232:5060 (NAT)
[Jul 30 22:10:51] Using INVITE request as basis request - 038f98e43077252f52a5f7d1200f7ff4@192.168.1.232:5060
[Jul 30 22:10:51] Found peer 'gs102' for 'gs102' from 192.168.1.232:5060
[Jul 30 22:10:51]
[Jul 30 22:10:51] <--- Reliably Transmitting (NAT) to 192.168.1.232:5060 --->
[Jul 30 22:10:51] SIP/2.0 401 Unauthorized
[Jul 30 22:10:51] Via: SIP/2.0/UDP 192.168.1.232:5060;branch=z9hG4bK36128eb2;received=192.168.1.232;rport=5060
[Jul 30 22:10:51] From: "Test Admin Phone" <sip:gs102@192.168.1.232>;tag=as3fe99d70
[Jul 30 22:10:51] To: <sip:+14389191747@192.168.1.212>;tag=as48e4b7de
[Jul 30 22:10:51] Call-ID: 038f98e43077252f52a5f7d1200f7ff4@192.168.1.232:5060
[Jul 30 22:10:51] CSeq: 102 INVITE
[Jul 30 22:10:51] Server: Asterisk PBX 11.25.1-vici
[Jul 30 22:10:51] Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
[Jul 30 22:10:51] Supported: replaces, timer
[Jul 30 22:10:51] WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="1e8571d4"
[Jul 30 22:10:51] Content-Length: 0
[Jul 30 22:10:51]
[Jul 30 22:10:51]
[Jul 30 22:10:51] <------------>
[Jul 30 22:10:51] Scheduling destruction of SIP dialog '038f98e43077252f52a5f7d1200f7ff4@192.168.1.232:5060' in 32000 ms (Method: INVITE)
[Jul 30 22:10:51]
[Jul 30 22:10:51] <--- SIP read from UDP:192.168.1.232:5060 --->
[Jul 30 22:10:51] ACK sip:+14389191747@192.168.1.212 SIP/2.0
[Jul 30 22:10:51] Via: SIP/2.0/UDP 192.168.1.232:5060;branch=z9hG4bK36128eb2;rport
[Jul 30 22:10:51] Max-Forwards: 70
[Jul 30 22:10:51] From: "Test Admin Phone" <sip:gs102@192.168.1.232>;tag=as3fe99d70
[Jul 30 22:10:51] To: <sip:+14389191747@192.168.1.212>;tag=as48e4b7de
[Jul 30 22:10:51] Contact: <sip:gs102@192.168.1.232:5060>
[Jul 30 22:10:51] Call-ID: 038f98e43077252f52a5f7d1200f7ff4@192.168.1.232:5060
[Jul 30 22:10:51] CSeq: 102 ACK
[Jul 30 22:10:51] User-Agent: Asterisk PBX 11.25.1-vici
[Jul 30 22:10:51] Content-Length: 0
[Jul 30 22:10:51]
[Jul 30 22:10:51] <------------->
[Jul 30 22:10:51] --- (10 headers 0 lines) ---

c20xh2
 
Posts: 95
Joined: Mon Feb 20, 2017 2:28 am

Re: Trunk between Asterisk

Postby c20xh2 » Sun Jul 30, 2017 9:32 pm

Allright so I'm almost there,

Found out that having "gs102" configured on both vicidial was my problem here :

Jul 30 21:59:33] NOTICE[1180][C-00000012]: chan_sip.c:23309 handle_response_invite: Failed to authenticate on INVITE to '"Test Admin Phone" <sip:gs102@192.168.1.232>;tag=as3e1c5b9e'


I have one last problem and I'm pretty sure I will be good to go,

SERVER_A make the call to SERVER_B, but SERVER_B is not using the right "context" (I think ?!) to send the call to Twilio (sip allready configured and working with Twilio) :
Code: Select all
[Jul 30 22:30:11]   == Using SIP RTP CoS mark 5
[Jul 30 22:30:11]     -- Executing [+14389191747@trunkinbound:1] AGI("SIP/192.168.1.232-000007f5", "agi-DID_route.agi") in new stack
[Jul 30 22:30:11]     -- Launched AGI Script /usr/share/asterisk/agi-bin/agi-DID_route.agi
[Jul 30 22:30:11]     -- <SIP/192.168.1.232-000007f5>AGI Script agi-DID_route.agi completed, returning 0
[Jul 30 22:30:11]     -- Executing [+14389191747@trunkinbound:2] Hangup("SIP/192.168.1.232-000007f5", "") in new stack
[Jul 30 22:30:11]   == Spawn extension (trunkinbound, +14389191747, 2) exited non-zero on 'SIP/192.168.1.232-000007f5'
[Jul 30 22:30:11]     -- Executing [h@trunkinbound:1] AGI("SIP/192.168.1.232-000007f5", "agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----16---------------") in new stack
[Jul 30 22:30:11]     -- <SIP/192.168.1.232-000007f5>AGI Script agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----16--------------- completed, returning 0
[Jul 30 22:30:11]   == Manager 'sendcron' logged off from 127.0.0.1


Almost there !
c20xh2
 
Posts: 95
Joined: Mon Feb 20, 2017 2:28 am

Re: Trunk between Asterisk

Postby c20xh2 » Sun Jul 30, 2017 9:58 pm

Finally made it work,

Final config if it can help someone :

SERVER A :

Account_entry :

Code: Select all
[Server_B]
type=friend
host=192.168.1.212
context=Server_B
allow=all
insecure=invite
qualify=yes
nat=force_rport,comedia
allowguest=yes


Dial plan :

Code: Select all
exten => _+1NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _+1NXXNXXXXXX,2,Dial(${SIPTRUNK}/+${EXTEN},,tTor)
exten => _+1NXXNXXXXXX,3,Hangup

exten => _NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _NXXNXXXXXX,2,Dial(${SIPTRUNK}/+1${EXTEN},,tTor)
exten => _NXXNXXXXXX,3,Hangup

exten => _1NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _1NXXNXXXXXX,2,Dial(${SIPTRUNK}/+${EXTEN},,tTor)
exten => _1NXXNXXXXXX,3,Hangup



Server B:

Account Entry:
Code: Select all
[Server_A]
type=friend
context=twilio
host=192.168.1.232
allow=all
insecure=invite
qualify=yes
nat=force_rport,comedia
allowguest=yes

[twilio]
disallow=all
allow=ulaw
type=friend
context=trunkinbound
dtmfmode=rfc4733
canreinvite=yes
host={myhost}
fromuser={myuser}
nat=force_rport,comedia
allowguest=yes


Dial Plan:
Code: Select all
[twilio]
exten => _+1NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _+1NXXNXXXXXX,2,Dial(${SIPTRUNK}/+${EXTEN:1},,tTor)
exten => _+1NXXNXXXXXX,3,Hangup

exten => _NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _NXXNXXXXXX,2,Dial(${SIPTRUNK}/+1${EXTEN},,tTor)
exten => _NXXNXXXXXX,3,Hangup

exten => _1NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _1NXXNXXXXXX,2,Dial(${SIPTRUNK}/+${EXTEN},,tTor)
exten => _1NXXNXXXXXX,3,Hangup


Sorry for using the forum to rubberduck like that, have a great one !
c20xh2
 
Posts: 95
Joined: Mon Feb 20, 2017 2:28 am


Return to Support

Who is online

Users browsing this forum: Bing [Bot] and 75 guests