我已经在这里呆了几天,似乎无法将来电路由到用户分机。 传出呼叫和内部 SIP 分机拨号都可以工作,但是,当呼叫与我为域设置和配置的 Twilio 弹性 SIP 中继关联的号码时,我收到来自运营商的"所有电路都忙"消息。
该系统是在 Ubuntu 14.04 上运行的 FreePBX 12.0.68 的全新安装,具有内部 SIP 分机拨号和中继上的出站呼叫。 Asterisk的Twilio中继配置取自这里和这里
type=peer
secret=xxxxxxxxxxxxxxxxxxx
username=xxxxxxxxxxxxxxx
host=xxxxxxxxx.pstn.twilio.com
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw
insecure=port,invite
fromuser=xxxxxxxxxxx
fromdomain=xxxxxxxxx.pstn.twilio.com
context=incoming
这是Twilio和服务器之间的TCP/UDP流量
Source Destination Protocal Info
10x.xxx.xx.xxx 10x.xxx.xxx.xx UDP Source port: 5060 Destination port: 5060
54.172.60.2 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.2 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.2 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.2 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.2 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.2 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.2 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.2 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.3 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.3 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.3 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.3 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.3 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.3 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.3 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.3 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.0 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.0 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
54.172.60.0 10x.xxx.xxx.xx SIP/SDP Request: INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com
10x.xxx.xx.xxx 10x.xxx.xxx.xx UDP Source port: 5060 Destination port: 5060
这是邀请 UDP 流
INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com SIP/2.0
Record-Route: <sip:54.172.60.0:5060;lr;ftag=11540065_6772d868_144031e0-db91-45e9-ae85-6de18ed14b19>
From: <sip:+16xxxxxxxxx@sip.us1.twilio.com;pstn-params=808481808882;cpc=ordinary>;tag=11540065_6772d868_144031e0-db91-45e9-ae85-6de18ed14b19
To: <sip:+14xxxxxxxxx@xxx.xxxxx.com;user=phone>
CSeq: 25149 INVITE
Max-Forwards: 132
Accept: application/sdp,application/isup,application/dtmf,application/dtmf-relay,multipart/mixed
Session-Expires: 1800
Min-SE: 90
Content-Disposition: session;handling=required
Diversion: sip:+14xxxxxxxxx@public-vip.us1.twilio.com;reason=unconditional
Call-ID: 33939be232ba77b26300353ace17928c@0.0.0.0
Via: SIP/2.0/UDP 54.172.60.0:5060;branch=z9hG4bKdf6c.854803a7.0
Via: SIP/2.0/UDP 172.18.18.39:5060;branch=z9hG4bK144031e0-db91-45e9-ae85-6de18ed14b19_6772d868_287964010429808
Contact: <sip:+16xxxxxxxxx@172.18.18.39:5060;transport=udp>
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE
User-Agent: Twilio Gateway
X-Twilio-AccountSid: ACaa6e5a9a0d40b2b12751f33b612ebf6e
X-Twilio-ApiVersion: 2010-04-01
Content-Type: application/sdp
X-Twilio-CallSid: CAcc7d0e0603fea476fdaa1c94d9243104
Content-Length: 233
v=0
o=- 412164138 412164138 IN IP4 54.172.60.23
s=SIP Media Capabilities
c=IN IP4 54.172.60.23
t=0 0
m=audio 11590 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=ptime:20
INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com SIP/2.0
Record-Route: <sip:54.172.60.0:5060;lr;ftag=11540065_6772d868_144031e0-db91-45e9-ae85-6de18ed14b19>
From: <sip:+16xxxxxxxxx@sip.us1.twilio.com;pstn-params=808481808882;cpc=ordinary>;tag=11540065_6772d868_144031e0-db91-45e9-ae85-6de18ed14b19
To: <sip:+14xxxxxxxxx@xxx.xxxxx.com;user=phone>
CSeq: 25149 INVITE
Max-Forwards: 132
Accept: application/sdp,application/isup,application/dtmf,application/dtmf-relay,multipart/mixed
Session-Expires: 1800
Min-SE: 90
Content-Disposition: session;handling=required
Diversion: sip:+14xxxxxxxxx@public-vip.us1.twilio.com;reason=unconditional
Call-ID: 33939be232ba77b26300353ace17928c@0.0.0.0
Via: SIP/2.0/UDP 54.172.60.0:5060;branch=z9hG4bKdf6c.854803a7.0
Via: SIP/2.0/UDP 172.18.18.39:5060;branch=z9hG4bK144031e0-db91-45e9-ae85-6de18ed14b19_6772d868_287964010429808
Contact: <sip:+16xxxxxxxxx@172.18.18.39:5060;transport=udp>
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE
User-Agent: Twilio Gateway
X-Twilio-AccountSid: ACaa6e5a9a0d40b2b12751f33b612ebf6e
X-Twilio-ApiVersion: 2010-04-01
Content-Type: application/sdp
X-Twilio-CallSid: CAcc7d0e0603fea476fdaa1c94d9243104
Content-Length: 233
v=0
o=- 412164138 412164138 IN IP4 54.172.60.23
s=SIP Media Capabilities
c=IN IP4 54.172.60.23
t=0 0
m=audio 11590 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=ptime:20
INVITE sip:+14xxxxxxxxx@xxx.xxxxx.com SIP/2.0
Record-Route: <sip:54.172.60.0:5060;lr;ftag=11540065_6772d868_144031e0-db91-45e9-ae85-6de18ed14b19>
From: <sip:+16xxxxxxxxx@sip.us1.twilio.com;pstn-params=808481808882;cpc=ordinary>;tag=11540065_6772d868_144031e0-db91-45e9-ae85-6de18ed14b19
To: <sip:+14xxxxxxxxx@xxx.xxxxx.com;user=phone>
CSeq: 25149 INVITE
Max-Forwards: 132
Accept: application/sdp,application/isup,application/dtmf,application/dtmf-relay,multipart/mixed
Session-Expires: 1800
Min-SE: 90
Content-Disposition: session;handling=required
Diversion: sip:+14xxxxxxxxx@public-vip.us1.twilio.com;reason=unconditional
Call-ID: 33939be232ba77b26300353ace17928c@0.0.0.0
Via: SIP/2.0/UDP 54.172.60.0:5060;branch=z9hG4bKdf6c.854803a7.0
Via: SIP/2.0/UDP 172.18.18.39:5060;branch=z9hG4bK144031e0-db91-45e9-ae85-6de18ed14b19_6772d868_287964010429808
Contact: <sip:+16xxxxxxxxx@172.18.18.39:5060;transport=udp>
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE
User-Agent: Twilio Gateway
X-Twilio-AccountSid: ACaa6e5a9a0d40b2b12751f33b612ebf6e
X-Twilio-ApiVersion: 2010-04-01
Content-Type: application/sdp
X-Twilio-CallSid: CAcc7d0e0603fea476fdaa1c94d9243104
Content-Length: 233
v=0
o=- 412164138 412164138 IN IP4 54.172.60.23
s=SIP Media Capabilities
c=IN IP4 54.172.60.23
t=0 0
m=audio 11590 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=ptime:20
我还在 FreePBX 接口中配置了一个传入路由,DID Number
设置为我的 Twilio 号码,Destination
直接设置为用户的 SIP 分机,相应的客户端正在运行并准备好接收呼叫。 我已经使用了netstat
和tcpdump
对我来说,看起来像是从 Twilio 发送的INVITE
请求,而 FreePBX 只是没有正确路由它?
我读到您遇到了NAT问题--我仍然想为遇到类似问题的人发布此内容。
我已经从我的几个PBX系统以及我们的一些客户端的ViciDIAL开源拨号器配置中获得了我的Twilio Elastic SIP中继正常运行。 我有一段时间似乎与OP描述的内容相同。
当然,我只在PBX上测试了入站 - 我尝试了几种不同的配置排列,直到我确定了使用Twilio而不是世界上任何其他SIP提供商的混乱之处。
首先,我唯一拥有的星号设置:
[twilio]
host=xxxxxxx.pstn.twilio.com
type=friend
dtmfmode=rfc4733
canreinivite=no
insecure=port,invite
[twilio1]
type=friend
insecure=port,invite
host=54.172.60.0
dtmfmode=rfc4733
canreinivite=no
[twilio2]
type=friend
insecure=port,invite
host=54.172.60.1
dtmfmode=rfc4733
canreinivite=no
。对于您将用于入站的每个 Twilio IP,依此类推,因为您永远不知道它将使用附近的哪个地理 IP。(我会注意到星号日志显示通过 IP 轮询调用,具体取决于您的地理区域)。
你可以在我的星号日志中看到一个例子,为了隐私起见,我只用(twilio_phone)替换了我的twilio电话号码:http://pastebin.com/rXz7cY39
另一个主要区别:
入站路由 (DID) 必须使用前导 + 符号声明,这在我的经验中并不常见
因此,使用 twilio,您必须将每个可能的 IP 作为中继包含在内,并且在拨出和创建入站路由时还要在号码前包含 +
希望这对任何努力实施的人都有帮助!