Call Capability (iOS-SDK)
# Call Capability (iOS-SDK)
Sobot provides the enterprises with a full set of perfect intelligent agent solutions. The Sobot call SDK provides support for all call-related functions, and allows enterprises to complete call tasks, outbound calls, call monitoring, call recording, and other operations with the accounts they used.
Sobot call SDK has the following features:
- Provide a complete process of login - use - logout.
- Consist of two login modules: external login with synchronized token and regular login with username and password.
- Support call phone registration, call record query, call monitoring, agent status switching and other basic functions.
Related limits and notes :
iOS SDK new version supports versions above iOS9, iPhone, and iPad, and supports both portrait mode and landscape mode.
The currently released XCode version is XCode 12.3.1. It is recommended to use the new version for development.
iOS requires MIC permission; otherwise, some functions are not available.
SDK cannot be used in conjunction with the call function in the Sobot APP and the call function in the Sobot PC console.
# File Introduction
# ● Schematic Diagram of Integration Process
# ● File Description
SDK files include (SobotCall.framework, SobotCommon.framework, SobotCall.bundle and SobotCommon.bundle), SobotCallDemo and Doc related documentation.
File | Description |
---|---|
SobotCall.framework | Sobot call SDK code library |
SobotCommon.framework | Sobot code basic dependency library |
SobotCommon.bundle | Resource library of basic tool package, containing image files, multilingual files and colors |
SobotCall.bundle | SDK resource library, containing image files, multilingual files and colors |
SobotCallApi.h | The file provides an access function |
SobotCallParameter.h | Basic UI configuration param class |
SobotCallCacheEntity.h | Basic function param class (domain name, color, language, display mode, etc.) |
SobotCallHomeController.h | Call entry interface |
SobotCallClient.h | Basic function |
# Integration Method
# ● Manual Integration
Download link: iOS_CallSDK (opens new window)
Unzip [iOS_SDK and add necessary files of SobotCall.framework, SobotCommon.framework, SobotCommon.bundle and SobotCall.bundle to your project.
# ● CocoaPods Integration
Add in podfile:
// Use the latest version
pod 'SobotCallSDK'
2
3
If you cannot find the latest version, run the following command to update the CocoaPods pod:
pod repo update --verbose
If you cannot update to the latest version, you can delete the index file and try again
rm ~/Library/Caches/CocoaPods/search_index.json
2
3
4
Delete pod cache:
Delete the pod file folder in the code,
pod cache clean SobotCallSDK
and then pod install
2
3
# Function Description
# ● Domain Name Settings
Domain name description:
Default SaaS platform domain name is: https:// api.sobot.com。
If you use the Tencent Cloud server, please set as: https:// www.soboten.com。
If you use localized deployment, please use your deployed server domain name.
Sample code:
SobotCallCacheEntity *config = [[SobotCallCacheEntity alloc] initWithBundleName:@"SobotCall"];
// General API service URL
config.openApiHost = @"https:// api.sobot.com";
// Call API service URL
config.callApiHost = @"https:// openapi.sobot.com";
// Agent signaling service
config.stompSocketUri = @"wss:// openapi.sobot.com/v6.0.0/webmsg/cc-webmsg";
// janus message monitoring service
config.janusSocketUri = @"wss:// rtc.sobot.com.cn/janus";
// janus proxy service
config.sipProxy = @"sip:192.168.30.68:5060";
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# ● Initialization
Initialization param and call method: Initialize information SobotCallCacheEntity; set the function related attributes; the initialization method is executed locally, with no asynchronous requests generated, and it takes effect immediately after setting.
The main call code is as follows:
[Note: Before initiating Sobot call SDK, call the initialization API initWithConfig; otherwise, the SDK cannot be initiated.]
The method is as follows:
/// Initialization configuration
/// @param config SobotCallCacheEntity Configuration class, domain name/internationalization/resource
/// @param kitInfo SobotKitConfig configuration class
/// @param resultBlock Initialization callback (NSInteger code,id _Nullable obj,NSString *_Nullable msg);
+(void)initWithConfig:(SobotCallCacheEntity *) config kitInfo:(SobotCallParameter *)kitInfo result:(SobotCallResultBlock) resultBlock;
2
3
4
5
6
7
8
9
10
11
Param:
Param | Type | Required | Description |
---|---|---|---|
config | NSObject | Yes | Basic software configuration, designating domain name, resource name, language, etc. |
kitInfo | NSObject | Yes | UI related configuration |
resultBlock | Block | No | Initialization status callback, code=1: succeed |
Sample code:
SobotCallCacheEntity *config = [[SobotCallCacheEntity alloc] initWithBundleName:@"SobotCall"];
// Designate bundle name
config.bundleName = @"SobotCall";
// Designate international file path in bundle
config.languageTableName = @"SobotLocalizable";
// Designate international file name
config.languagePathInBundle = @"Localizable";
// Designate color file name in bundle
config.colorTableName = @"SobotColor";
// Designate language
config.absoluetelanguage = @"zh-Hans";
// General API service URL
config.openApiHost = @"https:// api.sobot.com";
// Call API service URL
config.callApiHost = @"https:// openapi.sobot.com";
// Agent signaling service
config.stompSocketUri = @"wss:// openapi.sobot.com/v6.0.0/webmsg/cc-webmsg";
// janus message monitoring service
config.janusSocketUri = @"wss:// rtc.sobot.com.cn/janus";
// janus proxy service
config.sipProxy = @"sip:192.168.30.68:5060";
SobotCallParameter *kitInfo = [[SobotCallParameter alloc]init];
kitInfo.showHomeBack = NO;
[SobotCallApi initWithConfig:config kitInfo:kitInfo result:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# ● Permission Setting
Permissions to be added
<key>NSMicrophoneUsageDescription</key>
<String>Making voice calls requires your MIC permission</string>
2
# ● Initiate Sobot Page
# 1. Initiate Call Homepage
Method 1 : Directly use the method we provide to automatically log in and jump to the page. The method is as follows:
/// Initiate SDK and enter the call SDK homepage
/// @param account Account
/// @param loginPwd Password
/// @param vc Initiate VC
/// @param resultBlock Callback result
+(void)startWithAcount:(NSString *)account password:(NSString *)loginPwd viewController:(UIViewController *)vc result:(SobotResultBlock) resultBlock;
/// Add Initiation Page
/// token. Not the accessToken, the URL returned by the account login, the old and new versions will be determined by the system
+(void)startWithToken:(NSString *) token viewController:(UIViewController *) vc result:(SobotCallResultBlock) resultBlock;
2
3
4
5
6
7
8
9
10
11
12
13
Param
Param | Type | Required | Description |
---|---|---|---|
account | NSString | Yes | Agent account |
loginPwd | NSString | Yes | Agent account password |
vc | UIViewController | Yes | VC for executing jump |
resultBlock | Block | No | Execution result, code=1: succeed |
Sample code:
[SobotCallApi startWithAcount:loginAccount password:password viewController:self result:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
2
3
4
Method 2: Directly create SobotCallHomeController, manually log in and jump to the page. You need to log in first and then perform jump operation. The method is as follows:
/// Login
/// @param account Account
/// @param loginPwd Password
/// @param resultBlock Callback result
+(void)loginUser:(NSString *)account password:(NSString * )loginPwd result:(SobotCallResultBlock) resultBlock;
/// Login (with token)
/// @param account Account
/// @param loginPwd Password
/// @param token token
/// @param resultBlock Callback result
+(void)loginUser:(NSString *)account password:(NSString * )loginPwd token:(NSString *) token result:(SobotCallResultBlock) resultBlock;
2
3
4
5
6
7
8
9
10
11
12
13
14
Param
Param | Type | Required | Description |
---|---|---|---|
account | NSString | Yes | Agent account |
loginPwd | NSString | No | Agent account password, used only when token is null |
token | NSString | No | token logged in. Do not set the password when using token; otherwise, you have to log in again and the token will be refreshed |
vc | UIViewController | Yes | VC for executing jump |
resultBlock | Block | No | Execution result, code=1: succeed |
Example:
[SobotCallApi loginUser:fieldUserName.text password:fieldPassword.text token:fieldToken.text result:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
if(code == 1){
// Create VC directly and use at your own discretion
SobotCallHomeController *orderHomeVC = [[SobotCallHomeController alloc]init];
}
}];
2
3
4
5
6
7
8
9
Method 3:To login using AppKey and appID, you need to complete the login first and then perform a jump. (New in version 3.0.2):
/// To login using AppKey and appID
/// @param account Agent account
/// @param app_key AppKey
/// @param appid appid
/// @param vc Initiate VC
/// @param resultBlock Callback result
+(void)startWithAcount:(NSString *)account appkey:(NSString *)app_key appid:(NSString *) appid viewController:(UIViewController *)vc result:(SobotCallResultBlock) resultBlock;
2
3
4
5
6
7
8
Param
Param | Type | Required | Description |
---|---|---|---|
account | NSString | Yes | Agent account |
AppKey | NSString | Yes | appkey |
appid | NSString | Yes | appid |
vc | UIViewController | Yes | VC for executing jump |
resultBlock | Block | No | Execution result, code=1: succeed |
Example:
[SobotCallApi startWithAcount:@"123@123.com" appkey:@"your appkey" appid:@"your appid" viewController:self result:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
2
3
4
5
6
# ● Login
/// Login
/// @param account Account
/// @param loginPwd Password
/// @param resultBlock Callback result
+(void)loginUser:(NSString *)account password:(NSString * )loginPwd result:(SobotCallResultBlock) resultBlock;
/// Login (with token)
/// @param account Account
/// @param loginPwd Password
/// @param token token
/// @param resultBlock Callback result
+(void)loginUser:(NSString *)account password:(NSString * )loginPwd token:(NSString *) token result:(SobotCallResultBlock) resultBlock;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# ● Logout
/// Exit SDK
/// @param resultBlock Callback result
+(void)outSobotUser:(SobotCallResultBlock) resultBlock;
2
3
4
5
6
# ● Set Debug Mode
/// Set whether it is debug mode, with NO by default and logs not displayed
/// @param isShowDebug YES or NO
+(void)setShowDebug:(BOOL) isShowDebug;
2
3
4
5
6
# Configuration Class Attribute Description
# ● SobotCallParameter Class Description
The configuration takes effect immediately. Configure with the following functions in SobotCallApi.h, and overwrite the previous set value after the initialization and direct configuration;
Param | Type | Required | Description |
---|---|---|---|
showHomeBack | BOOL | No | Whether to display Back button on the homepage, NO (Not display) by default. |
Setting method:
/// Change kitConfig configuration
/// @param kitConfig congfig configuration
+(void)configKitInfo:(SobotCallParameter *) kitConfig;
/// Initialization configuration
/// @param config SobotCallCacheEntity Configuration class, domain name/internationalization/resource
/// @param kitInfo SobotKitConfig configuration class
/// @param resultBlock Initialization callback (NSInteger code,id _Nullable obj,NSString *_Nullable msg);
+(void)initWithConfig:(SobotCallCacheEntity *) config kitInfo:(SobotCallParameter *)kitInfo result:(SobotCallResultBlock) resultBlock;
2
3
4
5
6
7
8
9
10
11
# ● SobotCallCacheEntity Class Description
This attribute must be configured at initialization, and can be configured once without repeating the configuration.
Param | Type | Required | Description |
---|---|---|---|
bundleName | NSString | No | Resource name, SobotOrder by default. |
languagePathInBundle | NSString | No | International file path in bundle, with a fixed value of Localizable. |
languageTableName | NSString | No | International file name in bundle, with a fixed value of SobotLocal. |
colorTableName | NSString | No | Color file name in bundle, with a fixed value of SobotColor. |
absoluetelanguage | NSString | No | Designated language, following the system by default. |
defaultlanguage | NSString | No | Default language when recognition is unavailable, following the system by default. |
openApiHost | NSString | No | Public API domain name. |
callApiHost | NSString | No | Call service domain name. |
stompSocketUri | NSString | No | Agent status monitoring service URL. |
janusSocketUri | NSString | No | janus link service URL. |
sipProxy | NSString | No | janus proxy service URL. |
# Source Code and Demo
Sobot SDK Function DemoDownload (opens new window)
# FAQ
1.Get token?
Please get the login token through the Sobot login API. You should note that the token here is that obtained from development module, not the accessToken of the latest v6 version. In case of failure, you can log in with your username and password. The two methods have exactly the same effect.
Why can't I log in normally?
Before login, please confirm whether to perform the initialization operation, which is a local assignment; there will be no asynchronous requests, and the domain name and basic configuration information will be set. After confirming that the login information is correct, mainly verify whether the domain name fails to match.How to embed the call homepage into other frameworks?
Please refer to the Demo project, which has examples of using tabbar to put the Ticket Center page into it for management.How to monitor call reminder?
Currently there is no message notification for calls. If you need to monitor messages, please check the message monitoring related configuration in SobotCallClient.h.
# Description of Sobot SDK's Collection and Use of Personal Information
Description of Sobot SDK's Collection and Use of Personal Information (opens new window)