Ejemplo n.º 1
0
        public override void Service(AGIRequest request, AGIChannel channel)
        {
            // First of all i need user definition of IVR (if exist) from DB
            var steps = LoadUserDefinitionForIVR(request.Dnid);

            //Next we pick up the phone
            Answer();

            if (steps != null)
            {
                // Executing menu algorytm defined in VRG definition
                doSteps(steps);
            }

            Hangup();
        }
Ejemplo n.º 2
0
        public override void Service(AGIRequest param1, AGIChannel param2)
        {
            // Answer the call, this is important as otherwise
            // we wont be able to perform certain action on the
            // call flow.
            Answer();

            // Get a numeric sequence from the caller, we prompt them
            // to enter the number by playing an audio file asking
            // them to do so.
            // We're going to:
            // # Play the file called "enter_your_acc_number"
            // # limit the number of digits to 4
            // # wait a fixed period of 30 seconds for them to
            //   enter the digits.
            var digits = GetData("enter_your_acc_number", 30, 4);

            if (!string.IsNullOrEmpty(digits))
            {
            }
        }
Ejemplo n.º 3
0
        public override void Service(AGIRequest param1, AGIChannel param2)
        {
            // Answer the call, this is important as otherwise
            // we wont be able to perform certain action on the
            // call flow.
            Answer();

            // Get a numeric sequence from the caller, we prompt them
            // to enter the number by playing an audio file asking
            // them to do so.
            // We're going to:
            // # Play the file called "acccheck-enter_your_acc_number"
            // # wait a fixed period of 10 seconds (10000ms) for them to
            //   enter the digits.
            var digits = GetData("acccheck-enter_your_acc_number", 10000);

            if (!string.IsNullOrEmpty(digits))
            {
                // Do some work on an external source to query the
                // balance of this account. We're just pretend it
                // returns a balance of £4.99
                var balance = "4.99";
                var pounds  = balance.Split(new char[] { '.' })[0];
                var pence   = balance.Split(new char[] { '.' })[1];

                StreamFile("acccheck-your_balance_is");

                SayNumber(pounds);
                StreamFile("acccheck-pounds");
                StreamFile("acccheck-and");

                SayNumber(pence);
                StreamFile("acccheck-pence");
            }

            Hangup();
        }
Ejemplo n.º 4
0
 public override void Service(AGIRequest request, AGIChannel channel)
 {
     base.Hangup();
 }
Ejemplo n.º 5
0
		public override void Service(AGIRequest request, AGIChannel channel)
		{
			base.Hangup();
		}
Ejemplo n.º 6
0
        /*
         * Call -> play "wellcome" -> wait digit 5 seconds -> press 1 -> play "press-1" -> wait digit -> press * ----------------------------\
         *               ^                    ^                                                 ^     -> press 4 -> play "press-4" -------\  |
         *               |                    |                                                 |     -> press any -> play "bad" "digit" -+  |
         *               |                    |                                                 \-----------------------------------------/  |
         *               |                    |                                                       -> press # or timeout -\               |
         *               |                    |                                                                              |               |
         *               |                    |            -> press # or timeout -> play "goodbye" -> Hangup                 |               |
         *               |                    |                                          ^                                   |               |
         *               |                    |                                          \-----------------------------------+               |
         *               |                    |                                                                              |               |
         *               |                    |                                                                              |               |
         *               |                    |           -> press 2 -> play "press-1" -> wait digit  -> press # or timeout -/               |
         *               |                    |                                                 ^     -> press * ----------------------------+
         *               |                    |                                                 |     -> press 4 -> play "press-4" -------\  |
         *               |                    |                                                 |     -> press any -> play "bad" "digit" -+  |
         *               |                    |                                                 \-----------------------------------------/  |
         *               |                    |                                                                                              |
         *               |                    |            -> press other -> play "bad" "digit" -\                                           |
         *               |                    \--------------------------------------------------/                                           |
         *               \-------------------------------------------------------------------------------------------------------------------/
         */

        public override void Service(AGIRequest request, AGIChannel channel)
        {
            Answer();
            int  submenu = 0;
            char key     = '\0';
            bool welcome = true;

            while (true)
            {
                if (welcome)
                {
                    key     = StreamFile("welcome", escapeKeys);
                    welcome = false;
                    submenu = 0;
                }
                if (key == '\0')
                {
                    key = WaitForDigit(5000);
                    if (key == '\0' || key == '#')
                    {
                        StreamFile("goodbye");
                        break;
                    }
                }
                char newKey = '\0';
                switch (submenu)
                {
                case 0:
                    switch (key)
                    {
                    case '1':
                        newKey  = StreamFile("press-1", escapeKeys);
                        submenu = 1;
                        break;

                    case '2':
                        newKey  = StreamFile("press-2", escapeKeys);
                        submenu = 2;
                        break;

                    case '3':
                        newKey = StreamFile("press-3", escapeKeys);
                        break;

                    default:
                        newKey = StreamFile("bad", escapeKeys);
                        if (newKey == '\0')
                        {
                            newKey = StreamFile("digit", escapeKeys);
                        }
                        break;
                    }
                    break;

                case 1:
                    switch (key)
                    {
                    case '*':
                        welcome = true;
                        break;

                    case '4':
                        newKey = StreamFile("press-4", escapeKeys);
                        break;

                    default:
                        newKey = StreamFile("bad", escapeKeys);
                        if (newKey == '\0')
                        {
                            newKey = StreamFile("digit", escapeKeys);
                        }
                        break;
                    }
                    break;

                case 2:
                    switch (key)
                    {
                    case '*':
                        welcome = true;
                        break;

                    case '5':
                        newKey = StreamFile("press-5", escapeKeys);
                        break;

                    default:
                        newKey = StreamFile("bad", escapeKeys);
                        if (newKey == '\0')
                        {
                            newKey = StreamFile("digit", escapeKeys);
                        }
                        break;
                    }
                    break;
                }
                key = newKey;
            }
            Hangup();
        }
Ejemplo n.º 7
0
        /*
         * Call -> play "wellcome" -> wait digit 5 seconds -> press 1 -> play "press-1" -> wait digit -> press * ----------------------------\
         *               ^                    ^                                                 ^     -> press 4 -> play "press-4" -------\  |
         *               |                    |                                                 |     -> press any -> play "bad" "digit" -+  |
         *               |                    |                                                 \-----------------------------------------/  |
         *               |                    |                                                       -> press # or timeout -\               |
         *               |                    |                                                                              |               |
         *               |                    |            -> press # or timeout -> play "goodbye" -> Hangup                 |               |
         *               |                    |                                          ^                                   |               |
         *               |                    |                                          \-----------------------------------+               |
         *               |                    |                                                                              |               |
         *               |                    |                                                                              |               |
         *               |                    |           -> press 2 -> play "press-1" -> wait digit  -> press # or timeout -/               |
         *               |                    |                                                 ^     -> press * ----------------------------+
         *               |                    |                                                 |     -> press 4 -> play "press-4" -------\  |
         *               |                    |                                                 |     -> press any -> play "bad" "digit" -+  |
         *               |                    |                                                 \-----------------------------------------/  |
         *               |                    |                                                                                              |
         *               |                    |            -> press other -> play "bad" "digit" -\                                           |
         *               |                    \--------------------------------------------------/                                           |
         *               \-------------------------------------------------------------------------------------------------------------------/
         */

        public override void Service(AGIRequest request, AGIChannel channel)
        {
            Answer();
            int  submenu = 0;
            char key     = '\0';
            bool welcome = true;

            while (true)
            {
                if (welcome)
                {
                    var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                    SayTime(Convert.ToInt64((DateTime.Now - epoch).TotalSeconds));
                    key     = StreamFile("hello-world", escapeKeys);
                    welcome = false;
                    submenu = 0;
                }
                if (key == '\0')
                {
                    key = WaitForDigit(5000);
                    if (key == '\0' || key == '#')
                    {
                        StreamFile("goodbye");
                        break;
                    }
                }
                char newKey = '\0';
                switch (submenu)
                {
                case 0:
                    switch (key)
                    {
                    case '1':
                        newKey  = StreamFile("press-1", escapeKeys);
                        submenu = 1;
                        break;

                    case '2':
                        newKey  = StreamFile("press-2", escapeKeys);
                        submenu = 2;
                        break;

                    case '3':
                        newKey = StreamFile("press-3", escapeKeys);
                        break;

                    default:
                        newKey = StreamFile("bad", escapeKeys);
                        if (newKey == '\0')
                        {
                            newKey = StreamFile("digit", escapeKeys);
                        }
                        break;
                    }
                    break;

                case 1:
                    switch (key)
                    {
                    case '*':
                        welcome = true;
                        break;

                    case '4':
                        newKey = StreamFile("press-4", escapeKeys);
                        break;

                    default:
                        newKey = StreamFile("bad", escapeKeys);
                        if (newKey == '\0')
                        {
                            newKey = StreamFile("digit", escapeKeys);
                        }
                        break;
                    }
                    break;

                case 2:
                    switch (key)
                    {
                    case '*':
                        welcome = true;
                        break;

                    case '5':
                        newKey = StreamFile("press-5", escapeKeys);
                        break;

                    default:
                        newKey = StreamFile("bad", escapeKeys);
                        if (newKey == '\0')
                        {
                            newKey = StreamFile("digit", escapeKeys);
                        }
                        break;
                    }
                    break;
                }
                key = newKey;
            }
            Hangup();
        }
Ejemplo n.º 8
0
        //public static async Task RecognizeSpeechAsync()
        //{
        //    // Creates an instance of a speech config with specified subscription key and service region.
        //    // Replace with your own subscription key and service region (e.g., "westus").
        //    var config = SpeechConfig.FromSubscription("YourSubscriptionKey", "YourServiceRegion");

        //    // Creates a speech recognizer.
        //    using (var recognizer = new SpeechRecognizer(config))
        //    {
        //        Console.WriteLine("Say something...");

        //        // Starts speech recognition, and returns after a single utterance is recognized. The end of a
        //        // single utterance is determined by listening for silence at the end or until a maximum of 15
        //        // seconds of audio is processed.  The task returns the recognition text as result.
        //        // Note: Since RecognizeOnceAsync() returns only a single utterance, it is suitable only for single
        //        // shot recognition like command or query.
        //        // For long-running multi-utterance recognition, use StartContinuousRecognitionAsync() instead.
        //        var result = await recognizer.RecognizeOnceAsync();

        //        // Checks result.
        //        if (result.Reason == ResultReason.RecognizedSpeech)
        //        {
        //            Console.WriteLine($"We recognized: {result.Text}");
        //        }
        //        else if (result.Reason == ResultReason.NoMatch)
        //        {
        //            Console.WriteLine($"NOMATCH: Speech could not be recognized.");
        //        }
        //        else if (result.Reason == ResultReason.Canceled)
        //        {
        //            var cancellation = CancellationDetails.FromResult(result);
        //            Console.WriteLine($"CANCELED: Reason={cancellation.Reason}");

        //            if (cancellation.Reason == CancellationReason.Error)
        //            {
        //                Console.WriteLine($"CANCELED: ErrorCode={cancellation.ErrorCode}");
        //                Console.WriteLine($"CANCELED: ErrorDetails={cancellation.ErrorDetails}");
        //                Console.WriteLine($"CANCELED: Did you update the subscription info?");
        //            }
        //        }
        //    }
        //}

        #endregion

        public override void Service(AGIRequest request, AGIChannel channel)
        {
            var quemLigou = string.Empty;

            Answer();
            int  submenu = 0;
            char key     = '\0';
            bool welcome = true;

            while (true)
            {
                if (welcome)
                {
                    Thread.Sleep(2000);


                    key     = StreamFile("ARQUIVO DE AUDIO COREM ATENDEDOR", escapeKeys);
                    welcome = false;
                    submenu = 0;
                }
                if (key == '\0')
                {
                    key = WaitForDigit(5000);
                    if (key == '\0' || key == '#')
                    {
                        StreamFile("goodbye");
                        break;
                    }
                }
                char newKey = '\0';
                switch (submenu)
                {
                case 0:
                    switch (key)
                    {
                    case '1':
                        newKey  = StreamFile("ARQUIVO DE AUDIO OP1-SUB", escapeKeys);
                        submenu = 1;
                        break;

                    case '2':
                        newKey  = StreamFile("press-2", escapeKeys);
                        submenu = 2;
                        break;

                    case '3':
                        newKey  = StreamFile("press-3", escapeKeys);
                        submenu = 3;
                        break;

                    default:
                        newKey = StreamFile("bad", escapeKeys);
                        if (newKey == '\0')
                        {
                            newKey = StreamFile("digit", escapeKeys);
                        }
                        break;
                    }
                    break;


                case 1:
                    switch (key)
                    {
                    case '1':
                        var audio = RecordFile("aaa", "wav", escapeKeys, 3000);



                        newKey  = StreamFile("ARQUIVO DE AUDIO OP1-SUB1-GOIANIA", escapeKeys);
                        submenu = 11;
                        break;

                    case '2':
                        newKey  = StreamFile("ARQUIVO DE AUDIO OP1-SUB2-ANAPOLIS", escapeKeys);
                        submenu = 12;
                        break;

                    case '3':
                        newKey  = StreamFile("ARQUIVO DE AUDIO OP1-SUB3-VALPARAISO", escapeKeys);
                        submenu = 13;
                        break;

                    default:
                        newKey = StreamFile("bad", escapeKeys);
                        if (newKey == '\0')
                        {
                            newKey = StreamFile("digit", escapeKeys);
                        }
                        break;
                    }
                    break;

                case 11:
                    switch (key)
                    {
                    case '7':
                        submenu = 1;
                        newKey  = '1';
                        break;

                    case '8':
                        submenu = 0;
                        welcome = true;
                        break;
                    }
                    break;

                case 12:
                    switch (key)
                    {
                    case '7':
                        submenu = 1;
                        newKey  = '2';
                        break;

                    case '8':
                        submenu = 0;
                        welcome = true;
                        break;

                    default:
                        submenu = 1;
                        newKey  = '2';
                        break;
                    }
                    break;

                case 13:
                    switch (key)
                    {
                    case '7':
                        submenu = 1;
                        newKey  = '3';
                        break;

                    case '8':
                        submenu = 0;
                        welcome = true;
                        break;
                    }
                    break;

                case 2:
                    switch (key)
                    {
                    case '1':

                        submenu = 21;
                        break;

                    case '5':
                        newKey = StreamFile("press-5", escapeKeys);
                        break;

                    default:
                        newKey = StreamFile("bad", escapeKeys);
                        if (newKey == '\0')
                        {
                            newKey = StreamFile("digit", escapeKeys);
                        }
                        break;
                    }
                    break;
                }
                key = newKey;
            }

            Hangup();
        }
        public override void Service(AGIRequest request, AGIChannel channel)
        {
            var quemLigou = string.Empty;

            Answer();
            int  submenu = 0;
            char key     = '\0';
            bool welcome = true;

            while (true)
            {
                if (welcome)
                {
                    Thread.Sleep(5000);

                    key     = StreamFile("welcome", escapeKeys);
                    welcome = false;
                    submenu = 0;

                    quemLigou = request.Request["callerid"].ToString();
                    Thread.Sleep(2000);

                    //Persistencia.FilaPraLigar.Add(quemLigou);
                    Hangup();

                    return;

                    //SetVariable("callerid", "9002");
                    //var callerId = GetVariable("agi_callerid"); //channel.SendCommand(new GetVariableCommand("callerid"));
                    //SetExtension("9002");
                    //return;
                    //Exec("9003");
                }
                if (key == '\0')
                {
                    key = WaitForDigit(5000);
                    if (key == '\0' || key == '#')
                    {
                        StreamFile("goodbye");
                        break;
                    }
                }
                char newKey = '\0';
                switch (submenu)
                {
                case 0:
                    switch (key)
                    {
                    case '1':
                        newKey  = StreamFile("press-1", escapeKeys);
                        submenu = 1;
                        break;

                    case '2':
                        newKey  = StreamFile("press-2", escapeKeys);
                        submenu = 2;
                        break;

                    case '3':
                        newKey = StreamFile("press-3", escapeKeys);
                        break;

                    default:
                        newKey = StreamFile("bad", escapeKeys);
                        if (newKey == '\0')
                        {
                            newKey = StreamFile("digit", escapeKeys);
                        }
                        break;
                    }
                    break;

                case 1:
                    switch (key)
                    {
                    case '*':
                        welcome = true;
                        break;

                    case '4':
                        newKey = StreamFile("press-4", escapeKeys);
                        break;

                    default:
                        newKey = StreamFile("bad", escapeKeys);
                        if (newKey == '\0')
                        {
                            newKey = StreamFile("digit", escapeKeys);
                        }
                        break;
                    }
                    break;

                case 2:
                    switch (key)
                    {
                    case '*':
                        welcome = true;
                        break;

                    case '5':
                        newKey = StreamFile("press-5", escapeKeys);
                        break;

                    default:
                        newKey = StreamFile("bad", escapeKeys);
                        if (newKey == '\0')
                        {
                            newKey = StreamFile("digit", escapeKeys);
                        }
                        break;
                    }
                    break;
                }
                key = newKey;
            }

            Hangup();
        }