Re: [Asterisk-java-users] get queue Hold Time
Brought to you by:
srt
From: MT <moh...@gm...> - 2014-03-16 07:01:52
|
Hi yves, thanks for reply, if I use event listener in the multi access system it could be another QueueParams from another request. how can I manage that? about EventGeneratingAction I don't how to use it :( is there any samples that use EventGeneratingAction? I found an asterisk funtion QUEUE_VARIABLES that gives queue name and it set some variables that contains queue information like hold time that I need, I can get hold time by AGI but I want to get it from another server that have AMI access to it. Can I call function through Manager API and get the variables on that channel? thanks yves, you are great :) Mohsen On Sat, Mar 15, 2014 at 11:33 PM, Yves A. <yv...@gm...> wrote: > 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 lis...@li...https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > > > ------------------------------------------------------------------------------ > 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 > > |