我想在家里搭建一个小型 Asterisk 服务器。我在 Ubuntu 上安装了 Asterisk,并使用 2 台计算机相互连接。连接后,我可以在 Wireshark 中看到注册器正常。以下是输出啜饮秀同行命令:
Name/username Host Dyn Forcerport ACL Port Status
uriel/uriel 192.168.1.101 D N 5060 Unmonitored
vibrant/vibrant 192.168.1.100 D N 5060 Unmonitored
2 sip peers [Monitored: 0 online, 0 offline Unmonitored: 2 online, 0 offline]
但问题是当我调用 sip 时:[电子邮件保护]我从 uriel 得到 404 未找到。
抱歉我的英语不好。
正如用户 MealstroM 所问,以下是我的 sip.conf:
[vibrant]
type=friend
username=vibrant
secret=
host=dynamic
context=tutorial
nat=yes
qualify=yes
[uriel]
type=friend
username=uriel
secret=
host=dynamic
context=tutorial
nat=yes
qualify=yes
对于 cli sip 设置调试同侪活力
uriel-desktop*CLI> sip set debug peer vibrant
SIP Debugging Enabled for IP: 192.168.1.100
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 192.168.1.100:5060;rport;branch=z9hG4bKPj5uU12iuF3c7r4U7XBIgX36ORxjGapenJ
Max-Forwards: 70
From: ;tag=v911t7.3Vk2K1-5Um-iWhFL6AmkL5uEq
To:
Contact:
Call-ID: M1IPA30WrJWAmikvmIk1fikAEUSD4q5c
CSeq: 4975 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
Content-Type: application/sdp
Content-Length: 600
v=0
o=- 3535974498 3535974498 IN IP4 192.168.1.100
s=pjmedia
c=IN IP4 192.168.1.100
t=0 0
a=X-nat:0
m=audio 40010 RTP/AVP 106 105 107 3 0 8 9 108 103 104 102 18 101
c=IN IP4 192.168.1.100
a=rtcp:40011 IN IP4 192.168.1.100
a=sendrecv
a=rtpmap:106 speex/16000
a=rtpmap:105 speex/8000
a=rtpmap:107 speex/32000
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:108 AMR/8000
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:102 ILBC/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
--- (14 headers 25 lines) ---
Sending to 192.168.1.100:5060 (no NAT)
Using INVITE request as basis request - M1IPA30WrJWAmikvmIk1fikAEUSD4q5c
Found peer 'vibrant' for '192.168.1.100' from 192.168.1.100:5060
Found RTP audio format 106
Found RTP audio format 105
Found RTP audio format 107
Found RTP audio format 3
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 9
Found RTP audio format 108
Found RTP audio format 103
Found RTP audio format 104
Found RTP audio format 102
Found RTP audio format 18
Found RTP audio format 101
Found audio description format speex for ID 106
Found audio description format speex for ID 105
Found audio description format speex for ID 107
Found audio description format GSM for ID 3
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Found audio description format G722 for ID 9
Found audio description format AMR for ID 108
Found audio description format ISAC for ID 103
Found audio description format ISAC for ID 104
Found audio description format ILBC for ID 102
Found audio description format G729 for ID 18
Found audio description format telephone-event for ID 101
Capabilities: us - 0x80000008000e (gsm|ulaw|alaw|h263|testlaw), peer - audio=0x20050170e (gsm|ulaw|alaw|g729|speex|speex16|ilbc|g722|h263p|mpeg4)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0xe (gsm|ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 192.168.1.100:40010
Looking for uriel in tutorial (domain 192.168.1.200)
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.1.100:5060;branch=z9hG4bKPj5uU12iuF3c7r4U7XBIgX36ORxjGapenJ;received=192.168.1.100;rport=5060
From: ;tag=v911t7.3Vk2K1-5Um-iWhFL6AmkL5uEq
To: ;tag=as4078a435
Call-ID: M1IPA30WrJWAmikvmIk1fikAEUSD4q5c
CSeq: 4975 INVITE
Server: Asterisk PBX 1.8.4.4~dfsg-2ubuntu1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0
[Jan 19 17:08:18] NOTICE[1081]: chan_sip.c:21614 handle_request_invite: Call from 'vibrant' to extension 'uriel' rejected because extension not found in context 'tutorial'.
Scheduling destruction of SIP dialog 'M1IPA30WrJWAmikvmIk1fikAEUSD4q5c' in 6400 ms (Method: INVITE)
ACK sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 192.168.1.100:5060;rport;branch=z9hG4bKPj5uU12iuF3c7r4U7XBIgX36ORxjGapenJ
Max-Forwards: 70
From: ;tag=v911t7.3Vk2K1-5Um-iWhFL6AmkL5uEq
To: ;tag=as4078a435
Call-ID: M1IPA30WrJWAmikvmIk1fikAEUSD4q5c
CSeq: 4975 ACK
Content-Length: 0
--- (8 headers 0 lines) ---
Really destroying SIP dialog 'M1IPA30WrJWAmikvmIk1fikAEUSD4q5c' Method: ACK
Reliably Transmitting (NAT) to 192.168.1.100:5060:
OPTIONS sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.200:5060;branch=z9hG4bK41ab4d90;rport
Max-Forwards: 70
From: "asterisk" ;tag=as47523e3d
To:
Contact:
Call-ID: [email protected]:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 1.8.4.4~dfsg-2ubuntu1
Date: Thu, 19 Jan 2012 15:08:39 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0
---
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.200:5060;rport=5060;received=192.168.1.200;branch=z9hG4bK41ab4d90
Call-ID: [email protected]:5060
From: "asterisk" ;tag=as47523e3d
To: ;tag=z9hG4bK41ab4d90
CSeq: 102 OPTIONS
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Accept: application/sdp, application/pidf+xml, application/xpidf+xml, application/simple-message-summary, message/sipfrag;version=2.0, application/im-iscomposing+xml, text/plain
Supported: replaces, 100rel, timer, norefersub
Allow-Events: presence, message-summary, refer
Content-Length: 0
--- (11 headers 0 lines) ---
Really destroying SIP dialog '[email protected]:5060' Method: OPTIONS
现在来看看 extensions.conf
[tutorial]
exten => uriel,1,Dial(SIP/uriel);
exten => vibrant,2,Dial(SIP/vibrant);
答案1
[Jan 19 17:08:18] NOTICE[1081]: chan_sip.c:21614 handle_request_invite: Call from 'vibrant' to extension 'uriel' rejected because extension not found in context 'tutorial'.
这样就解释明白了,能把教程内容贴出来吗?
答案2
解决了!将 extensions.conf 更改为:
[tutorial]
exten => uriel,1,Dial(SIP/[email protected]);
exten => vibrant,2,Dial(SIP/[email protected]);
我不知道这是不是正确的做法,但它是有效的
答案3
将分机号更改为数字,使其与您在 sip.conf 中配置的设备名称不匹配,以便可以通过电话拨打。此外,type=peer
您无需在 extensions.conf 中包含 @ip-address
如果有帮助的话请告诉我。
答案4
检查您的 Vibrant 分机的优先级编号。当您拨打 Vibrant 时,星号将在您的教程上下文中查找具有 Vibrant 分机的优先权。只需将 2 替换为 1 即可。