По необходимости недавно стал разбираться с Asterisk с целью организации VoIP на одном небольшом предприятии. Как и положено новичку, установил и настроил Asterisk 1.6 (Asterisk GUI) в соответствии с предложенной инструкцией на Хабрахабре. Внутренние номера и входящие звонки работают прекрасно, однако есть проблема с исходящими звонками — они не работают (сигнал: занято). Для диагностики проблемы привожу некоторые характеристики локальной сети, конфигурации Asterisk и отладочный вывод работающего сервиса.
1. SIP-сервер (sip.local или 10.7.7.2) расположен в локальной сети 10.7.7.0/24, на шлюзе 10.7.7.1 работает iptables со следующими правилами:
Код: Выделить всё
iptables -A INPUT -s 8.7.6.5 -i ppp0 -j ACCEPT
iptables -A OUTPUT -d 8.7.6.5 -j ACCEPT
iptables -A FORWARD -p udp -i ppp0 -o eth0 --dport 5060 -j ACCEPT
iptables -A FORWARD -p udp -i ppp0 -o eth0 --dport 10000:20000 -j ACCEPT
iptables -A INPUT -p udp -m udp -s 8.7.6.5 --dport 5060 -j ACCEPT
iptables -A INPUT -p udp -m udp -s 8.7.6.5 --dport 10000:20000 -j ACCEPT
iptables -t nat -A PREROUTING -p udp -s 8.7.6.5 -i ppp0 -m udp --dport 5060 -j DNAT --to-destination 10.7.7.2
iptables -t nat -A PREROUTING -p udp -s 8.7.6.5 -i ppp0 -m udp --dport 10000:20000 -j DNAT --to-destination 10.7.7.2
3. Отладочный вывод asterisk -rvvv (с sip set debug peer EVO):
(Попытка позвонить на номер: 123456, SIP-провайдер: sip.myprovider.ru или IP 8.7.6.5, внешний IP-адрес шлюза 4.3.2.1)
Код: Выделить всё
Asterisk SVN-branch-1.6.0-r347660, Copyright (C) 1999 - 2010 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
== Parsing '/etc/asterisk/asterisk.conf': == Found
== Parsing '/etc/asterisk/extconfig.conf': == Found
Connected to Asterisk SVN-branch-1.6.0-r347660 currently running on sip (pid = 16037)
sip*CLI>
Verbosity is at least 4
[Ksip*CLI>
== Using SIP RTP CoS mark 5
[Ksip*CLI>
-- Executing [123456@DLPN_DialingPlan:1] [1;36;40mMacro[0;37;40m("[1;35;40mSIP/6003-0000001a[0;37;40m", "[1;35;40mtrunkdial-failover-0.3,SIP/EVO/123456,,EVO,[0;37;40m") in new stack
[Ksip*CLI>
-- Executing [s@macro-trunkdial-failover-0.3:1] [1;36;40mGotoIf[0;37;40m("[1;35;40mSIP/6003-0000001a[0;37;40m", "[1;35;40m0?1-fmsetcid,1[0;37;40m") in new stack
-- Executing [s@macro-trunkdial-failover-0.3:2] [1;36;40mGotoIf[0;37;40m("[1;35;40mSIP/6003-0000001a[0;37;40m", "[1;35;40m0?1-setgbobname,1[0;37;40m") in new stack
[Ksip*CLI>
-- Executing [s@macro-trunkdial-failover-0.3:3] [1;36;40mSet[0;37;40m("[1;35;40mSIP/6003-0000001a[0;37;40m", "[1;35;40mCALLERID(num)=[0;37;40m") in new stack
-- Executing [s@macro-trunkdial-failover-0.3:4] [1;36;40mSet[0;37;40m("[1;35;40mSIP/6003-0000001a[0;37;40m", "[1;35;40mCALLERID(all)=[0;37;40m") in new stack
-- Executing [s@macro-trunkdial-failover-0.3:5] [1;36;40mGotoIf[0;37;40m("[1;35;40mSIP/6003-0000001a[0;37;40m", "[1;35;40m0?1-dial,1[0;37;40m") in new stack
-- Executing [s@macro-trunkdial-failover-0.3:6] [1;36;40mSet[0;37;40m("[1;35;40mSIP/6003-0000001a[0;37;40m", "[1;35;40mCALLERID(all)=[0;37;40m") in new stack
-- Executing [s@macro-trunkdial-failover-0.3:7] [1;36;40mSet[0;37;40m("[1;35;40mSIP/6003-0000001a[0;37;40m", "[1;35;40mCALLERID(all)=[0;37;40m") in new stack
[Ksip*CLI>
-- Executing [s@macro-trunkdial-failover-0.3:8] [1;36;40mGoto[0;37;40m("[1;35;40mSIP/6003-0000001a[0;37;40m", "[1;35;40m1-dial,1[0;37;40m") in new stack
-- Goto (macro-trunkdial-failover-0.3,1-dial,1)
[Ksip*CLI>
-- Executing [1-dial@macro-trunkdial-failover-0.3:1] [1;36;40mDial[0;37;40m("[1;35;40mSIP/6003-0000001a[0;37;40m", "[1;35;40mSIP/EVO/123456[0;37;40m") in new stack
== Using SIP RTP CoS mark 5
Audio is at 10.7.7.2 port 19872
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x8 (alaw) to SDP
Adding codec 0x2 (gsm) to SDP
Adding codec 0x800 (g726) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 8.7.6.5:5060:
INVITE sip:123456@sip.myprovider.su SIP/2.0
Via: SIP/2.0/UDP 10.7.7.2:5060;branch=z9hG4bK391c6be4;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@10.7.7.2>;tag=as703ea828
To: <sip:123456@sip.myprovider.su>
Contact: <sip:asterisk@10.7.7.2>
Call-ID: 5e7f2f6a511b568a0c2b4a33127010d0@10.7.7.2
CSeq: 102 INVITE
User-Agent: Asterisk PBX SVN-branch-1.6.0-r347660
Date: Fri, 29 Nov 2013 12:22:09 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 348
v=0
o=root 1606046480 1606046480 IN IP4 10.7.7.2
s=Asterisk PBX SVN-branch-1.6.0-r347660
c=IN IP4 10.7.7.2
t=0 0
m=audio 19872 RTP/AVP 0 8 3 2 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
---
-- Called EVO/123456
[Ksip*CLI>
<--- SIP read from UDP://8.7.6.5:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.7.7.2:5060;branch=z9hG4bK391c6be4;received=4.3.2.1;rport=5060
Call-ID: 5e7f2f6a511b568a0c2b4a33127010d0@10.7.7.2
From: "asterisk"<sip:asterisk@10.7.7.2>;tag=as703ea828
To: <sip:123456@sip.myprovider.su>
CSeq: 102 INVITE
Content-Length: 0
<------------->
--- (7 headers 0 lines) ---
[Ksip*CLI>
<--- SIP read from UDP://8.7.6.5:5060 --->
SIP/2.0 500 Server Internal Error
Via: SIP/2.0/UDP 10.7.7.2:5060;branch=z9hG4bK391c6be4;received=4.3.2.1;rport=5060
Call-ID: 5e7f2f6a511b568a0c2b4a33127010d0@10.7.7.2
From: "asterisk"<sip:asterisk@10.7.7.2>;tag=as703ea828
To: <sip:123456@sip.myprovider.su>;tag=7kvnvovc
CSeq: 102 INVITE
Content-Length: 0
<------------->
--- (7 headers 0 lines) ---
-- Got SIP response 500 "Server Internal Error" back from 8.7.6.5
Transmitting (no NAT) to 8.7.6.5:5060:
ACK sip:123456@sip.myprovider.su SIP/2.0
Via: SIP/2.0/UDP 10.7.7.2:5060;branch=z9hG4bK391c6be4;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@10.7.7.2>;tag=as703ea828
To: <sip:123456@sip.myprovider.su>;tag=7kvnvovc
Contact: <sip:asterisk@10.7.7.2>
Call-ID: 5e7f2f6a511b568a0c2b4a33127010d0@10.7.7.2
CSeq: 102 ACK
User-Agent: Asterisk PBX SVN-branch-1.6.0-r347660
Content-Length: 0
---
-- SIP/EVO-0000001b is circuit-busy
[Ksip*CLI>
== Everyone is busy/congested at this time (1:0/1/0)
[Ksip*CLI>
-- Executing [1-dial@macro-trunkdial-failover-0.3:2] [1;36;40mGotoIf[0;37;40m("[1;35;40mSIP/6003-0000001a[0;37;40m", "[1;35;40m0 > 0 ?1-CONGESTION,1:1-out,1[0;37;40m") in new stack
[Ksip*CLI>
-- Goto (macro-trunkdial-failover-0.3,1-out,1)
[Ksip*CLI>
-- Executing [1-out@macro-trunkdial-failover-0.3:1] [1;36;40mHangup[0;37;40m("[1;35;40mSIP/6003-0000001a[0;37;40m", "[1;35;40m[0;37;40m") in new stack
== Spawn extension (macro-trunkdial-failover-0.3, 1-out, 1) exited non-zero on 'SIP/6003-0000001a' in macro 'trunkdial-failover-0.3'
== Spawn extension (DLPN_DialingPlan, 123456, 1) exited non-zero on 'SIP/6003-0000001a'
[Ksip*CLI>
Really destroying SIP dialog '5e7f2f6a511b568a0c2b4a33127010d0@10.7.7.2' Method: INVITE
[Ksip*CLI>
Disconnected from Asterisk server
Executing last minute cleanups
Заранее благодарствую!