Skip to content

Commit f295b4a

Browse files
committed
Speakerbox: Version 1.0, 2016-09-13
First release This sample app demonstrates how to use CallKit framework in a VoIP app to allow it to integrate natively into the system.
1 parent c2b5967 commit f295b4a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+5068
-0
lines changed

Speakerbox/Assets/Speakerbox-1024.png

55.9 KB
Loading

Speakerbox/Assets/Speakerbox-256.png

10.2 KB
Loading

Speakerbox/Assets/Speakerbox-512.png

23 KB
Loading
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>IntentsExtension</string>
9+
<key>CFBundleExecutable</key>
10+
<string>$(EXECUTABLE_NAME)</string>
11+
<key>CFBundleIdentifier</key>
12+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>$(PRODUCT_NAME)</string>
17+
<key>CFBundlePackageType</key>
18+
<string>XPC!</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>1.0</string>
21+
<key>CFBundleSignature</key>
22+
<string>????</string>
23+
<key>CFBundleVersion</key>
24+
<string>1</string>
25+
<key>NSExtension</key>
26+
<dict>
27+
<key>NSExtensionAttributes</key>
28+
<dict>
29+
<key>IntentsSupported</key>
30+
<array>
31+
<string>INStartAudioCallIntent</string>
32+
</array>
33+
</dict>
34+
<key>NSExtensionPointIdentifier</key>
35+
<string>com.apple.intents-service</string>
36+
<key>NSExtensionPrincipalClass</key>
37+
<string>$(PRODUCT_MODULE_NAME).IntentHandler</string>
38+
</dict>
39+
</dict>
40+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
Copyright (C) 2016 Apple Inc. All Rights Reserved.
3+
See LICENSE.txt for this sample’s licensing information
4+
5+
Abstract:
6+
Intents handler principal class
7+
*/
8+
9+
import Intents
10+
11+
class IntentHandler: INExtension, INStartAudioCallIntentHandling {
12+
13+
func handle(startAudioCall intent: INStartAudioCallIntent, completion: @escaping (INStartAudioCallIntentResponse) -> Void) {
14+
let response: INStartAudioCallIntentResponse
15+
defer {
16+
completion(response)
17+
}
18+
19+
// Ensure there is a person handle
20+
guard intent.contacts?.first?.personHandle != nil else {
21+
response = INStartAudioCallIntentResponse(code: .failure, userActivity: nil)
22+
return
23+
}
24+
25+
let userActivity = NSUserActivity(activityType: String(describing: INStartAudioCallIntent.self))
26+
27+
response = INStartAudioCallIntentResponse(code: .continueInApp, userActivity: userActivity)
28+
}
29+
30+
}

Speakerbox/LICENSE.txt

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Sample code project: Speakerbox: Using CallKit to create a VoIP app
2+
Version: 1.0
3+
4+
IMPORTANT: This Apple software is supplied to you by Apple
5+
Inc. ("Apple") in consideration of your agreement to the following
6+
terms, and your use, installation, modification or redistribution of
7+
this Apple software constitutes acceptance of these terms. If you do
8+
not agree with these terms, please do not use, install, modify or
9+
redistribute this Apple software.
10+
11+
In consideration of your agreement to abide by the following terms, and
12+
subject to these terms, Apple grants you a personal, non-exclusive
13+
license, under Apple's copyrights in this original Apple software (the
14+
"Apple Software"), to use, reproduce, modify and redistribute the Apple
15+
Software, with or without modifications, in source and/or binary forms;
16+
provided that if you redistribute the Apple Software in its entirety and
17+
without modifications, you must retain this notice and the following
18+
text and disclaimers in all such redistributions of the Apple Software.
19+
Neither the name, trademarks, service marks or logos of Apple Inc. may
20+
be used to endorse or promote products derived from the Apple Software
21+
without specific prior written permission from Apple. Except as
22+
expressly stated in this notice, no other rights or licenses, express or
23+
implied, are granted by Apple herein, including but not limited to any
24+
patent rights that may be infringed by your derivative works or by other
25+
works in which the Apple Software may be incorporated.
26+
27+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
28+
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
29+
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
30+
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
31+
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
32+
33+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
34+
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
35+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
36+
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
37+
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
38+
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
39+
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
40+
POSSIBILITY OF SUCH DAMAGE.
41+
42+
Copyright (C) 2016 Apple Inc. All Rights Reserved.

Speakerbox/README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Speakerbox: Using CallKit to create a VoIP app
2+
3+
This sample app demonstrates how to use CallKit.framework in a VoIP app to allow it to integrate natively into the system.
4+
5+
## Requirements
6+
7+
### Build
8+
9+
Xcode 8.0 or later; iOS 10.0 SDK or later
10+
11+
### Runtime
12+
13+
iOS 10.0 or later
14+
15+
## About Speakerbox
16+
17+
Speakerbox is an example VoIP app which uses CallKit.framework to make and receive calls. It demonstrates several key areas:
18+
19+
- Creating a CXProvider and setting its delegate, in order to perform call actions in response to delegate callbacks. For example, the app's ProviderDelegate implements `-provider:performAnswerCallAction:` to handle answering an incoming call.
20+
- Calling CXProvider API to provide updates to call metadata (using the CXCallUpdate class) and call lifecycle (using the various `report…` methods). For example, the app calls `CXProvider.reportOutgoingCall(with:connectedAtDate:)` to notify the system when an outgoing call has connected.
21+
- Creating a CXCallController in order to request transactions in response to user interactions in the app. For example, to start an outgoing call, the app calls `CXCallController.request(_:)` to request a CXTransaction containing a CXStartCallAction.
22+
- Registering an app's CXProviderConfiguration, in order to configure certain behaviors of the app. For example, the app sets `maximumCallsPerCallGroup` to 1 to indicate that calls may not be grouped together.
23+
- Handling call audio, including the correct points to configure the app's AVAudioSession versus starting call audio media. See `configureAudioSession()`, `startAudio()`, and `stopAudio()`.
24+
- Starting an outgoing call in response to an INStartAudioCallIntent, including introspecting the INInteraction and NSUserActivity which contain the intent.
25+
26+
Copyright (C) 2016 Apple Inc. All rights reserved.

0 commit comments

Comments
 (0)