PhoneKit
PhoneKit is an easy to use extension/wrapper of the Twilio Client iOS SDK for easily making/receiving VoIP calls from inside your iOS app.
Features
- a simple API for making calls to real phones or other clients
- a full-featured modal view controller to allow your users to interact with the call
- options to mute, switch to speakerphone, and send DTMF tones
- a property to set the caller ID
- a call record object containing useful information about a past call
- useful helper methods on NSString for dealing with phone numbers
Server
Unfortunately, the Twilio Client SDK requires all client-side apps to have a custom server-side counterpart that issues your app capability tokens and hosts TwiML to handle the calls. To hopefully make your life easier, I've created the repo above to address the server-side needs of the most common use cases for Twilio Client. It can be easily deployed to your heroku account in about a minute – simply follow the readme on that repo to get the server set up.
Demo
To run the example project, first clone the repo. Then, change the value of kServerBaseURL
at the top of PKTViewController.m
to point to auth.php
on your server. If you have issues with cocoapods, try running pod install
in the Example directory.
After starting the app, you can press "Call" immediately to hear a simple demo message. To call a real phone, you must first set the caller ID field to a number you have verified with Twilio. Then simply type the callee's phone number (don't worry about the formatting) into the Callee text field and press Call.
Installation
PhoneKit is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "PhoneKit"
Usage
After grabbing the token from auth.php, hand it to the Phone:
[PKTPhone sharedPhone].capabilityToken = token;
Set an optional caller ID:
[PKTPhone sharedPhone].callerId = @"1(555)867-5309";
I recommend using the provided PKTCallViewController for your call UI:
self.callViewController = [PKTCallViewController new];
[PKTPhone sharedPhone].delegate = self.callViewController;
Make a call!
[[PKTPhone sharedPhone] call:@"1 555-234-5678"];
To see what else you can do using PhoneKit, check out the example project and the class headers. And if you'd like to build your own custom views that are aesthetically consistent with PhoneKit, check out the library that the UI is built on: JCDialPad.
Author
Joseph Constantakis, [email protected]. Feel free to email me or open up a GitHub issue if you have any questions!
License
PhoneKit is available under the MIT license. See the LICENSE file for more info.