private async Task ProcessStasisEvents(IList <string> args, Channel channel)
        {
            _logger.Information($"ProcessStasisEvents.Start. ChannelId: {channel.Id}");
            if (!args.Any())
            {
                _logger.Information($"ProcessStasisEvents.RegisterIncomingCallCommand. ChannelId: {channel.Id}");
                await _commandFactory.GetCommand(StasisStartEventType.RegisterIncomingCallCommand).Execute(channel, null);

                return;
            }

            StasisStartEventArgs startEventArgs;

            try
            {
                startEventArgs = JsonSerializer.DecodeData <StasisStartEventArgs>(args[0]);
            }
            catch (Exception ex)
            {
                _logger.Error("AriClientOnStasisStartEvent. Args parsing error.", ex);
                return;
            }

            _logger.Information($"ProcessStasisEvents.GetCommand. EventType: {startEventArgs.EventType}. ChannelId: {channel.Id}");

            if (startEventArgs.EventType == StasisStartEventType.IgnoreStasisEvent)
            {
                return;
            }

            await _commandFactory.GetCommand(startEventArgs.EventType).Execute(channel, startEventArgs);
        }
Beispiel #2
0
 static void GetRecording(Channel c)
 {
     var playback = actionClient.Channels.Play(c.Id, "sound:vm-rec-name", "en", 0, 0, Guid.NewGuid().ToString()).Id;
     recording = new RecordingToChannel()
     {
         Recording = actionClient.Channels.Record(c.Id, "temp-recording", "wav", 6, 1, "overwrite", true, "#"),
         Channel = c
     };
 }
Beispiel #3
0
        public ConferenceUser(Conference conf, Channel chan, AriClient client, ConferenceUserType type)
        {
            _conference = conf;
            Channel = chan;
            _client = client;
            Type = type;

            // Initial State
            State = ConferenceUserState.AskForName;
            // Get user to speak name
            CurrentPlaybackId = _client.Channels.Play(Channel.Id, "sound:vm-rec-name", "en", 0, 0, Guid.NewGuid().ToString()).Id;
            RecordName();
        }
Beispiel #4
0
        public bool AddUser(Channel c)
        {
            if (State == ConferenceState.Destroying)
                return false;
            if (State == ConferenceState.Destroyed)
            {
                // We should initiate a new conference bridge
                if (!StartConference())
                    return false;
            }
            if (State < ConferenceState.Ready) return false;

            // Answer channel
            _client.Channels.Answer(c.Id);

            // Turn on talk detection on this channel
            _client.Channels.SetChannelVar(c.Id, "TALK_DETECT(set)", "");

            // Add conference user to collection
            ConferenceUsers.Add(new ConferenceUser(this, c, _client, ConferenceUserType.Normal));

            return true;
        }
Beispiel #5
0
 static void PlaybackRecording(Channel c)
 {
     var repeat = actionClient.Channels.Play(c.Id, "recording:temp-recording", "en", 0, 0, Guid.NewGuid().ToString()).Id;
 }