RE: [Asterisk-java-users] About the connectEvent
Brought to you by:
srt
From: King H. <kin...@ne...> - 2006-05-10 03:41:34
|
Hi Stefan, =20 I looked at the code and it seems that this problem is fixed already. Thanks!=20 =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. =20 Thanks once again!!! =20 Best Regards, =20 King =20 -----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 =20 Hm then this looks indeed like a bug. I opened an issue for this in Jira: =20 http://jira.reucon.org/browse/AJ-32 =20 and will have a look at it this week. =20 Thanks for reporting, =20 Stefan =20 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...=20 > [mailto:ast...@li...] On Behalf Of=20 > 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=20 > connected to asterisk, not after authentication succeeded), right? >=20 > are you in need of an event that is triggered upon successful=20 > authentication? if yes, why? (login() won't return until=20 > authentication either succeeded or failed, anyway) >=20 > =3DStefan >=20 >=20 > King Ho wrote: >=20 >>Hi, >>=20 >>=20 >>=20 >>I think my description is incorrect!! >>=20 >>=20 >>=20 >>I think the connectEvent is sent every time, including the first = attempt, after a login(), whether it is successful or not. >>=20 >>=20 >>=20 >>Sorry about the confusion! >>=20 >>=20 >>=20 >>King >>=20 >>=20 >>=20 >> _____ >>=20 >>From: ast...@li...=20 >>[mailto:ast...@li...] On Behalf Of=20 >>King Ho >>Sent: Monday, March 20, 2006 12:21 AM >>To: ast...@li... >>Subject: [Asterisk-java-users] About the connectEvent >>=20 >>=20 >>=20 >>=20 >>=20 >>Hi, >>=20 >>=20 >>=20 >>According to the api doc, the connectEvent should be sent after = successful login to the asterisk server. >>=20 >>=20 >>=20 >>However, it seems that it will be sent whenever the driver is=20 >>reconnected to the asterisk server. This may be caused by an initial=20 >>login >>=20 >>failure and the program tries to login again. In my program I have something like the following: >>=20 >>=20 >>=20 >> boolean authenticated =3D false; >>=20 >> while (!authenticated) { >>=20 >> try { >>=20 >> ManagerConnectionFactory factory =3D new=20 >> ManagerConnectionFactory( >>=20 >> address, port, login, password); >>=20 >> managerConnection.addEventHandler(this); >>=20 >> managerConnection =3D=20 >> factory.createManagerConnection(); >>=20 >> managerConnection.login(); >>=20 >> authenticated =3D true; >>=20 >> } catch (IOException e) { >>=20 >> Thread.sleep(5000); >>=20 >> } catch (TimeoutException e) { >>=20 >> Thread.sleep(5000); >>=20 >> } catch (AuthenticationFailedException e) { >>=20 >> Thread.sleep(5000); >>=20 >> } >>=20 >> } >>=20 >>=20 >>=20 >>If I have the login name or password incorrect, the connectEvent will=20 >>start coming in starting from the second >>=20 >>login attempt (no connectEvent is received during the first login attempt). >>=20 >>=20 >>=20 >>I think receiving the connectEvent before successfully login to the=20 >>asterisk server is kind of useless as nothing can >>=20 >>be done until login is successful. >>=20 >>=20 >>=20 >>Thanks. >>=20 >>=20 >>=20 >>Best Regards, >>=20 >>=20 >>=20 >>King >>=20 >>=20 >=20 >=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... =20 =20 =20 |