예제 #1
0
        protected BaseClient([NotNull] ICommsNetworkState network)
        {
            if (network == null)
            {
                throw new ArgumentNullException("network");
            }

            Log = Logs.Create(LogCategory.Network, GetType().Name);

            const int poolSize        = 32;
            const int byteBufferSize  = 1024;
            const int channelListSize = 8;
            var       byteArrayPool   = new ReadonlyLockedValue <Pool <byte[]> >(new Pool <byte[]>(poolSize, () => new byte[byteBufferSize]));
            var       channelListPool = new ConcurrentPool <List <RemoteChannel> >(poolSize, () => new List <RemoteChannel>(channelListSize));

            _sendQueue        = new SendQueue <TPeer>(this, byteArrayPool);
            _serverNegotiator = new ConnectionNegotiator <TPeer>(_sendQueue, network.PlayerName, network.CodecSettings);
            _lossSimulator    = new PacketDelaySimulator();

            _events = new EventQueue(byteArrayPool, channelListPool);
            _peers  = new SlaveClientCollection <TPeer>(_sendQueue, _serverNegotiator, _events, network.Rooms, network.PlayerName, network.CodecSettings);
            _peers.OnClientJoined        += OnAddedClient;
            _peers.OnClientIntroducedP2P += OnMetClient;

            _voiceReceiver = new VoiceReceiver <TPeer>(_serverNegotiator, _peers, _events, network.Rooms, channelListPool);
            _voiceSender   = new VoiceSender <TPeer>(_sendQueue, _serverNegotiator, _peers, _events, network.PlayerChannels, network.RoomChannels);

            _textReceiver = new TextReceiver <TPeer>(_events, network.Rooms, _peers);
            _textSender   = new TextSender <TPeer>(_sendQueue, _serverNegotiator, _peers);
        }
예제 #2
0
        public ActionResult CallList()
        {
            var results = VoiceSender.GetAllCalls()._embedded.calls;

            ViewData.Add("results", results);

            return(View("Index"));
        }
예제 #3
0
        public ActionResult GetAllCalls()
        {
            var calls = VoiceSender.GetAllCalls();

            ViewBag.numCalls = calls.count;

            return(View("Index"));
        }
예제 #4
0
        public FileResult GetRecording(string recording_url, string fileName)
        {
            var result   = VoiceSender.GetRecording(recording_url);
            var response = File(result.ResultStream, "audio/mpeg");

            response.FileDownloadName = fileName;
            return(response);
        }
예제 #5
0
        public ActionResult UnearmuffCall(string id)
        {
            var UUID = HttpContext.Session.GetString(UIDD);

            var result = VoiceSender.UnearmuffCall(id);

            return(View("Index"));
        }
예제 #6
0
        public ActionResult MakeCallWithNCCO(string to, string from)
        {
            var NEXMO_NUMBER = from;

            var results = VoiceSender.MakeCallWithNCCO(to, NEXMO_NUMBER);

            HttpContext.Session.SetString(UIDD, results.uuid);
            ViewBag.nccoCallResult = $"Call started. Call uuid is {results.uuid}";

            return(View("Index"));
        }
예제 #7
0
        public ActionResult EarmuffCall(string id)
        {
            var UUID = HttpContext.Session.GetString(UIDD);

            VoiceSender.EarmuffCall(id);

            Thread.Sleep(3000);

            VoiceSender.UnearmuffCall(id);

            return(View("Index"));
        }
예제 #8
0
        public ActionResult GetCall(string id)
        {
            var call = VoiceSender.GetCall(id);

            ViewBag.calluuid = $"Uuid: {call.uuid}";
            ViewBag.callconversation_uuid = $"Conversation uuid: {call.conversation_uuid}";
            ViewBag.calltonumber          = $"To: {call.to.number}";
            ViewBag.callfromnumber        = $"From: {call.from.number}";
            ViewBag.callstatus            = $"Status: {call.status}";
            ViewBag.calldirection         = $"Direction: {call.direction}";
            ViewBag.callrate       = $"Rate: {call.rate}";
            ViewBag.callprice      = $"Price: {call.price}";
            ViewBag.callduration   = $"Duration: {call.duration}";
            ViewBag.callstart_time = $"Start time: {call.start_time}";
            ViewBag.callend_time   = $"End time: {call.end_time}";
            ViewBag.callnetwork    = $"Network: {call.network}";

            return(View("Index"));
        }
예제 #9
0
        public ActionResult UnmuteCall(string id)
        {
            var result = VoiceSender.UnmuteCall(id);

            return(View("Index"));
        }
예제 #10
0
        public ActionResult TransferWithInlineNCCO(string id)
        {
            var result = VoiceSender.TransferCallWithInlineNCCO(id);

            return(View("Index"));
        }
예제 #11
0
        public ActionResult TransferCall(string id)
        {
            var result = VoiceSender.TransferCall(id);

            return(View("Index"));
        }
예제 #12
0
        public ActionResult PlayDTMFToCall(string id)
        {
            var result = VoiceSender.PlayDTMFToCall(id);

            return(View("Index"));
        }
예제 #13
0
        public ActionResult HangupCall(string id)
        {
            VoiceSender.HangupCall(id);

            return(View("Index"));
        }