[Asterisk-java-cvs] CVS: asterisk-java/src/java/net/sf/asterisk/fastagi/impl AGIChannelImpl.java,1.4
Brought to you by:
srt
From: Stefan R. <sr...@us...> - 2005-09-13 00:56:33
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3458/src/java/net/sf/asterisk/fastagi/impl Modified Files: AGIChannelImpl.java Log Message: moved agi command methods to AGIChannel Index: AGIChannelImpl.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/impl/AGIChannelImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -p -r1.4 -r1.5 --- AGIChannelImpl.java 12 Jul 2005 08:21:27 -0000 1.4 +++ AGIChannelImpl.java 13 Sep 2005 00:56:25 -0000 1.5 @@ -23,6 +23,28 @@ import net.sf.asterisk.fastagi.AGIWriter import net.sf.asterisk.fastagi.InvalidCommandSyntaxException; import net.sf.asterisk.fastagi.InvalidOrUnknownCommandException; import net.sf.asterisk.fastagi.command.AGICommand; +import net.sf.asterisk.fastagi.command.AnswerCommand; +import net.sf.asterisk.fastagi.command.ChannelStatusCommand; +import net.sf.asterisk.fastagi.command.ExecCommand; +import net.sf.asterisk.fastagi.command.GetDataCommand; +import net.sf.asterisk.fastagi.command.GetOptionCommand; +import net.sf.asterisk.fastagi.command.GetVariableCommand; +import net.sf.asterisk.fastagi.command.HangupCommand; +import net.sf.asterisk.fastagi.command.SayAlphaCommand; +import net.sf.asterisk.fastagi.command.SayDigitsCommand; +import net.sf.asterisk.fastagi.command.SayNumberCommand; +import net.sf.asterisk.fastagi.command.SayPhoneticCommand; +import net.sf.asterisk.fastagi.command.SayTimeCommand; +import net.sf.asterisk.fastagi.command.SetAutoHangupCommand; +import net.sf.asterisk.fastagi.command.SetCallerIdCommand; +import net.sf.asterisk.fastagi.command.SetContextCommand; +import net.sf.asterisk.fastagi.command.SetExtensionCommand; +import net.sf.asterisk.fastagi.command.SetMusicOffCommand; +import net.sf.asterisk.fastagi.command.SetMusicOnCommand; +import net.sf.asterisk.fastagi.command.SetPriorityCommand; +import net.sf.asterisk.fastagi.command.SetVariableCommand; +import net.sf.asterisk.fastagi.command.StreamFileCommand; +import net.sf.asterisk.fastagi.command.WaitForDigitCommand; import net.sf.asterisk.fastagi.reply.AGIReply; import net.sf.asterisk.io.SocketConnectionFacade; @@ -69,4 +91,229 @@ public class AGIChannelImpl implements A return reply; } + + public void answer() throws AGIException + { + sendCommand(new AnswerCommand()); + } + + public void hangup() throws AGIException + { + sendCommand(new HangupCommand()); + } + + public void setAutoHangup(int time) throws AGIException + { + sendCommand(new SetAutoHangupCommand(time)); + } + + public void setCallerId(String callerId) throws AGIException + { + sendCommand(new SetCallerIdCommand(callerId)); + } + + public void playMusicOnHold() throws AGIException + { + sendCommand(new SetMusicOnCommand()); + } + + public void playMusicOnHold(String musicOnHoldClass) throws AGIException + { + sendCommand(new SetMusicOnCommand(musicOnHoldClass)); + } + + public void stopMusicOnHold() throws AGIException + { + sendCommand(new SetMusicOffCommand()); + } + + public int getChannelStatus() throws AGIException + { + AGIReply reply; + + reply = sendCommand(new ChannelStatusCommand()); + return reply.getResultCode(); + } + + public String getData(String file) throws AGIException + { + AGIReply reply; + + reply = sendCommand(new GetDataCommand(file)); + return reply.getResult(); + } + + public String getData(String file, int timeout) throws AGIException + { + AGIReply reply; + + reply = sendCommand(new GetDataCommand(file, timeout)); + return reply.getResult(); + } + + public String getData(String file, int timeout, int maxDigits) + throws AGIException + { + AGIReply reply; + + reply = sendCommand(new GetDataCommand(file, timeout, maxDigits)); + return reply.getResult(); + } + + public char getOption(String file, String escapeDigits) + throws AGIException + { + AGIReply reply; + + reply = sendCommand(new GetOptionCommand(file, escapeDigits)); + return reply.getResultCodeAsChar(); + } + + public char getOption(String file, String escapeDigits, int timeout) + throws AGIException + { + AGIReply reply; + + reply = sendCommand(new GetOptionCommand(file, escapeDigits, timeout)); + return reply.getResultCodeAsChar(); + } + + public int exec(String application) throws AGIException + { + AGIReply reply; + + reply = sendCommand(new ExecCommand(application)); + return reply.getResultCode(); + } + + public int exec(String application, String options) throws AGIException + { + AGIReply reply; + + reply = sendCommand(new ExecCommand(application, options)); + return reply.getResultCode(); + } + + public void setContext(String context) throws AGIException + { + sendCommand(new SetContextCommand(context)); + } + + public void setExtension(String extension) throws AGIException + { + sendCommand(new SetExtensionCommand(extension)); + } + + public void setPriority(int priority) throws AGIException + { + sendCommand(new SetPriorityCommand(priority)); + } + + public void streamFile(String file) throws AGIException + { + sendCommand(new StreamFileCommand(file)); + } + + public char streamFile(String file, String escapeDigits) + throws AGIException + { + AGIReply reply; + + reply = sendCommand(new StreamFileCommand(file, escapeDigits)); + return reply.getResultCodeAsChar(); + } + + public void sayDigits(String digits) throws AGIException + { + sendCommand(new SayDigitsCommand(digits)); + } + + public char sayDigits(String digits, String escapeDigits) + throws AGIException + { + AGIReply reply; + + reply = sendCommand(new SayDigitsCommand(digits, escapeDigits)); + return reply.getResultCodeAsChar(); + } + + public void sayNumber(String number) throws AGIException + { + sendCommand(new SayNumberCommand(number)); + } + + public char sayNumber(String number, String escapeDigits) + throws AGIException + { + AGIReply reply; + + reply = sendCommand(new SayNumberCommand(number, escapeDigits)); + return reply.getResultCodeAsChar(); + } + + public void sayPhonetic(String text) throws AGIException + { + sendCommand(new SayPhoneticCommand(text)); + } + + public char sayPhonetic(String text, String escapeDigits) + throws AGIException + { + AGIReply reply; + + reply = sendCommand(new SayPhoneticCommand(text, escapeDigits)); + return reply.getResultCodeAsChar(); + } + + public void sayAlpha(String text) throws AGIException + { + sendCommand(new SayAlphaCommand(text)); + } + + public char sayAlpha(String text, String escapeDigits) + throws AGIException + { + AGIReply reply; + + reply = sendCommand(new SayAlphaCommand(text, escapeDigits)); + return reply.getResultCodeAsChar(); + } + + public void sayTime(long time) throws AGIException + { + sendCommand(new SayTimeCommand(time)); + } + + public char sayTime(long time, String escapeDigits) throws AGIException + { + AGIReply reply; + + reply = sendCommand(new SayTimeCommand(time, escapeDigits)); + return reply.getResultCodeAsChar(); + } + + public String getVariable(String name) throws AGIException + { + AGIReply reply; + + reply = sendCommand(new GetVariableCommand(name)); + if (reply.getResultCode() != 1) + { + return null; + } + return reply.getExtra(); + } + + public void setVariable(String name, String value) throws AGIException + { + sendCommand(new SetVariableCommand(name, value)); + } + + public char waitForDigit(int timeout) throws AGIException + { + AGIReply reply; + + reply = sendCommand(new WaitForDigitCommand(timeout)); + return reply.getResultCodeAsChar(); + } } |