Exemplo n.º 1
0
        private async void c_OnChannelEnteredBridgeEvent(object sender, ChannelEnteredBridgeEvent e)
        {
            ConferenceUser confUser = ConferenceUsers.SingleOrDefault(x => x.Channel.Id == e.Channel.Id);

            if (confUser == null)
            {
                return;
            }

            confUser.State = ConferenceUserState.InConf;

            if (ConferenceUsers.Count(x => x.State == ConferenceUserState.InConf) > 1) // are we the only ones here
            {
                // stop moh
                await _client.Bridges.StopMohAsync(Confbridge.Id);

                // change state
                State = ConferenceState.Ready;

                // announce new user
                await _client.Bridges.PlayAsync(Confbridge.Id, "recording:" + confUser.CurrentRecodingId, "en", 0, 0, Guid.NewGuid().ToString());

                await _client.Bridges.PlayAsync(Confbridge.Id, "sound:conf-hasjoin", "en", 0, 0, Guid.NewGuid().ToString());
            }
            else
            {
                // only caller in conf
                await _client.Channels.PlayAsync(e.Channel.Id, "sound:conf-onlyperson", "en", 0, 0, Guid.NewGuid().ToString());
            }
        }
Exemplo n.º 2
0
        private async void c_OnChannelDtmfReceivedEvent(object sender, ChannelDtmfReceivedEvent e)
        {
            ConferenceUser confUser = ConferenceUsers.SingleOrDefault(x => x.Channel.Id == e.Channel.Id);

            if (confUser == null)
            {
                return;
            }

            // Pass digit to conference user
            await confUser.KeyPress(e.Digit);
        }
Exemplo n.º 3
0
        public async Task RemoveUser(string channelId)
        {
            // Remove the channel from the bridge
            ConferenceUser confUser = ConferenceUsers.SingleOrDefault(x => x.Channel.Id == channelId);

            if (confUser == null)
            {
                return;
            }

            await _client.Bridges.RemoveChannelAsync(Confbridge.Id, channelId);

            ConferenceUsers.Remove(confUser);
        }
Exemplo n.º 4
0
        void c_OnChannelTalkingStartedEvent(object sender, ChannelTalkingStartedEvent e)
        {
            ConferenceUser confUser = ConferenceUsers.SingleOrDefault(x => x.Channel.Id == e.Channel.Id);

            Console.WriteLine("{0} Started to talk in conference {1}", e.Channel.Id, this.ConferenceName);
        }
Exemplo n.º 5
0
        void c_OnChannelTalkingFinishedEvent(object sender, ChannelTalkingFinishedEvent e)
        {
            ConferenceUser confUser = ConferenceUsers.SingleOrDefault(x => x.Channel.Id == e.Channel.Id);

            Console.WriteLine("{0} Finished talking in conference {1}, lasted {2} milliseconds", e.Channel.Id, this.ConferenceName, e.Duration);
        }