[AsteriskBrasil] A2Billing não gera CDR
João Marcelo Queiroz
jmbq em bol.com.br
Quarta Janeiro 19 12:57:38 BRST 2011
Estou com um problema relacionado ao CDR do A2Billing 1.6.0. Tudo vinha funcionando normalmente até o mês de novembro. Porém quando precisei puxar um relatório de dezembro vi que o CDR só ia até o dia 10/12/2010, depois disso não há mais registro no a2b. Utilizo o Trixbox 2.6.2.3 e lá eu tenho todos os registros atualizados.
Testei o user e password do a2b no MySQL e está ok. Vale frisar que para que as ligações saiam pelo sistema, é necessário digitar o PIN do a2b, isso funciona normalmente. O problema está apenas no CDR que não é salvo.
utilizo o contexto do a2b diretamente no from-internal-custom.
exten => _XXXXXX.,1,Answer
exten => _XXXXXX.,2,Wait,2
exten => _XXXXXX.,3,DeadAGI,a2billing.php
exten => _XXXXXX.,4,Wait,2
exten => _XXXXXX.,5,Hangup
A única alteração que fiz foi no firewall e fail2ban, mesmo acreditado não ter relação com o problema, segue meu script do iptables:
#!/bin/bash
iniciar (){
#regras firewall - JM
#libera para interface loopback
iptables -A INPUT -i lo -j ACCEPT
#libera acesso remoto e rede local
iptables -A INPUT -s xxx.xxx.xxx -j ACCEPT
iptables -A INPUT -s 192.168.0.0/255.255.255.0 -j ACCEPT
#libera ips do Brasil
iptables -A INPUT -p udp -s 177.0.0.0/11 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 177.0.0.0/11 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 186.192.0.0/11 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 186.192.0.0/11 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 186.224.0.0/11 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 186.224.0.0/11 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 187.0.0.0/11 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 187.0.0.0/11 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 187.32.0.0/11 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 187.32.0.0/11 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 187.64.0.0/11 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 187.64.0.0/11 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 187.96.0.0/11 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 187.96.0.0/11 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 189.0.0.0/11 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 189.0.0.0/11 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 189.32.0.0/11 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 189.32.0.0/11 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 189.64.0.0/11 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 189.64.0.0/11 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 189.96.0.0/11 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 189.96.0.0/11 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 200.17.0.0/16 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 200.17.0.0/16 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 200.18.0.0/15 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 200.18.0.0/15 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 200.20.0.0/16 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 200.20.0.0/16 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 200.96.0.0/13 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 200.96.0.0/13 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 200.128.0.0/9 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 200.128.0.0/9 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 201.0.0.0/12 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 201.0.0.0/12 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 201.16.0.0/12 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 201.16.0.0/12 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 201.32.0.0/12 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 201.32.0.0/12 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 201.48.0.0/12 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 201.48.0.0/12 --dport 10000:30000 -j ACCEPT
iptables -A INPUT -p udp -s 201.64.0.0/11 --dport 5060:5070 -j ACCEPT
iptables -A INPUT -p udp -s 201.64.0.0/11 --dport 10000:30000 -j ACCEPT
#bloqueia interface externa
iptables -A INPUT -i eth1 -j DROP
#libera portas
#iptables -A INPUT -p tcp --dport 22 -j ACCEPT
#iptables -A INPUT -p tcp --dport 53 -j ACCEPT
#iptables -A INPUT -p tcp --dport 80 -j ACCEPT
#iptables -A INPUT -p tcp --dport 443 -j ACCEPT
#iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
#iptables -A INPUT -p udp --dport 5060:5070 -j ACCEPT
#iptables -A INPUT -p udp --dport 10000:20000 -j ACCEPT
#iptables -A INPUT -p udp --dport 53 -j ACCEPT
#iptables -A INPUT -p udp --dport 4569 -j ACCEPT
#impede ping
iptables -A INPUT -p icmp --icmp-type echo-request -j DROP
#permite pacotes de conexoes ja iniciadas
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#protege contra IP spoofing
echo 1 > /proc/sys/net/ipv4/conf/default/rp_filter
#gera log
iptables -A INPUT -j log --log-level 3 --log-prefix "BLOQUEADO: "
#impede abertura de novas conexoes, bloqueando o acesso externo, com excecao das anteriores
iptables -A INPUT -p tcp -j DROP
iptables -A INPUT -p udp -j DROP
echo "Regras de firewall ativadas"
}
parar (){
iptables -F
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
echo "Regras de firewall desativadas"
}
case "$1" in
"start") iniciar ;;
"stop") parar ;;
"restart") parar; iniciar ;;
*) echo "Use os parametros start ou stop"
esac
/etc/init.d/fail2ban restart
_____________________
Segue log da ligação:
[2011-01-05 12:21:29] VERBOSE[26892] logger.c: [2011-01-05 12:21:29] -- Executing [xxxxxxx em from-internal:1] Answer("DGV/42", "") in new stack
[2011-01-05 12:21:29] VERBOSE[26892] logger.c: [2011-01-05 12:21:29] -- Executing [xxxxxxxx em from-internal:2] Wait("DGV/42", "2") in new stack
[2011-01-05 12:21:31] VERBOSE[26892] logger.c: [2011-01-05 12:21:31] -- Executing [xxxxxxxx em from-internal:3] DeadAGI("DGV/42", "a2billing.php") in new $
[2011-01-05 12:21:31] WARNING[26892] res_agi.c: Running DeadAGI on a live channel will cause problems, please use AGI
[2011-01-05 12:21:31] VERBOSE[26892] logger.c: [2011-01-05 12:21:31] -- Launched AGI Script /var/lib/asterisk/agi-bin/a2billing.php
[2011-01-05 12:21:32] VERBOSE[26892] logger.c: [2011-01-05 12:21:32] -- <DGV/42> Playing 'prepaid-enter-pin-number' (language 'pt_BR')
[2011-01-05 12:21:41] VERBOSE[26892] logger.c: [2011-01-05 12:21:41] -- AGI Script Executing Application: (DIAL) Options: (DGV/g1/xxxxxxxx|60|HRrL(2147$
[2011-01-05 12:21:41] VERBOSE[26892] logger.c: [2011-01-05 12:21:41] -- Limit Data for this call:
[2011-01-05 12:21:41] VERBOSE[26892] logger.c: [2011-01-05 12:21:41] > timelimit = 2147483647
[2011-01-05 12:21:41] VERBOSE[26892] logger.c: [2011-01-05 12:21:41] > play_warning = 61000
[2011-01-05 12:21:41] VERBOSE[26892] logger.c: [2011-01-05 12:21:41] > play_to_caller = yes
[2011-01-05 12:21:41] VERBOSE[26892] logger.c: [2011-01-05 12:21:41] > play_to_callee = no
[2011-01-05 12:21:41] VERBOSE[26892] logger.c: [2011-01-05 12:21:41] > warning_freq = 30000
[2011-01-05 12:21:41] VERBOSE[26892] logger.c: [2011-01-05 12:21:41] > start_sound = (null)
[2011-01-05 12:21:41] VERBOSE[26892] logger.c: [2011-01-05 12:21:41] > warning_sound = timeleft
[2011-01-05 12:21:41] VERBOSE[26892] logger.c: [2011-01-05 12:21:41] > end_sound = (null)
[2011-01-05 12:21:41] NOTICE[26892] chan_dgv.c: Asked to get a channel DGV/g1/xxxxxxxx using format AST_FORMAT_ULAW:ffWaveULaw
[2011-01-05 12:21:41] NOTICE[26892] chan_dgv.c: Group g1
[2011-01-05 12:21:41] VERBOSE[26892] logger.c: [2011-01-05 12:21:41] -- Called g1/xxxxxxxx
[2011-01-05 12:21:45] VERBOSE[26892] logger.c: [2011-01-05 12:21:45] -- DGV/1 is ringing
[2011-01-05 12:21:50] VERBOSE[26892] logger.c: [2011-01-05 12:21:50] -- DGV/1 is ringing
[2011-01-05 12:22:08] VERBOSE[26892] logger.c: [2011-01-05 12:22:08] -- DGV/1 answered DGV/42
[2011-01-05 12:22:12] WARNING[26892] file.c: Failed to write frame
[2011-01-05 12:22:12] VERBOSE[26892] logger.c: [2011-01-05 12:22:12] -- <DGV/42> Playing 'prepaid-enter-dest' (language 'br')
[2011-01-05 12:22:12] VERBOSE[26892] logger.c: [2011-01-05 12:22:12] -- Playing 'prepaid-invalid-digits' (escape_digits=#) (sample_offset 0)
[2011-01-05 12:22:12] WARNING[26892] file.c: Failed to write frame
[2011-01-05 12:22:12] WARNING[26892] file.c: Failed to write frame
[2011-01-05 12:22:12] VERBOSE[26892] logger.c: [2011-01-05 12:22:12] -- <DGV/42> Playing 'prepaid-enter-dest' (language 'br')
[2011-01-05 12:22:12] VERBOSE[26892] logger.c: [2011-01-05 12:22:12] -- Playing 'prepaid-invalid-digits' (escape_digits=#) (sample_offset 0)
[2011-01-05 12:22:12] WARNING[26892] file.c: Failed to write frame
[2011-01-05 12:22:12] VERBOSE[26892] logger.c: [2011-01-05 12:22:12] -- AGI Script a2billing.php completed, returning -1
[2011-01-05 12:22:12] VERBOSE[26892] logger.c: [2011-01-05 12:22:12] -- Executing [h em from-internal:1] Macro("DGV/42", "hangupcall") in new stack
[2011-01-05 12:22:12] VERBOSE[26892] logger.c: [2011-01-05 12:22:12] -- Executing [s em macro-hangupcall:1] GotoIf("DGV/42", "1?skiprg") in new stack
[2011-01-05 12:22:12] VERBOSE[26892] logger.c: [2011-01-05 12:22:12] -- Goto (macro-hangupcall,s,4)
[2011-01-05 12:22:12] DEBUG[26892] app_macro.c: Executed application: GotoIf
[2011-01-05 12:22:12] VERBOSE[26892] logger.c: [2011-01-05 12:22:12] -- Executing [s em macro-hangupcall:4] GotoIf("DGV/42", "1?skipblkvm") in new stack
[2011-01-05 12:22:12] VERBOSE[26892] logger.c: [2011-01-05 12:22:12] -- Goto (macro-hangupcall,s,7)
[2011-01-05 12:22:12] DEBUG[26892] app_macro.c: Executed application: GotoIf
[2011-01-05 12:22:12] VERBOSE[26892] logger.c: [2011-01-05 12:22:12] -- Executing [s em macro-hangupcall:7] GotoIf("DGV/42", "1?theend") in new stack
[2011-01-05 12:22:12] VERBOSE[26892] logger.c: [2011-01-05 12:22:12] -- Goto (macro-hangupcall,s,9)
[2011-01-05 12:22:12] DEBUG[26892] app_macro.c: Executed application: GotoIf
[2011-01-05 12:22:12] VERBOSE[26892] logger.c: [2011-01-05 12:22:12] -- Executing [s em macro-hangupcall:9] Hangup("DGV/42", "") in new stack
[2011-01-05 12:22:12] VERBOSE[26892] logger.c: [2011-01-05 12:22:12] == Spawn extension (macro-hangupcall, s, 9) exited non-zero on 'DGV/42' in macro 'hangupcall'
[2011-01-05 12:22:12] VERBOSE[26892] logger.c: [2011-01-05 12:22:12] == Spawn extension (macro-hangupcall, s, 9) exited non-zero on 'DGV/42'
[2011-01-05 12:22:12] NOTICE[26892] chan_dgv.c: Calling dg_HangUp on port 42
Qualquer ajuda seria bem vinda,
Atenciosamente,
João Queiroz
Mais detalhes sobre a lista de discussão AsteriskBrasil