Skip to main content

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.
Image Relevant restrictions and precautions:
  1. 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.
  2. IOS requires microphone permission; otherwise, the call function cannot be used.
  3. 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

Image
  • 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:
ParameterTypeRequiredDescription
configNSObjectYesBasic software configuration, specifying domain name, resource name, language, etc.
kitInfoNSObjectYesUI related configuration
resultBlockBlockNoInitialization 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
ParameterTypeRequiredDescription
accountNSStringYesCustomer service account
loginPwdNSStringYesCustomer service account password
vcUIViewControllerYesThe vc that performs the jump
resultBlockBlockNoExecution 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
ParameterTypeRequiredDescription
accountNSStringYesCustomer service account
loginPwdNSStringNoCustomer service account password, used only when token is empty
tokenNSStringNoThe 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.
vcUIViewControllerYesThe vc that performs the jump
resultBlockBlockNoExecution 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
ParameterTypeRequiredDescription
accountNSStringYesCustomer service account
AppKeyNSStringYesappkey
appidNSStringYesappid
vcUIViewControllerYesThe vc that performs the jump
resultBlockBlockNoExecution result, code=1 means success
Example:


[SobotCallApi startWithAcount:@"[email protected]" 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

  1. 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

AttributeNameTypeNullableDescription
accountLogin accountstringNoCall agent account
loginPwdPasswordstringNoPassword 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.
tokenLogin tokenstringYesIf there is a token, prioritize logging in with the token. It can be empty.

Callback Function

For details, see the SobotCallResultBlock description.

Check In

  1. 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!
  2. 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.
  3. Calling the sign-in interface from one end will disconnect other ends (not offline agents);
  4. 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

AttributeNameTypeNullableDescription
extExtension NumberstringNoExtension Number
agentStatusLogin StatusstringNoThe 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.
callWayLogin MethodintNo2.sip 3.Mobile Login (Web login method not supported)
bindMobileBind phone numberintYesMobile 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.
thisQueuesReception skill group number setNSArrayYesReception skill group

Return Value of Success Callback Function

AttributeNameTypeDescription
agentStateLogin StatusstringThe 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.
phoneTypeAnswering ModestringThe 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.
bindExtBind extension accountstringThe 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.
bindMobileBind phone numberstringMobile 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.
reasonCodeBusy ReasonnumberThe 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).
agentLoginQueueInfosReception Skill GroupList<QueueAgentCheckin>YesDetailed information of the skill group set for the currently signed-in agents

Skill Group Information QueueAgentCheckin

AttributeNameTypeDescription
queueIDSkill Group CodestringSkill Group Number
queueNameQueue NamestringSkill Group Name
queueWeightQueue WeightintQueue Weight
checkinCheck-in group typeint0: Default check-in group, 1: Optional check-in group. Default is check-in group.

Callback Function

For details, see the SobotCallResultBlock description.

Check Out

  1. 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!
  2. 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

  1. 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

AttributeNameTypeNullableDescription
reasonCodeBusy ReasonnumberNoLogin 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

  1. 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.

Query Agent Check-in Information

  1. 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!
  2. Call this interface after logging in successfully.
Example:
    +(void)queryLoginBingInfo:(SobotCallResultBlock) resultBlock;

Return Value

AttributeNameTypeNullableDescription
serviceIdAgent IDStringNoAgent ID
agentIDAgent IDStringNoAgent ID
agentNameAgent NameStringNoAgent Name
thisDNExtension NumberStringNoBound extension account
phonePhone NumberStringNoBound phone number
phoneTypesAnswering MethodList<PhoneType>NoAnswering Method
receptionQueuesList of skill groups currently receivingList<QueueAgentCheckin>NoQuery 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

  1. 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!
  2. Call this interface after logging in successfully.
Example:
    +(void)queryPhoneType:(SobotCallResultBlock) resultBlock;

Return Value

AttributeNameTypeNullableDescription
agentUuidAgent IDStringNoAgent ID
agentIDAgent IDStringNoAgent ID
agentNameAgent NameStringNoAgent Name
extExtension NumberStringNoBind extension account
phonePhone NumberStringNoBound phone number
phoneTypesAnswering MethodList<PhoneType>NoCollection of Answering Methods

Callback Function

For details, see the SobotCallResultBlock description.

Query Available Extension Numbers for Agent Seats

  1. 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!
  2. Call this interface after logging in successfully.
Example:
    +(void)queryUnusedExts:(SobotCallResultBlock)resultBlock;

Return Value

AttributeNameTypeNullableDescription
dataExtension information arrayList<Ext>NoExtension set information
Ext Description
AttributeNameTypeNullableDescription
extExtension NumberStringNoExtension number
bindStatusExtension Binding StatusStringNo0-Not Bound, 1-Bound

Callback Function

See the description of SobotCallResultBlock for details.

Query the login status of the agent

  1. 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!
  2. 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

  1. 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

AttributeNameTypeNullableDescription
dataBusy status arrayList<AgentBusyStatus>NoCollection of busy reasons
AgentBusyStatus
AttributeNameTypeNullableDescription
nameStatus NameStringNoStatus Name
codeStatus CodeStringNoStatus Code

Callback Function

For details, see the SobotCallResultBlock description.

Query Skill Groups Available for Agent Login

  1. 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

AttributeNameTypeNullableDescription
dataThe skill group currently served by the agentList<QueueAgentCheckin>NoSkill information collection

Callback Function

For details, see the SobotCallResultBlock description.

Reset Offline (Log Out)

  1. 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

  1. 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

AttributeNameTypeNullableDescription
otherDNCustomer NumberstringNoCustomer number displayed in the UI. For example: 135XXXXX5678; 13512345678;
privacyNumberCustomer number encryptionstringYesSupports encrypted number outbound calls; Example: XFHAOWHFEFLASJLKWJLD;
ANISpecify the caller ID number on the customer sidestringYesA 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.
outboundPlanCodeSpecified customer-side outward number plan codestringYesA 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.
userDataCustom dataobjectYesThis 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

  1. 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

  1. 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

  1. 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!
  2. 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.
  3. 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

  1. 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!
  2. 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

  1. 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!
  2. 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.
  3. The listener does not support this operation (the listener’s microphone is always off during monitoring).
  4. 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

  1. 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!
  2. 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

AttributeNameTypeDescription
AVAudioSessionCategoryPlayback TypeStringSpeaker 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

AttributeNameTypeDescription
AVAudioSessionCategoryPlayback TypeStringSpeaker Mode AVAudioSessionCategoryPlayback \r\n Receiver Mode AVAudioSessionCategoryPlayAndRecord

Callback Function

For details, see the SobotCallResultBlock description.

Send Satisfaction

  1. 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!
  2. 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

  1. 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!
  2. 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

AttributeNameTypeNullableDescription
delayTimeExtend TimenumberNoPositive integer, 30-900 seconds

Callback Function

For details, see the description of SobotCallResultBlock.

End of Organization

  1. 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!
  2. 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

  1. 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!
  2. 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.

Send Button

  1. 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

AttributeNameTypeNullableDescription
dtmfDigitsKey SetstringNoMaximum 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

  1. 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!
  2. 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

AttributeNameTypeDescription
agentUUIDAgent IDstringAgent ID
agentIDAgent IDstringAgent ID
agentNameAgent NamestringAgent Name
explicitRuleExplicit rule arrayobjectSet of explicit rules. See Table 1 below
explicitSchemaDynamic explicit scheme arrayobjectCollection of dynamic explicit schemes. See Table 2 below
explicitNumbersArray of Explicit NumbersobjectCollection of explicit numbers. See Table 3 below
Table 1 explicitRule Description of the explicit rule array
AttributeNameTypeDescription
codeCodestring1: Enterprise number pool random matching; 2: Dynamic outbound number plan matching; 3: Agent number pool assignment.
nameNamestringName.
hasSetIs DefaultbooleanOnly 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
AttributeNameTypeDescription
codeCodestringPlan ID
planNameNamestringName.
hasSetIs DefaultbooleanOnly 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
AttributeNameTypeDescription
numberDisplay numberstringTrunk number.
nickNameNumber AliasstringAlias for the relay number.
hasSetIs DefaultbooleanOnly 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

  1. 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!
  2. 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

AttributeNameTypeNullableDescription
explicitRuleExplicit RulestringNoMust 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.
explicitCodeDynamic Display Scheme CodestringYesMust 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.
explicitNumberOutbound Caller IDstringYesMust 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

AttributeNameTypeDescription
agentUUIDAgent IDstringAgent ID
agentIDAgent IDstringAgent ID
agentNameAgent NamestringAgent Name
explicitRuleExplicit rule arrayobjectSet of explicit rules. See Table 1 below
explicitSchemaDynamic explicit scheme arrayobjectCollection of dynamic explicit schemes. See Table 2 below
explicitNumbersArray of explicit numbersobjectCollection of explicit numbers. See Table 3 below
Table 1 explicitRule Description of the explicit rule array
AttributeNameTypeDescription
codeCodestring1: Enterprise number pool random match; 2: Dynamic outbound number scheme match; 3: Agent number pool specified.
nameNamestringName.
hasSetIs DefaultbooleanOnly 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
AttributeNameTypeDescription
codeCodestringPlan ID
planNameNamestringName.
hasSetIs DefaultbooleanOnly 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
AttributeNameTypeDescription
numberDisplay numberstringTrunk number.
nickNameNumber AliasstringAlias for the trunk number.
hasSetIs DefaultbooleanOnly 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.
ParameterTypeRequiredDescription
codeintYES0, failure, 1 success (This version only has 2 return values).
objobjectNoThe network interface JSON will be converted to a dictionary. For non-interface operations, the value is empty.
msgStringNoNetwork 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.
ParameterTypeRequiredDescription
showHomeBackBOOLNoWhether 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.
ParameterTypeRequiredDescription
bundleNameNSStringNoResource name, default is SobotOrder, default is SobotOrder.
languagePathInBundleNSStringNoThe path of the internationalization file in the bundle, fixed value Localizable.
languageTableNameNSStringNoThe name of the internationalization file in the bundle, fixed value SobotLocal.
colorTableNameNSStringNoColor file name in the bundle, fixed value: SobotColor.
absoluetelanguageNSStringNoSpecify the language. The default follows the system.
defaultlanguageNSStringNoDefault language when unrecognized, following the system by default.
openApiHostNSStringNoPublic interface domain name.
callApiHostNSStringNoCall service domain name.
stompSocketUriNSStringNoAgent status monitoring service address.
janusSocketUriNSStringNoJanus link service address.
sipProxyNSStringNoJanus 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 Collects and Uses Personal Information Statement

《ZhiChi Technology SDK Personal Information Collection and Usage Statement》