Thread: [Asterisk-java-users] Lot of timeouts when sending actions repetedly
Brought to you by:
srt
From: Mattias M. <ma...@wx...> - 2006-01-25 17:03:11
|
Hi all! =20 I am currently using this simple class to monitor the queue. One instance of this class is created once every one second (and hopefully deleted after reaching end). =20 I am actually quite new at Java and thread programming so I realize that there must be some better way to do this, but I hope this is sufficient for the time being. =20 The problem (if it is a problem) I am experiencing at the moment is that I receive one timeout every second, but it seems like I get all the events generated by this action. =20 My question is this: Do I actually lose any information as I get these timeouts or are there any other reasons for receiving them? =20 Never mind the horrors of my code. I just created this to get around the deadlock I experienced when trying to send an action from the event dispatching thread. =3D) =20 Thanks in advance! =20 // Mattias Malmquist =20 =20 =20 public class QueueStatusChecker extends Thread { ManagerConnection manager; EventGeneratingAction action; =20 public QueueStatusChecker(ManagerConnection manager, ManagerAction action) { this.manager =3D manager; this.action =3D (EventGeneratingAction)action; } public void run() { try { =20 manager.sendEventGeneratingAction(action, 5000); } catch (Exception e) { =20 if(e.getClass().getSimpleName().equals("EventTimeoutException")) { =20 System.out.println("Timeout"); } } } } |
From: Stefan R. <sr...@re...> - 2006-01-29 18:23:30
|
Try to replace=20 manager.sendEventGeneratingAction(action, 5000); by manager.sendAction(action, null); =3DStefan On Wed, 2006-01-25 at 18:02 +0100, Mattias Malmquist wrote: > Hi all! >=20 > =20 >=20 > I am currently using this simple class to monitor the queue. One > instance of this class is created once every one second (and hopefully > deleted after reaching end). >=20 > =20 >=20 > I am actually quite new at Java and thread programming so I realize > that there must be some better way to do this, but I hope this is > sufficient for the time being. >=20 > =20 >=20 > The problem (if it is a problem) I am experiencing at the moment is > that I receive one timeout every second, but it seems like I get all > the events generated by this action. >=20 > =20 >=20 > My question is this: Do I actually lose any information as I get these > timeouts or are there any other reasons for receiving them? >=20 > =20 >=20 > Never mind the horrors of my code. I just created this to get around > the deadlock I experienced when trying to send an action from the > event dispatching thread. =3D) >=20 > =20 >=20 > Thanks in advance! >=20 > =20 >=20 > // Mattias Malmquist >=20 > =20 >=20 >=20 > =20 >=20 > =20 >=20 > public class QueueStatusChecker extends Thread { >=20 > ManagerConnection manager; >=20 > EventGeneratingAction action; >=20 > =20 >=20 > public QueueStatusChecker(ManagerConnection > manager, ManagerAction action) { >=20 > this.manager =3D manager; >=20 > this.action =3D > (EventGeneratingAction)action; >=20 > } >=20 > public void run() { >=20 > try { >=20 >=20 > manager.sendEventGeneratingAction(action, 5000); >=20 > } catch (Exception e) { >=20 >=20 > if(e.getClass().getSimpleName().equals("EventTimeoutException")) { >=20 >=20 > System.out.println("Timeout"); >=20 > } >=20 > } >=20 > } >=20 > } >=20 >=20 |
From: Brett S. <bs...@no...> - 2006-01-29 22:53:43
|
I'm trying to find a list of values returned by the HangupEvent.getCause() method and their meanings. Does anyone know where to find this information? Regards, Brett. |
From: Stefan R. <sr...@re...> - 2006-01-29 23:01:05
|
On Mon, 2006-01-30 at 06:19 +1100, Brett Sutton wrote: > I'm trying to find a list of values returned by the=20 > HangupEvent.getCause() method and their meanings. >=20 > Does anyone know where to find this information? http://svn.digium.com/svn/asterisk/trunk/include/asterisk/causes.h =3DStefan |
From: Brett S. <bs...@no...> - 2006-01-29 23:30:42
|
Thanks Stefan, I've created the following enum. I thought you might find it useful for inclusion in Asterisk-Java. Regards, Brett. Stefan Reuter wrote: > On Mon, 2006-01-30 at 06:19 +1100, Brett Sutton wrote: > >> I'm trying to find a list of values returned by the >> HangupEvent.getCause() method and their meanings. >> >> Does anyone know where to find this information? >> > > http://svn.digium.com/svn/asterisk/trunk/include/asterisk/causes.h > > =Stefan > |
From: Brett S. <bs...@no...> - 2006-01-29 23:32:43
|
doh, and here is the code :) public enum HangupCause { AST_CAUSE_UNALLOCATED(1), AST_CAUSE_NO_ROUTE_TRANSIT_NET(2), AST_CAUSE_NO_ROUTE_DESTINATION(3), AST_CAUSE_CHANNEL_UNACCEPTABLE(6), AST_CAUSE_CALL_AWARDED_DELIVERED(7), AST_CAUSE_NORMAL_CLEARING(16), AST_CAUSE_USER_BUSY(17), AST_CAUSE_NO_USER_RESPONSE(18), AST_CAUSE_NO_ANSWER(19), AST_CAUSE_CALL_REJECTED(21), AST_CAUSE_NUMBER_CHANGED(22), AST_CAUSE_DESTINATION_OUT_OF_ORDER(27), AST_CAUSE_INVALID_NUMBER_FORMAT(28), AST_CAUSE_FACILITY_REJECTED(29), AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY(30), AST_CAUSE_NORMAL_UNSPECIFIED(31), AST_CAUSE_NORMAL_CIRCUIT_CONGESTION(34), AST_CAUSE_NETWORK_OUT_OF_ORDER(38), AST_CAUSE_NORMAL_TEMPORARY_FAILURE(41), AST_CAUSE_SWITCH_CONGESTION(42), AST_CAUSE_ACCESS_INFO_DISCARDED(43), AST_CAUSE_REQUESTED_CHAN_UNAVAIL(44), AST_CAUSE_PRE_EMPTED(45), AST_CAUSE_FACILITY_NOT_SUBSCRIBED(50), AST_CAUSE_OUTGOING_CALL_BARRED(52), AST_CAUSE_INCOMING_CALL_BARRED(54), AST_CAUSE_BEARERCAPABILITY_NOTAUTH(57), AST_CAUSE_BEARERCAPABILITY_NOTAVAIL(58), AST_CAUSE_BEARERCAPABILITY_NOTIMPL(65), AST_CAUSE_CHAN_NOT_IMPLEMENTED(66), AST_CAUSE_FACILITY_NOT_IMPLEMENTED(69), AST_CAUSE_INVALID_CALL_REFERENCE(81), AST_CAUSE_INCOMPATIBLE_DESTINATION(88), AST_CAUSE_INVALID_MSG_UNSPECIFIED(95), AST_CAUSE_MANDATORY_IE_MISSING(96), AST_CAUSE_MESSAGE_TYPE_NONEXIST(97), AST_CAUSE_WRONG_MESSAGE(98), AST_CAUSE_IE_NONEXIST(99), AST_CAUSE_INVALID_IE_CONTENTS(100), AST_CAUSE_WRONG_CALL_STATE(101), AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE(102), AST_CAUSE_MANDATORY_IE_LENGTH_ERROR(103), AST_CAUSE_PROTOCOL_ERROR(111), AST_CAUSE_INTERWORKING(127), /* Special Asterisk aliases */ AST_CAUSE_BUSY(AST_CAUSE_USER_BUSY), AST_CAUSE_FAILURE(AST_CAUSE_NETWORK_OUT_OF_ORDER), AST_CAUSE_NORMAL(AST_CAUSE_NORMAL_CLEARING), AST_CAUSE_NOANSWER(AST_CAUSE_NO_ANSWER), AST_CAUSE_CONGESTION(AST_CAUSE_NORMAL_CIRCUIT_CONGESTION), AST_CAUSE_UNREGISTERED(AST_CAUSE_NO_ROUTE_DESTINATION), AST_CAUSE_NOTDEFINED(0), AST_CAUSE_NOSUCHDRIVER(AST_CAUSE_CHAN_NOT_IMPLEMENTED); HangupCause(int cause) { this.cause = cause; } HangupCause(HangupCause cause) { this.cause = cause.cause; } public String toString() { String result = this.name(); if (this.name().startsWith("AST_CAUSE_")) result = this.name().substring(10); return result; } int cause; } |
From: Stefan R. <sr...@re...> - 2006-01-30 00:41:20
|
thanks, i've added it to svn. =3DStefan |