[Solved] Inbound Trunk with Twilio

All installation and configuration problems and questions

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

[Solved] Inbound Trunk with Twilio

Postby c20xh2 » Mon Feb 20, 2017 3:03 am

Hello,

I'm able to send outbound calls with my current config.

Problem is for the inbound calls :

Code: Select all
NOTICE[964][C-000002a5]: chan_sip.c:26002 handle_request_invite: Call from 'twilio' (54.172.60.3:5060) to extension '+14388004130' rejected because extension not found in context 'trunkinbound'.


So here we go:

1) Version of VICIDIAL

VERSION: 2.14-588a
BUILD: 170211-1041

2) loadavg

top - 02:36:24 up 2 days, 10:35, 2 users, load average: 0.09, 0.12, 0.10
Tasks: 109 total, 2 running, 107 sleeping, 0 stopped, 0 zombie

3) Server Specs

Cluster, Asterisk is running with 100gig HDD and 4 gig ram

4) Codecs used

Not sure right now , dtmfmode=rfc4733

5) VOIP or PSTN

VOIP

6) OS

PRETTY_NAME="openSUSE Leap 42.1 (x86_64)"


My account entry :

Code: Select all
Account Entry:    [twilio]
disallow=all
allow=ulaw
sipdebug=yes
type=friend
context=trunkinbound
dtmfmode=rfc4733
canreinvite=no
insecure=port,invite
host= [i]secret[/i] # I'm hidding my host for the post, tell me if you need the info but Outbound is working so yeah..
fromuser=+14388004130



Globals String:

Code: Select all
SIPTRUNK = SIP/twilio



Dialplan Entry:

(explanation :
Twilio need to receive the number with that format : +1NXXNXXXXXX, the list I use have 3 different format for the number(with 1 , with +1 , without any prefix)
Twilio need to receive the caller ID with the (+) sign before the number, I add it with my dialplan because when I add it in the Campaign settings Vici seems to remove the (+) sign)

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

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

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




Asterisk -vvvvvr when I do a test call on Twilio :

Code: Select all
[Feb 20 02:45:38] NOTICE[964][C-000002ab]: chan_sip.c:26002 handle_request_invite: Call from 'twilio' (54.172.60.1:5060) to extension '+14388004130' rejected because extension not found in context 'trunkinbound'.



Sip Debug (my ip and my host have been replaced by (myip,myhost):


Code: Select all
[Feb 20 02:54:19] <--- SIP read from UDP:54.172.60.0:5060 --->
[Feb 20 02:54:19] INVITE sip:+14388004130@myip SIP/2.0
[Feb 20 02:54:19] Record-Route: <sip:54.172.60.0:5060;lr;ftag=32646804_6772d868_f3822c33-43d9-4afb-88c2-ab36d29df426>
[Feb 20 02:54:19] CSeq: 1 INVITE
[Feb 20 02:54:19] From: <sip:hello@myhost>;tag=32646804_6772d868_f3822c33-43d9-4afb-88c2-ab36d29df426
[Feb 20 02:54:19] To: <sip:+14388004130@myip>
[Feb 20 02:54:19] Max-Forwards: 65
[Feb 20 02:54:19] X-OhSip-Sas-Id: f73daa99-db2a-48ad-8702-66690fb54d98
[Feb 20 02:54:19] X-OhSIP-Servlet: SipCallOut
[Feb 20 02:54:19] X-OhSIP-Remote-Test-Id: sip-call-out 473
[Feb 20 02:54:19] X-OhSIP-Test-Params: {"request-uri":"sip:+14388004130@verification.twilio.com"}
[Feb 20 02:54:19] Diversion: <sip:+14388004130@public-vip.us1.twilio.com>;reason=unconditional
[Feb 20 02:54:19] Call-ID: 85a6cca2f5f22a23ff52c3648c769461@0.0.0.0
[Feb 20 02:54:19] Via: SIP/2.0/UDP 54.172.60.0:5060;branch=z9hG4bKc044.54dae611.0
[Feb 20 02:54:19] Via: SIP/2.0/UDP 172.18.20.178:5060;rport=5060;received=172.18.20.178;branch=z9hG4bKf3822c33-43d9-4afb-88c2-ab36d29df426_6772d868_391807532501931
[Feb 20 02:54:19] Contact: <sip:hello@172.18.20.178:5060;transport=udp>
[Feb 20 02:54:19] Allow: INVITE,ACK,CANCEL,OPTIONS,BYE
[Feb 20 02:54:19] User-Agent: Twilio Gateway
[Feb 20 02:54:19] X-Twilio-AccountSid: ACcf42b68fd002addca69a6be86af201cf
[Feb 20 02:54:19] Content-Type: application/sdp
[Feb 20 02:54:19] X-Twilio-CallSid: CA7cee61b9eb57eebfd12a3850f9fed8b9
[Feb 20 02:54:19] Content-Length: 253
[Feb 20 02:54:19]
[Feb 20 02:54:19] v=0
[Feb 20 02:54:19] o=- 1299011811 1299011811 IN IP4 54.172.60.112
[Feb 20 02:54:19] s=Twilio Media Gateway
[Feb 20 02:54:19] c=IN IP4 54.172.60.112
[Feb 20 02:54:19] t=2208988800 2208988800
[Feb 20 02:54:19] m=audio 12130 RTP/AVP 0 101
[Feb 20 02:54:19] a=rtpmap:0 PCMU/8000
[Feb 20 02:54:19] a=rtpmap:101 telephone-event/8000
[Feb 20 02:54:19] a=fmtp:101 0-16
[Feb 20 02:54:19] a=sendrecv
[Feb 20 02:54:19] a=ptime:20
[Feb 20 02:54:19] <------------->
[Feb 20 02:54:19] --- (21 headers 11 lines) ---
[Feb 20 02:54:19] Sending to 54.172.60.0:5060 (NAT)
[Feb 20 02:54:19] Sending to 54.172.60.0:5060 (NAT)
[Feb 20 02:54:19] Using INVITE request as basis request - 85a6cca2f5f22a23ff52c3648c769461@0.0.0.0
[Feb 20 02:54:19] Found peer 'twilio' for 'hello' from 54.172.60.0:5060
[Feb 20 02:54:19]   == Using SIP RTP CoS mark 5
[Feb 20 02:54:19] Found RTP audio format 0
[Feb 20 02:54:19] Found RTP audio format 101
[Feb 20 02:54:19] Found audio description format PCMU for ID 0
[Feb 20 02:54:19] Found audio description format telephone-event for ID 101
[Feb 20 02:54:19] Capabilities: us - (ulaw), peer - audio=(ulaw)/video=(nothing)/text=(nothing), combined - (ulaw)
[Feb 20 02:54:19] Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
[Feb 20 02:54:19] Peer audio RTP is at port 54.172.60.112:12130
[Feb 20 02:54:19] Looking for +14388004130 in trunkinbound (domain myip)
[Feb 20 02:54:19]
[Feb 20 02:54:19] <--- Reliably Transmitting (NAT) to 54.172.60.0:5060 --->
[Feb 20 02:54:19] SIP/2.0 404 Not Found
[Feb 20 02:54:19] Via: SIP/2.0/UDP 54.172.60.0:5060;branch=z9hG4bKc044.54dae611.0;received=54.172.60.0;rport=5060
[Feb 20 02:54:19] Via: SIP/2.0/UDP 172.18.20.178:5060;rport=5060;received=172.18.20.178;branch=z9hG4bKf3822c33-43d9-4afb-88c2-ab36d29df426_6772d868_391807532501931
[Feb 20 02:54:19] From: <sip:hello@myhost>;tag=32646804_6772d868_f3822c33-43d9-4afb-88c2-ab36d29df426
[Feb 20 02:54:19] To: <sip:+14388004130@myip>;tag=as06cc8540
[Feb 20 02:54:19] Call-ID: 85a6cca2f5f22a23ff52c3648c769461@0.0.0.0
[Feb 20 02:54:19] CSeq: 1 INVITE
[Feb 20 02:54:19] Server: Asterisk PBX 11.25.1-vici
[Feb 20 02:54:19] Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
[Feb 20 02:54:19] Supported: replaces, timer
[Feb 20 02:54:19] Content-Length: 0
[Feb 20 02:54:19]
[Feb 20 02:54:19]
[Feb 20 02:54:19] <------------>
[Feb 20 02:54:19] NOTICE[964][C-000002b6]: chan_sip.c:26002 handle_request_invite: Call from 'twilio' (54.172.60.0:5060) to extension '+14388004130' rejected because extension not found in context 'trunkinbound'.
[Feb 20 02:54:19] Scheduling destruction of SIP dialog '85a6cca2f5f22a23ff52c3648c769461@0.0.0.0' in 6400 ms (Method: INVITE)
[Feb 20 02:54:19]
[Feb 20 02:54:19] <--- SIP read from UDP:54.172.60.0:5060 --->
[Feb 20 02:54:19] ACK sip:+14388004130@myip SIP/2.0
[Feb 20 02:54:19] Via: SIP/2.0/UDP 54.172.60.0:5060;branch=z9hG4bKc044.54dae611.0
[Feb 20 02:54:19] From: <sip:hello@myhost>;tag=32646804_6772d868_f3822c33-43d9-4afb-88c2-ab36d29df426
[Feb 20 02:54:19] Call-ID: 85a6cca2f5f22a23ff52c3648c769461@0.0.0.0
[Feb 20 02:54:19] To: <sip:+14388004130@myip>;tag=as06cc8540
[Feb 20 02:54:19] CSeq: 1 ACK
[Feb 20 02:54:19] Max-Forwards: 70
[Feb 20 02:54:19] User-Agent: Twilio Gateway
[Feb 20 02:54:19] Content-Length: 0
[Feb 20 02:54:19]
[Feb 20 02:54:19] <------------->
[Feb 20 02:54:19] --- (9 headers 0 lines) ---
[Feb 20 02:54:19] Really destroying SIP dialog '85a6cca2f5f22a23ff52c3648c769461@0.0.0.0' Method: ACK
[Feb 20 02:54:20] Reliably Transmitting (NAT) to 54.172.60.0:5060:
[Feb 20 02:54:20] OPTIONS sip:myhost SIP/2.0
[Feb 20 02:54:20] Via: SIP/2.0/UDP myip:5060;branch=z9hG4bK3a3b859f;rport
[Feb 20 02:54:20] Max-Forwards: 70
[Feb 20 02:54:20] From: "asterisk" <sip:+14388004130@myip>;tag=as66df5bdf
[Feb 20 02:54:20] To: <sip:myhost>
[Feb 20 02:54:20] Contact: <sip:+14388004130@myip:5060>
[Feb 20 02:54:20] Call-ID: 14bbaf650fcc680f20bba6571637078d@myip:5060
[Feb 20 02:54:20] CSeq: 102 OPTIONS
[Feb 20 02:54:20] User-Agent: Asterisk PBX 11.25.1-vici
[Feb 20 02:54:20] Date: Mon, 20 Feb 2017 07:54:20 GMT
[Feb 20 02:54:20] Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
[Feb 20 02:54:20] Supported: replaces, timer
[Feb 20 02:54:20] Content-Length: 0
[Feb 20 02:54:20]
[Feb 20 02:54:20]
[Feb 20 02:54:20] ---
[Feb 20 02:54:20]
[Feb 20 02:54:20] <--- SIP read from UDP:54.172.60.0:5060 --->
[Feb 20 02:54:20] SIP/2.0 200 OK
[Feb 20 02:54:20] Via: SIP/2.0/UDP myip:5060;received=myip;branch=z9hG4bK3a3b859f;rport=5060
[Feb 20 02:54:20] From: "asterisk" <sip:+14388004130@myip>;tag=as66df5bdf
[Feb 20 02:54:20] To: <sip:myhost>;tag=d1cbc6a212d9203d69304eca16fc0e77.5827
[Feb 20 02:54:20] Call-ID: 14bbaf650fcc680f20bba6571637078d@myip:5060
[Feb 20 02:54:20] CSeq: 102 OPTIONS
[Feb 20 02:54:20] Server: Twilio Gateway
[Feb 20 02:54:20] Content-Length: 0
[Feb 20 02:54:20]
[Feb 20 02:54:20] <------------->
[Feb 20 02:54:20] --- (8 headers 0 lines) ---
[Feb 20 02:54:20] Really destroying SIP dialog '14bbaf650fcc680f20bba6571637078d@myip:5060' Method: OPTIONS



I added the number in my Inbound/DID and try to setup it to a Voicemail, Inbound Group and Phone, always the same error.

Please tell me if you need more info/logs.

Thank you
Last edited by c20xh2 on Tue Feb 21, 2017 5:22 pm, edited 1 time in total.
c20xh2
 
Posts: 95
Joined: Mon Feb 20, 2017 2:28 am

Re: Inbound Trunk with Twilio

Postby ambiorixg12 » Tue Feb 21, 2017 9:46 am

Go to the following [trunkinbound] context and uncomment the following lines


; If you have DIDs that arrive with a plus sign at the beginning then uncomment
;exten => _+X.,1,AGI(agi-DID_route.agi)
;exten => _+X.,n,Hangup()
; If you have DIDs that arrive with a plus and 1 at the beginning that you want to filter out, then uncomment
;exten => _+1X.,1,Goto(trunkinbound,${EXTEN:2},1)
ambiorixg12
 
Posts: 453
Joined: Tue Sep 17, 2013 10:35 pm

Re: Inbound Trunk with Twilio

Postby c20xh2 » Tue Feb 21, 2017 5:22 pm

ambiorixg12, Thanks to you I learned something today. My inbound calls are now working.
c20xh2
 
Posts: 95
Joined: Mon Feb 20, 2017 2:28 am


Return to Support

Who is online

Users browsing this forum: Majestic-12 [Bot] and 129 guests