실행 중인 Debian 10 서버에서 HylaFax + IAXModem + Asterisk 설정을 얻으려고 합니다. 서버가 인터넷에 직접 연결되어 있고 방화벽이 비활성화되어 있습니다(규칙이 설정되어 있지 않음). 서버가 해야 할 유일한 일은 팩스를 보내는 것입니다. 저는 시프게이트 트렁크를 사용합니다. HylaFax가 팩스를 보내려고 하는 동안 Asterisk 콘솔에 다음 출력이 표시됩니다(SIP 디버깅 및 자세한 내용은 on/10임).
-- Accepting AUTHENTICATED call from 127.0.0.1:4570:
-- > requested format = alaw,
-- > requested prefs = (),
-- > actual format = alaw,
-- > host prefs = (alaw),
-- > priority = mine
-- Executing [RECIPIENT@fax_out:1] Set("IAX2/iaxmodem-7708", "CALLERID(num)=CALLER") in new stack
-- Executing [RECIPIENT@fax_out:2] Set("IAX2/iaxmodem-7708", "CALLERID(name)=CALLER") in new stack
-- Executing [RECIPIENT@fax_out:3] SIPAddHeader("IAX2/iaxmodem-7708", "P-Preferred-Identity:<sip:CALLER>") in new stack
-- Executing [RECIPIENT@fax_out:4] Dial("IAX2/iaxmodem-7708", "SIP/sipconnect.sipgate.de/RECIPIENT,,r") in new stack
== Using SIP RTP CoS mark 5
Audio is at 17702
Adding codec alaw to SDP
Adding codec ulaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 217.10.68.150:5060:
INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 127.0.1.1:5060;branch=z9hG4bK12349644
Max-Forwards: 70
From: "CALLER" <sip:[email protected]>;tag=as65bc91b0
To: <sip:[email protected]:5060>
Contact: <sip:[email protected]:5060>
Call-ID: [email protected]
CSeq: 102 INVITE
User-Agent: Asterisk PBX 16.2.1~dfsg-1+deb10u1
Date: Mon, 21 Oct 2019 12:22:20 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
P-Preferred-Identity: <sip:CALLER>
P-Asserted-Identity: "CALLER" <sip:[email protected]>
Content-Type: application/sdp
Content-Length: 270
v=0
o=root 698738770 698738770 IN IP4 127.0.1.1
s=Asterisk PBX 16.2.1~dfsg-1+deb10u1
c=IN IP4 127.0.1.1
t=0 0
m=audio 17702 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=sendrecv
---
-- Called SIP/sipconnect.sipgate.de/RECIPIENT
<--- SIP read from UDP:217.10.68.150:5060 --->
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 127.0.1.1:5060;rport=5060;received=X.X.X.X;branch=z9hG4bK12349644
From: "CALLER" <sip:[email protected]>;tag=as65bc91b0
To: <sip:[email protected]:5060>;tag=c63713a666d5644779294882ed89253a.0c69
Call-ID: [email protected]
CSeq: 102 INVITE
Proxy-Authenticate: Digest realm="sipconnect.sipgate.de", nonce="Xa2kKF2tovxRNF/AcCiPaUlB/z/ev7jl"
Content-Length: 0
<------------->
--- (8 headers 0 lines) ---
Transmitting (no NAT) to 217.10.68.150:5060:
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 127.0.1.1:5060;branch=z9hG4bK12349644
Max-Forwards: 70
From: "CALLER" <sip:[email protected]>;tag=as65bc91b0
To: <sip:[email protected]:5060>;tag=c63713a666d5644779294882ed89253a.0c69
Contact: <sip:[email protected]:5060>
Call-ID: [email protected]
CSeq: 102 ACK
User-Agent: Asterisk PBX 16.2.1~dfsg-1+deb10u1
Content-Length: 0
---
Audio is at 17702
Adding codec alaw to SDP
Adding codec ulaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 217.10.68.150:5060:
INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 127.0.1.1:5060;branch=z9hG4bK248f1ffc
Max-Forwards: 70
From: "CALLER" <sip:[email protected]>;tag=as65bc91b0
To: <sip:[email protected]:5060>
Contact: <sip:[email protected]:5060>
Call-ID: [email protected]
CSeq: 103 INVITE
User-Agent: Asterisk PBX 16.2.1~dfsg-1+deb10u1
Proxy-Authorization: Digest username="USER", realm="sipconnect.sipgate.de", algorithm=MD5, uri="sip:[email protected]:5060", nonce="Xa2kKF2tovxRNF/AcCiPaUlB/z/ev7jl", response="42016e991f588a252062bb86b35a3f6c"
Date: Mon, 21 Oct 2019 12:22:20 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
P-Preferred-Identity: <sip:CALLER>
P-Asserted-Identity: "CALLER" <sip:[email protected]>
Content-Type: application/sdp
Content-Length: 270
v=0
o=root 698738770 698738771 IN IP4 127.0.1.1
s=Asterisk PBX 16.2.1~dfsg-1+deb10u1
c=IN IP4 127.0.1.1
t=0 0
m=audio 17702 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=sendrecv
---
<--- SIP read from UDP:217.10.68.150:5060 --->
SIP/2.0 100 trying -- your call is important to us
Via: SIP/2.0/UDP 127.0.1.1:5060;rport=5060;received=X.X.X.X;branch=z9hG4bK248f1ffc
From: "CALLER" <sip:[email protected]>;tag=as65bc91b0
To: <sip:[email protected]:5060>
Call-ID: [email protected]
CSeq: 103 INVITE
Content-Length: 0
<------------->
--- (7 headers 0 lines) ---
<--- SIP read from UDP:217.10.68.150:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 127.0.1.1:5060;rport=5060;received=X.X.X.X;branch=z9hG4bK248f1ffc
Record-Route: <sip:172.20.40.8;lr>
Record-Route: <sip:217.10.68.150;lr;ftag=as65bc91b0>
From: "CALLER" <sip:[email protected]>;tag=as65bc91b0
To: <sip:[email protected]:5060>;tag=as21618100
Call-ID: [email protected]
CSeq: 103 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces
Contact: <sip:[email protected]:5060>
Content-Length: 0
<------------->
--- (12 headers 0 lines) ---
sip_route_dump: route/path hop: <sip:217.10.68.150;lr;ftag=as65bc91b0>
sip_route_dump: route/path hop: <sip:172.20.40.8;lr>
-- SIP/sipconnect.sipgate.de-00000003 is ringing
<--- SIP read from UDP:217.10.68.150:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 127.0.1.1:5060;rport=5060;received=X.X.X.X;branch=z9hG4bK248f1ffc
Record-Route: <sip:172.20.40.8;lr>
Record-Route: <sip:217.10.68.150;lr;ftag=as65bc91b0>
From: "CALLER" <sip:[email protected]>;tag=as65bc91b0
To: <sip:[email protected]:5060>;tag=as21618100
Call-ID: [email protected]
CSeq: 103 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces
Contact: <sip:[email protected]:5060>
Content-Type: application/sdp
Content-Length: 298
v=0
o=root 1290589385 1290589385 IN IP4 217.116.117.70
s=sipgate VoIP GW
c=IN IP4 212.9.44.253
t=0 0
m=audio 15550 RTP/AVP 8 0 101
a=silenceSupp:off - - - -
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv
a=rtcp:15551
a=ptime:20
<------------->
--- (13 headers 14 lines) ---
Found RTP audio format 8
Found RTP audio format 0
Found RTP audio format 101
Found audio description format PCMA for ID 8
Found audio description format PCMU for ID 0
Found audio description format telephone-event for ID 101
Capabilities: us - (alaw|ulaw), peer - audio=(ulaw|alaw)/video=(nothing)/text=(nothing), combined - (alaw|ulaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
> 0x7f4634015640 -- Strict RTP learning after remote address set to: 212.9.44.253:15550
Peer audio RTP is at port 212.9.44.253:15550
sip_route_dump: route/path hop: <sip:217.10.68.150;lr;ftag=as65bc91b0>
sip_route_dump: route/path hop: <sip:172.20.40.8;lr>
set_destination: Parsing <sip:217.10.68.150;lr;ftag=as65bc91b0> for address/port to send to
set_destination: set destination to 217.10.68.150:5060
Transmitting (no NAT) to 217.10.68.150:5060:
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 127.0.1.1:5060;branch=z9hG4bK12463de5
Route: <sip:217.10.68.150;lr;ftag=as65bc91b0>,<sip:172.20.40.8;lr>
Max-Forwards: 70
From: "CALLER" <sip:[email protected]>;tag=as65bc91b0
To: <sip:[email protected]:5060>;tag=as21618100
Contact: <sip:[email protected]:5060>
Call-ID: [email protected]
CSeq: 103 ACK
User-Agent: Asterisk PBX 16.2.1~dfsg-1+deb10u1
Content-Length: 0
---
-- SIP/sipconnect.sipgate.de-00000003 answered IAX2/iaxmodem-7708
-- Channel SIP/sipconnect.sipgate.de-00000003 joined 'simple_bridge' basic-bridge <262f871a-8fc7-4bb9-a64b-981378a84acd>
-- Channel IAX2/iaxmodem-7708 joined 'simple_bridge' basic-bridge <262f871a-8fc7-4bb9-a64b-981378a84acd>
> 0x7f4634015640 -- Strict RTP switching to RTP target address 212.9.44.253:15550 as source
<--- SIP read from UDP:217.10.68.150:5060 --->
<------------->
<--- SIP read from UDP:217.10.68.150:5060 --->
BYE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 217.10.68.150;branch=z9hG4bKd711.674d11475dd9179e68c4eb52c2088642.0
Via: SIP/2.0/UDP 172.20.40.8;branch=z9hG4bKd711.39ae43c7fc3d82443eba26f3d75b5f39.0
Via: SIP/2.0/UDP 217.116.117.70:5060;branch=z9hG4bK5d2cbd05
Max-Forwards: 68
From: <sip:[email protected]:5060>;tag=as21618100
To: "CALLER" <sip:[email protected]>;tag=as65bc91b0
Call-ID: [email protected]
CSeq: 102 BYE
Reason: Q.850;cause=16
Content-Length: 0
X-hint: rr-enforced
<------------->
--- (12 headers 0 lines) ---
Sending to 217.10.68.150:5060 (no NAT)
Scheduling destruction of SIP dialog '[email protected]' in 6400 ms (Method: BYE)
<--- Transmitting (no NAT) to 217.10.68.150:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 217.10.68.150;branch=z9hG4bKd711.674d11475dd9179e68c4eb52c2088642.0;received=217.10.68.150
Via: SIP/2.0/UDP 172.20.40.8;branch=z9hG4bKd711.39ae43c7fc3d82443eba26f3d75b5f39.0
Via: SIP/2.0/UDP 217.116.117.70:5060;branch=z9hG4bK5d2cbd05
From: <sip:[email protected]:5060>;tag=as21618100
To: "CALLER" <sip:[email protected]>;tag=as65bc91b0
Call-ID: [email protected]
CSeq: 102 BYE
Server: Asterisk PBX 16.2.1~dfsg-1+deb10u1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0
<------------>
-- Channel SIP/sipconnect.sipgate.de-00000003 left 'simple_bridge' basic-bridge <262f871a-8fc7-4bb9-a64b-981378a84acd>
-- Channel IAX2/iaxmodem-7708 left 'simple_bridge' basic-bridge <262f871a-8fc7-4bb9-a64b-981378a84acd>
== Spawn extension (fax_out, RECIPIENT, 4) exited non-zero on 'IAX2/iaxmodem-7708'
-- Hungup 'IAX2/iaxmodem-7708'
Really destroying SIP dialog '[email protected]' Method: BYE
안에 /var/spool/hylafax/log/xferfaxlog
:
10/21/19 15:38 SEND 000000096 ttyIAX0 41 "" [email protected] "RECIPIENT" "" 2220072 0 0:00:03 0:00:00 "No carrier detected" "" "" "" "root" "00 00 00"
(발신자/수신자 번호와 사용자 이름을 여기서 바꿨습니다)
현재 방화벽이 실행되고 있지 않습니다.
root@asterisk:/etc/asterisk# iptables -nL
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
이것은 내 별표 구성입니다.
안에 /etc/asterisk/sip.conf
:
[general]
context=unauthenticated
bindport=5060
bindaddr=0.0.0.0
realm=domain.tld
externhost=domain.tld:5060
localnet=127.0.0.0/255.255.255.0
nat=no
srvlookup=yes
allowguest=no
alwaysauthreject=yes
register => USER:[email protected]/USER
[sipconnect.sipgate.de]
type=peer
host=sipconnect.sipgate.de
outboundproxy=sipconnect.sipgate.de
port=5060
username=USER
defaultuser=USER
fromuser=USER
fromdomain=sipconnect.sipgate.de
secret=PASS
dtmfmode=rfc2833
insecure=port,invite
canreinvite=no
directmedia=no
registertimeout=600
sendrpid=pai
usereqphone=no
t38pt_udptl=no
disallow=all
allow=alaw
allow=ulaw
qualify=yes
context=unauthenticated
(여기서 자격 증명과 도메인 이름을 교체했습니다)
안에 /etc/asterisk/extensions.conf
:
[general]
[sipgate_in]
exten => sipgate_in,1,Goto(siptrunk,${CUT(CUT(SIP_HEADER(To),@,1),:,2)},1)
[siptrunk]
exten => 1234567,1,Dial(IAX2/iaxmodem)
exten => 1234567,n,Hangup
[fax_out]
exten => _X.,1,Set(CALLERID(num)=00491231234567)
exten => _X.,n,Set(CALLERID(name)=${CALLERID(num)})
exten => _X.,n,SipAddHeader(P-Preferred-Identity:<sip:${CALLERID(num)}>)
exten => _X.,n,Dial(SIP/sipconnect.sipgate.de/${EXTEN},,r)
[unauthenticated]
(여기서 발신자 번호를 바꿨습니다)
안에 /etc/asterisk/iax.conf
:
[general]
bindport=4569
bindaddr=127.0.0.1
calltokenoptional=127.0.0.1/255.255.255.0
[iaxmodem]
port=4570
type=friend
host=dynamic
qualify=yes
secret=pwd
requirecalltoken=no
disallow=all
allow=alaw
jitterbuffer=no
trunk=no
context=fax_out
(여기서 자격 증명을 교체했습니다)
안에 /etc/iaxmodem/ttyIAX0
:
device /dev/ttyIAX0
owner uucp:uucp
mode 660
port 4570
refresh 60
server 127.0.0.1
peername iaxmodem
secret pwd
codec alaw
nojitterbuffer
(여기서 자격 증명을 교체했습니다)
IAXModem이 ttyIAX0
성공적으로 등록되었으며 Asterisk는 sipgate 트렁크에서 온라인 상태입니다. 알려진 작업 설정에서 수신자에게 팩스를 보내는 데 성공했습니다. 이전에는 일부 네트워크 프로토콜 오류가 발생했지만 테스트 중에 방화벽을 활성화하지 않았기 때문에 이러한 오류는 장치 등으로 등록하려는 시도에서 발생했습니다.
수신자는 T.38을 사용하지 않는 3CX를 실행하고 있으므로 T.38이 문제가 아닌지 확인하기 위해 내 구성에서도 T.38을 비활성화했습니다.
제가 이해하는 바에 따르면, 디버그 출력에는 팩스가 전송되기 전에 대상 장치가 끊겼다는 내용이 나와 있습니다. 내가 본 게 맞나? 통신이 왜 이렇게 작동하는지 아는 사람이 있나요? 조기 끊김 사유는 어떻게 알 수 있나요?
업데이트: 이제 다른 대상 번호로 팩스를 보낼 수 있게 되었습니다. 내가 모든 일을 제대로 했을 수도 있지만 3CX 팩스가 문제를 일으킵니다. 하지만 디버그 프로토콜에 대해서는 여전히 확신이 없습니다. 이 경우에도 그래야 하는 것처럼 보입니까?
업데이트 2: T.38 폴백이 대상 3CX에서 활성화되었으며 이제 Asterisk PBX에서 팩스를 수신합니다. 저는 3CX 구성, 즉 "폴백"이 무엇을 의미하는지 잘 모릅니다. 하지만 지금은 작동합니다. 초기 끊김의 원인을 어떻게 알 수 있는지 아직도 궁금합니다. 아마도 전혀 불가능할 수도 있습니다. 이제 내 구성이 실제 생활에 적합하기를 바랍니다.
답변1
이제 SIP 디버그를 통해 단방향 오디오 문제(RTP가 로컬 호스트 IP를 전송함)가 있음을 확인했습니다. nat=yes
이 트렁크에 대해 활성화해 보십시오 sipconnect.sipgate.de
. SIP 디버그에서 RDP를 위해 전송되는 공용 IP가 표시되어야 합니다 c=IN IP4 127.0.1.1
. c=IN IP4 your.public.ip.address
.
IP가 공격당하는 경우 기본 포트를 변경하는 대신 방화벽을 활성화하고 SIP 포트로의 트래픽만 허용하는 것이 좋습니다 sipconnect.sipgate.de
(일반적으로 공급자는 IP 목록 또는 범위를 제공합니다).