<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Just realized that maybe you’re talking about disconnecting any other AMI/manger connected user from another manager connection…hhmmm… I don’t think so. Check AMI commands from asterisk wiki. If not, you may need system command in your AMI connection to close some other socket. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] <b>On Behalf Of </b>Gohar Ahmed<br><b>Sent:</b> Thursday, August 25, 2011 4:25 PM<br><b>To:</b> 'Asterisk Users Mailing List - Non-Commercial Discussion'<br><b>Subject:</b> Re: [asterisk-users] How to know how many user is connected<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>What I understood: you need to disconnect the AMI socket.<o:p></o:p></p><p class=MsoNormal>1) I want to disconnect <b>connected manager</b> into Asterisk. Is it possible ? <span style='font-family:Wingdings'>ß</span> Close the $socket after you get the response. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>What I understood: you need to maintain the socket until some button is pressed to stop AMI<br>2) I want to maintain this socket connection until we disconnect it from web page. <span style='font-family:Wingdings'>ß</span> Close the $socket on particular action from web-page. This one’s tricky btw maintain a while loop and break loop on a condition toggled by web-page)<o:p></o:p></p><p class=MsoNormal>See php section for other examples.<o:p></o:p></p><p class=MsoNormal><a href="http://www.voip-info.org/wiki/view/Asterisk+manager+Examples">http://www.voip-info.org/wiki/view/Asterisk+manager+Examples</a> <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] <b>On Behalf Of </b>virendra bhati<br><b>Sent:</b> Thursday, August 25, 2011 4:02 PM<br><b>To:</b> Asterisk Users Mailing List - Non-Commercial Discussion<br><b>Subject:</b> Re: [asterisk-users] How to know how many user is connected<o:p></o:p></span></p></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'>Hi List,<br><br>Thanks now I am able to get all values from asterisk CLI but I want 2 more things .<br><br>1) I want to disconnect <b>connected manager</b> into Asterisk. Is it possible ?<br>2) I want to maintain this socket connection until we disconnect it from web page.<o:p></o:p></p><div><p class=MsoNormal>On Thu, Aug 25, 2011 at 1:57 PM, virendra bhati <<a href="mailto:virbhati@gmail.com">virbhati@gmail.com</a>> wrote:<o:p></o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'>Hi List,<br><br>Thanks for guide me. Yes I know that CLI command , My motive is to get information into Php that's why I am finding the solution. <br><br>Ahmad Sir, You are right I forget to get information back from CLI to Php file. Thanks for provide the help link.I will revert back after testing my code with your guidance <br> <o:p></o:p></p><div><div><div><p class=MsoNormal>On Thu, Aug 25, 2011 at 12:21 PM, DHAVAL INDRODIYA <<a href="mailto:dhaval.it01034@gmail.com" target="_blank">dhaval.it01034@gmail.com</a>> wrote:<o:p></o:p></p></div></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'><div><div><p class=MsoNormal>Hi<br>You can use simple cli command<br>Manager show connected<o:p></o:p></p><div><p class=MsoNormal><br><br>On Thursday, August 25, 2011, James zhu <<a href="mailto:zhulizhong@live.com" target="_blank">zhulizhong@live.com</a>> wrote:<br>> hi:<br>> please refer this:<br>> <a href="http://www.voip-info.org/wiki/view/Asterisk+manager+Example:+PHP" target="_blank">http://www.voip-info.org/wiki/view/Asterisk+manager+Example:+PHP</a><br>> and check the manager.conf, make sure the accounts in managers.conf matchs the managers displayed.<br>><br>> Best regards,<br>> James.zhu<br>> Doing asterisk/PRI/ss7/dahdi, linux, asterisk cards, gateway(fxs/fxo/pri<->SIP).<br>> website: <a href="http://www.voipviews.com" target="_blank">www.voipviews.com</a><br>><br>><br>> ________________________________<br>> From: <a href="mailto:gohar.ahmed@vopium.com" target="_blank">gohar.ahmed@vopium.com</a><br>> To: <a href="mailto:asterisk-users@lists.digium.com" target="_blank">asterisk-users@lists.digium.com</a><br>> Date: Thu, 25 Aug 2011 11:26:53 +0500<br>> Subject: Re: [asterisk-users] How to know how many user is connected<br>><br>> I’m not a php expert, but seems your php script is incomplete/ you are sending to socket (fputs) but note receiving anything(fgets) :<br>><o:p></o:p></p></div><p class=MsoNormal>> See this page <<a href="http://www.voip-info.org/wiki/view/Asterisk+manager+Example:+PHP" target="_blank">http://www.voip-info.org/wiki/view/Asterisk+manager+Example:+PHP</a>> will help you.<o:p></o:p></p><div><div><p class=MsoNormal><br>><br>> <br>><br>> <br>><br>> From: <a href="mailto:asterisk-users-bounces@lists.digium.com" target="_blank">asterisk-users-bounces@lists.digium.com</a> [mailto:<a href="mailto:asterisk-users-bounces@lists.digium.com" target="_blank">asterisk-users-bounces@lists.digium.com</a>] On Behalf Of virendra bhati<br>> Sent: Wednesday, August 24, 2011 6:16 PM<br>> To: Asterisk Users Mailing List - Non-Commercial Discussion<br>> Subject: [asterisk-users] How to know how many user is connected<br>><br>> <br>><br>> Hi List,<br>><br>> I want to know how many manager is connected into asterisk server. I have made simple file but I don't have any idea how to get information back from Asterisk CLI<br>><br>> <?php<br>><br>> $socket = fsockopen("127.0.0.1","5038", $errno, $errstr, 30);<br>> if (!$socket)<br>> {<br>> $done=0;<br>> } else {<br>> fputs($socket, "Action: Login\r\n");<br>> fputs($socket, "UserName: root\r\n");<br>> fputs($socket, "Secret: energy\r\n\r\n");<br>> fputs($socket, "Action: Command\r\n");<br>> fputs($socket, "Command: manager show connected\r\n");<br>> $done=1;<br>> }<br>><br>> ?><br>><br>> Now how to get information into this PHP file....<br>><br>> -----<br>> Thanks and regards<br>><br>> Virendra Bhati<br>> +91-9172341457<br>> Software Engineer<br>><br>> <br>><br>> -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> -- New to Asterisk? Join us for a live introductory webinar every Thurs: <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a> asterisk-users mailing list To UNSUBSCRIBE or update options visit: <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a> <o:p></o:p></p></div></div><p class=MsoNormal><o:p> </o:p></p></div></div><p class=MsoNormal>--<br>_____________________________________________________________________<o:p></o:p></p><div><p class=MsoNormal><br>-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>New to Asterisk? Join us for a live introductory webinar every Thurs:<br> <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br><br>asterisk-users mailing list<br>To UNSUBSCRIBE or update options visit:<br> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><o:p></o:p></p></div></blockquote></div><p class=MsoNormal><br><br clear=all><br>-- <o:p></o:p></p><div><div><p class=MsoNormal><br><br><br>-----<br>Thanks and regards<br><br> Virendra Bhati<br>+91-9172341457<br>Software Engineer<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p></div></div></div><p class=MsoNormal><br><br clear=all><br>-- <o:p></o:p></p><div><p class=MsoNormal><br><br><br>-----<br>Thanks and regards<br><br> Virendra Bhati<br>+91-9172341457<br>Software Engineer<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>