Esempio n. 1
0
        private void ProcessAcceptedCall(TLPhoneCallAccepted phoneCallAccepted)
        {
            DispatchStateChanged(PhoneCallState.STATE_EXCHANGING_KEYS);

            if (!TLUtils.CheckGaAndGb(phoneCallAccepted.GB.Data, _secretP.Data))
            {
                CallFailed();
                return;
            }


            _authKey = MTProtoService.GetAuthKey(_aOrB, phoneCallAccepted.GB.ToBytes(), _secretP.ToBytes());
            var keyHash        = Utils.ComputeSHA1(_authKey);
            var keyFingerprint = new TLLong(BitConverter.ToInt64(keyHash, 12));

            var peer = new TLInputPhoneCall
            {
                Id         = phoneCallAccepted.Id,
                AccessHash = phoneCallAccepted.AccessHash
            };

            var protocol = new TLPhoneCallProtocol
            {
                Flags        = new TLInt(0),
                UdpP2P       = true,
                UdpReflector = true,
                MinLayer     = new TLInt(CALL_MIN_LAYER),
                MaxLayer     = new TLInt(CALL_MAX_LAYER)
            };

            _mtProtoService.ConfirmCallAsync(peer, TLString.FromBigEndianData(_ga), keyFingerprint, protocol,
                                             result =>
            {
                _call = result;
                InitiateActualEncryptedCall();
            },
                                             error =>
            {
                CallFailed();
            });
        }