diff options
Diffstat (limited to 'pjsip-apps/src/pjsua/winrt/gui/uwp/Voip/Helpers/VoipCallHelper.cs')
-rw-r--r-- | pjsip-apps/src/pjsua/winrt/gui/uwp/Voip/Helpers/VoipCallHelper.cs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/pjsip-apps/src/pjsua/winrt/gui/uwp/Voip/Helpers/VoipCallHelper.cs b/pjsip-apps/src/pjsua/winrt/gui/uwp/Voip/Helpers/VoipCallHelper.cs new file mode 100644 index 00000000..3063ef94 --- /dev/null +++ b/pjsip-apps/src/pjsua/winrt/gui/uwp/Voip/Helpers/VoipCallHelper.cs @@ -0,0 +1,56 @@ +//*********************************************************
+//
+// Copyright (c) Microsoft. All rights reserved.
+// This code is licensed under the MIT License (MIT).
+// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
+// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
+// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
+// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
+//
+//*********************************************************
+using System;
+using System.Threading.Tasks;
+using VoipTasks.BackgroundOperations;
+using Windows.Foundation.Collections;
+using Windows.Foundation.Metadata;
+
+namespace VoipUI.Helpers
+{
+ static class VoipCallHelper
+ {
+ public static async Task<OperationResult> NewOutgoingCallAsync(String dstURI)
+ {
+ if (!ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsVoipContract", 1))
+ {
+ return OperationResult.Failed;
+ }
+
+ AppServiceHelper appServiceHelper = new AppServiceHelper();
+
+ ValueSet message = new ValueSet();
+ message[NewCallArguments.DstURI.ToString()] = dstURI;
+ message[BackgroundOperation.NewBackgroundRequest] = (int)BackgroundRequest.NewOutgoingCall;
+
+ 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;
+ }
+ }
+}
|