public static async Task <OperationResult> NewIncomingCallAsync(String contactName, String contactNumber)
        {
            if (!ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1))
            {
                return(OperationResult.Failed);
            }

            AppServiceHelper appServiceHelper = new AppServiceHelper();

            ValueSet message = new ValueSet();

            message[BackgroundOperation.NewBackgroundRequest]  = (int)BackgroundRequest.NewIncomingCall;
            message[NewCallArguments.ContactImage.ToString()]  = "";
            message[NewCallArguments.ContactName.ToString()]   = contactName;
            message[NewCallArguments.ContactNumber.ToString()] = contactNumber;
            message[NewCallArguments.ServiceName.ToString()]   = "My First UWP Voip App";

            ValueSet response = await appServiceHelper.SendMessageAsync(message);

            if (response != null)
            {
                return((OperationResult)(response[BackgroundOperation.Result]));
            }

            return(OperationResult.Failed);
        }
        public static async Task<OperationResult> NewIncomingCallAsync(String contactName, String contactNumber)
        {
            if (!ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1))
            {
                return OperationResult.Failed;
            }

            AppServiceHelper appServiceHelper = new AppServiceHelper();

            ValueSet message = new ValueSet();
            message[BackgroundOperation.NewBackgroundRequest] = (int)BackgroundRequest.NewIncomingCall;
            message[NewCallArguments.ContactImage.ToString()] = "";
            message[NewCallArguments.ContactName.ToString()] = contactName;
            message[NewCallArguments.ContactNumber.ToString()] = contactNumber;
            message[NewCallArguments.ServiceName.ToString()] = "My First UWP Voip App";
            
            ValueSet response = await appServiceHelper.SendMessageAsync(message);

            if (response != null)
            {
                return ((OperationResult)(response[BackgroundOperation.Result]));
            }

            return OperationResult.Failed;
        }
        public static OperationResult EndCallAsync()
        {
            AppServiceHelper appServiceHelper = new AppServiceHelper();

            ValueSet message = new ValueSet();
            message[BackgroundOperation.NewBackgroundRequest] = (int)BackgroundRequest.EndCall;

            appServiceHelper.SendMessage(message);
            
            return OperationResult.Succeeded;
        }
        public static OperationResult EndCallAsync()
        {
            AppServiceHelper appServiceHelper = new AppServiceHelper();

            ValueSet message = new ValueSet();

            message[BackgroundOperation.NewBackgroundRequest] = (int)BackgroundRequest.EndCall;

            appServiceHelper.SendMessage(message);

            return(OperationResult.Succeeded);
        }
        public static async Task <String> GetCallDurationAsync()
        {
            AppServiceHelper appServiceHelper = new AppServiceHelper();

            ValueSet message = new ValueSet();

            message[BackgroundOperation.NewBackgroundRequest] = (int)BackgroundRequest.GetCallDuration;

            ValueSet response = await appServiceHelper.SendMessageAsync(message);

            if (response != null)
            {
                return((response[BackgroundOperation.Result]) as String);
            }

            return(new TimeSpan().ToString());
        }
        public static async Task <OperationResult> StopVideoAsync()
        {
            AppServiceHelper appServiceHelper = new AppServiceHelper();

            ValueSet message = new ValueSet();

            message[BackgroundOperation.NewBackgroundRequest] = (int)BackgroundRequest.StartVideo;

            ValueSet response = await appServiceHelper.SendMessageAsync(message);

            if (response != null)
            {
                return((OperationResult)(response[BackgroundOperation.Result]));
            }

            return(OperationResult.Failed);
        }
        public static async Task<String> GetCallDurationAsync()
        {
            AppServiceHelper appServiceHelper = new AppServiceHelper();

            ValueSet message = new ValueSet();
            message[BackgroundOperation.NewBackgroundRequest] = (int)BackgroundRequest.GetCallDuration;

            ValueSet response = await appServiceHelper.SendMessageAsync(message);

            if (response != null)
            {
                return ((response[BackgroundOperation.Result]) as String);
            }

            return new TimeSpan().ToString();
        }
        public static async Task<OperationResult> StopVideoAsync()
        {
            AppServiceHelper appServiceHelper = new AppServiceHelper();

            ValueSet message = new ValueSet();
            message[BackgroundOperation.NewBackgroundRequest] = (int)BackgroundRequest.StartVideo;

            ValueSet response = await appServiceHelper.SendMessageAsync(message);

            if (response != null)
            {
                return ((OperationResult)(response[BackgroundOperation.Result]));
            }

            return OperationResult.Failed;
        }