Intento ejecutar una configuración de HylaFax + IAXModem + Asterisk en un servidor Debian 10. El servidor está conectado directamente a Internet, el firewall está desactivado (no hay reglas configuradas). Lo único que tiene que hacer ese servidor es enviar fax. Yo uso un baúl sipgate. Mientras HylaFax intenta enviar el fax, veo este resultado en la consola de Asterisk (la depuración SIP y la detalle están activadas/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
En /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"
(Reemplacé el número del remitente/destinatario y el nombre de usuario aquí)
El Firewall no se está ejecutando actualmente:
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
Esta es mi configuración de Asterisk:
En /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
(Reemplacé las credenciales y el nombre de dominio aquí)
En /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]
(Reemplacé el número del remitente aquí)
En /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
(Reemplacé las credenciales aquí)
En /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
(Reemplacé las credenciales aquí)
El IAXModem ttyIAX0
se registró exitosamente, Asterisk está en línea en el troncal sipgate. El envío de un fax desde una configuración operativa conocida al destinatario se realizó correctamente. Anteriormente recibí algunos errores de protocolo de red, pero como no activé el firewall durante la prueba, estos provienen de algún intento de registrarme como dispositivo, etc.
En el destinatario se está ejecutando un 3CX que no usa T.38, por lo que también desactivé T.38 en mi configuración, solo para asegurarme de que T.38 no sea el problema.
Según tengo entendido, el resultado de la depuración dice que el dispositivo de destino colgó antes de enviar el fax. ¿Veo esto bien? ¿Alguien tiene alguna idea de por qué la comunicación se comporta así? ¿Cómo puedo saber el motivo del corte anticipado?
Actualizar: Ahora pude enviar un fax a otro número de destino. Quizás hice todo bien, pero el fax 3CX genera un problema. Pero todavía no estoy seguro acerca del protocolo de depuración: ¿parece que debería funcionar en este caso?
Actualización 2: El respaldo T.38 ha sido habilitado en el 3CX objetivo, ahora recibe fax desde mi PBX Asterisk. No sé mucho sobre la configuración de 3CX, lo que significa ese "alternativo", pero, sin embargo, ahora funciona. Todavía tengo curiosidad por saber cómo puedo averiguar el motivo del bloqueo anticipado; tal vez no sea posible en absoluto. Espero que mi configuración ahora sea buena para la vida real...
Respuesta1
Ahora con la depuración SIP, veo que tienes un problema de audio unidireccional (RTP en tu lado envía tu IP de host local). Intente habilitar nat=yes
para esta troncal sipconnect.sipgate.de
. En la depuración de SIP, debería ver que su IP pública se envía para RDP: c=IN IP4 127.0.1.1
debería ser: c=IN IP4 your.public.ip.address
.
Para que su IP sea atacada, en lugar de cambiar el puerto predeterminado, recomendaría habilitar el firewall y solo permitir el tráfico a su puerto SIP sipconnect.sipgate.de
(normalmente, los proveedores le brindan una lista o rango de IP).