Ejemplo n.º 1
0
 public override void ProcessResponse(FastAGIResponse response)
 {
     if (response.ResultValue == "0")
     {
         throw new AGICommandException("TDDMode Command Failed. The channel is not TDD capable.");
     }
 }
Ejemplo n.º 2
0
 public override void ProcessResponse(FastAGIResponse response)
 {
     if (response.ResultValue != "0")
     {
         throw new AGICommandException("SetPriority Command Failed.");
     }
 }
Ejemplo n.º 3
0
 public override void ProcessResponse(FastAGIResponse response)
 {
     if (response.ResultValue == "-1")
     {
         throw new AGICommandException("SendImage Command Failed.");
     }
 }
 public override void ProcessResponse(FastAGIResponse response)
 {
     if (response.ResultValue == "0")
     {
         throw new AGICommandException("DatabaseDeleteTree Command Failed.");
     }
 }
Ejemplo n.º 5
0
        public override string ProcessResponse(FastAGIResponse response)
        {
            if (response.ResultValue == "1")
            {
                _variableValue = response.Payload;
            }

            return(_variableValue);
        }
Ejemplo n.º 6
0
        public override ChannelStatus ProcessResponse(FastAGIResponse response)
        {
            if (Enum.IsDefined(typeof(ChannelStatus), response.ResultValue))
            {
                _channelStatus = (ChannelStatus)Enum.Parse(typeof(ChannelStatus), response.ResultValue);
            }

            return(_channelStatus);
        }
Ejemplo n.º 7
0
        public override string ProcessResponse(FastAGIResponse response)
        {
            if (response.ResultValue == "-1")
            {
                throw new AGICommandException("ReceiveText Command Failed.");
            }

            _text = response.ResultValue;

            return(_text);
        }
Ejemplo n.º 8
0
        public override string ProcessResponse(FastAGIResponse response)
        {
            _applicationReturnValue = response.ResultValue;

            if (response.ResultValue == "-2")
            {
                throw new AGICommandException("Execute Command Failed.");
            }

            return(_applicationReturnValue);
        }
Ejemplo n.º 9
0
        public override string ProcessResponse(FastAGIResponse response)
        {
            if (response.ResultValue == "0")
            {
                throw new AGICommandException("DatabaseGet Command Failed.");
            }

            _resultingValue = response.Payload;

            return(_resultingValue);
        }
Ejemplo n.º 10
0
        public override Digits ProcessResponse(FastAGIResponse response)
        {
            if (response.ResultValue == "-1")
            {
                throw new AGICommandException("SayPhonetic Command Failed.");
            }

            if (response.ResultValue != "0")
            {
                _pressedDigit = AsteriskAGI.GetDigitsFromString(((Char)int.Parse(response.ResultValue)).ToString());
            }

            return(_pressedDigit);
        }
Ejemplo n.º 11
0
        public override GetDataCommandResult ProcessResponse(FastAGIResponse response)
        {
            if (response.ResultValue == "-1")
            {
                throw new AGICommandException("GetData Command Failed.");
            }

            _result = new GetDataCommandResult();

            _result.ResultingDtmfData = response.ResultValue;
            _result.Timeout           = response.Payload == "timeout";

            return(_result);
        }
Ejemplo n.º 12
0
        public override Char?ProcessResponse(FastAGIResponse response)
        {
            if (response.ResultValue == "-1")
            {
                throw new AGICommandException("ReceiveChar Command Failed.");
            }

            if (response.ResultValue != "0")
            {
                _character = (Char)int.Parse(response.ResultValue);
            }

            return(_character);
        }
Ejemplo n.º 13
0
        public override Digits ProcessResponse(FastAGIResponse response)
        {
            if (response.ResultValue == "-1")
            {
                throw new AGICommandException("WaitForDigit Command Failed.");
            }

            if (response.ResultValue != "0")
            {
                int digitCode;
                if (int.TryParse(response.ResultValue, out digitCode))
                {
                    _digit = AsteriskAGI.GetDigitsFromString(((Char)digitCode).ToString());
                }
            }

            return(_digit);
        }
Ejemplo n.º 14
0
        public override StreamFileResult ProcessResponse(FastAGIResponse response)
        {
            if (response.ResultValue == "-1")
            {
                throw new AGICommandException("StreamFile Command Failed.");
            }

            if (response.EndPosition != null)
            {
                _offset = response.EndPosition.Value;
            }

            if (response.ResultValue != "0")
            {
                _digit = AsteriskAGI.GetDigitsFromString(((Char)int.Parse(response.ResultValue)).ToString());
            }

            return(new StreamFileResult(_digit, _offset));
        }
Ejemplo n.º 15
0
        public override Char?ProcessResponse(FastAGIResponse response)
        {
            if (response.ResultValue == "-1")
            {
                if (response.Payload == "waitfor")
                {
                    throw new AGICommandException(string.Format("{0} Waitfor. EndPos={1}", CommonExceptionMessage, response.EndPosition));
                }

                if (response.Payload == "writefile")
                {
                    throw new AGICommandException(string.Format("{0} Failure to write file.", CommonExceptionMessage));
                }
            }
            else if (response.ResultValue == "0")
            {
                if (response.Payload == "hangup")
                {
                    throw new HangUpException(string.Format("{0} EndPos={1}", CommonExceptionMessage, response.EndPosition));
                }

                if (response.Payload == "timeout")
                {
                    throw new AGICommandException(string.Format("{0} Timeout. EndPos={1}", CommonExceptionMessage, response.EndPosition));
                }
            }
            else if (response.Payload == "randomerror")
            {
                throw new AGICommandException(string.Format("{0} Random Error. EndPos={1}, Error={2}", CommonExceptionMessage, response.EndPosition,
                                                            response.ResultValue));
            }

            if (response.Payload == "dtmf")
            {
                _dtmfDigit = (Char)int.Parse(response.ResultValue);
            }

            return(_dtmfDigit);
        }
Ejemplo n.º 16
0
 public override void ProcessResponse(FastAGIResponse response)
 {
     //This command always returns a result value of 0.
 }
Ejemplo n.º 17
0
 public abstract void ProcessResponse(FastAGIResponse response);