<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Muito obrigado Yves, será muito util!<br><br>Abraço<br><br><div><hr id="stopSpelling">From: yvesfernandes@gmail.com<br>To: asteriskbrasil@listas.asteriskbrasil.org<br>Date: Tue, 25 Jun 2013 18:03:14 -0300<br>Subject: [AsteriskBrasil] RES: Envio de SMS - GOIP 1 - SMS Server<br><br><style><!--
.ExternalClass .ecxshape {
}
--></style><style><!--
.ExternalClass p.ecxMsoNormal, .ExternalClass li.ecxMsoNormal, .ExternalClass div.ecxMsoNormal {
font-size:12.0pt;
font-family:"Times New Roman","serif";
}
.ExternalClass a:link, .ExternalClass span.ecxMsoHyperlink {
color:blue;
text-decoration:underline;
}
.ExternalClass span.ecxMsoHyperlinkFollowed {
color:purple;
text-decoration:underline;
}
.ExternalClass p {
font-size:12.0pt;
font-family:"Times New Roman","serif";
}
.ExternalClass p.ecxMsoAcetate, .ExternalClass li.ecxMsoAcetate, .ExternalClass div.ecxMsoAcetate {
font-size:8.0pt;
font-family:"Tahoma","sans-serif";
}
.ExternalClass p.ecxmsonormal, .ExternalClass li.ecxmsonormal, .ExternalClass div.ecxmsonormal {
font-size:12.0pt;
font-family:"Times New Roman","serif";
}
.ExternalClass p.ecxmsoacetate, .ExternalClass li.ecxmsoacetate, .ExternalClass div.ecxmsoacetate {
font-size:12.0pt;
font-family:"Times New Roman","serif";
}
.ExternalClass p.ecxmsochpdefault, .ExternalClass li.ecxmsochpdefault, .ExternalClass div.ecxmsochpdefault {
font-size:12.0pt;
font-family:"Times New Roman","serif";
}
.ExternalClass span.ecxmsohyperlink {
}
.ExternalClass span.ecxmsohyperlinkfollowed {
}
.ExternalClass span.ecxestilodeemail17 {
}
.ExternalClass span.ecxtextodebalochar {
}
.ExternalClass p.ecxmsonormal1, .ExternalClass li.ecxmsonormal1, .ExternalClass div.ecxmsonormal1 {
font-size:11.0pt;
font-family:"Calibri","sans-serif";
}
.ExternalClass span.ecxmsohyperlink1 {
color:blue;
text-decoration:underline;
}
.ExternalClass span.ecxmsohyperlinkfollowed1 {
color:purple;
text-decoration:underline;
}
.ExternalClass p.ecxmsoacetate1, .ExternalClass li.ecxmsoacetate1, .ExternalClass div.ecxmsoacetate1 {
font-size:8.0pt;
font-family:"Tahoma","sans-serif";
}
.ExternalClass span.ecxestilodeemail171 {
font-family:"Calibri","sans-serif";
color:windowtext;
}
.ExternalClass span.ecxtextodebalochar1 {
font-family:"Tahoma","sans-serif";
}
.ExternalClass p.ecxmsochpdefault1, .ExternalClass li.ecxmsochpdefault1, .ExternalClass div.ecxmsochpdefault1 {
font-size:12.0pt;
font-family:"Calibri","sans-serif";
}
.ExternalClass span.ecxEstiloDeEmail32 {
font-family:"Calibri","sans-serif";
color:#1F497D;
}
.ExternalClass span.ecxTextodebaloChar {
font-family:"Tahoma","sans-serif";
}
.ExternalClass .ecxMsoChpDefault {
font-size:10.0pt;
}
.ExternalClass div.ecxWordSection1 {
}
--></style><div class="ecxWordSection1"><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US">O código está abaixo.</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;">É só trocar o IP(Colocar o do seu servidor sms server) o usuário e senha do mysql.</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;">Depois você dá permissão ao arquivo de execução.</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;">./nomedoarquivo DDD+TELEFONE “MENSAGEM MENSAGEM”</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;">Caso queria mandar para mais de um telefone é só colocat DDD+TELEFONE,DDD+TELEFONE, DDD+TELEFONE</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;">./nomedoarquivo DDD+TELEFONE, DDD+TELEFONE, DDD+TELEFONE “MENSAGEM MENSAGEM”</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;">==========================================================================================</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;">#!/usr/bin/php</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"><?php</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> $SMS_HOST = "10.200.1.252";</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> $SMS_USER = "root";</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> $SMS_PASS = "root";</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;">if( $argc != 3 ) {</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> fprintf( STDERR, "Usage: %s \"TELEFONE[,TELEFONE]*\" \"MENSAGEM\"\n", $argv[0] );</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US">exit( 1 );</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> }</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> $tel = $argv[1];</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> $msg = $argv[2];</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> $db = mysql_connect( $SMS_HOST, 'sms', 'sms4321' ) or die('Erro ao conectar no mysql');</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> /* cria mensagem */</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> $sql = sprintf( "INSERT INTO goip.message (userid, msg, type, tel, prov) VALUES (1, \"%s\", 4, \"%s\", 1)", </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> addslashes( $msg ), addslashes( $tel ) );</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> mysql_query( $sql, $db ); </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> $id = mysql_insert_id( $db );</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> if( !$id || $id == 0 ) {</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> mysql_close( $db );</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;">fprintf( STDERR, "Nao foi possivel gerar mensagem\nSQL: %s\n", $sql );</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> exit( 1 );</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> }</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> /* insere mensagem no queue de envio</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> OBS: para cada telefone, um registro */ </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> $numeros = explode( ",", $tel );</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> for( $i=0; $i<count($numeros); $i++ ) {</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> $sql = sprintf( "INSERT INTO goip.sends (time, userid, messageid, goipid, provider, telnum) VALUES(NOW(), 1, %d, 1, \"1\", \"%s\")", $id, $numeros[$i] );</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> mysql_query( $sql, $db );</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> }</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> mysql_close( $db );</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;">/* executa script de envio via wget */</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US">$cmd = sprintf( "wget -q -O /dev/null \"http://%s/goip/en/resend.php?messageid=%d&USERNAME=%s&PASSWORD=%s\"", $SMS_HOST, $id, $SMS_USER, $SMS_PASS );</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> $ret = 0;</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> system( $cmd, $ret );</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> if( $ret != 0 ) {</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;" lang="EN-US"> </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;">fprintf( STDERR, "Nao foi possivel enviar o sms via comando\nCMD: %s\n", $cmd );</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> exit(1);</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> } </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> exit(0);</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;">?></span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;">================================================================================================</span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> </span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;"> </span></p><div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm;"><p class="ecxMsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";">De:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";"> asteriskbrasil-bounces@listas.asteriskbrasil.org [mailto:asteriskbrasil-bounces@listas.asteriskbrasil.org] <b>Em nome de </b>lucas farias<br><b>Enviada em:</b> terça-feira, 25 de junho de 2013 17:40<br><b>Para:</b> asteriskbrasil@listas.asteriskbrasil.org<br><b>Assunto:</b> Re: [AsteriskBrasil] Envio de SMS - GOIP 1 - SMS Server</span></p></div></div><p class="ecxMsoNormal"> </p><div><p class="ecxMsoNormal" style=""><span style="font-family:"Calibri","sans-serif";">Opa! Me envie este programinha por favor! Ficarei muito grato!<br><br>Abraços</span></p><div><div class="ecxMsoNormal" style="text-align:center;" align="center"><span style="font-family:"Calibri","sans-serif";"><hr id="ecxstopSpelling" size="2" width="100%" align="center"></span></div><p class="ecxMsoNormal" style=""><span style="font-family:"Calibri","sans-serif";">From: <a href="mailto:yvesfernandes@gmail.com">yvesfernandes@gmail.com</a><br>To: <a href="mailto:asteriskbrasil@listas.asteriskbrasil.org">asteriskbrasil@listas.asteriskbrasil.org</a><br>Date: Tue, 25 Jun 2013 17:38:23 -0300<br>Subject: [AsteriskBrasil] Envio de SMS - GOIP 1 - SMS Server</span></p><div><p class="ecxMsoNormal"><span style="font-family:"Calibri","sans-serif";">Prezados,</span></p><p class="ecxMsoNormal"><span style="font-family:"Calibri","sans-serif";"> </span></p><p class="ecxMsoNormal"><span style="font-family:"Calibri","sans-serif";">Desenvolvi um programinha em php para envio de sms pelo goip.</span></p><p class="ecxMsoNormal"><span style="font-family:"Calibri","sans-serif";"> </span></p><p class="ecxMsoNormal"><span style="font-family:"Calibri","sans-serif";">Quem quiser pode pedir aqui, que envio por e-mail.</span></p><p class="ecxMsoNormal"><span style="font-family:"Calibri","sans-serif";"> </span></p><p class="ecxMsoNormal"><span style="font-family:"Calibri","sans-serif";">Só lembrando que já tem que estar com o SMS Server instalado em algum host.</span></p><p class="ecxMsoNormal"><span style="font-family:"Calibri","sans-serif";"> </span></p><p class="ecxMsoNormal"><span style="font-family:"Calibri","sans-serif";">E quem quiser me auxiliar a efetuar ligações do meu Asterisk 1.4.26.3 pelo GOIP, ficarei muito grato. Rrsrs.</span></p><p class="ecxMsoNormal"><span style="font-family:"Calibri","sans-serif";"> </span></p><p class="ecxMsoNormal"><span style="font-family:"Calibri","sans-serif";">Abraços</span></p><p class="ecxMsoNormal"><span style="font-family:"Calibri","sans-serif";"> </span></p></div><p class="ecxMsoNormal"><span style="font-family:"Calibri","sans-serif";"><br>_______________________________________________ KHOMP: completa linha de placas externas FXO, FXS, GSM e E1; Media Gateways de 1 a 64 E1s para SIP com R2, ISDN e SS7; Intercomunicadores para acesso remoto via rede IP. Conhe</span><span style="font-family:"Tahoma","sans-serif";">�</span><span style="font-family:"Calibri","sans-serif";">a em <a href="http://www.Khomp.com" target="_blank">www.Khomp.com</a>. _______________________________________________ ALIGERA </span><span style="font-family:"Tahoma","sans-serif";">�</span><span style="font-family:"Calibri","sans-serif";"> Fabricante nacional de Gateways SIP-E1 para R2, ISDN e SS7. Placas de 1E1, 2E1, 4E1 e 8E1 para PCI ou PCI Express. Channel Bank </span><span style="font-family:"Tahoma","sans-serif";">�</span><span style="font-family:"Calibri","sans-serif";"> Appliance Asterisk - Acesse <a href="http://www.aligera.com.br" target="_blank">www.aligera.com.br</a>. _______________________________________________ Para remover seu email desta lista, basta enviar um email em branco para <a href="mailto:asteriskbrasil-unsubscribe@listas.asteriskbrasil.org">asteriskbrasil-unsubscribe@listas.asteriskbrasil.org</a></span></p></div></div></div><br>_______________________________________________
KHOMP: completa linha de placas externas FXO, FXS, GSM e E1;
Media Gateways de 1 a 64 E1s para SIP com R2, ISDN e SS7;
Intercomunicadores para acesso remoto via rede IP. Conhe�a em www.Khomp.com.
_______________________________________________
ALIGERA � Fabricante nacional de Gateways SIP-E1 para R2, ISDN e SS7.
Placas de 1E1, 2E1, 4E1 e 8E1 para PCI ou PCI Express.
Channel Bank � Appliance Asterisk - Acesse www.aligera.com.br.
_______________________________________________
Para remover seu email desta lista, basta enviar um email em branco para asteriskbrasil-unsubscribe@listas.asteriskbrasil.org</div>                                            </div></body>
</html>