| 1 |
** |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 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 |
} |