Documentation Index
Fetch the complete documentation index at: https://docs.sobot.io/llms.txt
Use this file to discover all available pages before exploring further.
Call Capability (iOS-SDK)
Zhi Chi Customer Service provides enterprises with a complete set of intelligent customer service solutions. The Zhi Chi Call SDK supports all call-related functions. By simply providing the account to be used, tasks such as making calls, outbound calls, call monitoring, and call recording can be completed.
The Wisdom Tooth Call SDK has the following features:
- Provide the complete process of login - use - logout.
- There are 2 types of login modules: external login with token synchronization and regular login with username and password.
- Supports basic functions such as call phone registration, call record inquiry, call monitoring, and agent status switching.
Relevant restrictions and precautions:
-
The new version of the iOS SDK supports iOS 11 and above, and is compatible with both iPhone and iPad, supporting both portrait and landscape modes.
-
IOS requires microphone permission; otherwise, the call function cannot be used.
-
The SDK cannot be used at the same time as the call function in the Zhichi Customer Service APP and the call function in the Zhichi PC workstation.
Process Description
Integration Process Diagram
- SDK File Description
The SDK includes (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 | Base dependency library for ZhiChi code |
| SobotCommon.bundle | Resource library for basic toolkits, including image files, multilingual files, and colors |
| SobotCall.bundle | SDK resource library, contains image files, multilingual files, colors |
| SobotCallApi.h | This file provides access functions |
| SobotCallParameter.h | Basic UI configuration parameter class |
| SobotCallCacheEntity.h | Basic function parameter class (domain name, color, language, display mode, etc.) |
| SobotCallHomeController.h | Call Entry Interface |
| SobotCallClient.h | Basic Functions |
Integration Method
Manual Integration
Download link: iOS_CallSDK
Unzip [iOS_SDK], and add the necessary files SobotCall.framework, SobotCommon.framework, SobotCommon.bundle, and SobotCall.bundle to your project.
CocoaPods Integration
Add the following to the podfile:
// Use the latest version
pod 'SobotCallSDK'
If the latest version cannot be found, run the following command to update the CocoaPods repository:
pod repo update --verbose
If the latest version cannot be updated, you can delete the index file and try again.
rm ~/Library/Caches/CocoaPods/search_index.json
Clear pod cache:
Delete the pod folder in the code,
pod cache clean SobotCallSDK
Run pod install again.
Quick Start
Step 1 Initialization
Initialization parameters and calling method: Initialize information SobotCallCacheEntity to set function-related attributes; The initialization method runs locally without asynchronous requests, and takes effect immediately after setting.
The main calling code is as follows:
[Note: Before starting the ZhiChi Call SDK, you must call the initialization interface initWithConfig. Otherwise, the SDK will fail to start.]
Method:
/// Initialize Configuration
/// @param config SobotCallCacheEntity configuration class, domain/internationalization/resources
/// @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;
Parameters:
| Parameter | Type | Required | Description |
|---|
| config | NSObject | Yes | Basic software configuration, specifying domain name, resource name, language, etc. |
| kitInfo | NSObject | Yes | UI related configuration |
| resultBlock | Block | No | Initialization status callback, code=1 means success |
Example code:
SobotCallCacheEntity *config = [[SobotCallCacheEntity alloc] initWithBundleName:@"SobotCall"];
// Specify the bundle name
config.bundleName = @"SobotCall";
// Specify the path of the internationalization file in the bundle
config.languageTableName = @"SobotLocalizable";
// Specify the internationalization file name
config.languagePathInBundle = @"Localizable";
// File name of the specified color in the bundle
config.colorTableName = @"SobotColor";
// Specify language
config.absoluetelanguage = @"zh-Hans";
// General interface service address
config.openApiHost = @"https://api.sobot.com";
// Call interface service address
config.callApiHost = @"https://openapi.sobot.com";
// Agent signaling service
config.stompSocketUri = @"wss://openapi.sobot.com/v6.0.0/webmsg/cc-webmsg";
// Janus message listening 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) {
}];
Step 2 Start the ZhiChi Page
Method 1: Use the method we provide to automatically complete login and redirect to the page.
Method:
/// Start the SDK and enter the home page of the Call SDK
/// @param account Account
/// @param loginPwd Password
/// @param vc Launch VC
/// @param resultBlock Callback result
+(void)startWithAcount:(NSString *)account password:(NSString *)loginPwd viewController:(UIViewController *)vc result:(SobotResultBlock) resultBlock;
/// Add launch page
/// token is not accessToken, the address returned after account login, internally automatically determines old or new version
+(void)startWithToken:(NSString *) token viewController:(UIViewController *) vc result:(SobotCallResultBlock) resultBlock;
Parameter
| Parameter | Type | Required | Description |
|---|
| account | NSString | Yes | Customer service account |
| loginPwd | NSString | Yes | Customer service account password |
| vc | UIViewController | Yes | The vc that performs the jump |
| resultBlock | Block | No | Execution result, code=1 means success |
Example code:
[SobotCallApi startWithAcount:loginAccount password:password viewController:self result:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Method 2: Directly create SobotCallHomeController, complete the login by yourself and then jump to the page. You need to complete the login first, and then execute the jump.
Method:
/// Login
/// @param account Account
/// @param loginPwd Password
/// @param resultBlock Callback result
+(void)loginUser:(NSString *)account password:(NSString * )loginPwd result:(SobotCallResultBlock) resultBlock;
/// Login (Using 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;
Parameters
| Parameter | Type | Required | Description |
|---|
| account | NSString | Yes | Customer service account |
| loginPwd | NSString | No | Customer service account password, used only when token is empty |
| token | NSString | No | The company token that has been obtained. When using the token method, do not set a password. Setting a password will log in again and refresh the token. |
| vc | UIViewController | Yes | The vc that performs the jump |
| resultBlock | Block | No | Execution result, code=1 means success |
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, decide on usage yourself
SobotCallHomeController *orderHomeVC = [[SobotCallHomeController alloc]init];
}
}];
Method 3: Log in using AppKey and appid. You need to complete the login first, and then perform the redirection. (Added in version 3.0.2)
Method:
/// Log in using AppKey and appid
/// @param account Account
/// @param app_key AppKey
/// @param appid appid
/// @param vc Launch VC
/// @param resultBlock Callback result
+(void)startWithAcount:(NSString *)account appkey:(NSString *)app_key appid:(NSString *) appid viewController:(UIViewController *)vc result:(SobotCallResultBlock) resultBlock;
Parameter
| Parameter | Type | Required | Description |
|---|
| account | NSString | Yes | Customer service account |
| AppKey | NSString | Yes | appkey |
| appid | NSString | Yes | appid |
| vc | UIViewController | Yes | The vc that performs the jump |
| resultBlock | Block | No | Execution result, code=1 means success |
Example:
[SobotCallApi startWithAcount:@"123@123.com" appkey:@"your appkey" appid:@"your appid" viewController:self result:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Function Description
Open Interface Initialization
The first step in using the open API is to set the initialization configuration.
Example:
SobotCallCacheEntity *callCacheEntity = [[SobotCallCacheEntity alloc] init];
callCacheEntity.callApiHost = @"https://openapi.soboten.com";
callCacheEntity.openApiHost = @"https://api.sobot.com";
callCacheEntity.stompSocketUri = @"wss://openapi.soboten.com/v6.0.0/webmsg/cc-webmsg";
callCacheEntity.janusSocketUri = @"wss://rtc.sobot.com.cn/janus";
callCacheEntity.sipProxy = @"sip:192.168.30.68:5060";
[SobotCallOpenApi initWithConfig:callCacheEntity result:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Request Parameters
See the description of SobotCallCacheEntity for details.
Callback Function
See the description of SobotCallResultBlock for more details.
Login Operation
Login
- The return values of this interface will continue to add attributes. Please use the correct compatibility coding method to ensure that the calling code does not throw errors when return value attributes are added.
Example:
/// Login
/// @param account Account
/// @param loginPwd Password
/// @param token token
/// @param resultBlock Callback for login result
/// Account is required. Either password or token must have a value.
+(void)loginWithAcount:(NSString *)account
password:(NSString * )loginPwd
token:(NSString *)token
result:(SobotCallResultBlock) resultBlock;
Request Parameters
| Attribute | Name | Type | Nullable | Description |
|---|
| account | Login account | string | No | Call agent account |
| loginPwd | Password | string | No | Password for the call agent. If a token exists, there is no need to pass the password. If the password exists, the system will re-acquire the token. |
| token | Login token | string | Yes | If there is a token, prioritize logging in with the token. It can be empty. |
Callback Function
For details, see the SobotCallResultBlock description.
Check In
- The return values of this interface will continue to add attributes. Please use the correct compatible coding method to ensure that the calling code does not throw errors when return value attributes are added!
- The system gets the latest agent ID in this interface. If you change the ID, the new ID will take effect after you sign in again.
- Calling the sign-in interface from one end will disconnect other ends (not offline agents);
- Supports the login status of the agent server = offline, online, and all other statuses for check-in. But when the agent server’s working status = in a call, ringing, in conversation, on hold, or in wrap-up, check-in is not allowed.
Example:
+(void)agentLoginWithExt:(NSString *)ext
agentStatus:(int )agentStatus
callWay:(int)callWay
bindMobile:(NSString*)bindMobile
sipPassword:(NSString *)sipPassword
sipIp:(NSString *)sipIp
thisQueues:(NSArray *)thisQueues
ResultBlock:(SobotCallResultBlock)resultBlock;
Request Parameters
| Attribute | Name | Type | Nullable | Description |
|---|
| ext | Extension Number | string | No | Extension Number |
| agentStatus | Login Status | string | No | The agent’s login status after successful sign-in.\r\n 1: Online; 2: Do Not Disturb.\r\n If left empty, the default is Do Not Disturb. |
| callWay | Login Method | int | No | 2.sip 3.Mobile Login (Web login method not supported) |
| bindMobile | Bind phone number | int | Yes | Mobile number or landline number.\r\nWhen the answering method is mobile, the bound phone number is not empty. The bound phone number specified by the interface will change the bound phone number in the agent settings.\r\nThe bound phone numbers for different agents cannot be the same. |
| thisQueues | Reception skill group number set | NSArray | Yes | Reception skill group |
Return Value of Success Callback Function
| Attribute | Name | Type | Description | |
|---|
| agentState | Login Status | string | The agent’s login status after successful sign-in.\r\n 1: Online; 2: Do Not Disturb.\r\n If left empty, the default is Do Not Disturb. | |
| phoneType | Answering Mode | string | The answering mode specified by the interface will modify the agent’s default answering mode after successful login. The administrator resetting the agent’s answering mode permission will also change the agent’s default answering mode.\r\n sip: SIP phone; pstn: mobile phone; webrtc: web page.\r\n If empty, the system will use the agent’s default answering mode. | |
| bindExt | Bind extension account | string | The extension account specified by the interface will change the extension account bound in the agent settings.\r\nWhen empty, the system will use the extension account bound in the agent settings. | |
| bindMobile | Bind phone number | string | Mobile number or landline number.\r\nThe phone number specified by the interface will change the bound phone number in the agent settings.\r\nIf left empty, the system will use the bound phone number from the agent settings. | |
| reasonCode | Busy Reason | number | The reason for being busy.\r\n2: Do Not Disturb; 11: Break; 12: Break (Training); 13: Break (Meeting); 14: Break (Meal); 15: Break (Event); 16: Break (Custom 1); 17: Break (Custom 2); 18: Break (Custom 3). | |
| agentLoginQueueInfos | Reception Skill Group | List<QueueAgentCheckin> | Yes | Detailed information of the skill group set for the currently signed-in agents |
| Attribute | Name | Type | Description |
|---|
| queueID | Skill Group Code | string | Skill Group Number |
| queueName | Queue Name | string | Skill Group Name |
| queueWeight | Queue Weight | int | Queue Weight |
| checkin | Check-in group type | int | 0: Default check-in group, 1: Optional check-in group. Default is check-in group. |
Callback Function
For details, see the SobotCallResultBlock description.
Check Out
- The return values of this interface will keep adding attributes. Please use the correct compatible coding method to ensure that the calling code will not throw errors when return value attributes are added!
- The agent’s working status must be “Ready”, “Busy”, or “Locked”. Otherwise, it is not allowed.
Example:
[SobotCallOpenApi logOut:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Callback Function
For details, see the description of SobotCallResultBlock.
Busy Status
- The return values of this interface will keep adding attributes. Please use the correct compatible coding method to ensure that the calling code does not throw errors when return value attributes are added!
Example:
[SobotCallOpenApi noReady:2 resultBlock:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Request Parameters
| Attribute | Name | Type | Nullable | Description |
|---|
| reasonCode | Busy Reason | number | No | Login status displayed after setting busy.\r\n2: Do Not Disturb; 11: Break; 12: Break (Training); 13: Break (Meeting); 14: Break (Meal); 15: Break (Event); 16: Break (Custom 1); 17: Break (Custom 2); 18: Break (Custom 3). |
Callback Function
For details, see the SobotCallResultBlock description.
Idle Settings
- The return values of this interface will continue to add attributes. Please use the correct compatible coding method to ensure that the calling code does not throw errors when return value attributes are added!
Example:
[SobotCallOpenApi ready:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Callback Function
See the description of SobotCallResultBlock for more details.
- The return values of this interface will keep adding attributes. Please use the correct compatible coding method to ensure that the calling code does not throw errors when return value attributes are added!
- Call this interface after logging in successfully.
Example:
+(void)queryLoginBingInfo:(SobotCallResultBlock) resultBlock;
Return Value
| Attribute | Name | Type | Nullable | Description |
|---|
| serviceId | Agent ID | String | No | Agent ID |
| agentID | Agent ID | String | No | Agent ID |
| agentName | Agent Name | String | No | Agent Name |
| thisDN | Extension Number | String | No | Bound extension account |
| phone | Phone Number | String | No | Bound phone number |
| phoneTypes | Answering Method | List<PhoneType> | No | Answering Method |
| receptionQueues | List of skill groups currently receiving | List<QueueAgentCheckin> | No | Query real-time skill group data that agents have checked into (currently active reception skill groups). |
Callback Function
See the description of SobotCallResultBlock for more details.
Query Available Answering Methods for Agent Seats
- The return values of this interface will continue to add attributes. Please use the correct compatibility coding method to ensure that the calling code does not throw errors when return value attributes are added!
- Call this interface after logging in successfully.
Example:
+(void)queryPhoneType:(SobotCallResultBlock) resultBlock;
Return Value
| Attribute | Name | Type | Nullable | Description |
|---|
| agentUuid | Agent ID | String | No | Agent ID |
| agentID | Agent ID | String | No | Agent ID |
| agentName | Agent Name | String | No | Agent Name |
| ext | Extension Number | String | No | Bind extension account |
| phone | Phone Number | String | No | Bound phone number |
| phoneTypes | Answering Method | List<PhoneType> | No | Collection of Answering Methods |
Callback Function
For details, see the SobotCallResultBlock description.
Query Available Extension Numbers for Agent Seats
- The return values of this interface will keep adding attributes. Please use the correct compatibility method to code, ensuring that when return value attributes are added, the calling end’s code will not throw errors!
- Call this interface after logging in successfully.
Example:
+(void)queryUnusedExts:(SobotCallResultBlock)resultBlock;
Return Value
| Attribute | Name | Type | Nullable | Description |
|---|
| data | Extension information array | List<Ext> | No | Extension set information |
Ext Description
| Attribute | Name | Type | Nullable | Description |
|---|
| ext | Extension Number | String | No | Extension number |
| bindStatus | Extension Binding Status | String | No | 0-Not Bound, 1-Bound |
Callback Function
See the description of SobotCallResultBlock for details.
Query the login status of the agent
- The return values of this interface will keep adding attributes. Please use the correct compatibility coding method to ensure that the calling code does not throw errors when return value attributes are added!
- Call this interface after logging in successfully.
Example:
+(void)queryStates:(SobotCallResultBlock)resultBlock;
Callback Function
See the description of SobotCallResultBlock for details.
Query Available Busy Reasons for Agent
- The return values of this interface will continue to add attributes. Please use the correct compatibility coding method to ensure that the calling code does not throw errors when return value attributes are added!
Example:
+(void)queryAgentBusyStatus:(SobotCallResultBlock)resultBlock;
Return Value
| Attribute | Name | Type | Nullable | Description |
|---|
| data | Busy status array | List<AgentBusyStatus> | No | Collection of busy reasons |
AgentBusyStatus
| Attribute | Name | Type | Nullable | Description |
|---|
| name | Status Name | String | No | Status Name |
| code | Status Code | String | No | Status Code |
Callback Function
For details, see the SobotCallResultBlock description.
Query Skill Groups Available for Agent Login
- The return values of this interface will continue to add attributes. Please use the correct compatibility coding method to ensure that the calling code does not throw errors when return value attributes are added!
Example:
+(void)queryReceptionQueues:(SobotCallResultBlock)resultBlock;
Return Value
| Attribute | Name | Type | Nullable | Description |
|---|
| data | The skill group currently served by the agent | List<QueueAgentCheckin> | No | Skill information collection |
Callback Function
For details, see the SobotCallResultBlock description.
Reset Offline (Log Out)
- The return values of this interface will continue to add attributes. Please use the correct compatibility coding method to ensure that the calling code does not throw errors when return value attributes are added!
Example:
+(void)logOut:(SobotCallResultBlock)resultBlock;
Callback Function
For details, see the SobotCallResultBlock description.
Call Operation
Outbound Calls
- The return values of this interface will keep adding attributes. Please use the correct compatibility coding method to ensure that the calling code does not throw errors when return value attributes are added!
Example:
/// Outbound Call
/// @param otherDN Customer number
/// @param privacyNumber Customer number encryption
/// @param companyId Company ID. If not provided, it defaults to the companyId returned at login.
/// @param ANI Specifies the caller's external display number
/// @param outboundPlanCode Specifies the external number plan code on the customer side (Optional outbound route code. According to the outbound route code set in the ZhiChi system, it matches an external number to call the customer)
/// @param resultBlock Result callback
+(void)makeCallWithotherDN:(NSString *)otherDN
privacyNumber:(NSString*)privacyNumber
companyId:(NSString*)companyId
ani:(NSString *)ANI
userData:(NSDictionary *)userData
outboundPlanCode:(NSString *)outboundPlanCode
ResultBlock:(SobotCallResultBlock)resultBlock
Request Parameters
| Attribute | Name | Type | Nullable | Description |
|---|
| otherDN | Customer Number | string | No | Customer number displayed in the UI. For example: 135XXXXX5678; 13512345678; |
| privacyNumber | Customer number encryption | string | Yes | Supports encrypted number outbound calls; Example: XFHAOWHFEFLASJLKWJLD; |
| ANI | Specify the caller ID number on the customer side | string | Yes | A valid number within the enterprise data permission range. It does not need to be within the agent’s data permission settings.\r\nWhen not empty, the system uses this number to call customers. All data set in the agent’s outbound routing will become invalid.\r\nWhen both the specified caller ID number and the specified caller ID scheme code on the customer side are empty, the system uses the rules and numbers set in the <outbound routing> for agents to make calls. |
| outboundPlanCode | Specified customer-side outward number plan code | string | Yes | A valid dynamic outward number plan within the scope of enterprise data permissions. It does not need to be within the data permission range set for agents.\r\nWhen the specified customer-side outward number is not empty, the specified customer-side outward number plan code must be empty.\r\nWhen it is not empty, the system uses this plan to query numbers for outbound calls. All data set in the agent’s outbound call routing will be invalid.\r\nWhen both the specified customer-side outward number and the specified customer-side outward number plan code are empty, the system uses the rules and numbers set in the Outbound Call Routing by the agent. |
| userData | Custom data | object | Yes | This value will be returned during phone events.\r\nThis value will be stored in call records.\r\nRequires encodeURIComponent encoding. |
Callback Function
For details, see the SobotCallResultBlock description.
Answer the Call
- The return values of this interface will keep adding attributes. Please use the correct compatible coding method to ensure that the calling code will not throw errors when return value attributes are added!
Example:
[SobotCallOpenApi answer:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Callback Function
For details, see the SobotCallResultBlock description.
Hang Up
- The return values of this interface will keep adding attributes. Please use the correct compatible coding method to ensure that the calling-end code will not throw errors when return value attributes are added!
Example:
[SobotCallOpenApi hangup:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Callback Function
See the description of SobotCallResultBlock for details.
Keep
- The return values of this interface will keep adding attributes. Please use the correct compatible coding method to ensure that the calling code will not throw errors when return value attributes are added!
- Temporarily suspend the call between the agent and the customer. After holding, the customer will hear hold music, and the agent side will be muted.
- This operation supports 3 answering methods: SIP phone, web page, and mobile phone.
Example:
[SobotCallOpenApi holdCall:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Callback Function
For details, see the description of SobotCallResultBlock.
Cancel Hold
- The return values of this interface will continue to add attributes. Please use the correct compatibility coding method to ensure that the calling code does not throw errors when return value attributes are added!
- Restore the suspended call between the agent and the customer. After canceling the hold, the customer and agent resume normal conversation.
Example:
[SobotCallOpenApi retrieveCall:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Callback Function
See the SobotCallResultBlock description for more details.
Mute
- The return values of this interface will continue to add attributes. Please use the correct compatible coding method to ensure that the calling code will not throw errors when return value attributes are added!
- Turn off the microphone of the operation seat so that others cannot hear the sound from this seat. For example: Agent A consults Agent B, and both Agent A and Agent B can mute their own microphones.
- The listener does not support this operation (the listener’s microphone is always off during monitoring).
- This operation supports 3 answering methods: SIP phone, web page, and mobile phone.
Example:
/// Mute
/// @param resultBlock Result callback
[SobotCallOpenApi muteCall:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Callback Function
See the SobotCallResultBlock description for details.
Unmute
- The return values of this interface will continue to add attributes. Please use the correct compatible coding method to ensure that the calling code does not throw errors when return value attributes are added!
- Restore the microphone on the agent side so that others and the agent can resume normal calls.
Example:
/// Unmute
/// @param resultBlock Result callback
[SobotCallOpenApi unmute:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Callback Function
For details, see the description of SobotCallResultBlock.
Query Sound Playback Type
Switch between the earpiece and speaker repeatedly.
Example:
///
///Query sound playback type
NSString *type = [SobotCallOpenApi searchPlayCategory];
Return Value
| Attribute | Name | Type | Description |
|---|
| AVAudioSessionCategory | Playback Type | String | Speaker Mode AVAudioSessionCategoryPlayback \r\n Receiver Mode AVAudioSessionCategoryPlayAndRecord |
Set Sound Playback Type
Switch between the earpiece and speaker.
Example:
///
///Set the sound playback type
[SobotCallOpenApi changedPlayCategory:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Return Value
| Attribute | Name | Type | Description |
|---|
| AVAudioSessionCategory | Playback Type | String | Speaker Mode AVAudioSessionCategoryPlayback \r\n Receiver Mode AVAudioSessionCategoryPlayAndRecord |
Callback Function
For details, see the SobotCallResultBlock description.
Send Satisfaction
- The return values of this interface will keep adding attributes. Please use the correct compatible coding method to ensure that the calling code won’t throw errors when return value attributes are added!
- After the agent sends the satisfaction survey, the system disconnects all agent-side calls (including monitoring, three-way calls, etc.), keeps the customer-side call active, and plays the satisfaction evaluation message; at the same time, it hangs up all agent-side calls.
Example:
/// Send Satisfaction Evaluation
/// @param resultBlock Result callback
[SobotCallOpenApi sendSatisfy:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Callback Function
See the description of SobotCallResultBlock for details.
Extend the Tidying Duration
- The return values of this interface will keep adding attributes. Please use the correct compatible coding method to ensure that the calling code won’t throw errors when new attributes are added to the return values!
- When the agent’s phone status is in wrap-up, you can extend the wrap-up duration; 30-900 seconds.
Example:
[SobotCallOpenApi delayACW:30 ResultBlock:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Request Parameters
| Attribute | Name | Type | Nullable | Description |
|---|
| delayTime | Extend Time | number | No | Positive integer, 30-900 seconds |
Callback Function
For details, see the description of SobotCallResultBlock.
End of Organization
- The return values of this interface will keep adding attributes. Please use the correct compatible coding method to ensure that the calling code will not throw errors when return value attributes are added!
- When the agent’s phone status is in wrap-up, you can end the wrap-up status early.
Example:
/// End of sorting
/// @param resultBlock Result callback
[SobotCallOpenApi completeACW:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Callback Function
For details, see the SobotCallResultBlock description.
Finish organizing and set to busy
- The return values of this interface will continue to add attributes. Please use the correct compatible coding method to ensure that the calling code will not throw errors when return value attributes are added!
- When the agent’s phone status is in the “organizing” state, you can end the organizing state early and enter the “do not disturb” state.
Example:
/// Finish organizing and set to busy
/// @param resultBlock Result callback
[SobotCallOpenApi completeACWToBusy:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Return Value of Callback Function
For details, see the SobotCallResultBlock description.
- The return values of this interface will continue to add attributes. Please use the correct compatible coding method to ensure that the calling code does not throw errors when return value attributes are added!
Example:
/// Send Button
/// @param dtmfDigits Key press value (Send one key value per request. For example, for 801#, send the key requests 8, 0, 1, and # in sequence. This parameter cannot be empty.)
/// @param resultBlock Result callback
[SobotCallOpenApi agentSendDtmf:@"#" ResultBlock:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Request Parameters
| Attribute | Name | Type | Nullable | Description |
|---|
| dtmfDigits | Key Set | string | No | Maximum 24 digits. Characters include 1-9, *, and #. Example: 801#. |
Callback Function Return Value
For details, see the description of SobotCallResultBlock.
Auxiliary Operations
Query the outbound routing rules for seats
- The return values of this interface will keep adding attributes. Please use the correct compatible coding method to ensure that the calling code will not throw errors when return value attributes are added!
- After the agent signs in, they can check the outbound routing rules set in the “Outbound Routing” for agents.
Example
/// Query the outbound routing rules for agents
/// @param resultBlock Result callback.
[SobotCallOpenApi queryRoutes:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
if(code == CALL_CODE_SUCCEEDED){
}
}];
Return Value of Callback Function
See the description of SobotCallResultBlock for more details.
Return Value obj Description
| Attribute | Name | Type | Description |
|---|
| agentUUID | Agent ID | string | Agent ID |
| agentID | Agent ID | string | Agent ID |
| agentName | Agent Name | string | Agent Name |
| explicitRule | Explicit rule array | object | Set of explicit rules. See Table 1 below |
| explicitSchema | Dynamic explicit scheme array | object | Collection of dynamic explicit schemes. See Table 2 below |
| explicitNumbers | Array of Explicit Numbers | object | Collection of explicit numbers. See Table 3 below |
Table 1 explicitRule Description of the explicit rule array
| Attribute | Name | Type | Description |
|---|
| code | Code | string | 1: Enterprise number pool random matching; 2: Dynamic outbound number plan matching; 3: Agent number pool assignment. |
| name | Name | string | Name. |
| hasSet | Is Default | boolean | Only 1 item in the collection is default data.\r\n true: default display rule; false: non-default display rule. |
Table 2 explicitSchema Dynamic Externally Visible Plan Array Description
| Attribute | Name | Type | Description |
|---|
| code | Code | string | Plan ID |
| planName | Name | string | Name. |
| hasSet | Is Default | boolean | Only one data item in the collection is the default data.\r\n true: default plan; false: non-default plan. |
Table 3 explicitNumbers Description of the explicit number array
| Attribute | Name | Type | Description |
|---|
| number | Display number | string | Trunk number. |
| nickName | Number Alias | string | Alias for the relay number. |
| hasSet | Is Default | boolean | Only one data in the collection is default data.\r\n true: Default display number; false: Non-default display number. |
Modify the Outbound Routing Rules for Seats
- The return values of this interface will keep adding attributes. Please use the correct compatible coding method to ensure that the calling code will not throw errors when return value attributes are added!
- When the agent’s phone is idle, the system can switch to the last used outbound rule for that agent.
Example:
/// Modify the outbound routing rules for the agent
/// @param explicitRule Explicit rule (1: Random match in enterprise number pool; 2: Dynamic explicit number scheme match; 3: Designated agent number pool; Single choice;)
/// @param explicitCode Dynamic explicit code Required when the explicit rule is a dynamic explicit number plan
/// @param explicitNumber Display number. Do not use display rules. Directly specify one of the company's display numbers to call the customer. At least one of the display number or display rule must be provided.
/// @param resultBlock Result callback
[SobotCallOpenApi agentSetRouteExplicitRule:@"1" explicitCode:@"" explicitNumber:@"" resultBlock:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) {
}];
Request Parameters
| Attribute | Name | Type | Nullable | Description |
|---|
| explicitRule | Explicit Rule | string | No | Must be within the data permission range of the agent’s explicit rule in <Outbound Route>.\r\n 1: Random match from enterprise number pool; 2: Match with dynamic explicit number scheme; 3: Specify from agent number pool. |
| explicitCode | Dynamic Display Scheme Code | string | Yes | Must be within the data permission range of the agent’s dynamic display scheme in <Outbound Route>. \r\n Required when display rule=Dynamic Display Number Scheme Match. |
| explicitNumber | Outbound Caller ID | string | Yes | Must be within the personal number pool data permission range of the agent in <Outbound Routing> . \r\n When the outbound rule = Agent Number Pool Specified, this field cannot be empty. |
Callback Function Return Value
See the SobotCallResultBlock description for details.
Return Value
| Attribute | Name | Type | Description |
|---|
| agentUUID | Agent ID | string | Agent ID |
| agentID | Agent ID | string | Agent ID |
| agentName | Agent Name | string | Agent Name |
| explicitRule | Explicit rule array | object | Set of explicit rules. See Table 1 below |
| explicitSchema | Dynamic explicit scheme array | object | Collection of dynamic explicit schemes. See Table 2 below |
| explicitNumbers | Array of explicit numbers | object | Collection of explicit numbers. See Table 3 below |
Table 1 explicitRule Description of the explicit rule array
| Attribute | Name | Type | Description |
|---|
| code | Code | string | 1: Enterprise number pool random match; 2: Dynamic outbound number scheme match; 3: Agent number pool specified. |
| name | Name | string | Name. |
| hasSet | Is Default | boolean | Only one data item in the collection is default data.\r\n true: Default display rule; false: Non-default display rule. |
Table 2 explicitSchema Dynamic External Schema Array Description
| Attribute | Name | Type | Description |
|---|
| code | Code | string | Plan ID |
| planName | Name | string | Name. |
| hasSet | Is Default | boolean | Only one data item in the collection is the default data.\r\n true: default plan; false: non-default plan. |
Table 3 explicitNumbers Description of the explicit number array
| Attribute | Name | Type | Description |
|---|
| number | Display number | string | Trunk number. |
| nickName | Number Alias | string | Alias for the trunk number. |
| hasSet | Is Default | boolean | Only one data in the set is default data.\r\n true: Default display number; false: Non-default display number. |
General Attribute Description
Unified Callback Interface SobotCallResultBlock
All interfaces uniformly use this rule to return results. The main thread has returned, and you can directly refresh the UI.
| Parameter | Type | Required | Description |
|---|
| code | int | YES | 0, failure, 1 success (This version only has 2 return values). |
| obj | object | No | The network interface JSON will be converted to a dictionary. For non-interface operations, the value is empty. |
| msg | String | No | Network interface is a json string, non-interface operation is an operation result description, and failure reason when it fails. |
When the status is successful, please use the following listener to get the real-time status of the agent and call events:
Monitor agent status
Event description reference Call Event (TS).
//1. Use block method to implement monitoring
[[SobotCallClient getSobotCallClient] setCallOpenWebListenerBlock:^(id _Nullable obj, id _Nullable object, id _Nullable msg) {
NSDictionary *dict = (NSDictionary *)msg;
if(!sobotIsNull(dict)){
NSString *messageId = sobotConvertToString(dict[@"messageID"]);
if([@"RequestHangup" isEqual:messageId]){
// Hang up
}
if([@"EventAgentConnectionChanged" isEqual:messageId] || [@"EventAgentLogout" isEqualToString:messageId]){
}
if([@"EventDialing" isEqual:messageId]){
}
if([@"EventAgentReady" isEqual:messageId]){
// Hang up
}
if([@"EventEstablished" isEqual:messageId]){
// The other party answered the phone
}
if([@"EventReleased" isEqual:messageId]){
// Hang up
}
if([@"EventMuted" isEqual:messageId]){
// Mute
}
if([@"EventUnmuted" isEqual:messageId]){
// Unmute
}
if ([@"EventWebSocketSession" isEqual:messageId]) {
}
if([[messageId lowercaseString] containsString:@"error"]){
if([@"EventAgentError" isEqual:messageId]){
}
}
}
}];
//2. Use the proxy method to implement monitoring
//>2.1 Set Proxy
[SobotCallClient getSobotCallClient].openDelegate = self;
//>2.2 Implement the proxy method
-(void)sobotCallOpenListenerobject:(id _Nullable)obj{
}
Listen to Call Events
1. Use the block method to implement monitoring
[[SobotCallClient getSobotCallClient] setCallOpenSipListenerBlock:^(id _Nullable obj, id _Nullable object, id _Nullable msg) {
NSString *event = @"";
if(msg){
if([msg[@"result"] isKindOfClass:[NSDictionary class]]){
event = msg[@"result"][@"event"];
}
}
if([@"registered" isEqual:event]){
// Registration successful
}
if([@"hangup" isEqual:event]){
// Hang up
}
if([@"incomingcall" isEqual:event]){
NSDictionary *resultDict = msg[@"result"];
NSString *call_info = sobotConvertToString([msg objectForKey:@"call_info"]);
// Incoming calls do not auto-answer, waiting for the page to trigger the answer event.
if([@"offer" isEqual:jsep[@"type"]] && [call_info containsString:@"answer-after=0"]){
// Auto Answer
}else{
// Waiting for connection
}
}
}
if([@"notify" isEqual:event]){
if([@"talk" isEqual:msg[@"result"][@"notify"]]){
}
}
if([@"accepted" isEqual:event]){
}
if([@"trickle" isEqual:msg[@"janus"]]){
}
}
}];
2. Use a proxy to implement monitoring.
//>2.1 Set Proxy
[SobotCallClient getSobotCallClient].openDelegate = self;
//>2.2 Implement the proxy method
-(void)sobotCallOpenListenerobject:(id _Nullable)obj{
}
Parameter Description
Domain Settings (Optional)
Domain Name Description:
-
The default SaaS platform domain name is: https://api.sobot.com.
-
If you are a Tencent Cloud service, please set it to: https://www.soboten.com.
-
If you are using a local deployment, please use your own service domain name.
Example code:
SobotCallCacheEntity *config = [[SobotCallCacheEntity alloc] initWithBundleName:@"SobotCall"];
// General interface service address
config.openApiHost = @"https://api.sobot.com";
// Call interface service address
config.callApiHost = @"https://openapi.sobot.com";
// Agent Signaling Service
config.stompSocketUri = @"wss://openapi.sobot.com/v6.0.0/webmsg/cc-webmsg";
// janus message listening service
config.janusSocketUri = @"wss://rtc.sobot.com.cn/janus";
// janus proxy service
config.sipProxy = @"sip:192.168.30.68:5060";
SobotCallParameter Class Description
The configuration takes effect immediately. Use the following function in SobotCallApi.h to configure. After initialization and direct configuration, the new setting will override the previous one.
| Parameter | Type | Required | Description |
|---|
| showHomeBack | BOOL | No | Whether to show the back button on the home page. Default is NO, not displayed. |
Setting method:
/// Change the kitConfig settings
/// @param kitConfig Configuration settings
+(void)configKitInfo:(SobotCallParameter *) kitConfig;
/// Initialize Configuration
/// @param config SobotCallCacheEntity configuration class, domain name/internationalization/resources
/// @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;
SobotCallCacheEntity Class Description
This attribute must be configured during initialization. Configure it once and there is no need to repeat the configuration.
| Parameter | Type | Required | Description |
|---|
| bundleName | NSString | No | Resource name, default is SobotOrder, default is SobotOrder. |
| languagePathInBundle | NSString | No | The path of the internationalization file in the bundle, fixed value Localizable. |
| languageTableName | NSString | No | The name of the internationalization file in the bundle, fixed value SobotLocal. |
| colorTableName | NSString | No | Color file name in the bundle, fixed value: SobotColor. |
| absoluetelanguage | NSString | No | Specify the language. The default follows the system. |
| defaultlanguage | NSString | No | Default language when unrecognized, following the system by default. |
| openApiHost | NSString | No | Public interface domain name. |
| callApiHost | NSString | No | Call service domain name. |
| stompSocketUri | NSString | No | Agent status monitoring service address. |
| janusSocketUri | NSString | No | Janus link service address. |
| sipProxy | NSString | No | Janus proxy server address. |
Permission Settings
Permissions to be added
<key>NSMicrophoneUsageDescription</key>
<string>Voice calls require access to your microphone permission</string>
Source Code and Demo
ZhiChi SDK Function Experience Demo Download Address
Update Notes
《SDK Version Update Notes》
《ZhiChi Technology SDK Personal Information Collection and Usage Statement》