<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Direto consegui um resultado melhor Daviramos.<br>
<br>
Mas Sylvio pelo que vi aqui strpos só retorna verdadeiro ou falso.<br>
<br>
Pelo manager é melhor pois não preciso dar permissões ao usuário
www-data.<br>
<br>
Patrick<br>
<div class="moz-cite-prefix">Em 01-11-2012 10:24, Daviramos Roussenq
Fortunato escreveu:<br>
</div>
<blockquote
cite="mid:CABFgOvogUrMk-8WoO-eS+6qzT4Pm9K1Y0zM6pCCMg+5FYPrOpw@mail.gmail.com"
type="cite">Patrick,
<div><br>
</div>
<div> De uma olhada em <a moz-do-not-send="true"
href="http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+SIPpeers">http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+SIPpeers</a></div>
<div><br>
</div>
<div> Eu quando uso comando direto como está fazendo: sip show
peers, eu não uso o MANAGER, uso direto do console mesmo, segue
exemplo:</div>
<div><br>
</div>
<div><br>
</div>
<div><?</div>
<div>
<div>exec('/usr/sbin/asterisk -rx "sip show peers"', $result);</div>
<div>reset($result);</div>
<div>while (key($result) !== null) {</div>
</div>
<div> printf("%s-%s",key($result),current($result));</div>
<div> next($result);</div>
<div>}</div>
<div><br>
</div>
<div>?></div>
<div><br>
</div>
<div><br>
</div>
<div><br>
<div class="gmail_quote">Em 1 de novembro de 2012 10:14, Sylvio
Jollenbeck <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:sylvio.jollenbeck@gmail.com" target="_blank">sylvio.jollenbeck@gmail.com</a>></span>
escreveu:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Patrick,<br>
<br>
Dentro do while, use a função strpos do php.<br>
<br>
Abs<br>
<br>
Sylvio Jollenbeck<br>
<br>
<div class="gmail_quote">
<div>
<div class="h5">2012/11/1 Patrick EL Youssef <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:wushumasters@gmail.com"
target="_blank">wushumasters@gmail.com</a>></span><br>
</div>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div class="h5">
<div text="#000000" bgcolor="#FFFFFF"> Pessoal,<br>
<br>
Quem mexe bem com o manager e puder me ajudar.
Estou executando comando "sip show peers" via php
porém ele me retorna sempre as mensagens do
proprio manager junto do comando:<br>
<br>
<span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">Asterisk Call
Manager/1.2<span> </span></span><br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">Response: Success<span> </span></span><br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">Message:
Authentication accepted<span> </span></span><br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">Event: FullyBooted<span> </span></span><br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">Privilege:
system,all<span> </span></span><br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">Status: Fully
Booted<span> </span></span><br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">Response: Follows<span> </span></span><br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">Privilege: Command<span> </span></span><br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">Name/username Host
Dyn Forcerport ACL Port Status Description
Realtime<span> </span></span><br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">2000/2000
(Unspecified) D N A 0 UNKNOWN<span> </span></span><br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">2001/2001 <a
moz-do-not-send="true"
href="tel:192.168.1.131" value="+551921681131"
target="_blank">192.168.1.131</a> D N 5060
UNREACHABLE<span> </span></span><br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">2</span><span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px"> sip peers
[Monitored: 0 online, 2 offline Unmonitored: 0
online, 0 offline]<span> </span></span><br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">--END COMMAND--<span> </span></span><br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">Response: Goodbye<span> </span></span><br
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">
<span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:'Times
New Roman';word-spacing:0px">Message: Thanks for
all the fish.<span> </span></span><br>
<br>
Tem como eu só pegar a saída do comando mesmo. Meu
código php é esse:<br>
<br>
$socket = fsockopen("127.0.0.1","5038", $errno,
$errstr, 10);<br>
if (!$socket) {<br>
echo "$errstr ($errno)\n";<br>
} else {<br>
fputs($socket, "Action:
Login\r\n");<br>
fputs($socket, "UserName:
usuario\r\n");<br>
fputs($socket, "Secret:
senha\r\n\r\n");<br>
<br>
fputs($socket, "Action:
Command\r\n");<br>
fputs($socket, "Command: sip show
peers\r\n\r\n");<br>
fputs($socket, "Action:
Logoff\r\n\r\n");<br>
<br>
while (!feof($socket)) {<br>
echo
fgets($socket),'<br>';<br>
}<br>
<br>
fclose($socket);<br>
}<br>
<br>
Obrigado,<br>
Patrick<br>
</div>
<br>
</div>
</div>
_______________________________________________<br>
KHOMP Inovação: External Board Series<br>
Módulos de 1/2 rack e 1U para todas as interfaces e
soluções Asterisk e FreeSWITCH.<br>
Tenha a External Series Experience na sua aplicação.
Visite <a moz-do-not-send="true"
href="http://www.khomp.com" target="_blank">www.khomp.com</a><br>
_______________________________________________<br>
DIGIVOICE Fabricante de Placas de Voz e Channel Bank<br>
20 anos de experiência com E1(R2/ISDN), FXS, FXO e GSM<br>
Centro Treinamento - Curso de PABX IP - Asterisk -
Site <a moz-do-not-send="true"
href="http://www.digivoice.com.br" target="_blank">www.digivoice.com.br</a><br>
________<br>
YEALINK: Telefones IP e VídeoPhones IP com o melhor
custo/benefício do mercado.<br>
email: <a moz-do-not-send="true"
href="mailto:yealink@commlogik.com.br" target="_blank">yealink@commlogik.com.br</a>
| <a moz-do-not-send="true"
href="http://www.commlogik.com.br" target="_blank">www.commlogik.com.br</a>
| <a moz-do-not-send="true"
href="tel:%2811%29%205503-1011" value="+551155031011"
target="_blank">(11) 5503-1011</a><br>
______________________________________________<br>
Para remover seu email desta lista, basta enviar um
email em branco para <a moz-do-not-send="true"
href="mailto:asteriskbrasil-unsubscribe@listas.asteriskbrasil.org"
target="_blank">asteriskbrasil-unsubscribe@listas.asteriskbrasil.org</a><br>
</blockquote>
</div>
<br>
<br>
_______________________________________________<br>
KHOMP Inovação: External Board Series<br>
Módulos de 1/2 rack e 1U para todas as interfaces e soluções
Asterisk e FreeSWITCH.<br>
Tenha a External Series Experience na sua aplicação. Visite
<a moz-do-not-send="true" href="http://www.khomp.com"
target="_blank">www.khomp.com</a><br>
_______________________________________________<br>
DIGIVOICE Fabricante de Placas de Voz e Channel Bank<br>
20 anos de experiência com E1(R2/ISDN), FXS, FXO e GSM<br>
Centro Treinamento - Curso de PABX IP - Asterisk - Site <a
moz-do-not-send="true" href="http://www.digivoice.com.br"
target="_blank">www.digivoice.com.br</a><br>
________<br>
YEALINK: Telefones IP e VídeoPhones IP com o melhor
custo/benefício do mercado.<br>
email: <a moz-do-not-send="true"
href="mailto:yealink@commlogik.com.br">yealink@commlogik.com.br</a>
| <a moz-do-not-send="true"
href="http://www.commlogik.com.br" target="_blank">www.commlogik.com.br</a>
| <a moz-do-not-send="true" href="tel:%2811%29%205503-1011"
value="+551155031011">(11) 5503-1011</a><br>
______________________________________________<br>
Para remover seu email desta lista, basta enviar um email em
branco para <a moz-do-not-send="true"
href="mailto:asteriskbrasil-unsubscribe@listas.asteriskbrasil.org">asteriskbrasil-unsubscribe@listas.asteriskbrasil.org</a><br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
Atenciosamente<br>
Daviramos Roussenq Fortunato<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
KHOMP Inovação: External Board Series
Módulos de 1/2 rack e 1U para todas as interfaces e soluções Asterisk e FreeSWITCH.
Tenha a External Series Experience na sua aplicação. Visite <a class="moz-txt-link-abbreviated" href="http://www.khomp.com">www.khomp.com</a>
_______________________________________________
DIGIVOICE Fabricante de Placas de Voz e Channel Bank
20 anos de experiência com E1(R2/ISDN), FXS, FXO e GSM
Centro Treinamento - Curso de PABX IP - Asterisk - Site <a class="moz-txt-link-abbreviated" href="http://www.digivoice.com.br">www.digivoice.com.br</a>
________
YEALINK: Telefones IP e VídeoPhones IP com o melhor custo/benefício do mercado.
email: <a class="moz-txt-link-abbreviated" href="mailto:yealink@commlogik.com.br">yealink@commlogik.com.br</a> | <a class="moz-txt-link-abbreviated" href="http://www.commlogik.com.br">www.commlogik.com.br</a> | (11) 5503-1011
______________________________________________
Para remover seu email desta lista, basta enviar um email em branco para <a class="moz-txt-link-abbreviated" href="mailto:asteriskbrasil-unsubscribe@listas.asteriskbrasil.org">asteriskbrasil-unsubscribe@listas.asteriskbrasil.org</a></pre>
</blockquote>
<br>
</body>
</html>