private void Call_CallStateChanged(object sender, CallStateChangedArgs e)
        {
            IPhoneCall grCall = sender as IPhoneCall;

            _grCall = grCall;
            MyCallState tmp = MyCallState.DoNotthing;

            if (e.State == CallState.Answered)
            {
                StartDevices();
                mediaReceiver.AttachToCall(call);
                mediaSender.AttachToCall(call);
                videoReceiver.AttachToCall(call);
                videoSender.AttachToCall(call);
                tmp = MyCallState.Answered;
            }

            if (e.State == CallState.InCall)
            {
                StartDevices();
                tmp = MyCallState.InCall;
                CallDuration();
            }

            if (e.State.IsCallEnded() == true)
            {
                StopDevices();
                mediaReceiver.Detach();
                mediaSender.Detach();
                videoSender.Detach();
                videoReceiver.Detach();
                WireDownCallEvents();
                call = null;
                tmp  = MyCallState.CallEnd;
                Instance.IsLocalCameraUsed = false;
                timer.Stop();
            }

            if (e.State == CallState.LocalHeld)
            {
                StopDevices();
            }
            if (e.State == CallState.Busy)
            {
                StopDevices();
                tmp = MyCallState.Busy;
            }
            if (e.State == CallState.Cancelled)
            {
                StopDevices();
                tmp = MyCallState.Canceled;
            }
            if (e.State == CallState.Completed)
            {
                tmp = MyCallState.CallEnd;
            }

            if (CallStateChange != null)
            {
                CallStateChange.Invoke(tmp);
            }
        }
 /// <summary>
 /// Attaches the media handlers to the given phone call.
 /// </summary>
 public void AttachVideo(IPhoneCall call)
 {
     _phoneCallVideoReceiver.AttachToCall(call);
     _phoneCallVideoSender.AttachToCall(call);
 }
 public void AttachReceiveCall()
 {
     videoReceiver.AttachToCall(call);
     audioReceiver.AttachToCall(call);
 }