0

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

无论如何,运行 Asterisk 11.5.1 的 VoIP linux (Debian 7) 在接口 eth1 上有公共 IP,防火墙 (iptables) 在盒子和 Bahnhof VoIP 服务器之间完全打开。来电正常。传出不如下面的日志所示。我已经从上到下搜索了网络,并有关于这个问题的 zip。

我有另一个提供商(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
...

extensions.conf

...
[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

明显的错误是“SIP/2.0 404 No domain-name found in requestURI:0700XXXXXX”,但是导致这种情况的基本条件对我来说并不明显:]

请注意,所有 XXX 都是由于显而易见的原因而被掩盖的真实值。

非常感谢您尝试的任何帮助或想法!

已解决 - 2013 年 10 月 19 日更新

问题现已解决,运营商 Bahnhof(在瑞典)与 Sipgate 的设置类似。这意味着在如何配置 REGISTER 和 Trunk 方面几乎没有灵活性。这里一个不会影响一般 SIP 提供商的小错误在这里会产生重大影响,也许这是 Bahnhof 和 Sipgate 的高安全策略。简而言之,注册不良会阻止您拨打外线电话。

在 sip.conf 中归结为这一点,

Bad register: register => 55500XXXXXX:mypassword@bahnhof/2000
OK  register: register => 55500XXXXXX:mypassword@bahnhof/55500XXXXXX

然后在 extensions.conf 中,

[default]
exten => 55500XXXXXX,1,Goto(010XXXXXXX-in,s,1)

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

解决方案是为每个 IP 地址添加 [bahnhof-peer-01], [bahnhof-peer-2] ... 条目,

[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 中设置,

[general]
context=default
allowguest=yes
alwaysauthreject=yes

extensions.conf,

[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] 上下文中除了入站扩展之外没有任何内容,并且您有正确的设置,您就可以了。匿名呼入电话将无法访问您的中继线或分机,只能访问他们显然需要知道的呼入分机 (55500XXXXXX) 才能通过您的 Bahnhof 号码的呼入规则。

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

4

0 回答 0