[Asterisk-java-cvs] CVS: asterisk-java/src/java/net/sf/asterisk/fastagi/reply AGIReply.java,1.1,1.2
Brought to you by:
srt
From: Stefan R. <sr...@us...> - 2005-03-08 02:55:47
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11648/src/java/net/sf/asterisk/fastagi/reply Modified Files: AGIReply.java Log Message: Added status and usage properties Renamed returnCode to result in accordance to asterisk parlance Index: AGIReply.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply/AGIReply.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- AGIReply.java 8 Mar 2005 02:25:35 -0000 1.1 +++ AGIReply.java 8 Mar 2005 02:55:35 -0000 1.2 @@ -19,7 +19,10 @@ package net.sf.asterisk.fastagi.reply; import java.io.Serializable; /** - * Response to an AGICommand. + * Reply received in response to an AGICommand.<br> + * The AGIReply contains information about success or failure of the execution of an AGICommand and - + * depending on the command sent - additional information returned, for example the value of a + * variable requested by a GetVariableCommand. * * @see net.sf.asterisk.fastagi.command.AGICommand * @@ -29,29 +32,109 @@ import java.io.Serializable; public class AGIReply implements Serializable { /** + * Status code (200) indicating Asterisk successfully processed the AGICommand. + */ + public static int SC_SUCCESS = 200; + + /** + * Status code (510) indicating Asterisk was unable to process the AGICommand because there is + * no command with the given name available. + */ + public static int SC_INVALID_OR_UNKNOWN_COMMAND = 510; + + /** + * Status code (510) indicating Asterisk was unable to process the AGICommand because the syntax + * used was not correct. This is most likely due to missing required parameters or additional + * parameters sent that are not understood.<br> + * Ensure proper quoting of the parameters when you receive this status code. + */ + public static int SC_INVALID_COMMAND_SYNTAX = 520; + + /** * Serial version identifier. */ private static final long serialVersionUID = 3256727294671337012L; - int returnCode; + /** + * The return code. + */ + private int result; + + /** + * The status code. + */ + private int status; + + /** + * In case of status == 520 (invalid command syntax) this attribute contains the synopsis of the + * command. + */ + private String usage; /** * Returns the return code. * * @return the return code. */ - public int getReturnCode() + public int getResult() { - return returnCode; + return result; } /** * Sets the return code. * - * @param returnCode the return code to set. + * @param result the return code to set. */ - public void setReturnCode(int returnCode) + public void setResult(int result) { - this.returnCode = returnCode; + this.result = result; + } + + /** + * Returns the status code.<br> + * Supported status codes are: + * <ul> + * <li>200 Success + * <li>510 Invalid or unknown command + * <li>520 Invalid command syntax + * </ul> + * + * @return the status code. + */ + public int getStatus() + { + return status; + } + + /** + * Sets the status code. + * + * @param status the status code to set. + */ + public void setStatus(int status) + { + this.status = status; + } + + /** + * Returns the synopsis of the command sent if Asterisk expected a different syntax (status == + * 502). + * + * @return the synopsis of the command sent, <code>null</code> if there were no syntax errors. + */ + public String getUsage() + { + return usage; + } + + /** + * Sets the synopsis of the command sent. + * + * @param usage the synopsis of the command sent. + */ + public void setUsage(String usage) + { + this.usage = usage; } } |