This guide assists you in rapidly developing your VoIP application with Zoiper SDK 2.0. This manual contains an overview of the entities in the SDK with a lot of practical examples of implementation, usage and configuration.
**By default zdk.objc.framework is not included in the example. If you still don't have the framework, please contact us on zoiper.com. zdk.objc.framework MUST be placed in current folder! **
To enjoy the powerful benefits of Zoiper SDK 2.0, you need a license. Depending on your needs, you can buy 2 different types of licenses:
- Installation license per end-user
- Unlimited installations;
Please contact Zoiper for more details and test licenses or to receive licenses for testing purposes.
Zoiper SDK 2.0 is thread-safe. Shared objects can be called simultaneously from multiple threads. All callbacks from the SDK modules to the application code are performed in the context of the application thread which invokes the respective functions and methods.
In order to receive callbacks, the SDK needs to receive processing time from your application core. You can achieve this by invoking the respective functions.
On Android, iOS, and macOS, the main UI thread usually handles the assignment of processing time to the SDK.
Regarding sockets and transports, the SDK manages and utilizes the threads internally. For the interaction with sockets and transports, the SDK also internally manages and utilizes its own separate thread. As a result, the application code can use the processing time without blocking the SDK sockets.
Inside the SDK packages, you can find the respective reference and examples of basic usage for all:
- methods
- functions
- APIs
- callbacks
- etc.
The SDK is (partially) built with:
- JThread, Copyright (C) 2000-2005 Jori Liesenborgs ([email protected])
- JRTPLIB, part of JRTPLIB Copyright (C) 1999-2005 Jori Liesenborgs
- GSM, Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann, Technische Universitaet Berlin
- iLBC, iLBC Speech Coder ANSI-C Source Code iLBC_define.h Copyright (C) The Internet Society (2004). All Rights Reserved.
- SPEEX The Xiph OSC and the Speex Parrot logos are trademarks (TM) of Xiph.Org.
- OpenLDAP, Copyright 1999-2003 The OpenLDAP Foundation, Redwood City, California, USA. All Rights Reserved.
- PortAudio, Copyright (C) 1999-2002 Ross Bencina and Phil Burk
- PortMixer, PortMixer, Windows WMME Implementation, Copyright (C) 2002, Written by Dominic Mazzoni and Augustus Saunders
- Resiprocate, The Vovida license The Vovida Software License, Version 1.0, Copyright (C) 2000 Vovida Networks, Inc. All rights reserved.
- This product includes cryptographic software written by Eric Young ([email protected]).
- This product includes software written by Tim Hudson ([email protected]).
Please contact [email protected] for more information.
Developing your VoIP application for iOS with Objective-C™, or Swift becomes easier with the Zoiper Software Development Kit for iOS. Zoiper SDK 2.0 is namely an all-inclusive solution for developing iOS applications with:
- audio calls (SIP, IAX)
- video call (SIP)
- presence
- messaging
- call recordings
- other functionalities
The SDK consists of an iOS Framework with the respective headers that you can easily integrate into your target application.
Requirement | Description |
---|---|
Processor | Intel Core i3 or better |
Memory | 4GB (minimum), 8 GB (recommended) |
Hard disk space | 1 GB |
Xcode® | Xcode 12 or later |
Operating system (Development environment) | macOS 10.15 or later |
Operating system (Runtime environment) | iOS 12 or later |
Architecture | arm64 |
Mode | Live device |
Folder | Description |
---|---|
package/Documentation | Contains the Zoiper SDK 2.0 Documentation. Click on the index.html file to open the documentation in your browser. |
package/zdk.objc.framework | The actual framework which you need to import in your project. |
The demo application for Swift — Zoiper SDK Demo — gives you a clear idea on how to implement functionalities of the Zoiper Software Development Kit for iOS. After the initialization of the Zoiper SDK 2.0 Demo, you can configure and register an account on a SIP server. Upon success, you can make an audio call. The Demo illustrates how...
- to implement the SDK into a real project
- to connect the development kit with your project
- the main functionalities are used
- callbacks are handled
- SDK logging takes place
We assume that you are already familiar with iOS and Objective-C concepts such as:
- delegates
- Objective-C memory management
- Cocoa’s Storyboard for the UI elements of the demo app
Since the purpose of the demo is to illustrate the main functionalities of the Zoiper SDK 2.0, the UI is limited.
To compile the Demo project, you must have all of the following:
- an Apple developer account
- a developer-registered iOS device
- XCode
- a SIP server to test with
- a SIP account corresponding to the SIP Server
- a license for the Zoiper SDK 2.0 and the activation details.
- Download the Zoiper SDK 2.0 Demo
- Open the xcodeproj file with XCode.
- Connect a registered iOS device and select it as a building target.
- Click the Run button to build the sample app for the device.
- When the application runs enter the Activation details to activate the product.
To be able to run the Zoiper Swift Example, you will need to include the zdk.objc.framework to the project and then to build it. By default zdk.objc.framework is not included in the example. If you still don't have the framework, please contact us on zoiper.com.
zdk.objc.framework MUST be placed in current folder!
Transport type: TCP Enabled codecs:
- aLaw
- uLaw
- GSM
- speex
- iLBC30
- G729
- VP8
STUN: Disabled
Default STUN settings:
- Server: stun.zoiper.com
- Port: 3478
- Refresh period: 30
To test the demo, you need activation credentials from Zoiper. You can enter them manually, or hardcode them in your application.
Enter your username and password in the Activation fields and click on the “Activate” button.
When the activation is fine, the status will change to “Success”. If it is not successful a “Failed” status will be returned, followed by an error code.
To hardcode your credentials, use the following call:
let appDelegate = UIApplication.shared.delegate as! AppDelegate appDelegate.contextManager.activateZDK(zdkVersion,
withUserName: activationUsername!.text!,
andPassword: activationPassword!.text!)
Do not take your credentials from the GUI, but pass them.
You need a SIP account to register to the server and make calls. To configure it, follow these steps:
- Enter its details (username, password and hostname at least)
- Click on the „Register“ button
The status screen will show a registration status. When the registration is successful you should be able to make calls. In the other case, the status screen will show an error code.
To change the SIP configuration, you will need to adjust the calls in:
private func createDefaultSIPConfiguration() -> ZDKSIPConfig
You can adjust the configuration by using the following method calls.
sipConfiguration.transport = .tt_TCP
Possible values:
- .tt_TCP
- .tt_UDP
- .tt_TLS
sipConfiguration.useOutboundProxy = false
sipConfiguration.outboundProxy = nil
sipConfiguration.authUsername = nil
sipConfiguration.stun = createDefaultSTUNConfiguration()
sipConfiguration.rPort = .rpt_Signaling
sipConfiguration.dtmf = .dtmftsip_RFC_2833
Possible values:
- .dtmfsip_RFC_2833
- .dtmfsip_SIPInfo
- .dtmfsip_inband
- disabled
To change the PUSH configuration, you will need to adjust the calls in:
private func createDefaultPushConfiguration() -> ZDKPushConfig
You can adjust the push configuration by using the following method calls.
pushConfiguration.enabled = false
pushConfiguration.rtpMediaProxy = false
pushConfiguration.transport = .tt_TCP
pushConfiguration.cid = Bundle.main.bundleIdentifier!
pushConfiguration.uri = "https://gateway.push.apple.com:2195"
pushConfiguration.type = "apple"
pushConfiguration.proxy = "www.push_proxy.com"
pushConfiguration.token = "a6954b367dc0d28308a92dff76b7041abf9193e834bafd50cee0222068cb632b"
To change the header fields configuration, you will need to adjust the calls in:
private func createSIPHeaderFieldsConfiguration() -> [ZDKHeaderField]
You can adjust the values by using the following method calls.
header1Values.append("header_1_value_1")
header2Values.append("header_2_value_1")
header2Values.append("header_2_value_2")
header3Values.append("header_3_value_1")
header3Values.append("header_3_value_2")
header3Values.append("header_3_value_3")
header4Values.append("header_4_value_1")
header4Values.append("header_4_value_2")
header4Values.append("header_4_value_3")
header4Values.append("header_4_value_4")
header4Values.append("header_4_value_5")
You can adjust the name and set a header by using the following method calls.
headers.append(zdkAccountProvider.createSIPHeaderField("test_header_1", values: header1Values, method: .smt_All))
headers.append(zdkAccountProvider.createSIPHeaderField("test_header_2", values: header2Values, method: .smt_Register))
headers.append(zdkAccountProvider.createSIPHeaderField("test_header_3", values: header3Values, method: .smt_Invite))
headers.append(zdkAccountProvider.createSIPHeaderField("test_header_4", values: header4Values, method: .smt_All))
Possible method values:
Method |
---|
smt_None |
smt_Invite |
smt_Notify |
smt_Options |
smt_Register |
smt_Subscribe |
smt_Message |
smt_Info |
smt_Publish |
smt_Service |
smt_All |
zdkAccount!.mediaCodecs = [CodecId.uLaw.rawValue as NSNumber,
CodecId.aLaw.rawValue as NSNumber,
CodecId.GSM.rawValue as NSNumber,
CodecId.speex.rawValue as NSNumber,
CodecId.iLBC30.rawValue as NSNumber,
CodecId.g729.rawValue as NSNumber,
CodecId.vp8.rawValue as NSNumber]
Possible values and Codec Ids:
ID | Codec |
---|---|
0 | uLaw |
1 | GSM |
6 | aLaw |
7 | g722 |
16 | g729 |
24 | speex |
25 | speexWide |
26 | speexUltra |
27 | iLBC30 |
29 | g726 |
31 | vp8 |
34 | opusNarrow |
35 | opusWide |
36 | opusSuper |
37 | opusFull |
You need to set up your environment in the same way as for the demo application. Keep in mind that the application must run on a real device. It cannot be used with simulators.
To use Zoiper SDK 2.0 in your iOS project, you need to add it as a required framework to your project and initialize it as a context. Below, you can see how to initialize the context:
override init() {
zdkContext = HelperFactory.sharedInstance().context
zdkAccountProvider = HelperFactory.sharedInstance().context.accountProvider
super.init()
zdkContext.setStatusListener(self)
initContext()
}
func initContext() {
zdkContext.configuration.sipUdpPort = Int32.random(in: 32000..<65000)
repeat {
zdkContext.configuration.rtpPort = Int32.random(in: 32000..<65000)
} while (zdkContext.configuration.rtpPort != zdkContext.configuration.sipUdpPort)
zdkContext.audioControls.setAutomaticGainControlMode(.agct_Hardware, gain: 0.0)
zdkContext.audioControls.echoCancellation = .ect_Hardware
zdkContext.audioControls.noiseSuppression = true
zdkContext.configuration.enableIPv6 = true
}
Keep in mind that inside the initialization of the Context, the SIP and RTP ports will be also initialized. Right after this, you can best activate the Zoiper SDK 2.0 license. Use the activation username and password you received from Zoiper.com. You can complete the activation by invoking the activateZDK method as follows:
activateZDK method like so:
contextManager.activateZDK(zdkVersion,
withUserName: activationUsername,
andPassword: activationPassword)
You can find the API and method references here.