Re: [Asterisk-java-users] get queue Hold Time
Brought to you by:
srt
From: Yves A. <yv...@gm...> - 2014-03-15 20:02:55
|
Hi, the QueueStatusAction class is a so called "EventGeneratingAction"... that means that asterisk-java will fire the appropriate events which contain further information after you sent the action... you have to implement a listener for these events, catch them (in your case the QueueParamsEvent) and read their information... "success" after you snet the action means that your action was properly sent... but before sending the action, you should have set up your listeners... because this is an asynchronous process, you should work with a thread... (that can terminate after receiving the (QueueStatusCompleteEvent).. regards, yves Am 15.03.2014 17:25, schrieb MT: > 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... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |