Exemple #1
0
        public async void PlayPromptsInQueue()
        {
            if (_arkeCall.GetCurrentState() == State.StoppingPlayback || _promptQueue.Count == 0)
            {
                return;
            }
            _arkeCall.Logger.Debug($"Playing next prompt in queue, queue size: {_promptQueue.Count}", _arkeCall.LogData);

            try
            {
                var prompt = _promptQueue.Dequeue();

                if (prompt != null)
                {
                    await PlayPromptFile(prompt.PromptFile);
                }
            }
            catch (Exception)
            {
                _arkeCall.CallStateMachine.Fire(Trigger.FinishedPrompt);
            }
        }
Exemple #2
0
 public async Task PlayRecordingToLineAsync(string recordingName, string lineId)
 {
     try
     {
         _currentPlaybackId = await _sipPromptApi.PlayRecordingToLineAsync(lineId, recordingName);
     }
     catch (Exception e)
     {
         _arkeCall.Logger.Error(e, $"Error Playing Prompt: {e.Message}");
         if (_arkeCall.GetCurrentState() != State.HangUp)
         {
             await _arkeCall.CallStateMachine.FireAsync(Trigger.FinishCall);
         }
     }
 }
Exemple #3
0
        public async void PlayPromptsInQueue()
        {
            if (_arkeCall.GetCurrentState() == State.StoppingPlayback || _promptQueue.Count == 0)
            {
                return;
            }
            _arkeCall.Logger.Debug($"Playing next prompt in queue, queue size: {_promptQueue.Count}", _arkeCall.LogData);

            try
            {
                var prompt = _promptQueue.Dequeue();

                if (prompt != null)
                {
                    switch (prompt.Direction)
                    {
                    case Direction.Incoming:
                        await PlayPromptToIncomingLine(prompt.PromptFile).ConfigureAwait(false);

                        break;

                    case Direction.Outgoing:
                        await PlayPromptToOutgoingLine(prompt.PromptFile).ConfigureAwait(false);

                        break;

                    default:
                        await PlayPromptToBridge(prompt.PromptFile).ConfigureAwait(false);

                        break;
                    }
                }
            }
            catch (Exception)
            {
                _arkeCall.CallStateMachine.Fire(Trigger.FinishedPrompt);
            }
        }