Esempio n. 1
0
        public AGIReply SendCommand(Command.AGICommand command)
        {
            agiWriter.SendCommand(command);
            agiReply = agiReader.ReadReply();
            int status = agiReply.GetStatus();

            if (status == (int)AGIReplyStatuses.SC_INVALID_OR_UNKNOWN_COMMAND)
            {
                throw new InvalidOrUnknownCommandException(command.BuildCommand());
            }
            else if (status == (int)AGIReplyStatuses.SC_INVALID_COMMAND_SYNTAX)
            {
                throw new InvalidCommandSyntaxException(agiReply.GetSynopsis(), agiReply.GetUsage());
            }
            return(agiReply);
        }
Esempio n. 2
0
        public AGIReply SendCommand(Command.AGICommand command)
        {
            agiWriter.SendCommand(command);
            agiReply = agiReader.ReadReply();
            int status = agiReply.GetStatus();

            if (status == (int)AGIReplyStatuses.SC_INVALID_OR_UNKNOWN_COMMAND)
            {
                throw new InvalidOrUnknownCommandException(command.BuildCommand());
            }
            else if (status == (int)AGIReplyStatuses.SC_INVALID_COMMAND_SYNTAX)
            {
                throw new InvalidCommandSyntaxException(agiReply.GetSynopsis(), agiReply.GetUsage());
            }
            else if (status == (int)AGIReplyStatuses.SC_DEAD_CHANNEL && _SC511_CAUSES_EXCEPTION)
            {
                throw new AGIHangupException();
            }
            else if ((status == 0) && agiReply.FirstLine == "HANGUP" && _SCHANGUP_CAUSES_EXCEPTION)
            {
                throw new AGIHangupException();
            }
            return(agiReply);
        }