News & Reviews
More How-To's & Tips More News
More Reviews Device Configuration Tools
No account yet? Create one
Forgot your Username or Password?

Welcome to the Voxilla VoIP Forum.

Voxilla has been a trusted source for accurate, up-to-date information on the IP Communications industry since 2002. A dedicated staff of reporters and engineers produce feature articles and product reviews to keep industry watchers abreast of the people, companies, and trends driving a fast moving market.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.





Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old June 26th, 2007, 03:06 PM
zero[^l^]cool zero[^l^]cool is offline
Junior Member
 
Join Date: Jun 2007
Posts: 10
zero[^l^]cool is on a distinguished road
Default Asterisk Manager API

Hello
I am a little initial in the Asterisk's World, I am trying to develop a Script in PHP to have thes stats in real time, by using “Asterisk Manager API” I have looked on voip-info.org, I found the commands, but I don't find a solution to recover some information, example:
1 - If I want to recover the calls waitings of a defined Queu
2 - If I want to recover the number of peoples who are connected on a queue…

If you have somme simple examples or an explanation of all “the API” directives that could help me.

Thank's a lot

Last edited by zero[^l^]cool : June 26th, 2007 at 03:16 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old June 27th, 2007, 12:57 PM
zero[^l^]cool zero[^l^]cool is offline
Junior Member
 
Join Date: Jun 2007
Posts: 10
zero[^l^]cool is on a distinguished road
Default Re: Asterisk Manager API

Done :P
to recover all the information after Queues Action:
PHP Code:
function info_queus($ip,$port,$login,$pass,$operation)
{
$oSocket = @fsockopen($ip,$port,$errnum$errdesc);
    if(
$oSocket)
    {
            
fputs($oSocket"Action: login\r\n");
            
fputs($oSocket"Username: $login\r\n");
            
fputs($oSocket"Secret: $pass\r\n\r\n");
            
fputs($oSocket"Action: Queues\r\n");
            
fputs($oSocket"Queue: $operation\r\n\r\n");
            
fputs($oSocket"Action: Logoff\r\n\r\n");
            
            
$infos=array();
            
                while (!
feof($oSocket)) 
                {
                    
$inf_temp=explode("\r\n",fread($oSocket8192));
                
                            foreach(
$inf_temp as $tmp)
                                        if(
$tmp!="")
                                                 
array_push($infos,str_word_count($tmp,1,"0123456789/@"));
                                 
                                 unset(
$tmp,$inf_tmp);
                         
                    }
            
fclose($oSocket);
            
            return 
$infos ;
    }return 
false    ;

To recover th number of the Calls waiting on a queu:
PHP Code:
function appels_attentes($tableau,$operation)
{
$i=0;
        
            foreach(
$tableau as $valeur)
            {
                    if(
$valeur[0]==$operation)
                            break;
                    
                
$i++;
            }
    return 
$tableau[$i][2] ;        

To recovers thes Members with the number of calls taken:
PHP Code:
function nbr_membres($tableau,$trunk,$sufix,$context)
{


            
$nbr=0;
            
$users=array();
            foreach(
$tableau as $valeur)
                        if(
eregi("^$trunk$sufix([0-9])+$context",$valeur[0]))
                        {                    
                            
                        if(
$valeur[5]=="taken"
                            
$vl_ajt=$valeur[6] ;
                                else    
                                    
$vl_ajt=$valeur[5];
                                    
                            
array_push($users,array($valeur[0],$vl_ajt));
                            unset(
$vl_ajt);
                        }
                            
            return 
$users ;

I have Juste a little problem, that when I use " "Action: Queues" it send back, all the informations about all the queues, I want to know if it's possible to have juste some informations to juste one queu.

Thank you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:



Similar Threads for: Asterisk Manager API
Thread Thread Starter Forum Replies Last Post
parsing API Manager response lamy Asterisk Support Forum 0 September 12th, 2005 09:57 AM
= and => on manager.conf - api manager lamy Asterisk Support Forum 2 September 8th, 2005 04:07 PM
ParkedCalls Manager API command gventer Asterisk Support Forum 0 August 23rd, 2005 11:02 PM
Any way to link Asterisk with Contact Manager software? MustardMan Asterisk Support Forum 4 July 13th, 2005 06:00 PM
Asterisk, trunk?,skinny?+Cisco Call manager digital_storm Asterisk Support Forum 0 July 6th, 2005 12:54 PM



All times are GMT. The time now is 05:56 AM.


vBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd. SEO by vBSEO 3.0.0 ©2007, Crawlability, Inc. Logos and trademarks are the property of Voxilla or their respective owner. All other content © 2003-2007 by Voxilla, Inc.