Asterisk, IAXModem e HylaFax: Nenhuma operadora detectada

Asterisk, IAXModem e HylaFax: Nenhuma operadora detectada

Tento obter uma configuração HylaFax + IAXModem + Asterisk em um servidor Debian 10 em execução. O servidor está conectado diretamente à Internet, o firewall está desabilitado (sem regras configuradas). A única coisa que o servidor precisa fazer é enviar fax. Eu uso um tronco Sipgate. Enquanto o HylaFax está tentando enviar o fax, vejo esta saída no console do Asterisk (a depuração e verbosidade do SIP estão ativadas/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

Em /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"

(Substituí o número do remetente/destinatário e o nome de usuário aqui)

O Firewall não está em execução no momento:

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 é a minha configuração do Asterisk:

Em /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

(Substituí credenciais e nome de domínio aqui)

Em /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]

(Substituí o número do remetente aqui)

Em /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

(Substituí as credenciais aqui)

Em /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

(Substituí as credenciais aqui)

O IAXModem ttyIAX0foi registrado com sucesso, o Asterisk está online no tronco sipgate. O envio de um fax de uma configuração de trabalho conhecida para o destinatário foi bem-sucedido. Anteriormente recebi alguns erros de protocolo de rede, mas como não ativei o firewall durante os testes, eles vêm de alguma tentativa de registro como dispositivo etc...

No destinatário está um 3CX rodando que não usa T.38, então desativei o T.38 na minha configuração também, só para ter certeza de que o T.38 não é o problema.

Pelo que entendi, a saída de depuração diz que o dispositivo de destino desligou antes do envio do fax. Eu vejo isso certo? Alguém tem alguma ideia de por que a comunicação se comporta assim? Como posso saber o motivo do desligamento antecipado?

Atualizar: Consegui enviar um fax para outro número de destino agora. Talvez eu tenha feito tudo certo, mas o fax 3CX dá um problema. Mas ainda não tenho certeza sobre o protocolo de depuração - parece que deveria ser neste caso?

Atualização 2: O fallback T.38 foi habilitado no 3CX alvo, agora ele recebe fax do meu PBX Asterisk. Não sei muito sobre a configuração do 3CX, o que significa esse "substituto" - mas, no entanto, funciona agora. Ainda estou curioso para saber o motivo do desligamento antecipado - talvez não seja possível. Espero que minha configuração agora esteja boa para a vida real ...

Responder1

Agora, com a depuração SIP, vejo que você tem um problema de áudio unilateral (o RTP do seu lado envia o IP do host local). Tente ativar nat=yeseste trunk sipconnect.sipgate.de. Na depuração SIP, você deverá ver seu IP público sendo enviado para RDP: c=IN IP4 127.0.1.1deveria ser: c=IN IP4 your.public.ip.address.

Para o seu IP ser atacado, em vez de alterar a porta padrão, eu recomendaria ativar o firewall e permitir apenas o tráfego para a sua porta SIP sipconnect.sipgate.de(normalmente, os provedores fornecem uma lista ou intervalo de IPs).

informação relacionada