Debian Codegraph @

Xpjproject/pjsip-apps/src/pjsua/winrt/gui/uwp/Voip/Helpers/VoipCallHelper.cs

raw symbols SCIP
1 //*********************************************************
2 //
3 // Copyright (c) Microsoft. All rights reserved.
4 // This code is licensed under the MIT License (MIT).
5 // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6 // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7 // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8 // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 //
10 //*********************************************************
11 using System;
12 using System.Threading.Tasks;
13 using VoipTasks.BackgroundOperations;
14 using Windows.Foundation.Collections;
15 using Windows.Foundation.Metadata;
16
17 namespace VoipUI.Helpers
18 {
19 static class VoipCallHelper
20 {
21 public static async Task<OperationResult> NewOutgoingCallAsync(String dstURI)
22 {
23 if (!ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsVoipContract", 1))
24 {
25 return OperationResult.Failed;
26 }
27
28 AppServiceHelper appServiceHelper = new AppServiceHelper();
29
30 ValueSet message = new ValueSet();
31 message[NewCallArguments.DstURI.ToString()] = dstURI;
32 message[BackgroundOperation.NewBackgroundRequest] = (int)BackgroundRequest.NewOutgoingCall;
33
34 ValueSet response = await appServiceHelper.SendMessageAsync(message);
35
36 if (response != null)
37 {
38 return ((OperationResult)(response[BackgroundOperation.Result]));
39 }
40
41 return OperationResult.Failed;
42 }
43
44 public static OperationResult EndCallAsync()
45 {
46 AppServiceHelper appServiceHelper = new AppServiceHelper();
47
48 ValueSet message = new ValueSet();
49 message[BackgroundOperation.NewBackgroundRequest] = (int)BackgroundRequest.EndCall;
50
51 appServiceHelper.SendMessage(message);
52
53 return OperationResult.Succeeded;
54 }
55 }
56 }