[Asterisk-java-users] Re: Asterisk-java-users digest, Vol 1 #99 - 2 msgs
Brought to you by:
srt
From: Samant N. <sa...@ai...> - 2005-10-26 01:06:19
|
CVS Head - 10/10/2005 ----- Original Message ----- From: <ast...@li...> To: <ast...@li...> Sent: Saturday, October 22, 2005 3:31 PM Subject: Asterisk-java-users digest, Vol 1 #99 - 2 msgs > Send Asterisk-java-users mailing list submissions to > ast...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > or, via email, send a message with subject or body 'help' to > ast...@li... > > You can reach the person managing the list at > ast...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Asterisk-java-users digest..." > > > Today's Topics: > > 1. Little help with the Command Action (Samant Nagpaul) > 2. Re: Little help with the Command Action (Stefan Reuter) > > --__--__-- > > Message: 1 > From: "Samant Nagpaul" <sa...@ai...> > To: <ast...@li...> > Date: Fri, 21 Oct 2005 14:07:54 +1000 > Subject: [Asterisk-java-users] Little help with the Command Action > Reply-To: ast...@li... > > This is a multi-part message in MIME format. > > ------=_NextPart_000_0026_01C5D648.D4F71880 > Content-Type: text/plain; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > Hello, > > I am getting an error when I try sending a CLI command through the = > command action.=20 > > Has anybody experienced this before? If I run any other action it works = > except CommandAction. > > > INFO: Connecting to 203.62.158.26 port 5038 > # event : net.sf.asterisk.manager.event.ConnectEvent: dateReceived=3DFri = > Oct 21 14:05:33 EST 2005; systemHashcode=3D32019423 > 21/10/2005 14:05:33 net.sf.asterisk.util.impl.JavaLoggingLog info > INFO: Connected via Asterisk Call Manager/1.0 > 21/10/2005 14:05:33 net.sf.asterisk.util.impl.JavaLoggingLog info > INFO: Successfully logged in > Logged in > 21/10/2005 14:05:33 net.sf.asterisk.util.impl.JavaLoggingLog error > SEVERE: Unable to retrieve internalActionId from response: asterisk sent = > actionId 'null': > net.sf.asterisk.manager.response.CommandResponse: actionId=3D'null'; = > message=3D'null'; response=3D'Follows'; uniqueId=3D'null'; = > systemHashcode=3D2917593 > 21/10/2005 14:05:33 net.sf.asterisk.util.impl.JavaLoggingLog info > INFO: responseHandler not found > 21/10/2005 14:05:33 net.sf.asterisk.util.impl.JavaLoggingLog warn > WARNING: buffer contains neither response nor event > Exception in thread "main" net.sf.asterisk.manager.TimeoutException: = > Timeout waiting for response to Command > at = > net.sf.asterisk.manager.DefaultManagerConnection.sendAction(DefaultManage= > rConnection.java:421) > at = > net.sf.asterisk.manager.DefaultManagerConnection.sendAction(DefaultManage= > rConnection.java:397) > at CManager.runCommand(CManager.java:56) > at CManager.main(CManager.java:27) > > This is the code I am using > > public class CManager implements ManagerEventHandler, = > ManagerResponseHandler > { > private ManagerConnection managerConnection; > =20 > public static void main(String[] args) throws Exception > { > CManager recordingManager; > > recordingManager =3D new CManager(); > recordingManager.runCommand("4003","samant123"); > } > =20 > public CManager() throws IOException > { > ManagerConnectionFactory factory =3D new = > ManagerConnectionFactory(); > this.managerConnection =3D = > factory.getManagerConnection("locahost", "manager", "asterisk"); > } > > public CManager(String ip, String manager_username, String = > manager_password) throws IOException > { > ManagerConnectionFactory factory =3D new = > ManagerConnectionFactory(); > this.managerConnection =3D factory.getManagerConnection(ip, = > manager_username, manager_password); > } > =20 > public String runCommand(String channel, String fileName)=20 > throws IOException, AuthenticationFailedException, TimeoutException > { > this.managerConnection.addEventHandler(this); > > ManagerResponse originateResponse; > > CommandAction commandAction =3D new CommandAction(); > commandAction.setCommand("show voicemail users"); > > managerConnection.login(); > System.out.println("Logged in"); > > originateResponse =3D = > this.managerConnection.sendAction(commandAction); > > String response =3D originateResponse.getResponse(); =20 > =20 > managerConnection.logoff(); > System.out.println("Logged out"); > System.out.println(response); > return response; > } > > > public void handleEvent(ManagerEvent event) > { > System.out.println ("# event : " + event); > } > =20 > public void handleResponse(ManagerResponse response) > { > System.out.println ("# response : " + response); > System.out.println ("# response : " + response.getAttributes()); > } > =20 > } > > ------=_NextPart_000_0026_01C5D648.D4F71880 > Content-Type: text/html; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> > <HTML><HEAD> > <META http-equiv=3DContent-Type content=3D"text/html; = > charset=3Diso-8859-1"> > <META content=3D"MSHTML 6.00.2900.2769" name=3DGENERATOR> > <STYLE></STYLE> > </HEAD> > <BODY bgColor=3D#ffffff><FONT face=3DArial size=3D2> > <DIV>Hello,</DIV> > <DIV> </DIV> > <DIV>I am getting an error when I try sending a CLI command through the = > command=20 > action. </DIV> > <DIV> </DIV> > <DIV>Has anybody experienced this before? If I run any other action it = > works=20 > except CommandAction.</DIV> > <DIV> </DIV> > <DIV> </DIV> > <DIV>INFO: Connecting to 203.62.158.26 port 5038<BR># event :=20 > net.sf.asterisk.manager.event.ConnectEvent: dateReceived=3DFri Oct 21 = > 14:05:33 EST=20 > 2005; systemHashcode=3D32019423<BR>21/10/2005 14:05:33=20 > net.sf.asterisk.util.impl.JavaLoggingLog info<BR>INFO: Connected via = > Asterisk=20 > Call Manager/1.0<BR>21/10/2005 14:05:33 = > net.sf.asterisk.util.impl.JavaLoggingLog=20 > info<BR>INFO: Successfully logged in<BR>Logged in<BR>21/10/2005 14:05:33 = > > net.sf.asterisk.util.impl.JavaLoggingLog error<BR>SEVERE: Unable to = > retrieve=20 > internalActionId from response: asterisk sent actionId=20 > 'null':<BR>net.sf.asterisk.manager.response.CommandResponse: = > actionId=3D'null';=20 > message=3D'null'; response=3D'Follows'; uniqueId=3D'null';=20 > systemHashcode=3D2917593<BR>21/10/2005 14:05:33=20 > net.sf.asterisk.util.impl.JavaLoggingLog info<BR>INFO: responseHandler = > not=20 > found<BR>21/10/2005 14:05:33 net.sf.asterisk.util.impl.JavaLoggingLog=20 > warn<BR>WARNING: buffer contains neither response nor event<BR>Exception = > in=20 > thread "main" net.sf.asterisk.manager.TimeoutException: Timeout waiting = > for=20 > response to Command<BR> at=20 > net.sf.asterisk.manager.DefaultManagerConnection.sendAction(DefaultManage= > rConnection.java:421)<BR> =20 > at=20 > net.sf.asterisk.manager.DefaultManagerConnection.sendAction(DefaultManage= > rConnection.java:397)<BR> =20 > at=20 > CManager.runCommand(CManager.java:56)<BR> &n= > bsp; =20 > at CManager.main(CManager.java:27)</DIV> > <DIV> </DIV> > <DIV>This is the code I am using</DIV> > <DIV><BR>public class CManager implements ManagerEventHandler,=20 > ManagerResponseHandler<BR>{<BR> private ManagerConnection=20 > managerConnection;<BR> <BR> public static void main(String[] = > args)=20 > throws Exception<BR> {<BR> CManager = > recordingManager;</DIV> > <DIV> </DIV> > <DIV> recordingManager =3D new=20 > CManager();<BR> recordingManager.runCommand("4003","samant123"= > );<BR> }<BR> <BR> public=20 > CManager() throws IOException<BR> =20 > {<BR> ManagerConnectionFactory = > factory=20 > =3D new = > ManagerConnectionFactory();<BR> = > =20 > this.managerConnection =3D factory.getManagerConnection("locahost", = > "manager",=20 > "asterisk");<BR> }</DIV> > <DIV> </DIV> > <DIV> public CManager(String ip, String manager_username, String=20 > manager_password) throws IOException<BR> =20 > {<BR> ManagerConnectionFactory = > factory=20 > =3D new = > ManagerConnectionFactory();<BR> = > =20 > this.managerConnection =3D factory.getManagerConnection(ip, = > manager_username,=20 > manager_password);<BR> = > }<BR> <BR> =20 > public String runCommand(String channel, String fileName) = > <BR> =20 > throws IOException, AuthenticationFailedException,=20 > TimeoutException<BR> =20 > {<BR> this.managerConnection.addEventHandler(this);</DIV> > <DIV> </DIV> > <DIV> ManagerResponse=20 > originateResponse;</DIV> > <DIV> </DIV> > <DIV> CommandAction = > commandAction =3D=20 > new CommandAction();<BR> commandAction.setCommand("show = > voicemail=20 > users");</DIV> > <DIV> </DIV> > <DIV> managerConnection.login();<BR> &n= > bsp; =20 > System.out.println("Logged in");</DIV> > <DIV> </DIV> > <DIV> originateResponse =3D=20 > this.managerConnection.sendAction(commandAction);</DIV> > <DIV> </DIV> > <DIV> String response =3D=20 > originateResponse.getResponse(); =20 > <BR> =20 > <BR> =20 > managerConnection.logoff();<BR> = > =20 > System.out.println("Logged = > out");<BR> =20 > System.out.println(response);<BR> &nbs= > p;=20 > return response;<BR> }</DIV> > <DIV> </DIV> > <DIV><BR> public void handleEvent(ManagerEvent = > event)<BR> =20 > {<BR> System.out.println ("# event : = > " +=20 > event);<BR> }<BR> <BR> public void=20 > handleResponse(ManagerResponse response)<BR> =20 > {<BR> System.out.println ("# = > response : " +=20 > response);<BR> System.out.println = > ("#=20 > response : " + response.getAttributes());<BR> =20 > }<BR> <BR>}<BR></DIV></FONT></BODY></HTML> > > ------=_NextPart_000_0026_01C5D648.D4F71880-- > > > > --__--__-- > > Message: 2 > Subject: Re: [Asterisk-java-users] Little help with the Command Action > From: Stefan Reuter <sr...@re...> > To: ast...@li... > Date: Fri, 21 Oct 2005 06:29:34 +0000 > Reply-To: ast...@li... > > > --=-KlynJpwKZIRhTb3fM7Bl > Content-Type: text/plain > Content-Transfer-Encoding: quoted-printable > > Hi, > > what version of Asterisk do you use? > > =3DStefan > > On Fri, 2005-10-21 at 14:07 +1000, Samant Nagpaul wrote: >> Hello, >> =20 >> I am getting an error when I try sending a CLI command through the >> command action.=20 >> =20 >> Has anybody experienced this before? If I run any other action it >> works except CommandAction. >> =20 >> =20 >> INFO: Connecting to 203.62.158.26 port 5038 >> # event : net.sf.asterisk.manager.event.ConnectEvent: dateReceived=3DFri >> Oct 21 14:05:33 EST 2005; systemHashcode=3D32019423 >> 21/10/2005 14:05:33 net.sf.asterisk.util.impl.JavaLoggingLog info >> INFO: Connected via Asterisk Call Manager/1.0 >> 21/10/2005 14:05:33 net.sf.asterisk.util.impl.JavaLoggingLog info >> INFO: Successfully logged in >> Logged in >> 21/10/2005 14:05:33 net.sf.asterisk.util.impl.JavaLoggingLog error >> SEVERE: Unable to retrieve internalActionId from response: asterisk >> sent actionId 'null': >> net.sf.asterisk.manager.response.CommandResponse: actionId=3D'null'; >> message=3D'null'; response=3D'Follows'; uniqueId=3D'null'; >> systemHashcode=3D2917593 >> 21/10/2005 14:05:33 net.sf.asterisk.util.impl.JavaLoggingLog info >> INFO: responseHandler not found >> 21/10/2005 14:05:33 net.sf.asterisk.util.impl.JavaLoggingLog warn >> WARNING: buffer contains neither response nor event >> Exception in thread "main" net.sf.asterisk.manager.TimeoutException: >> Timeout waiting for response to Command >> at >> net.sf.asterisk.manager.DefaultManagerConnection.sendAction(DefaultManage= > rConnection.java:421) >> at >> net.sf.asterisk.manager.DefaultManagerConnection.sendAction(DefaultManage= > rConnection.java:397) >> at CManager.runCommand(CManager.java:56) >> at CManager.main(CManager.java:27) >> =20 >> This is the code I am using >>=20 >> public class CManager implements ManagerEventHandler, >> ManagerResponseHandler >> { >> private ManagerConnection managerConnection; >> =20 >> public static void main(String[] args) throws Exception >> { >> CManager recordingManager; >> =20 >> recordingManager =3D new CManager(); >> recordingManager.runCommand("4003","samant123"); >> } >> =20 >> public CManager() throws IOException >> { >> ManagerConnectionFactory factory =3D new >> ManagerConnectionFactory(); >> this.managerConnection =3D >> factory.getManagerConnection("locahost", "manager", "asterisk"); >> } >> =20 >> public CManager(String ip, String manager_username, String >> manager_password) throws IOException >> { >> ManagerConnectionFactory factory =3D new >> ManagerConnectionFactory(); >> this.managerConnection =3D factory.getManagerConnection(ip, >> manager_username, manager_password); >> } >> =20 >> public String runCommand(String channel, String fileName)=20 >> throws IOException, AuthenticationFailedException, >> TimeoutException >> { >> this.managerConnection.addEventHandler(this); >> =20 >> ManagerResponse originateResponse; >> =20 >> CommandAction commandAction =3D new CommandAction(); >> commandAction.setCommand("show voicemail users"); >> =20 >> managerConnection.login(); >> System.out.println("Logged in"); >> =20 >> originateResponse =3D >> this.managerConnection.sendAction(commandAction); >> =20 >> String response =3D originateResponse.getResponse(); =20 >> =20 >> managerConnection.logoff(); >> System.out.println("Logged out"); >> System.out.println(response); >> return response; >> } >> =20 >>=20 >> public void handleEvent(ManagerEvent event) >> { >> System.out.println ("# event : " + event); >> } >> =20 >> public void handleResponse(ManagerResponse response) >> { >> System.out.println ("# response : " + response); >> System.out.println ("# response : " + >> response.getAttributes()); >> } >> =20 >> } >>=20 > > --=-KlynJpwKZIRhTb3fM7Bl > Content-Type: application/pgp-signature; name=signature.asc > Content-Description: This is a digitally signed message part > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.2 (GNU/Linux) > > iD8DBQBDWIrOTUZ7XZofpgURAiziAJ0dx8xrjGfbI9cwPIH3DtPZFFmgXwCfZCr0 > 6aA3qKxAtOilS/JpuF3mPg8= > =8/u2 > -----END PGP SIGNATURE----- > > --=-KlynJpwKZIRhTb3fM7Bl-- > > > > > --__--__-- > > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > End of Asterisk-java-users Digest |