Download presentation
Presentation is loading. Please wait.
Published byClinton Page Modified over 6 years ago
1
Windows Calls Applications (windows.applicationmodel.calls)
Microsoft Build 2016 4/28/2018 6:59 PM Windows Calls Applications (windows.applicationmodel.calls) Bayo Olatunji Program Manager Sage Schreiner UWP Application that makes phone calls on Windows 10 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
2
Introduction to Calls API
4/28/2018 6:59 PM Introduction to Calls API Public Calls API Available for UWPs in Windows 10 Fall release Mobile extension SDK Replaces the older Silverlight PhoneCallTask() The Microsoft ‘Phone’ dialer app uses this public API Features Allows initiating a cellular call without a per-use UI consent Supports dual-SIM phones Includes common telephony events and background task triggers //build2016 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
3
Microsoft Build 2016 4/28/2018 6:59 PM Calls Applications A dialing application, or application that includes calls functionality will generally: Enumerate available lines, and identify the intended line – could be as simple as ‘default’ or as complex as a picker provided to the user. Dial() or DialWithOptions() on the line in question. Pass a phone number that it acquired via Contacts, Call History, a dial pad, or other means. Register for any needed background task triggers. Background task example: knowing when a line parameter has changed //build2016 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
4
4/28/2018 6:59 PM Documentation windows.applicationmodel.calls is the namespace for telephony APIs, including this one. API documentation available at: Complete sample application found at: //build2016 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
5
Windows Calls Applications
Microsoft Build 2016 4/28/2018 6:59 PM Windows Calls Applications //build2016 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
6
Get a Line / Defaults / Multi-line aware
4/28/2018 6:59 PM Get a Line / Defaults / Multi-line aware Enumerate lines A multi-line aware dialing app enumerates available lines on a given device. A line (usually) correlates to a SIM slot Dial() and DialWithOptions() are always called on a line Line properties Returned line properties include: The OS “friendly name” and color associated with the line Current line network status Whether a line can dial out calls //build2016 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
7
Demo Bayo Olatunji Microsoft Build 2016 4/28/2018 6:59 PM
Mention emulator + fake calls Bayo Olatunji © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
8
Get Lines //build2016 4/28/2018 6:59 PM
/// <summary> Enumerate through all phone lines and returns a list of all phone lines </summary> /// <returns> A dictionary of cellular phone lines and their guids. </ returns> private async Task<Dictionary<Guid,PhoneLine>> GetPhoneLinesAsync() { PhoneCallStore store = await PhoneCallManager.RequestStoreAsync(); // Start the PhoneLineWatcher var watcher = store.RequestLineWatcher(); var phoneLines = new List<PhoneLine>(); var lineEnumerationCompletion = new TaskCompletionSource<bool>(); watcher.LineAdded += async (o, args) => { var line = await PhoneLine.FromIdAsync(args.LineId); phoneLines.Add(line); }; watcher.Stopped += (o, args) => lineEnumerationCompletion.TrySetResult(false); watcher.EnumerationCompleted += (o, args) => lineEnumerationCompletion.TrySetResult(true); watcher.Start(); // Wait for enumeration completion if (!await lineEnumerationCompletion.Task) throw new Exception("Phone Line Enumeration failed"); } watcher.Stop(); Dictionary<Guid,PhoneLine> returnedLines = new Dictionary<Guid,PhoneLine>(); foreach (PhoneLine phoneLine in phoneLines) if (phoneLine != null && phoneLine.CanDial returnedLines.Add(phoneLine.Id,phoneLine); return returnedLines; //build2016 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
9
Get Default Line //build2016
4/28/2018 6:59 PM Get Default Line /// <summary> Gets the default phone line </summary> /// <returns> A one phone line. The default one on the device. </returns> private async Task<PhoneLine> GetDefaultPhoneLineAsync() { PhoneCallStore phoneCallStore = await PhoneCallManager.RequestStoreAsync(); Guid lineId = await phoneCallStore.GetDefaultLineAsync(); return await PhoneLine.FromIdAsync(lineId); } //build2016 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
10
Dial a Call Two Dial Methods //build2016 Dial() and DialWithOptions()
4/28/2018 6:59 PM Dial a Call Two Dial Methods Dial() and DialWithOptions() Both methods are always called on a line Dial() is used for simple dialing actions with only the Phone number as a parameter DialWithOptions() may be used when additional flexibility is required such as: initiating a call on speakerphone calling a specific component contact setting a display name for the target phone number (For now on we’ll just refer to Dial(), but we mean either of the two APIs, Dial() or DialWithOptions()) //build2016 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
11
Demo Bayo Olatunji Microsoft Build 2016 4/28/2018 6:59 PM
Mention emulator + fake calls Bayo Olatunji © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
12
4/28/2018 6:59 PM Dial() /// <summary> Dials a phone number with the display name on the current phone line. </summary> /// <param name="PhoneNumber"> The phone number to dial </param> /// <param name="DisplayName"> The display name to show in the UI </param> public async void DialOnCurrentLineAsync(string PhoneNumber, string DisplayName) { if ((currentPhoneLine != null) && (PhoneNumber.Trim().Length > 0)) currentPhoneLine.Dial(PhoneNumber, DisplayName); } else var dialog = new MessageDialog("No line found to place the call"); await dialog.ShowAsync(); //build2016 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
13
DialWithOptions() //build2016
4/28/2018 6:59 PM DialWithOptions() /// <summary> Dials a phone number with with options on the current phone line. </summary> /// <param name="PhoneNumber"> The phone number to dial </param> /// <param name="DisplayName"> The display name to show in the UI </param> public async void DialOnCurrentLineWSpeakerphoneAsync(string PhoneNumber, string DisplayName) { if (( currentPhoneLine != null) && (PhoneNumber.Trim().Length > 0)) // Populate phone dial options with number, display name, and an audio endpoint. PhoneDialOptions callingOptions = new PhoneDialOptions(); callingOptions.Number = PhoneNumber; callingOptions.DisplayName = DisplayName; callingOptions.AudioEndpoint = PhoneAudioRoutingEndpoint.Speakerphone; currentPhoneLine.DialWithOptions(callingOptions); } else var dialog = new MessageDialog("No line found to place the call"); await dialog.ShowAsync(); //build2016 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
14
Background Task Triggers
4/28/2018 6:59 PM Background Task Triggers NewVoic Message The system received a new voice mail message or the voice mail count went to 0. CallHistoryChanged The call history has changed. LineChanged The PhoneLineProperties have changed. //build2016 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
15
Windows Calls Applications
Microsoft Build 2016 4/28/2018 6:59 PM Windows Calls Applications //build2016 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
16
A Few Notes… Considerations Win10 & Publication in China
4/28/2018 6:59 PM A Few Notes… Considerations Applications that make use of the Calls APIs must declare “phoneCall” in manifest. Applications must have UI present in the foreground when Dial() is called Win10 & Publication in China If your Calling application manifest MinOS supports the Win10 Fall 2015 OS release (10586), your application will initially fail Store certification in China. Contact your premier support representative if you need a waiver to publish in China Windows next Privacy Control New per-app privacy functionality for Windows next that allows users to control access to Dial() for easy publication in China Just like Calendar, , Contacts, Location etc… //build2016 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
17
Related Functional Areas
4/28/2018 6:59 PM Related Functional Areas Call History Call history APIs are supported for Dialer applications that would like to provide a view of the OS call history database. Applications will need to declare phoneCallHistoryPublic in manifest. Documentation and Build 2015 videos available online: Call Origin, Spam Filter Samples and documentation available online: //build2016 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
18
Microsoft Build 2016 4/28/2018 6:59 PM Forward Thinking Help us prioritize – please make your voice heard! ( Call Control – Answer, Hangup, Conference, Forward, Information In-call application launch – Launch an app from the call UI In-call UI extension – Write to a surface in the in-call UI Support additional Windows platforms – Xbox, Hololense and more… Calls Control – hold, mute, flash, conference, reject, hang-up, answer, information (properties) of current calls Incoming / in-call UI replacement – users can find replacement UI for incoming and in-call native UIs. OEMs can preconfigure. In-call App Launch – Launch an application with context about your current, on-going call, and use it to provide information about the call, or control the call directly. Universal – extended contract to all Windows platforms. Application hosted public lines – an application can publish a line + properties and allow other apps to invoke them. //build2016 © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
19
Thank you! //build2016
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.