You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
1.4 KiB

select b.tplg_descricao, tipo_chamada, a.uniqueid, a.calldate, a.src, a.dst, a.billsec, a.duration, a.userfield, case when(tplg_codigo in(23,24,33,34))then 'MÓVEL' else c.nome_municipio end as nome_municipio, c.uf
from pbx_bilhetes a
inner join pbx_tipo_ligacao b on b.tplg_codigo = a.tipo_chamada
left join pbx_municipios c on c.id = a.id_municipio
where tipo_chamada <> '99'
and uf = 'NI'
-- select * from pbx_tipo_ligacao where tplg_codigo in(23,24,33,34)
-- select * from pbx_municipios where id = -1 limit 10
select * from pbx_bilhetes where tipo_chamada <> '99' limit 10
select length(src), * from pbx_bilhetes where substring(src,1,2) = '00';
select length(dst), * from pbx_bilhetes where substring(dst,1,2) = '00';
-- 1, 4, 5, 25, 35
select calldate, uniqueid, src, dst, tipo_chamada, flag_fila, id_municipio from pbx_bilhetes where tipo_chamada = 25 limit 10
/*
insert into pbx_municipios(id, uf, nome_localidade, nome_municipio, prefixo, faixa_inicial, faixa_final, codigo_ddd)
values(0, 'LC', 'CHAMADAS INTERNAS/EMERGENCIA', 'CHAMADAS INTERNAS/EMERGENCIA', 0,0,0,0);
insert into pbx_municipios(id, uf, nome_localidade, nome_municipio, prefixo, faixa_inicial, faixa_final, codigo_ddd)
values(-1, 'NI', 'CHAMADAS NAO IDENTIFICADAS', 'CHAMADAS NAO IDENTIFICADAS', 0,0,0,0);
*/
-- Sintaxe chamada internacional
-- 00 + código pais + código de area + número