Re: [Asterisk-java-users] About the connectEvent
Brought to you by:
srt
From: Stefan R. <sr...@re...> - 2006-03-19 17:13:12
|
in this case it does what the api docs say (being triggered when connected to asterisk, not after authentication succeeded), right? 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) =3DStefan King Ho wrote: > Hi, >=20 > =20 >=20 > I think my description is incorrect!! >=20 > =20 >=20 > I think the connectEvent is sent every time, including the first attemp= t, after a login(), whether it is successful or not. >=20 > =20 >=20 > Sorry about the confusion! >=20 > =20 >=20 > King >=20 > =20 >=20 > _____ =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 >=20 > =20 >=20 > Hi, >=20 > =20 >=20 > According to the api doc, the connectEvent should be sent after success= ful login to the asterisk server. >=20 > =20 >=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 >=20 > failure and the program tries to login again. In my program I have some= thing like the following: >=20 > =20 >=20 > boolean authenticated =3D false; >=20 > while (!authenticated) { >=20 > try { >=20 > ManagerConnectionFactory factory =3D new ManagerCon= nectionFactory( >=20 > address, port, login, password); >=20 > managerConnection.addEventHandler(this); >=20 > managerConnection =3D factory.createManagerConnecti= on(); >=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 s= tart coming in starting from the second >=20 > login attempt (no connectEvent is received during the first login attem= pt). >=20 > =20 >=20 > I think receiving the connectEvent before successfully login to the ast= erisk 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 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... |