Re: [Asterisk-java-users] About the connectEvent
Brought to you by:
srt
From: Stefan R. <sr...@re...> - 2006-03-20 01:28:28
|
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 serv= er. It is a pseudo event not directly related to an asterisk generated ev= ent.=20 > -----------------------------------------------------------------------= ------------------------------------------ >=20 > When the server is restarted, I need to know if we have auto-reconnecte= d AND login successfully back to the server. If yes, I'll start another t= hread 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 t= o the server may be bad. >=20 > I hope this make sense. >=20 > Thanks. >=20 > King >=20 >=20 >=20 > -----Original Message----- > From: ast...@li... [mailto:asterisk-= jav...@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 attemp= t, after a login(), whether it is successful or not. >> >>=20 >> >>Sorry about the confusion! >> >>=20 >> >>King >> >>=20 >> >> _____ =20 >> >>From: ast...@li... [mailto:asterisk-= jav...@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 success= ful login to the asterisk server. >> >>=20 >> >>However, it seems that it will be sent whenever the driver is reconnect= ed 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 some= thing like the following: >> >>=20 >> >> boolean authenticated =3D false; >> >> while (!authenticated) { >> >> try { >> >> ManagerConnectionFactory factory =3D new ManagerCon= nectionFactory( >> >> address, port, login, password); >> >> managerConnection.addEventHandler(this); >> >> managerConnection =3D factory.createManagerConnecti= on(); >> >> 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 s= tart coming in starting from the second >> >>login attempt (no connectEvent is received during the first login attem= pt). >> >>=20 >> >>I think receiving the connectEvent before successfully login to the ast= erisk 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=C3=B6ln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... Jabber: sr...@ja... |