<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16705" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Olá João.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Eu utilizo sempre o mysql direto pra fazer 
consultas ao banco, no exemplo abaixo pego a quantidade de segundos restantes na 
tabela sipusers e determino qual o tempo maximo em segundos o usuario pode falar 
na chamada.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>[globals]</FONT></DIV>
<DIV><FONT face=Arial size=2>dbhostname=127.0.0.1</FONT></DIV>
<DIV><FONT face=Arial size=2>dbusername=usuariomysql</FONT></DIV>
<DIV><FONT face=Arial size=2>dbpassword=senhadousuariomysql</FONT></DIV>
<DIV><FONT face=Arial size=2>dbname=nomedobancomysql</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>[seucontexto]</FONT></DIV>
<DIV><FONT face=Arial size=2>exten =&gt; _[3]XXXXXXX, 1, MYSQL( Connect connid 
${dbhostname} ${dbusername} ${dbpassword} ${dbname} )</FONT></DIV>
<DIV><FONT face=Arial size=2>exten =&gt;&nbsp;_[3]XXXXXXX, 2, MYSQL( Query 
resultid ${connid} SELECT `seconds_left`&nbsp; from `sip_users` where 
`accountcode`=${CALLERID(num):0:4} )</FONT></DIV>
<DIV><FONT face=Arial size=2>exten =&gt;&nbsp;_[3]XXXXXXX, 3, MYSQL( Fetch 
fetchid ${resultid} seconds_left )</FONT></DIV>
<DIV><FONT face=Arial size=2>exten =&gt;&nbsp;_[3]XXXXXXX, 4, 'MYSQL( Clear 
${resultid} )</FONT></DIV>
<DIV><FONT face=Arial size=2>exten =&gt;&nbsp;_[3]XXXXXXX, 5, 'MYSQL( Disconnect 
${connid} )</FONT></DIV>
<DIV><FONT face=Arial size=2>exten =&gt;&nbsp;_[3]XXXXXXX, 6, 
noop(&nbsp;Segundos restantes: ${seconds_left} segundos. )</FONT></DIV>
<DIV><FONT face=Arial size=2>exten =&gt;&nbsp;_[3]XXXXXXX, 7, 
set(&nbsp;TIMEOUT(absolute)=${seconds_left} )</FONT></DIV>
<DIV>
<DIV><FONT face=Arial size=2>exten =&gt;&nbsp;_[3]XXXXXXX, 8, Dial( 
SIP/${EXTEN}, 45, tT&nbsp;)</FONT></DIV></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>"SecondsLeft" = Tempo de ligações restante em 
segundos.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Ps.. vc pode fazer a conexao e obter os dados 
atraves de uma macro, assim o dialplan fica mais facil de&nbsp;visualizar e 
modifgicar as consultas sql.</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;</DIV>
<DIV><BR></DIV>
<DIV><BR></FONT>----- Original Message ----- </DIV>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=jamaicabsd@gmail.com href="mailto:jamaicabsd@gmail.com">joao 
  jamaicabsd</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A 
  title=asteriskbrasil@listas.asteriskbrasil.org 
  href="mailto:asteriskbrasil@listas.asteriskbrasil.org">asterisk BR</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Saturday, August 30, 2008 4:03 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> [AsteriskBrasil] chamando 
  AGI</DIV>
  <DIV><BR></DIV>
  <DIV dir=ltr>Boa tarde a todos!<BR>Estou tentando chamar um AGI para fazer uma 
  consulta no mysql e primeiramente gostaria de saber qual o parâmetro correto 
  para eu colocar dentro do extconfig.conf? Caso for realmente preciso.<BR><BR>O 
  meu extensions.conf está 
  assim:<BR><BR>[aluno]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exten 
  =&gt; 
  s,1,Playback(codmatricula)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  ;//pede para digitar sua 
  matricula<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exten =&gt; 
  1,1,set(OPCAO=${CALLERIDNUM})&nbsp;&nbsp; ;// para armazenar na variável OPCAO 
  o que a pessoa digitou no teclado é isso 
  mesmo?<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exten =&gt; 
  2,1,agi(consulta.agi)&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; 
  ;// é assim mesmo que chamo o AGI? Como faço para enviar para dentro do AGI a 
  variável OPCAO?<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exten =&gt; 
  3,1,Goto(ura-principal,s,1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  exten =&gt; 4,1,HangUp<BR><BR>Estou usando o FreeBSD, e o AGI está dentro do 
  diretório agi-bin.<BR>Estou desde ontem tentando resolver isso e nao consigo, 
  vc's podem me ajudar?<BR>Obrigado a todos e um bom find.<BR><BR><BR 
  clear=all><BR>-- <BR>E-mail: <A 
  href="mailto:jamaicabsd@gmail.com">jamaicabsd@gmail.com</A><BR>Aux Suporte de 
  Sistemas (UNISUL)<BR>E-mail: <A 
  href="mailto:joao.maykon@unisul.br">joao.maykon@unisul.br</A><BR>MSN: <A 
  href="mailto:joaomaykonm@hotmail.com">joaomaykonm@hotmail.com</A><BR>Cel: (48) 
  9144 2326<BR></DIV>
  <P>
  <HR>

  <P></P>_______________________________________________<BR>Compre uma camiseta 
  da AsteriskBrasil.org!<BR>http://www.voipmania.com.br<BR><BR>Acesse o canal 
  IRC de discussão sobre Asterisk em Português Brasileiro na rede Freenode.net: 
  #asterisk-br<BR>_______________________________________________<BR>Lista de 
  discussões 
  AsteriskBrasil.org<BR>AsteriskBrasil@listas.asteriskbrasil.org<BR>http://listas.asteriskbrasil.org/mailman/listinfo/asteriskbrasil</BLOCKQUOTE></BODY></HTML>