<div>Obrigado Junior vou testar isso o mais breve possível desculpe a demora para responder mas estava enrolado com uma E1 com sinalização R2 aqui abraço, vou testar e postar os resultados vlw</div>  <div>&nbsp;</div>  <div>Eder de Souza</div>  <div><BR><BR>&nbsp;</div>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">  <DIV class=Section1>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Eder... e agora José.!!!?.. hehehe<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">É o seguinte, preferi alterar o logger.c para
 colocar um TIMESTAMP no arquivo queue_log no inicio das linhas para facilitar.<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Está ai. Exatamente como esta funcionando aqui. O “Motorzinho” que coleta o queue_log e joga em uma tabela no POSTGRE.<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Salve nosso amigo Cláudio Polegato Jr que me ajudou com essa rotina em C.<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">To mandando também o logger.c com a alteração para colocar o timestamp no inicio de cada linha do
 queue_log.<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Att:<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Rosilto Junior.<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Vc precisa criar a tabela no postrgres.. dessa forma..<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy;
 FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">CREATE TABLE "public"."queue_log" (<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp; "data" TIMESTAMP WITH TIME ZONE NOT NULL, <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp; "uid1" VARCHAR(50) NOT NULL, <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp; "uid2" VARCHAR(50), <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp; </SPAN></FONT><FONT
 face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">"fila" VARCHAR(50), <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp; "agente" VARCHAR(50), <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp; "evento" VARCHAR(80), <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp; "param1" VARCHAR(50), <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp; "param2" VARCHAR(50), <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp; "param3"
 VARCHAR(50)<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">) WITH OIDS;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Código fonte do “daemon”..<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY:
 Arial">---------------------- inicio motor.c -----------------------------------<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">#include &lt;stdio.h&gt;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">#include &lt;stdlib.h&gt;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">#include &lt;string.h&gt;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">#include &lt;libpq-fe.h&gt;<o:p></o:p></SPAN></FONT></div>  <div
 class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">#include &lt;time.h&gt;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">/*###########################################################*/<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">/* Conversor do queue_log para PostgreSQL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">/* Data:
 20-10-2006&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">/* DSS Telecomunicacoes e Informatica&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">/* Por: junior@dssnet.com.br&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<o:p></o:p></SPAN></FONT></div>  <div
 class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">/* Porto Velho - RO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">/*###########################################################*/<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN
 style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">#define MAX_CAMPOS 11<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">#define DELIMITADOR '|'<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">char* campos[MAX_CAMPOS];<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">int Preencher_Campos(char *linha)<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">{<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN
 style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp; char *inicio, *delimitador;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp; int campo_atual = 0;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp; inicio = linha;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp; delimitador = strchr(inicio, DELIMITADOR);<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (delimitador &amp;&amp; campo_atual &lt; MAX_CAMPOS-1)<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New"
 size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *delimitador = '\0';<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; campos[campo_atual++] = inicio;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inicio = delimitador + 1;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 delimitador = strchr(inicio, DELIMITADOR);<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp; campos[campo_atual++] = inicio;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp; return campo_atual;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;}<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New"
 size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">/*Objeto de conexão*/<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">PGconn *conn = NULL;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">/*Ponteiro de resultado*/<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">PGresult *result;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">int main()<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN
 lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">{<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">/*realiza a conexão*/<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">conn = PQconnectdb("host=localhost user=asterisk password=asterisk dbname=asterisk");<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">if(PQstatus(conn) == CONNECTION_OK)<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
 New'">{<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">printf("Conexão com o banco efetuada com sucesso. ");<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">}<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">else<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">{<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">printf("Falha na conexão. </SPAN></FONT><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Erro: %s",
 PQerrorMessage(conn));<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">PQfinish(conn);<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">return -1;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">}<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">//Delete lixo da
 tabela...<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result = PQexec(conn, "DELETE FROM queue_log WHERE evento = 'CONFIGRELOAD'");<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!result)<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { printf("Erro executando query."); }<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New"
 size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">else<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { switch(PQresultStatus(result)) <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case PGRES_EMPTY_QUERY:<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">printf("Nenhuma alteracao.");<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case
 PGRES_FATAL_ERROR:<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Erro na query: %s ", PQresultErrorMessage(result));<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">break;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case
 PGRES_COMMAND_OK:<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">printf("%s linhas afetadas. ", PQcmdTuples(result));<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default:<o:p></o:p></SPAN></FONT></div>  <div
 class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Query executada sem retorno.");<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<o:p></o:p></SPAN></FONT></div>  <div
 class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">FILE *arquivo;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">char consulta[1024];<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">char string[1024]; //string onde ficara a linha<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">int x = 0;<o:p></o:p></SPAN></FONT></div>  <div
 class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">int campos_lidos;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">char *delimitador, *inicio;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">int aux1;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">//#define DATE_FORMAT "%Y-%m-%d %T"<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">//time_t t;<o:p></o:p></SPAN></FONT></div> 
 <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">//struct tm tm;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">//char date[256];<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">//time(&amp;t);<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">//localtime_r(&amp;t, &amp;tm);<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">//strftime(date, sizeof(date), DATE_FORMAT, &amp;tm);<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US
 style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">arquivo = fopen("/var/log/asterisk/queue_log", "rt");<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">while (! feof(arquivo))&nbsp; <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">{<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">while(fgets(string, sizeof(string), arquivo)) //le arquivo<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;
 {&nbsp; <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp; delimitador = strchr(string, '\n');<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">while (delimitador)<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *delimitador = '\0';<o:p></o:p></SPAN></FONT></div> 
 <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("\n\n\nLinha: %s\n\n", string);<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; campos_lidos = Preencher_Campos(string);<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Campos LIDOS: %d\n", campos_lidos);<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int
 i;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (i=0; i&lt;campos_lidos-1; i++)<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Campo %2i: %s\n", i, campos[i]);<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //getchar();<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE:
 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Sendo a variável "campos_lidos" especificando quantos campos<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // foram encontrados<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // E o vetor "campos" apontando para o início de cada campo<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // desta linha na memória terminados por '\0'<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New"
 size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Aqui é contigo! ;-)<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strcpy(consulta,"");<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><FONT face="Courier New" size=2><SPAN
 lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">strcat(consulta,"INSERT INTO queue_log&nbsp; values ('");<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">for (i=0; i&lt; campos_lidos-1; i++)<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strcat(consulta,campos[i]);<o:p></o:p></SPAN></FONT></div>  <div
 class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strcat(consulta, "','");<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aux1 = i+1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
 New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strcat(consulta,campos[aux1]);<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></FONT><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">strcat(consulta, "')");<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result = PQexec(conn, consulta);<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT
 face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!result)<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { printf("Erro executando query."); }<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
 New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { switch(PQresultStatus(result)) <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;case PGRES_EMPTY_QUERY:<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
 New'">printf("Nenhuma alteracao.");<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case PGRES_FATAL_ERROR:<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Erro na query: %s ", PQresultErrorMessage(result));<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY:
 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">break;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case PGRES_COMMAND_OK:<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">printf("%s linhas afetadas. ", PQcmdTuples(result));<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT
 face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default:<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Query executada sem retorno.");<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 break;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;}<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inicio = delimitador + 1;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; delimitador = strchr(inicio, '\n');<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN
 style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp; x = x+1;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp; <o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp; }<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">}<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY:
 'Courier New'">fclose(arquivo); //fecha arquivo<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">/*Libera objeto da query*/<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">PQclear(result);<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">}<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
 New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">/*Verifica se a conexão está aberta e a encerra*/<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">if(conn != NULL)<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">PQfinish(conn);<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">}<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
 New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">------------------- fim motor.c --------------------------<o:p></o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <DIV>  <DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">  <HR tabIndex=-1 align=center width="100%" SIZE=2>  </SPAN></FONT></DIV>  <div class=MsoNormal><B><FONT face=Tahoma size=2><SPAN
 style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">De:</SPAN></FONT></B><FONT face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> asteriskbrasil-bounces@listas.asteriskbrasil.org [mailto:asteriskbrasil-bounces@listas.asteriskbrasil.org] <B><SPAN style="FONT-WEIGHT: bold">Em nome de </SPAN></B>eder souza<BR><B><SPAN style="FONT-WEIGHT: bold">Enviada em:</SPAN></B> quarta-feira, 13 de dezembro de 2006 09:20<BR><B><SPAN style="FONT-WEIGHT: bold">Para:</SPAN></B> <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:PersonName w:st="on">asteriskbrasil@listas.asteriskbrasil.org</st1:PersonName><BR><B><SPAN style="FONT-WEIGHT: bold">Assunto:</SPAN></B> Re: [AsteriskBrasil] RES: tabela CDR postgres billing !!!</SPAN></FONT><o:p></o:p></div></DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <DIV>  <div class=MsoNormal><FONT face="Times
 New Roman" size=3><SPAN style="FONT-SIZE: 12pt">Olá Junior <o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">Obrigado pela Dica estou começando a fazer um daemon em C que leia o arquivo queue_log e coloque os dados que acho interessante&nbsp;dentro de uma tabela do meu postgres, reparei que neste arquivo&nbsp;nao é mostrado a data e nem a hora que a fila foi atendida,&nbsp; mas não vejo isto como um problema&nbsp;posso comparar o ID da chamada e assim descobrir a data&nbsp;e a hora atraves da tabela CDR que esta no meu banco vou ter q fazer um join entre as tableas para comparar. <o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">Dei uma fuçada no histórico e vi uma mensagem
 sua "PostgreSQL rotina em C...sugestao" gostaria de saber se aquele fonte que vc postou em C vc já conseguiu fazer ?&nbsp; claro se conseguiu poste aqui o fonte para ajudar a galera e a mim me poupará tempo.<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">Obrigado pelas Dicas<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">Eder de Souza<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div
 class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><BR><BR>&nbsp;<o:p></o:p></SPAN></FONT></div></DIV>  <BLOCKQUOTE style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; MARGIN-TOP: 5pt; PADDING-LEFT: 4pt; MARGIN-BOTTOM: 5pt; PADDING-BOTTOM: 0cm; MARGIN-LEFT: 3.75pt; BORDER-LEFT: #1010ff 1.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: medium none">  <DIV>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Eder!!!<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Respondendo a 1 pergunta, vc consegue essa informação no arquivo /var/log/asterisk/queue_log&nbsp; nos flags “CONNECT” e “COMPLETECALLER” ou &nbsp;“COMPLETEAGENT”<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
 style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">No oráculo (voip-info.org) tem maiores detalhes. Sobre os parâmetros\eventos que o queue_log grava... com ele vc tem “tudo” o que acontece com as chamadas passadas pela fila,<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">não precisa(depende do caso) &nbsp;nem olhar o cdr..<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">No trixbox tem um “daemon” que fica rodando de tempo em tempo e “joga” o arquivo /var/log/asterisk/queue_log para uma tabela no banco de dados.<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div
 class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Vc pode fazer o seu e consultar direto na tabela..<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">A informação de “por quantos ramais” a ligação passou até ser atendida, no flag “CONNECT” tem a informação da última posição (na fila) que o chamador foi atendido.. não sei se ajuda..<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt;
 COLOR: navy; FONT-FAMILY: Arial">Att:.<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Jr..<o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></div></DIV>  <DIV>  <DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">  <HR tabIndex=-1 align=center width="100%" SIZE=2>  </SPAN></FONT></DIV>  <DIV>  <div class=MsoNormal><B><FONT face=Tahoma size=2><SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">De:</SPAN></FONT></B><FONT face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> asteriskbrasil-bounces@listas.asteriskbrasil.org [mailto:asteriskbrasil-bounces@listas.asteriskbrasil.org] <B><SPAN style="FONT-WEIGHT:
 bold">Em nome de </SPAN></B>eder souza<BR><B><SPAN style="FONT-WEIGHT: bold">Enviada em:</SPAN></B> segunda-feira, 11 de dezembro de 2006 22:33<BR><B><SPAN style="FONT-WEIGHT: bold">Para:</SPAN></B> <?xml:namespace prefix = u1 /><u1:PersonName u2:st="on"><st1:PersonName w:st="on">asteriskbrasil@listas.asteriskbrasil.org</u1:PersonName></st1:PersonName><BR><B><SPAN style="FONT-WEIGHT: bold">Assunto:</SPAN></B> [AsteriskBrasil] tabela CDR postgres billing !!!</SPAN></FONT><o:p></o:p></div></DIV></DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><o:p>&nbsp;</o:p></SPAN></FONT></div></DIV>  <DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">Olá lista possuo uma tabela CDR em postgres que faz bilhetagem de todas as ligações e dentrada e saidas feitas pelo asterisk, tenho uma dúvida possuo uma fila configurada como eu consigo inserir no meu banco o tempo que uma ligação de
 entrada demorou para ser atendida??<o:p></o:p></SPAN></FONT></div></DIV></DIV>  <DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></div></DIV></DIV>  <DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">Existe como saber isso ? se é possivel tbm bilhetar por quais ramais essa ligação passou antes de ser atendida por algum ramal tem como pessoal ? e como fazer isso caso for possivel !!!<o:p></o:p></SPAN></FONT></div></DIV></DIV>  <DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></div></DIV></DIV>  <DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">vlw pessoal<o:p></o:p></SPAN></FONT></div></DIV></DIV>  <DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE:
 12pt">&nbsp;<o:p></o:p></SPAN></FONT></div></DIV></DIV>  <DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">Eder de Souza<o:p></o:p></SPAN></FONT></div></DIV></DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">&nbsp; <o:p></o:p></SPAN></FONT></div></DIV>  <DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">  <HR align=center width="100%" SIZE=1>  </SPAN></FONT></DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">Yahoo! Search<BR>Música para ver e ouvir: <A href="http://us.rd.yahoo.com/mail/br/tagline/search/video/*http:/br.search.yahoo.com/search/video?p=james+blunt&amp;ei=UTF-8&amp;cv=g&amp;x=wrt&amp;vm=r&amp;fr=intl-mail-br-b">You're Beautiful, do James Blunt</A><o:p></o:p></SPAN></FONT></div></DIV>  <DIV>  <div class=MsoNormal><FONT face="Times New
 Roman" size=2><SPAN style="FONT-SIZE: 10pt">--<BR>No virus found in this incoming message.<BR>Checked by AVG Free Edition.<BR>Version: 7.5.432 / Virus Database: 268.15.16/582 - Release Date: 11/12/2006 16:32</SPAN></FONT><o:p></o:p></div></DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=2><SPAN style="FONT-SIZE: 10pt">--<BR>No virus found in this outgoing message.<BR>Checked by AVG Free Edition.<BR>Version: 7.5.432 / Virus Database: 268.15.16/582 - Release Date: 11/12/2006 16:32</SPAN></FONT><o:p></o:p></div></DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">----------------------------------------<BR>Estação VoIP 2006<BR>5 e 6 Dezembro<BR>Curitiba PR<BR>http://www.estacaovoip.com.br<BR><BR>_______________________________________________<BR>LIsta de discussões
 AsteriskBrasil.org<BR>AsteriskBrasil@listas.asteriskbrasil.org<BR>http://listas.asteriskbrasil.org/mailman/listinfo/asteriskbrasil<BR><BR>_______________________________________________<BR>Acesse o wiki AsteriskBrasil.org:<BR>http://www.asteriskbrasil.org<o:p></o:p></SPAN></FONT></div></BLOCKQUOTE>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><o:p>&nbsp;</o:p></SPAN></FONT></div>  <div><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">&nbsp; <o:p></o:p></SPAN></FONT></div>  <DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">  <HR align=center width="100%" SIZE=1>  </SPAN></FONT></DIV>  <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o <A
 href="http://us.rd.yahoo.com/mail/br/tagline/answers/*http:/br.answers.yahoo.com/">Yahoo! Respostas</A>!<o:p></o:p></SPAN></FONT></div>  <div><FONT face="Times New Roman" size=2><SPAN style="FONT-SIZE: 10pt">--<BR>No virus found in this incoming message.<BR>Checked by AVG Free Edition.<BR>Version: 7.5.432 / Virus Database: 268.15.16/582 - Release Date: 11/12/2006 16:32</SPAN></FONT><o:p></o:p></div></DIV>----------------------------------------<BR>Estação VoIP 2006<BR>5 e 6 Dezembro<BR>Curitiba PR<BR>http://www.estacaovoip.com.br<BR><BR>_______________________________________________<BR>LIsta de discussões AsteriskBrasil.org<BR>AsteriskBrasil@listas.asteriskbrasil.org<BR>http://listas.asteriskbrasil.org/mailman/listinfo/asteriskbrasil<BR><BR>_______________________________________________<BR>Acesse o wiki AsteriskBrasil.org:<BR>http://www.asteriskbrasil.org</BLOCKQUOTE><BR><p>&#32;__________________________________________________<br>Fale com seus amigos  de graça com o
 novo Yahoo! Messenger <br>http://br.messenger.yahoo.com/