Re: [Asterisk-java-users] get queue Hold Time
Brought to you by:
srt
From: MT <moh...@gm...> - 2014-03-19 11:09:23
|
thanks yves this is a very usefull example, i suggest to add it on the tutorial thanks again your example solve my problem and show me a new way to work with AMI. On Tuesday, March 18, 2014, Miguel Santiago <m.s...@gm...> wrote: > Once you are implementing an AGI, yo can look up for the queue containing > the channel you are managing. > El 15/03/2014 17:27, "MT" <moh...@gm...<javascript:_e(%7B%7D,'cvml','moh...@gm...');>> > escribió: > >> Hi everyone, >> >> I want to get Hold Time of specified Queue. >> >> I search everywhere to get it through AGI but there is no such a thing in >> AGI to get you hold time of given queue. >> So I decide to use Manager API and call QueueStatus to get HoldTime on >> the QueueParams section: >> >> this is my Manager Class: >> >> import java.io.IOException; >> >> import org.asteriskjava.manager.AuthenticationFailedException; >> import org.asteriskjava.manager.ManagerConnection; >> import org.asteriskjava.manager.ManagerConnectionFactory; >> import org.asteriskjava.manager.TimeoutException; >> import org.asteriskjava.manager.action.QueueStatusAction; >> import org.asteriskjava.manager.event.QueueParamsEvent; >> import org.asteriskjava.manager.response.ManagerResponse; >> >> public class Manager { >> >> private ManagerConnection managerConnection; >> >> public Manager(String host, String user, String pass) throws >> IOException { >> >> ManagerConnectionFactory factory = new >> ManagerConnectionFactory(host, user, pass); >> this.managerConnection = factory.createManagerConnection(); >> >> } >> >> public void getHoldTime(String queue) throws IOException, >> AuthenticationFailedException, TimeoutException, InterruptedException { >> >> QueueStatusAction queueStatus = new QueueStatusAction(); >> >> ManagerResponse statusResponse; >> >> queueStatus.setQueue(queue); >> >> >> // connect to Asterisk and log in >> managerConnection.login(); >> >> // send the originate action and wait for a maximum of 30 seconds >> for Asterisk >> // to send a reply >> statusResponse = managerConnection.sendAction(queueStatus, 2000); >> >> // print out whether the originate succeeded or not >> System.out.println("Response Result:" + >> statusResponse.toString()); >> >> // and finally log off and disconnect >> managerConnection.logoff(); >> } >> } >> >> >> I call getHoldTime from AGI: >> >> Manager m = new Manager(ip,user,pass); >> m.getHoldTime(queue); >> >> >> but it doesn’t contain queue param section it just say successful for >> this action. >> >> please help me how to get hold time of specific queue with asterisk java. >> >> Mohsen >> >> >> ------------------------------------------------------------------------------ >> Learn Graph Databases - Download FREE O'Reilly Book >> "Graph Databases" is the definitive new guide to graph databases and their >> applications. Written by three acclaimed leaders in the field, >> this first edition is now available. Download your free book today! >> http://p.sf.net/sfu/13534_NeoTech >> _______________________________________________ >> Asterisk-java-users mailing list >> Ast...@li...<javascript:_e(%7B%7D,'cvml','Ast...@li...');> >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >> >> |