Esempio n. 1
0
        public void OnIncomingCall(object sender, CallEventArgs e)
        {
            Console.WriteLine($"Incomming call by {e.CallerPhoneNumber}. Do you want to accept that? [y/n]");

            string answer = "";

            do
            {
                answer = Console.ReadLine();
                if (answer == "y")
                {
                    AcceptCall(e);
                    Console.WriteLine("Call accepted");
                }
                else if (answer == "n")
                {
                    RejectCall(e);
                    Console.WriteLine("Call rejected");
                }
            }while (answer != "y" && answer != "n");

            if (answer == "n")
            {
                e.DataTimeEndCall = DateTime.Now;
                CallTerminate?.Invoke(this, e);
                Console.WriteLine("Call terminate");
                return;
            }
            answer = "";

            while (answer != "y")
            {
                Console.WriteLine("Terminate Call? [y/n]");
                answer = Console.ReadLine();

                if (answer == "y")
                {
                    e.DataTimeEndCall = DateTime.Now;
                    CallTerminate?.Invoke(this, e);
                    Console.WriteLine("Call terminate");
                }
            }
        }
Esempio n. 2
0
 private void OnCallTerminate(object sender, CallEventArgs e)
 {
     CallTerminate?.Invoke(sender, e);
 }