[Asterisk-java-users] Problems with CommandAction
Brought to you by:
srt
From: Bruno K. <bru...@un...> - 2008-02-01 17:36:18
|
Hello, Asterisk 1.4.17, Asterisk-java 0.3.1 I am trying to use the CommandAction with 'diaplan show' but the = response gives only the last line of the response. It seems that the Reader doesn't allow to give such responses splitted over several = lines.=20 If you accept a modification to treat it I suggest the following code in = the ManagerReaderImpl.java : StringBuilder commandResponseResult =3D null; // the buffer to be = used for multi lines command response=20 while ((line =3D socket.readLine()) !=3D null && !this.die) { ... // your code was : // Special handling for "Response: Follows" (CommandResponse) // if ("Follows".equals(buffer.get("response")) && = line.endsWith("--END COMMAND--")) // { // buffer.put("result", line); // continue; // } // I suggest : // special handling for "Response: Follows" (CommandResponse) to treat = several lines // START if ("Follows".equals(buffer.get("response")) && = line.length() > 0 && buffer.containsKey("actionid")) { if (commandResponseResult =3D=3D null) { if (line.endsWith("--END COMMAND--")) { buffer.put("result", line); } else { commandResponseResult =3D new StringBuilder(line); } } else { commandResponseResult.append(line); if (line.endsWith("--END COMMAND--")) { buffer.put("result", commandResponseResult.toString()); commandResponseResult =3D null; } } continue; } // END ... Thanks for letting me know if you are ok with that and thanks for your = help, Bruno Konik > -----Message d'origine----- > De : ast...@li...=20 > [mailto:ast...@li...] De=20 > la part de Stefan Reuter > Envoy=E9 : mardi 2 octobre 2007 02:44 > =C0 : ast...@li... > Objet : Re: [Asterisk-java-users] asterisk java and astmanproxy >=20 > Ga=EBtan Minet wrote: > > Here is a link > >=20 > > http://dev.mcit.be/various/astmanproxy-asterisk-java.html >=20 > Thanks. You'll find the link on the A-J homepage. I've also=20 > added it to the AstManProxy page on voip-info.org. >=20 > Support for the server property is now in SVN. >=20 > =3DStefan >=20 >=20 |