enhancing voip apps with callkit - apple inc....enhancing voip apps with callkit sirisha...
TRANSCRIPT
© 2016 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.
App Frameworks #WWDC16
Session 230
Enhancing VoIP Apps with CallKit
Sirisha Pillalamarri CallKit EngineerStuart Montgomery CallKit EngineerNick Fraioli CallKit Engineer
How do VoIP apps work today?
Wouldn’t it be nice if…
CallKit
Agenda
ArchitectureIncoming CallOutgoing CallAPI Details
System Services
Architecture
VoIP App
-
System
System Services
Architecture
VoIP App
CallKit
-
System
System Services
Architecture
VoIP App
CallKitCallKit
- -
System
Architecture
VoIP App
CallKit
System
Architecture
VoIP App
CallKit
System
Architecture
System
Architecture
System
Architecture
System
Speakerbox
Architecture
App Code App UI
System
Speakerbox
Architecture
CallKit
App Code App UI
System
Speakerbox
Architecture
CallKit
App Code App UI
CXProvider
-
System
Speakerbox
Architecture
CallKit
App Code App UI
CXCallController
-
CXProvider
-
System
Speakerbox
CXProvider vs. CXCallController
CXProvider vs. CXCallController
CXProvider
CXProvider vs. CXCallController
CXProvider
Out-of-band notifications
CXProvider vs. CXCallController
CXProvider
Out-of-band notificationsNot user actions
CXProvider vs. CXCallController
CXProvider
Out-of-band notificationsNot user actionsExternal events• Incoming call
CXProvider vs. CXCallController
CXCallControllerCXProvider
Out-of-band notificationsNot user actionsExternal events• Incoming call
CXProvider vs. CXCallController
CXCallControllerCXProvider
Out-of-band notificationsNot user actionsExternal events• Incoming call
Requests from app
CXProvider vs. CXCallController
CXCallControllerCXProvider
Out-of-band notificationsNot user actionsExternal events• Incoming call
Requests from app Local user actions
CXProvider vs. CXCallController
CXCallControllerCXProvider
Out-of-band notificationsNot user actionsExternal events• Incoming call
Requests from app Local user actionsInternal events• Start call
CXProvider vs. CXCallController
CXCallControllerCXProvider
Out-of-band notificationsNot user actionsExternal events• Incoming call
Requests from app Local user actionsInternal events• Start call
Interplay with other providers• Hold and Start Call
CXProvider vs. CXCallControllerExample uses
CXProvider vs. CXCallControllerExample uses
Use CXProvider to report
Incoming callOutgoing call connectedCall ended on remote side
CXProvider vs. CXCallControllerExample uses
Use CXCallController to request
Start outgoing callAnswer callEnd call
Use CXProvider to report
Incoming callOutgoing call connectedCall ended on remote side
Speakerbox
Architecture
CallKit
App Code
System
CXProvider
Speakerbox
Architecture
CallKit
App Code
-
System
CXProvider
CXCallUpdate
Speakerbox
Architecture
CallKit
App Code
System
CXProvider
Speakerbox
Architecture
CallKit
App Code
System
CXProvider
CXAction
-
Speakerbox
Architecture
CallKit
App Code
System
CXCallController
Speakerbox
Architecture
CallKit
App Code
System
-
CXCallController
CXTransaction
Incoming Call
Speakerbox
Architecture
CallKit
App Code
System
Speakerbox
Architecture
CallKit
App Code
CXProvider
System
Speakerbox
Architecture
CallKit
App Code
-
CXCallUpdate
CXProvider
System
Speakerbox
Architecture
CallKit
App Code
-
CXCallUpdate
-
CXProvider
System
System UIIncoming Call
Speakerbox
Architecture
CallKit
App Code
System
CXProvider
System UI
Speakerbox
Architecture
CallKit
App Code
-
System
CXProvider
System UIAnswer
Speakerbox
Architecture
CallKit
App Code
-
CXAnswerCallActionSystem
CXProvider
- System UI
Speakerbox
Architecture
CallKit
App Code
-
CXAnswerCallActionSystem
CXProvider
- System UI
Answer
Speakerbox
Architecture
CallKit
App Code App UI
CXProvider
System
Speakerbox
Architecture
CallKit
App Code App UI
CXCallControllerCXProvider
System
End
Speakerbox
Architecture
CallKit
App Code App UI
CXTransaction(CXEndCallAction)
-
CXCallControllerCXProvider
System
Speakerbox
Architecture
CallKit
App Code App UI
CXTransaction(CXEndCallAction)
-
CXEndCallAction
CXCallControllerCXProvider
-
System
Speakerbox
Architecture
CallKit
App Code App UI
CXTransaction(CXEndCallAction)
-
CXEndCallAction
CXCallControllerCXProvider
-
System
End
DemoIncoming Call
Stuart Montgomery
Incoming callRecap
Incoming callRecap
Reported incoming call to system
provider.reportNewIncomingCall(with: UUID, update: CXCallUpdate) { error in /* ... */ }
Incoming callRecap
Reported incoming call to system
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) { /* ... */ }
provider.reportNewIncomingCall(with: UUID, update: CXCallUpdate) { error in /* ... */ }
Performed the CXAnswerCallAction
Incoming callRecap
Reported incoming call to system
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) { /* ... */ }
answerCallAction.fulfill()
provider.reportNewIncomingCall(with: UUID, update: CXCallUpdate) { error in /* ... */ }
Performed the CXAnswerCallAction
Fulfilled the CXAnswerCallAction
Call Actions
CXAnswerCallActionCXStartCallActionCXEndCallActionCXSetHeldCallActionCXSetGroupCallActionCXPlayDTMFCallActionCXSetMutedCallAction
Managing Multiple Calls
Managing Multiple Calls
CXTransaction
Managing Multiple Calls
CXTransaction• List of multiple actions
Managing Multiple Calls
CXTransaction• List of multiple actions• CXEndCallAction and CXAnswerCallAction
Managing Multiple Calls
CXTransaction• List of multiple actions• CXEndCallAction and CXAnswerCallAction• Fulfill each action individually
Managing Multiple Calls
CXTransaction• List of multiple actions• CXEndCallAction and CXAnswerCallAction• Fulfill each action individually
Outgoing Call
Call controllerOutgoing Call
Call controllerOutgoing Call
Call controllerOutgoing Call
Handle start call intent
Speakerbox
Start Call
Call controllerOutgoing Call
Handle start call intent
Introducing SiriKit Presidio Wednesday 5:00PM
Speakerbox
Start Call
Call controllerOutgoing Call
Handle start call intentCreate start call action
Speakerbox
App Code Start Call
Call controllerOutgoing Call
Handle start call intentCreate start call actionRequest start call action
Speakerbox
CallKit
App Code
CXCallController
Start Call
Call controllerOutgoing Call
Handle start call intentCreate start call actionRequest start call actionReceive start call action
Speakerbox
CallKit
App Code
CXProvider CXCallController
System
Call controllerOutgoing Call
Handle start call intentCreate start call actionRequest start call actionReceive start call actionExecute start call action
Speakerbox
CallKit
App Code
CXProvider CXCallController
System
Start Call
LifecycleOutgoing Call
LifecycleOutgoing Call
LifecycleOutgoing Call
Starting
LifecycleOutgoing Call
Starting
LifecycleOutgoing Call
Starting Started
LifecycleOutgoing Call
Starting Started
LifecycleOutgoing Call
Starting Started Connecting
LifecycleOutgoing Call
Starting Started Connecting
LifecycleOutgoing Call
Starting Started Connecting Connected
DemoOutgoing Call
Stuart Montgomery
Outgoing callRecap
Outgoing callRecap
Request start call action with Call Controller
callController.request(startCallTransaction) { error in /* ... */ }
Outgoing callRecap
callController.request(startCallTransaction) { error in /* ... */ }
startCallAction.fulfill()
Request start call action with Call Controller
Fulfill start call action with Provider
Outgoing callRecap
callController.request(startCallTransaction) { error in /* ... */ }
Request start call action with Call Controller
startCallAction.fulfill()
Fulfill start call action with Provider
provider.reportOutgoingCall(with: call.uuid, startedConnectingAt: call.connectingDate) provider.reportOutgoingCall(with: call.uuid, connectedAt: call.connectDate)
Send call state updates
API Details
API Details
AuthorizationConfigurationAction ErrorsSystem RestrictionsAudio
Provider Authorization
Provider Authorization
Check authorization status
Provider Authorization
Check authorization statusRequest authorization
Provider Authorization
Check authorization statusRequest authorizationObserve authorization changes
Provider Configuration
Provider Configuration
Customized experience
Provider Configuration
Customized experience• Localized name for display
Provider Configuration
Customized experience• Localized name for display• Video support
Customized experience• Localized name for display• Video support• Masked image icon
Provider Configuration
Failing actions appropriatelyAction Errors
Failing actions appropriatelyAction Errors
Failing actions appropriately
Starting
Action Errors
Receive action
Failing actions appropriately
Starting
Action Errors
Receive action
Failing actions appropriately
Starting
Action Errors
Started
Receive action
Failing actions appropriatelyAction Errors
Receive action
Starting Started
Failing actions appropriatelyAction Errors
Receive actionFail action
Starting Started
Failing actions appropriatelyAction Errors
Receive actionFail action
Starting Started
Failing actions appropriatelyAction Errors
Receive actionFail action
Starting Started
TimeoutsAction Errors
TimeoutsAction Errors
TimeoutsAction Errors
Enforce app responsiveness
TimeoutsAction Errors
Enforce app responsivenessRespond to actions in a timely manner
TimeoutsAction Errors
Enforce app responsivenessRespond to actions in a timely mannerReact to action timeouts
Incoming callSystem Restrictions
Incoming callSystem Restrictions
Not authorized
Incoming callSystem Restrictions
Not authorizedBlock list
Incoming callSystem Restrictions
Not authorizedBlock listDo not disturb
Incoming callSystem Restrictions
Not authorizedBlock listDo not disturb• React to completion handler
provider.reportNewIncomingCall(with: UUID(), update: CXCallUpdate()) { error in
if let incomingCallError = error,
incomingCallErrorCode = CXErrorCodeIncomingCallError(rawValue: incomingCallError.code)
where incomingCallErrorCode == .filteredByDoNotDisturb {
// handle do not disturb
}
}
BenefitsAudio
BenefitsAudio
High priority session
BenefitsAudio
High priority sessionFewer interruptions
BenefitsAudio
High priority sessionFewer interruptionsAudio routing hints
Incoming callAudio
Incoming callAudio
Incoming callAudio
Answer Received Answer Fulfilled
Incoming callAudio
Answer Received Answer Fulfilled
Incoming callAudio
Answer Received Answer Fulfilled
Configure AVAudioSession
Incoming callAudio
Answer Received Answer Fulfilled
Configure AVAudioSession
Incoming callAudio
Answer Received Answer Fulfilled
Configure AVAudioSession
Incoming callAudio
Answer Received Answer Fulfilled
Configure AVAudioSession
Incoming callAudio
Answer Received Answer Fulfilled
Configure AVAudioSession
Did activateAVAudioSession
Incoming callAudio
Answer Received Answer Fulfilled
Configure AVAudioSession
Did activateAVAudioSession
Start call media
API detailsRecap
AuthorizationConfigurationAction ErrorsSystem RestrictionsAudio
Summary
Summary
Integration into the system
Summary
Integration into the systemFeature parity
Summary
Integration into the systemFeature parityBetter app visibility
More Information
https://developer.apple.com/wwdc16/230
Related Sessions
Introducing SiriKit Presidio Wednesday 5:00PM
Extending Your Apps with SiriKit Nob Hill Thursday 1:40PM
Networking with for the Modern Internet Pacific Heights Thursday 3:00PM
Delivering an Exceptional Audio Experience Nob Hill Friday 1:40PM
Labs
CallKit Lab Frameworks Lab A Friday 9:00AM
SiriKit Lab Frameworks Lab B Friday 9:00AM
Networking Lab 2 Frameworks Lab D Friday 2:00PM
Audio Lab Graphics, Games, and Media Lab D Friday 3:00PM