ChatterBox.Client.Common.Communication.Voip.States.VoipState_HangingUp.OnEnteringState C# (CSharp) Method

OnEnteringState() public method

public OnEnteringState ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task
        public override async Task OnEnteringState()
        {
            Context.SendToPeer(RelayMessageTags.VoipHangup, "");
            if (Context.PeerConnection != null)
            {
                Context.PeerConnection.Close();
                Context.PeerConnection = null;
                Context.PeerId = null;
            }

            StopTracks(Context.LocalStream?.GetTracks());
            Context.LocalStream?.Stop();
            Context.LocalStream = null;

            StopTracks(Context.RemoteStream?.GetTracks());
            Context.RemoteStream?.Stop();
            Context.RemoteStream = null;

            Context.ResetRenderers();

            var idleState = new VoipState_Idle();
            await Context.SwitchState(idleState);
        }