예제 #1
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);
        }
예제 #2
0
        public void Execute(IAGIScriptHost host, Dictionary <string, string> configurationSettings)
        {
            _hostAGI = host;

            _asteriskAGI = new AsteriskAGI(this);
            _asteriskAGI.Init();

            Uri uri = new Uri(_asteriskAGI.RequestInfo.Request);

            _agiVariables = parseQueryStrings(uri.Query);

            _configurationSettings = configurationSettings;

            OnExecute(host);
        }
예제 #3
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);
        }
예제 #4
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));
        }
예제 #5
0
 public override string GetCommand()
 {
     return(string.Format("SAY PHONETIC \"{0}\" \"{1}\"", _message, AsteriskAGI.GetDigitsString(_escapeDigits)));
 }
예제 #6
0
 public override string GetCommand()
 {
     return(string.Format("SAY DATE {0} {1}", (_date.ToUniversalTime().Ticks / TimeSpan.TicksPerSecond), AsteriskAGI.GetDigitsString(_escapeDigits)));
 }
예제 #7
0
        public override string GetCommand()
        {
            validateNumber(_number);

            return(string.Format("SAY DIGITS {0} {1}", _number, AsteriskAGI.GetDigitsString(_escapeDigits)));
        }
예제 #8
0
 public override string GetCommand()
 {
     return(string.Format("SAY TIME {0} {1}", ((_time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds), AsteriskAGI.GetDigitsString(_escapeDigits)));
 }
예제 #9
0
        public override string GetCommand()
        {
            string commandFormat = "SAY DATETIME {0} {1} {2} {3}";

            if (string.IsNullOrEmpty(_format) && string.IsNullOrEmpty(_timeZone))
            {
                commandFormat = "SAY DATETIME {0} {1}";
            }
            else if (string.IsNullOrEmpty(_format) || string.IsNullOrEmpty(_timeZone))
            {
                commandFormat = "SAY DATETIME {0} {1} {3}";                 // TODO: This is going to need testing I'm not 100% sure asterisk will be able to tell if {3} is a timezone or a format.
            }
            return(string.Format(commandFormat, (_time - (new DateTime(1970, 1, 1, 0, 0, 0))).TotalSeconds, AsteriskAGI.GetDigitsString(_escapeDigits), _format, _timeZone));
        }
예제 #10
0
 public override string GetCommand()
 {
     return(string.Format("SAY NUMBER {0} {1}", _number.ToString(), AsteriskAGI.GetDigitsString(_escapeDigits)));
 }
예제 #11
0
        public override string GetCommand()
        {
            string silenceString = _silence != null?string.Format(" s={0}", _silence) : string.Empty;

            string beepString         = _beep ? " beep" : string.Empty;
            string offsetSampleString = _offsetSample != null?string.Format(" {0}", _offsetSample) : string.Empty;

            return(string.Format("RECORD FILE {0} {1} {2} {3}{4}{5}{6}", _fileName, _format, AsteriskAGI.GetDigitsString(_escapeDigits),
                                 _timeout, offsetSampleString, beepString, silenceString));
        }
예제 #12
0
 public override string GetCommand()
 {
     return(string.Format("SAY ALPHA \"{0}\" \"{1}\"", _chars, AsteriskAGI.GetDigitsString(_escapeDigits)));
 }