[Asterisk-java-users] Problem with ConnectEvent
Brought to you by:
srt
From: <kin...@ne...> - 2005-11-16 04:55:14
|
Hi, I am trying to send a Status Action whenever the connection to the server is reestablished (For example, if I do a "restart now" in Asterisk I want to send a StatusAction when the connection is reestablished) Below is part of the handleEvent method: public void handleEvent(ManagerEvent event) { if (event instanceof ConnectEvent) { System.out.println("Server connection re-established!!!!!!!"); try { managerConnection.sendAction(new StatusAction()); } catch (IOException e) { } catch (TimeoutException e) { } } } It seems that sending the StatusAction will somehow make the reconnection to the server failed. The output from Asterisk is: == Connect attempt from '192.168.0.10' unable to authenticate This is strange as the ConnectEvent should only be sent if login is successful. If I remove the sendAction, I can see from Asterisk that the reconnection is successful. Do I need to wait some time after receiving a connectEvent and before sending any action? By the way, I am using 0.2 rc2 version of the library and Asterisk 1.2.0 rc2. Thanks in advance. Best Regards, King |