RE: [Asterisk-java-users] About the connectEvent
Brought to you by:
srt
From: King H. <kin...@ne...> - 2006-05-09 09:16:17
|
Hi Stefan, I looked at the code and it seems that this problem is fixed already. Thanks!=20 However, I don't see this mentioned in the file "CHANGES". You might = want to add this in as this might make some difference to someone else. Thanks once again!!! Best Regards, King -----Original Message----- From: ast...@li... [mailto:ast...@li...] On Behalf Of = Stefan Reuter Sent: Monday, March 20, 2006 9:28 AM To: ast...@li... Subject: Re: [Asterisk-java-users] About the connectEvent Hm then this looks indeed like a bug. I opened an issue for this in Jira: http://jira.reucon.org/browse/AJ-32 and will have a look at it this week. Thanks for reporting, Stefan King Ho wrote: > Below is the API doc that comes with A-J 0.3: >=20 > -------------------------------------------------------------------------= --- ------------------------------------- > public class ConnectEvent > extends ManagerEvent >=20 > A ConnectEvent is triggered after successful login to the asterisk = server. It is a pseudo event not directly related to an asterisk generated = event.=20 > -------------------------------------------------------------------------= --- ------------------------------------- >=20 > When the server is restarted, I need to know if we have = auto-reconnected AND login successfully back to the server. If yes, I'll start another = thread and send some actions to the server. Right now, I cannot tell with a connectEvent is if the login is successful or not and sending actions to = the server may be bad. >=20 > I hope this make sense. >=20 > Thanks. >=20 > King >=20 >=20 >=20 > -----Original Message----- > From: ast...@li... [mailto:ast...@li...] On Behalf Of = Stefan Reuter > Sent: Monday, March 20, 2006 1:13 AM > To: ast...@li... > Subject: Re: [Asterisk-java-users] About the connectEvent >=20 > in this case it does what the api docs say (being triggered when > connected to asterisk, not after authentication succeeded), right? >=20 > are you in need of an event that is triggered upon successful > authentication? if yes, why? (login() won't return until = authentication > either succeeded or failed, anyway) >=20 > =3DStefan >=20 >=20 > King Ho wrote: >=20 >>Hi, >> >>=20 >> >>I think my description is incorrect!! >> >>=20 >> >>I think the connectEvent is sent every time, including the first = attempt, after a login(), whether it is successful or not. >> >>=20 >> >>Sorry about the confusion! >> >>=20 >> >>King >> >>=20 >> >> _____ =20 >> >>From: ast...@li... [mailto:ast...@li...] On Behalf Of = King Ho >>Sent: Monday, March 20, 2006 12:21 AM >>To: ast...@li... >>Subject: [Asterisk-java-users] About the connectEvent >> >>=20 >> >>=20 >> >>Hi, >> >>=20 >> >>According to the api doc, the connectEvent should be sent after = successful login to the asterisk server. >> >>=20 >> >>However, it seems that it will be sent whenever the driver is = reconnected to the asterisk server. This may be caused by an initial login=20 >> >>failure and the program tries to login again. In my program I have something like the following: >> >>=20 >> >> boolean authenticated =3D false; >> >> while (!authenticated) { >> >> try { >> >> ManagerConnectionFactory factory =3D new ManagerConnectionFactory( >> >> address, port, login, password); >> >> managerConnection.addEventHandler(this); >> >> managerConnection =3D = factory.createManagerConnection(); >> >> managerConnection.login(); >> >> authenticated =3D true; >> >> } catch (IOException e) { >> >> Thread.sleep(5000); >> >> } catch (TimeoutException e) { >> >> Thread.sleep(5000); >> >> } catch (AuthenticationFailedException e) { >> >> Thread.sleep(5000); >> >> } >> >> } >> >>=20 >> >>If I have the login name or password incorrect, the connectEvent will start coming in starting from the second >> >>login attempt (no connectEvent is received during the first login attempt). >> >>=20 >> >>I think receiving the connectEvent before successfully login to the asterisk server is kind of useless as nothing can >> >>be done until login is successful. >> >>=20 >> >>Thanks. >> >>=20 >> >>Best Regards, >> >>=20 >> >>King >> >> >=20 >=20 >=20 --=20 reuter network consulting Neusser Str. 110 50760 K=F6ln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... Jabber: sr...@ja... |