Sip 星号在URI中找不到域名

Sip 星号在URI中找不到域名,sip,asterisk,Sip,Asterisk,我正试图让Asterisk与瑞典Bahnhof IP电话提供商合作。他们没有正式支持第三方解决方案,但这从未阻止过我 无论如何,运行Asterisk 11.5.1的VoIP linux(Debian 7)在接口eth1上具有公共IP,box和Bahnhof VoIP服务器之间的防火墙(iptables)完全打开。来电正常。传出的消息与下面的日志中显示的不一样。我在网上自上而下搜索了一下,对这个问题有了初步的了解 我有另一个提供商(CellIP),它可以很好地使用这些相同的设置,我从未从他们那里收

我正试图让Asterisk与瑞典Bahnhof IP电话提供商合作。他们没有正式支持第三方解决方案,但这从未阻止过我

无论如何,运行Asterisk 11.5.1的VoIP linux(Debian 7)在接口eth1上具有公共IP,box和Bahnhof VoIP服务器之间的防火墙(iptables)完全打开。来电正常。传出的消息与下面的日志中显示的不一样。我在网上自上而下搜索了一下,对这个问题有了初步的了解

我有另一个提供商(CellIP),它可以很好地使用这些相同的设置,我从未从他们那里收到过任何404条如下的消息

sip.conf

...
[bahnhof]
type=peer
defaultuser=55500XXXXXX
fromuser=55500XXXXXX
context=default
secret=mypassword
host=bahnhof-lda.soho1.voip.bahnhof.net
fromdomain=bahnhof-lda.soho1.voip.bahnhof.net
insecure=port,invite
qualify=yes
canreinvite=no
dtmfmode=rfc2833
...
...
[010XXXXXXX-out]
exten => _0X.,1,Set(CALLERID(num)=55500XXXXXX)
exten => _0X.,n,Dial(SIP/${EXTEN}@bahnhof,30,trg)
exten => _0X.,n,Hangup()
...
extensions.conf

...
[bahnhof]
type=peer
defaultuser=55500XXXXXX
fromuser=55500XXXXXX
context=default
secret=mypassword
host=bahnhof-lda.soho1.voip.bahnhof.net
fromdomain=bahnhof-lda.soho1.voip.bahnhof.net
insecure=port,invite
qualify=yes
canreinvite=no
dtmfmode=rfc2833
...
...
[010XXXXXXX-out]
exten => _0X.,1,Set(CALLERID(num)=55500XXXXXX)
exten => _0X.,n,Dial(SIP/${EXTEN}@bahnhof,30,trg)
exten => _0X.,n,Hangup()
...
SIP调试

<------------>
Audio is at 10060
Adding codec 0x100 (g729) to SDP
Adding codec 0x2 (gsm) to SDP
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x8 (alaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 77.240.208.105:5060:
INVITE sip:0700XXXXXX@bahnhof-lda.soho1.voip.bahnhof.net SIP/2.0
Via: SIP/2.0/UDP 81.170.XXX.XXX:5060;branch=z9hG4bK4db8a605
Max-Forwards: 70
From: "0700XXXXXX" <sip:55500XXXXXX@bahnhof-lda.soho1.voip.bahnhof.net>;tag=as5eaad2ef
To: <sip:0700XXXXXX@bahnhof-lda.soho1.voip.bahnhof.net>
Contact: <sip:55500XXXXXX@81.170.XXX.XXX:5060>
Call-ID: 498e8f9616aadc0a658b301909fe58d7@bahnhof-lda.soho1.voip.bahnhof.net
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.8.11.0
Date: Wed, 16 Oct 2013 15:18:57 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 360

v=0
o=root 495353330 495353330 IN IP4 81.170.195.158
s=Asterisk PBX 1.8.11.0
c=IN IP4 81.170.XXX.XXX
t=0 0
m=audio 10060 RTP/AVP 18 3 0 8 101
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

---

<--- SIP read from UDP:77.240.208.105:5060 --->
SIP/2.0 100 Trying
User-Agent: Centile-Supra/1
CSeq: 102 INVITE
Via: SIP/2.0/UDP 81.170.XXX.XXX:5060;branch=z9hG4bK4db8a605
Content-Length: 0
From: "0700XXXXXX" <sip:55500XXXXXX@bahnhof-lda.soho1.voip.bahnhof.net>;tag=as5eaad2ef
To: <sip:0700XXXXXX@bahnhof-lda.soho1.voip.bahnhof.net>
Call-ID: 498e8f9616aadc0a658b301909fe58d7@bahnhof-lda.soho1.voip.bahnhof.net

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

<--- SIP read from UDP:77.240.208.105:5060 --->
SIP/2.0 404 No domain-name found in requestURI:0700XXXXXX
User-Agent: Intraswitch/7.5.6.4.SR4-SNAPSHOT_SCF-8
CSeq: 102 INVITE
Via: SIP/2.0/UDP 81.170.XXX.XXX:5060;branch=z9hG4bK4db8a605
Content-Length: 0
Record-Route: <sip:77.240.208.105;lr>
From: "0700XXXXXX" <sip:55500XXXXXX@bahnhof-lda.soho1.voip.bahnhof.net>;tag=as5eaad2ef
To: <sip:0700XXXXXX@bahnhof-lda.soho1.voip.bahnhof.net>;tag=e67fec39-f749-59b4-4b8f-c798e694a64b
Supported: replaces, 100rel, timer
Server: Intraswitch/7.5.6.4.SR4-SNAPSHOT_SCF-8
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, MESSAGE, PRACK, REFER, INFO, SUBSCRIBE, NOTIFY
Contact: <sip:0700XXXXXX@77.240.208.19:5061>
Call-ID: 498e8f9616aadc0a658b301909fe58d7@bahnhof-lda.soho1.voip.bahnhof.net
然后在extensions.conf中

[default]
exten => 55500XXXXXX,1,Goto(010XXXXXXX-in,s,1)
[default]
; Incoming calls on SE line 010XXXXXXX (steered from "register" section)
exten => 55500XXXXXX,1,Goto(010XXXXXXX-in,s,1)
; NOTHING MORE UNDER default

[extensions]
...
现在出站呼叫可以工作了,但是这里的Bahnhof实际上比Sipgate更加棘手,Bahnhof有一个SIP服务器集群,其中入站呼叫可以来自其中任何一个服务器。当Asterisk解析bahnhof-lda.soho1.voip.bahnhof.net时,它只取第一个ip地址,并将其视为SIP对等方。问题是,入站SIP呼叫可以来自六个地址中的任何一个,而不仅仅是您注册的地址

解决方案是添加[bahnhof-peer-01]、[bahnhof-peer-2]。。。每个ip地址的条目

[bahnhof-peer-01]
type=peer
context=default
host=77.240.208.19
insecure=port,invite
canreinvite=no
dtmfmode=rfc2833

[bahnhof-peer-02]
type=peer
context=default
host=77.240.208.20
insecure=port,invite
canreinvite=no
dtmfmode=rfc2833

...

只需在sip.conf中设置

Bad register: register => 55500XXXXXX:mypassword@bahnhof/2000
OK  register: register => 55500XXXXXX:mypassword@bahnhof/55500XXXXXX
[general]
context=default
allowguest=yes
alwaysauthreject=yes
extensions.conf

[default]
exten => 55500XXXXXX,1,Goto(010XXXXXXX-in,s,1)
[default]
; Incoming calls on SE line 010XXXXXXX (steered from "register" section)
exten => 55500XXXXXX,1,Goto(010XXXXXXX-in,s,1)
; NOTHING MORE UNDER default

[extensions]
...
这将允许接受任何来电,即使是未经验证的来电。有人可能会认为这是一种安全风险,但我的所有VoIP流量都被防火墙规则严格锁定,所以这就是我所采用的解决方案。此外,只要您在[general]中将上下文设置为default,并且在[default]上下文下有一个正确的设置,除了入站扩展之外,没有任何内容,您就可以了。匿名入站呼叫将无法访问您的中继线或分机,只能访问他们显然需要知道的入站分机(55500XXXXXX),以了解您的Bahnhof号码的入站规则


最后,该解决方案通过Bahnhof SIP提供商实现了出站和入站呼叫。从技术上讲,当您使用用户名作为注册行上的扩展名时,似乎会发生这样的情况:当发出出站呼叫时,这将强制对SIP服务器进行摘要身份验证。这反过来似乎满足了SIP服务器在URI中的域名部分。我并不完全清楚这一点,但显然起到了一定作用。

有人猜测bahnhof-lda.soho1.voip.bahnhof.net主机名是错误的。看看在您的sip.conf中使用bahnhof条目的IP地址是否有任何区别。尝试了一下,结果是我现在得到了一个找不到的sip/2.0 404,而在这些情况下,我最终要做的是启动xlite软电话,将其连接到问题提供商,并对sip流量执行数据包捕获。我从来没有发现一个提供商不支持xlite,所以他们不能欺骗你,SIP捕获会让你知道什么域名有效。解决方案添加在上面。