CCPaaS FrontEnd SDK API V2.1.0
The API SDK only provides methods. This document provides basic usage, precautions, example code, and other information for the outbound API SDK.
Basic Usage
- Include the SDK file in the page where you need to embed the call-out component;
- The CC PaaS system server provides a method to obtain an encrypted Token;
- Copy the sample code, modify the configuration parameters, and call the corresponding method to use the SDK;
- The API-SDK can be used independently. If you need a UI interface, please read the UI-SDK documentation. Download Address:
Notes
Browser Compatibility
- The SDK currently supports IE9+ (including) and browsers based on its kernel (360/qq/…), as well as other mainstream browsers (chrome/firefox/…).
- If possible, it is recommended to upgrade to IE10 or higher to get the best user experience.
- The role of API-SDK is to provide methods, and UI-SDK provides interface UI. If you need to use existing dialing, input, pop-up and other interface functions, you need to use UI-SDK together.
AppDataProvider Class Usage
- Obtain the AppDataProvider Class through UdeskCCPaasApiClass.AppDataProvider;
- Add a class that inherits from AppDataProvider, and the new class can override the following methods;
- Each method in AppDataProvider returns a Promise, otherwise some functions of the SDK component may be abnormal;
SDK Initialization and Destruction
- Initialize the instance
<!-- Include the API-SDK js file -->
<script src="https://ccps.s4.udesk.cn/ccpaas-phone-sdk/sdk/cti-phone/2.1.0/call-center-class.es6.js"></script>
let AppDataProviderBase = UdeskCCPaasApiClass.AppDataProvider;
class AppDataProvider extends AppDataProviderBase {
GetToken() {
return new Promise((resolve, reject) => {
// Send a request to get the authentication information
$.ajax({
url: "https://xxxxxx/xxxxx" // Customer provides the corresponding backend interface; responsible for generating token for the front end
}).
then(response => {
// respose.data={
// appId: "xxxxxxx" Tenant unique identifier
// timestamp: "xxxxxx" Timestamp for authentication
// token: "xxxxxxxxxx" Authentication token
// };
resolve(response.data);
});
});
},
}
// s4 environment example
let UdeskCCPaasApiClassInstance = new UdeskCCPaasApiClass({
AgentId: "",
AppId: "",
AppDataProvider: new AppDataProvider(),
Domain: "wss://tower-xcc1.s4.udesk.cn:443/ws",
HttpDomain: "https://apigw-xcc1.s4.udesk.cn:443/backend",
Log: function (message, type) {
// reason type is object
// Contains the message attribute, the value is the error message
// Example: {message: "Outbound call failed"}
}
});
UdeskCCPaasApiClassInstance.Init();
- Destroy the instance
UdeskCCPaasApiClassInstance.Destroy();
UdeskCCPaasApiClass Instance Parameter Description
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
AppId | string | Tenant Identification | "" | Yes |
AgentId | string | Agent Identification | "" | Yes |
LanguageCode | string | Language | "ZH-CN" | No |
AutoConnect | Bool | Auto Connect by Default | true | No |
AppDataProvider | object | Data Provider Class | null | Yes |
Domain | string | WebSocket Connection | "" | Yes |
HttpDomain | string | Interface Address | " " | Yes |
method
Method Name | Type | Description |
---|---|---|
GetToken | function | Get Authentication |
Glossary
Advanced Call Features | Feature Description |
---|---|
Three-party Transfer | The agent can transfer the call to another agent after a three-party call. |
Three-party External Line | The agent can introduce an external line agent during a three-party call. |
Three-party Call | The agent can introduce another agent during a call. |
Three-party Retrieve | The agent can retrieve the call after introducing another agent. |
Consult | The agent can pause the call with the customer, play audio to the customer, and have a conversation with another agent. After the consultation, the agent can resume the call with the customer. |
Consult then Three-party | After the agent consults with another agent, they can continue the three-party call with the customer. |
Consult then Transfer | The agent can transfer the call to another agent after consulting with them. |
Consult External Line | The agent can pause the call with the customer, play audio to the customer, and have a conversation with an external line agent. After the consultation, the agent can resume the call with the customer. |
Consult then Retrieve | The agent can retrieve the call after consulting with another agent. |
Whisper | The supervisor can have a private conversation with the agent without the customer hearing it. |
Barge | The supervisor can join the call and have a three-party conversation with the agent and the customer. |
Intercept | The supervisor can hang up the agent and then continue the call with the customer. |
Monitor | The supervisor can listen to the call between the agent and the customer without being heard by either party. |
Transfer | The agent can transfer the call to another agent. |
Transfer External Line | The agent can transfer the call to an external line agent. |
Five: Interface API
Return Parameter Description
Name | Type | Description |
---|---|---|
Message | string | Information on successful or failed method execution |
Code | string | Corresponding code |
Data | object/Array | Returned data |
Visible | Bool | Whether the error message can be directly exposed to the user |
WebSocket Connection
1. Disconnect WebSocket Connection
Basic Information
Method Name: Disconnect
Overview
Disconnect the outbound component WebSocket connection
Example
Invocation
UdeskCCPaasApiClassInstance.Disconnect()
Request Parameters
None
Return Data
None
2. Connect WebSocket
Basic Information
Method Name: ConnectAsync
Overview
Connect to the outbound component WebSocket
Example
Invocation
UdeskCCPaasApiClassInstance.ConnectAsync().then(resp=>{})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Outbound Call Related
01. Making a Call
Basic Information
Method Name: MakeCallAsync
Overview
After the outbound call component is successfully connected, the user manually invokes the method to make a call.)
Example
Invocation
UdeskCCPaasApiClassInstance.MakeCallAsync("xxxxxxxxxxx").then(resp=>{})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Number | string | true | The number to dial |
Options | object | false | Additional data, e.g.: { BizId: "" } |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
02. Hang Up Call
Basic Information
Method Name: HangupAsync
Overview
After the call ends, the user manually initiates the hang-up method using the outbound call component.
Example
Invocation
UdeskCCPaasApiClassInstance.HangupAsync(CallId).then(resp=>{})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | String | True | Call ID (obtained during ringing or call) |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
03. Answer Call
Basic Information
Method Name: AnswerAsync
Overview
After the phone rings, the user manually initiates the call answer method using the outbound call component.
Example
Invocation
UdeskCCPaasApiClassInstance.AnswerAsync().then(resp=>{})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
04. Setting Device Mode
Basic Information
Method Name: SetPhoneModeAsync
Overview
When making calls, the outbound call component can choose which mode to use (IP phone, mobile phone, web phone).
Example
Invocation
UdeskCCPaasApiClassInstance.SetPhoneModeAsync("voip").then(resp=>{})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
PhoneMode | string | true | Agent call mode (voip, cellphone, webrtc) |
Parameter Description
Name | Description |
---|---|
voip | IP Phone |
cellphone | Mobile Phone |
webrtc | Web Phone |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
05. Getting Device Modes
Basic Information
Method Name: GetPhoneModesAsync
Overview
Get all available devices for the agent.
Example
Invocation
UdeskCCPaasApiClassInstance.GetPhoneModesAsync().then(resp=>{})
Response
{
Code: "0000",
Data: [{
Id: "cellphone",
Name: "Mobile phone"
},
{
Id: "voip",
Name: "IP Telephone"
},
{
Id: "webrtc",
Name: "Webphone"
}],
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
06. Retrieving All Agent Statuses
Basic Information
Method Name: GetAgentStatesAsync
Overview
Retrieve all available statuses for agents.
Example
Invocation
UdeskCCPaasApiClassInstance.GetAgentStatesAsync().then(resp=>{})
Response
{
Code: "0000",
Data: [
{ Code: "idle", Label: "idle" },
{ Code: "busy", Label: "busy" },
{ Code: "onBreak", Label: "Short break" },
{ Code: "offline", Label: "offline" },
{ Code: 101, Label: "Lunch", Owner: "onBreak" },
{ Code: 102, Label: "Using the restroom", Owner: "onBreak" },
{ Code: 103, Label: "Meeting", Owner: "onBreak" }
],
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (Failure callback parameters: Message, Code, Data, Visible) |
07. Setting Agent Status
Basic Information
Method Name: SetAgentStateAsync
Overview
Set the status of the agent.
Example
Invocation
Switching to Busy, Break, Idle, Offline
UdeskCCPaasApiClassInstance.SetAgentStateAsync("busy").then(resp=>{})
Switching to Custom Break
UdeskCCPaasApiClassInstance.SetAgentStateAsync("onBreak", 101).then(resp=>{})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Value | Required | Description |
---|---|---|---|
State | string | true | Agent status ("idle", "busy", "onBreak", "offline") |
SubState | string | false | Custom status value (Required if switching to a custom break, pass the corresponding code) |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (Failure callback parameters: Message, Code, Data, Visible) |
08. Retrieving Basic Web Phone Information
Basic Information
Method Name: GetWebPhoneInfoAsync
Overview
This method retrieves basic information about the web phone.
Example
Invocation
UdeskCCPaasApiClassInstance.GetWebPhoneInfoAsync().then(resp=>{})
Response
{
Code: "0000",
Data: {
SipServer: "xxxxx",
Number: "xxxxx",
Password: "xxxxx",
},
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Type | Description |
---|---|---|
SipServer | string | SIP server address |
Number | string | Account number |
Password | string | Password |
09. Retrieving the Wrap-Up Time for Incoming Calls
Basic Information
Method Name: GetCallInWrapUpTimeAsync
Overview
This method retrieves the wrap-up time for incoming calls.
Example
Invocation
UdeskCCPaasApiClassInstance.GetCallInWrapUpTimeAsync().then(resp=>{})
Response
{
Code: "0000",
Data: {
WrapUpTime: 0
},
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Type | Description |
---|---|---|
WrapUpTime | number | Wrap-up time |
10. Get Relay Number List
Basic Information
Method Name: GetSpNumbersAsync
Overview
This method retrieves a list of selectable relay numbers.
Example
Invocation
UdeskCCPaasApiClassInstance.GetSpNumbersAsync({OwnerType: "app"}).then(resp=>{})
Response
{
Code: "0000",
Data: ["xxxxx", "xxxxx", "xxxxx"]
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | { OwnerType: "app" } |
Request Parameters Description
Name | Type | Description |
---|---|---|
OwnerType | string | Tenant: app Agent: agent |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (Failure callback parameters: Message, Code, Data, Visible) |
11. Get Current Default Relay Number
Basic Information
Method Name: GetCurrentSpNumberAsync
Overview
This method retrieves the default relay number for the current agent/tenant.
Example
Invocation
UdeskCCPaasApiClassInstance.GetCurrentSpNumberAsync({OwnerType: "app"}).then(resp=>{})
Response
{
Code: "0000",
Data: "xxxxx",
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | { OwnerType: "app" } |
Request Parameters Description
Name | Type | Description |
---|---|---|
OwnerType | string | Tenant: app Agent: agent |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (Failure callback parameters: Message, Code, Data, Visible) |
12. Set Default Continuation Number
Basic Information
Method Name: SetSpNumberAsync
Overview
Sets the default continuation number for the seat/tenant.
Example
Invocation
UdeskCCPaasApiClassInstance.SetSpNumberAsync({OwnerType: "app", DisplayNumber: "xxxxxxxx"}).then(resp=>{})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | { OwnerType: "app", DisplayNumber: "xxxxxxxx" } |
Request Parameters Description
Name | Type | Description |
---|---|---|
OwnerType | string | Tenant: app Seat: agent |
DisplayNumber | string | The set relay number |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
13. Get Terminal (IP Phone, Web Phone) Information
Basic Information
Method Name: GetAgentTerminalInfoAsync
Overview
Obtains information about the terminal (IP phone, web phone).
Example
Invocation
UdeskCCPaasApiClassInstance.GetAgentTerminalInfoAsync({TerminalType: "voip"}).then(resp=>{})
Response
{
Code: "0000",
Data: {
SipServer: "xxxxx",
Number: "xxxxx",
Password: "xxxxx",
},
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | {TerminalType: "voip"} |
Request Parameters Description
Name | Type | Description |
---|---|---|
TerminalType | string | IP Phone: voip Web Phone: webrtc |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
14. Three-way Retrieval
Basic Information
Method Name: RetrieveAfterThreeWayAsync
Overview
Manually invoke the retrieval method during a three-way call.
Example
Invocation
UdeskCCPaasApiClassInstance.RetrieveAfterThreeWayAsync({ CallId: "xxxxxxxxx" }).then(resp => {})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | Call ID, { CallId: "xxxxxxxxx" } |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
15. Consultation Retrieval
Basic Information
Method Name: EndConsultationAsync
Overview
Manually invoke the retrieval method during a consultation call.
Example
Invocation
UdeskCCPaasApiClassInstance.EndConsultationAsync({ CallId: "xxxxxxxxx" }).then(resp => {})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | Call ID, { CallId: "xxxxxxxxx" } |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
16. Recovery
Basic Information
Method Name: RecoveryAsync
Overview
Manually invoke the recovery method during a call to maintain the call.
Example
Invocation
UdeskCCPaasApiClassInstance.RecoveryAsync({ CallId: "xxxxxxxxx" }).then(resp => {})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | Call ID, { CallId: "xxxxxxxxx" } |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (failure callback parameters: Message, Code, Data, Visible) |
17. Consultation to Three-Way
Basic Information
Method Name: ConsultationToThreeWayAsync
Overview
During the consultation process, manually invoke the three-way method.
Example
Invocation
UdeskCCPaasApiClassInstance.ConsultationToThreeWayAsync({ CallId: "xxxxxxxxx" }).then(resp => {})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | Call ID, { CallId: "xxxxxxxxx" } |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (failure callback parameters: Message, Code, Data, Visible) |
18. Post-Three-Way Transfer
Basic Information
Method Name: TransferAfterThreeWayAsync
Overview
This method is used to manually initiate a transfer during a three-way call.
Example
Invocation
UdeskCCPaasApiClassInstance.TransferAfterThreeWayAsync({ CallId: "xxxxxxxxx" }).then(resp => {})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | Call ID, { CallId: "xxxxxxxxx" } |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (Failure callback parameters: Message, Code, Data, Visible) |
19. Whisper
Basic Information
Method Name: WhisperAsync
Overview
This method is used to manually initiate a whisper during a call.
Example
Invocation
UdeskCCPaasApiClassInstance.WhisperAsync({ CallId: "xxxxxxxxx", AgentId: "xxxxxxxxx" }).then(resp => {})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | Call ID, { CallId: "xxxxxxxxx" } |
Request Parameters Description:
Name | Value | Required | Description |
---|---|---|---|
CallId | string | true | Call ID |
AgentId | string | true | ID of the agent being whispered to |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (Failure callback parameters: Message, Code, Data, Visible) |
20. Force Pickup
Basic Information
Method Name: ForcePickupAsync
Overview
This method is used to manually initiate a force pickup during a call.
Example
Invocation
UdeskCCPaasApiClassInstance.ForcePickupAsync({ CallId: "xxxxxxxxx", AgentId: "xxxxxxxxx", AgentPhone: "xxxxxx" }).then(resp => {})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | Call ID, { CallId: "xxxxxxxxx" } |
Request Parameters Description:
Name | Value | Required | Description |
---|---|---|---|
CallId | string | true | Call ID |
AgentId | string | true | ID of the whispered to |
AgentPhone | string | true | Phone number of the agent |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
21. Transfer to IVR
Basic Information
Method Name: TransferIvrAsync
Overview
This method is used to manually transfer a call to an IVR during a call.
Example
Invocation
UdeskCCPaasApiClassInstance.TransferIvrAsync({ CallId: "xxxxxxxxx", IvrId: "", NodeId: "", JumpType: "" }).then(resp => {})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | { CallId: "xxxxxxxxx", IvrId: "xx", NodeId: "xx", JumpType: "agent_hangup" } |
Request Parameters Description:
Name | Value | Required | Description |
---|---|---|---|
CallId | string | true | Call ID |
IvrId | string | true | IVR ID |
NodeId | string | true | Node ID |
JumpType | string | true | Transfer mode |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
22. Retrieving IVR Node List
Basic Information
Method Name: GetIvrNodesAsync
Overview
This method retrieves the list of IVR nodes.
Example
Invocation
UdeskCCPaasApiClassInstance.GetIvrNodesAsync("25").then(resp=>{})
Response
{
Code: "0000",
Data: [
{
id: 1,
name: "ivrtest "
},
],
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
id | string | true | The node ID of the IVR |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (failure callback parameters: Message, Code, Data, Visible) |
23. Retrieving Queue List
Basic Information
Method Name: GetQueuesAgentsAsync
Overview
This method retrieves the list of queues.
Example
Invocation
UdeskCCPaasApiClassInstance.GetQueuesAgentsAsync().then(resp=>{})
Response
{
Code: "0000",
Data: [{
Name: "Jerry Queue",
QueueId: "2",
Strategy: 2,
Timeout: 60,
}],
Message: "",
Visible: false
}
Request Parameters
None.
Request Parameters Description
Name | Value | Required | Description |
---|---|---|---|
CallId | string | true | Call ID |
IvrId | string | true | IVR ID |
NodeId | string | true | Node ID |
JumpType | string | true | Transfer mode |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Value | Description |
---|---|---|
Name | string | Queue name |
QueueId | string | Queue ID |
24. Transfer Seat/Transfer External Line
Basic Information
Method Name: TransferAsync
Overview
During a call, manually initiate the transfer method.
Example
Invocation
UdeskCCPaasApiClassInstance.TransferAsync({ CallId: "xxxxxxxxx", AgentId: "xxxxxxxxx" }).then(resp=>{})
UdeskCCPaasApiClassInstance.TransferAsync({ CallId: "xxxxxxxxx", AgentPhone: "xxxxxxxxx" }).then(resp=>{})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | { CallId: "xxxxxxxxx", AgentId: "xxxxxxxxx" } |
Request Parameters Description:
Name | Value | Required | Description |
---|---|---|---|
CallId | string | true | Call ID |
AgentId | string | true | ID of the seat to transfer to |
AgentPhone | string | true | The number of the external line to transfer to |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
25. Hold
Basic Information
Method Name: HoldAsync
Overview
During a call, manually initiate the method to hold the call.
Example
Invocation
UdeskCCPaasApiClassInstance.HoldAsync({ CallId: "xxxxxxxxx" }).then(resp=>{})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | { CallId: "xxxxxxxxx" } |
Request Parameters Description
Name | Value | Required | Description |
---|---|---|---|
CallId | string | true | Call ID |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
26. Consultation
Basic Information
Method Name: ConsultationAsync
Overview
This method is manually called to initiate a consultation call during a conversation.
Example
Invocation
UdeskCCPaasApiClassInstance.ConsultationAsync({ CallId: "xxxxxxxxx", AgentId: "xxx" }).then(resp => {})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | { CallId: "xxxxxxxxx", AgentId: "xxx" } |
Request Parameters Description
Name | Value | Required | Description |
---|---|---|---|
CallId | string | true | Call ID |
AgentId | string | true | ID of the agent for consultation |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (Failure callback parameters: Message, Code, Data, Visible) |
27. Threeway
Basic Information
Method Name: ThreewayAsync
Overview
This method is manually called to initiate a three-way call during a conversation.
Example
Invocation
UdeskCCPaasApiClassInstance.ThreewayAsync({ CallId: "xxxxxxxxx", AgentId: "xxx" }).then(resp => {})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | { CallId: "xxxxxxxxx", AgentId: "xxx" } |
Request Parameters Description:
Name | Value | Required | Description |
---|---|---|---|
CallId | string | true | Call ID |
AgentId | string | true | ID of the agent for the three-way call |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (Failure callback parameters: Message, Code, Data, Visible) |
28. Consultation Transfer
Basic Information
Method Name: ConsultationToTransferAsync
Overview
This method is used to manually initiate a transfer during a consultation process.
Example
Invocation
UdeskCCPaasApiClassInstance.ConsultationToTransferAsync({ CallId: "xxxxxxxxx", AgentId: "xxx" }).then(resp => {})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | { CallId: "xxxxxxxxx", AgentId: "xxx" } |
Request Parameters Description:
Name | Value | Required | Description |
---|---|---|---|
CallId | string | true | Call ID |
AgentId | string | true | ID of the agent to transfer to |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (Failure callback parameters: Message, Code, Data, Visible) |
29. Transfer to Queue
Basic Information
Method Name: TransferQueueAsync
Overview
This method is used to manually initiate a transfer to a queue during a call.
Example
Invocation
UdeskCCPaasApiClassInstance.TransferQueueAsync({ CallId: "xxxxxxxxx", QueueId: "xxx" }).then(resp => {})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | { CallId: "xxxxxxxxx", QueueId: "xxx" } |
Request Parameters Description:
Name | Value | Required | Description |
---|---|---|---|
CallId | string | true | Call ID |
QueueId | string | true | ID of the queue to transfer to |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (Failure callback parameters: Message, Code, Data, Visible) |
30. Interception
Basic Information
Method Name: SubstituteAsync
Overview
This method manually initiates an interception of a call.
Example
Invocation
UdeskCCPaasApiClassInstance.SubstituteAsync({ CallId: "xxxxxxxxx", AgentId: "xxx" }).then(resp => {})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | { CallId: "xxxxxxxxx", AgentId: "xxx" } |
Request Parameters Description:
Name | Value | Required | Description |
---|---|---|---|
CallId | string | true | Call ID |
AgentId | string | true | Target agent ID for interception |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (failure callback parameters: Message, Code, Data, Visible) |
31. Monitoring
Basic Information
Method Name: EavesdropAsync
Overview
This method manually initiates call monitoring.
Example
Invocation
UdeskCCPaasApiClassInstance.EavesdropAsync({ CallId: "xxxxxxxxx", AgentId: "xxx" }).then(resp => {})
Response
{
Code: "0000",
Data: null,
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
Options | object | true | { CallId: "xxxxxxxxx", AgentId: "xxx" } |
Request Parameters Description:
Name | Value | Required | Description |
---|---|---|---|
CallId | string | true | Call ID |
AgentId | string | true | Target agent ID for monitoring |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (failure callback parameters: Message, Code, Data, Visible) |
32. Get Other Agents List
Basic Information
Method Name: GetOtherAgentsAsync
Overview
This method is used to retrieve a list of other agents.
Example
Invocation
UdeskCCPaasApiClassInstance.GetOtherAgentsAsync({ State: 'idle' }).then(resp => {})
Response
{
Code: "0000",
Data: [{
AgentId: "78",
AppId: "xxxxxx",
Email: "diandian@test.cn",
Enable: true,
ExtState: 0,
ExtenInfos: null,
Extensions: null,
Mobile: "xxxxxxx",
Name: "xxxxxxx",
Queues: null,
QueuesNames: null,
Role: "agent",
State: 1,
WorkId: "",
WrapUpTime: 0,
}],
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description | |
---|---|---|---|---|
Options | object | True | { State: 'idle' } |
Request Parameters Description:
Name | Value | Required | Description |
---|---|---|---|
State | string | False | Agent status: idle |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (Failure parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Value | Description |
---|---|---|
AgentId | string | Agent ID |
AppId | string | App ID |
Enable | string | Is it available? |
33. Get Number Pool/Trunk Number List
Basic Information
Method Name: GetNumberPoolAndSpNumAsync
Overview
This method is used to retrieve the number pool/trunk number list.
Example
Invocation
UdeskCCPaasApiClassInstance.GetNumberPoolAndSpNumAsync({ type }).then(resp => {})
Response
{
Code: "0000",
Data: {
list: [],
defaultId: "xxxxxx",
},
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
type | string | True | { type: 1 for trunk numbers, type: 2 for number pool } |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (Failure parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Value | Description |
---|---|---|
Number Pool or Trunk List | array | resp.Data.list |
Selected ID in the List | string | resp.Data.defaultId |
Depending on the type , the method returns the corresponding list. If there is a selected item in the current list, defaultId will be the id of the selected item, otherwise it will be null. Each time the trunk number and number pool are switched, a new list is obtained. |
34. Select Number Pool/Relay Number List
Basic Information
Method Name: SetSpNumberPoolNumAsync
Overview
Select the corresponding number pool or relay number.
Example
Invocation
UdeskCCPaasApiClassInstance.SetSpNumberPoolNumAsync({ type, id }).then(resp => {})
Response
{
Code: "0000",
Data: {
},
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
type | string | true | { type: 1 represents the selected relay number, type: 2 represents the selected number pool } |
id | string | true | The ID of the selected number pool or relay number |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Value | Description |
---|---|---|
A new list is obtained every time the relay number and number pool are switched, and the selection takes effect immediately. |
35. Mute/Unmute
Basic Information
Method Name: MuteAsync/UnmuteAsync
Overview
Note: This feature is only available in web phone mode.
Example
Invocation
UdeskCCPaasApiClassInstance.MuteAsync({ CallId: 'xxxxxx' }).then(resp => {})
UdeskCCPaasApiClassInstance.UnmuteAsync({ CallId: 'xxxxxx' }).then(resp => {})
Response
{
Code: "0000",
Data: {
},
Message: "",
Visible: false
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
callId | string | true |
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Value | Description |
---|
Component Class
1. Init Initialize Class Instance 2. Destory Destroy Class Instance
Six: Events
- Listening for Call Events
udeskCtiPhoneSdkInstance.on("event.udesk-cc-paas", (conversation) => {
});
- Unsubscribing from Call Events
udeskCtiPhoneSdkInstance.off("event.udesk-cc-paas");
1. Triggered When the Agent Status Changes
Basic Information
Method Name: AgentStateChanged
Overview
This is a listener event triggered when the agent status changes.
Example
Invocation
UdeskCCPaasApiClassInstance.on("AgentStateChanged",function(resp){})
Response
{
Code: "0000",
Data: [{
CurState: "busy",
CurStateSubId: "0",
OldState: "idle"
}],
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Value | Description |
---|---|---|
CurState | string | Current agent status |
CurStateSubId | string | Current agent's subId |
OldState | string | Previous agent status |
2. Phone Mode Change
Basic Information
Method Name: PhoneModeChanged
Overview
A listening event for the change in phone mode.
Example
Invocation
UdeskCCPaasApiClassInstance.on("PhoneModeChanged",function(resp){})
Response
{
Code: "0000",
Data: [{
CurContact: "voip"
CurExtState: "offline"
CurNumber: "90310468561028"
}],
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Value | Description |
---|---|---|
CurContact | string | Current device mode |
CurExtState | string | Current device status |
CurNumber | string | Current device number |
3. Phone State Change
Basic Information
Method Name: PhoneStateChanged
Overview
A listening event for the change in phone state.
Example
Invocation
UdeskCCPaasApiClassInstance.on("PhoneStateChanged",function(resp){})
Response
{
Code: "0000",
Data: [{
CallID: "",
CurState: "busy"
}],
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Value | Description |
---|---|---|
CallID | string | Call ID |
CurState | string | Current agent state |
4. Call Component Preparation Completion
Basic Information
Method Name: Ready
Overview
A listening event for the completion of call component preparation.
Example
Invocation
UdeskCCPaasApiClassInstance.on("Ready",function(resp){})
Response
{
Code: "0000",
Data: [{
CurExtState:"offline"
CurMode:"voip"
CurState:"busy"
}],
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Value | Description |
---|---|---|
CurExtState | string | Current device status |
CurMode | string | Current phone mode |
CurState | string | Current agent state |
5. Advanced Call Call Status Change
Basic Information
Method Name: AdvancedCallStatusChanged
Overview
A listening event for the change in advanced call call status.
Example
Invocation
UdeskCCPaasApiClassInstance.on("AdvancedCallStatusChanged",function(resp){})
Response
{
Code: "0000",
Data: {
AdvancedCallStatus: "Originated",
AgentInfo: {TelNumber: "90310468561028"},
CallAuthority: {
OnBarButtonSwitch: true,
AllowTransferAfterThreeWay: true,
AllowHold: false,
AllowConsultation: false,
AllowThreeWayAfterConsultation: fasle,
AllowTransferAfterConsultation: fasle,
AllowHangup: false,
AllowAnswer: false,
AllowTransfer: false,
AllowEndConsultation: false,
AllowCancel: false,
AllowUnHold: false,
AllowThreeWay: false,
AdvancedCallStatus: false,
},
CallDirection: "Outbound",
CallEvent: "Originated",
CallID: "ea648a5d-56f6-432b-44e1-0941febbb870",
CallType: "OtherIn",
CalledInfo: {TelNumber: "15712886965", City: "New York"}, #Missed call notification
CallerInfo: {TelNumber: "90310468561028"}, #Outgoing call information
ChannelUUID: "42de0839-74ba-442d-a3a5-7744029bd573",
CustomerInfo: {TelNumber: "15712886965", City: "New York"}, #customer Message
DisplayInfo: {TelNumber: "051480114036", City: "Beijing"}, #Presentation Message
WorkFlow: "out_callback",
},
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Value | Description |
---|---|---|
OnBarButtonSwitch | bool | Visibility of the retrieve button |
AllowTransferAfterThreeWay | bool | Visibility of the transfer button after three-way call |
AllowHold | bool | Visibility of the hold button |
AllowConsultation | bool | Visibility of the consultation button |
AllowThreeWayAfterConsultation | bool | Visibility of the three-way button after consultation |
AllowTransferAfterConsultation | bool | Visibility of the transfer button after consultation |
AllowHangup | bool | Visibility of the hangup button |
AllowAnswer | bool | Visibility of the answer button |
AllowTransfer | bool | Visibility of the transfer button |
AllowEndConsultation | bool | Visibility of the consultation retrieve button |
AllowCancel | bool | Visibility of the three-way retrieve button |
AllowUnHold | bool | Visibility of the resume button |
AllowThreeWay | bool | Visibility of the three-way button |
AdvancedCallStatus | bool | Current status |
6. Synchronize Server State
Basic Information
Method Name: GetState
Overview
A listening event for the synchronization of the server state.
Example
Invocation
UdeskCCPaasApiClassInstance.on("GetState",function(resp){})
Response
{
Code: "0000",
Data: {
AdvancedCallStatus: undefined,
AgentInfo: undefined,
CallDirection: "",
CallID: "",
CallType: undefined,
CurContact: "90310468561028",
CurExtState: "idle",
CurMode: "voip",
CurState: "idle",
CurSubStateId: "",
CustomerInfo: undefined,
DestNumber: "",
DestNumberLoc: "",
Payload: null,
SpNumber: "",
StartTime: "",
UserData: "",
},
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Value | Description |
---|---|---|
CallDirection | string | Call direction (if currently in a call) |
CallID | string | Call ID (if currently in a call) |
CurExtState | string | Current phone status |
CurMode | string | Current phone mode |
CurState | string | Current agent state |
CurSubStateId | string | Current agent's sub-state of rest |
DestNumber | string | Call number (if currently in a call) |
StartTime | string | Start time of the current work state (if currently in a call) |
7. Incoming Ring
Basic Information
Method Name: Delivered
Overview
A listening event for an incoming ring.
Example
Invocation
UdeskCCPaasApiClassInstance.on("Delivered",function(resp){})
Response
{
Code: "0000",
Data: {
CallID: "",
AgentInfo: {},
CustomerInfo: {},
FromQueue: "",
DisplayNum: undefined,
WorkFlow: "",
CallAuthority: "",
CallType: "",
},
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Type | Description |
---|---|---|
CallID | string | Call ID |
AgentInfo | object | Agent information, {City} |
CustomerInfo | object | Customer information, {City, Number} |
FromQueue | string | Call source |
DisplayNum | string | Display number |
WorkFlow | string | Call direction (out_direct, in, out_callback) |
8. Outgoing Ring
Basic Information
Method Name: Originated
Overview
This event listener is for the outgoing ringtone.
Example
Invocation
UdeskCCPaasApiClassInstance.on("Originated",function(resp){})
Response
{
Code: "0000",
Data: {
CallID: "",
AgentInfo: {},
CustomerInfo: {},
FromQueue: "",
DisplayNum: undefined,
WorkFlow: "",
CallAuthority: "",
CallType: "",
},
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Type | Description |
---|---|---|
CallID | string | Call ID |
AgentInfo | object | Agent information, {City} |
CustomerInfo | object | Customer information, {City, Number} |
FromQueue | string | Call source |
DisplayNum | string | Displayed number |
WorkFlow | string | Call direction (out_direct, in, out_callback) |
CallAuthority | object | Call permissions |
CallType | string | Call type (incoming, outgoing, three-way, consultation, etc.) |
9. Call in Progress
Basic Information
Method Name: Established
Overview
This event listener is for calls that are in progress.
Example
Invocation
UdeskCCPaasApiClassInstance.on("Established",function(resp){})
Response
{
Code: "0000",
Data: {
CallID: "",
AgentInfo: {},
CustomerInfo: {},
FromQueue: "",
DisplayNum: undefined,
WorkFlow: "",
CallAuthority: "",
CallType: "",
},
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Type | Description |
---|---|---|
CallID | string | Call ID |
AgentInfo | object | Agent information, {City} |
CustomerInfo | object | Customer information, {City, Number} |
FromQueue | string | Call source |
DisplayNum | string | Displayed number |
WorkFlow | string | Call direction (out_direct, in, out_callback) |
CallAuthority | object | Call permissions |
CallType | string | Call type (incoming, outgoing, three-way, consultation, etc.) |
10. Hang Up
Basic Information
Method Name: ConnectionCleared
Overview
The event listener for a hang-up.
Example
Invocation
UdeskCCPaasApiClassInstance.on("ConnectionCleared",function(resp){})
Response
{
Code: "0000",
Data: {
CallID: "",
AgentInfo: {},
CustomerInfo: {},
FromQueue: "",
DisplayNum: undefined,
WorkFlow: "",
CallAuthority: "",
CallType: "",
},
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Type | Description |
---|---|---|
CallID | string | Call ID |
AgentInfo | object | Agent information, {City} |
CustomerInfo | object | Customer information, {City, Number} |
FromQueue | string | Call source |
DisplayNum | string | Displayed number |
WorkFlow | string | Call direction (out_direct, in, out_callback) |
CallAuthority | object | Call permissions |
CallType | string | Call type (incoming, outgoing, three-way, consultation, etc.) |
11. Hold Call
Basic Information
Method Name: Held
Overview
The event listener for holding a call.
Example
Invocation
UdeskCCPaasApiClassInstance.on("Held",function(resp){})
Response
{
Code: "0000",
Data: {
CallID: "",
AgentInfo: {},
CustomerInfo: {},
FromQueue: "",
DisplayNum: undefined,
WorkFlow: "",
CallAuthority: "",
CallType: "",
},
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Type | Description |
---|---|---|
CallID | string | Call ID |
AgentInfo | object | Agent information, {City} |
CustomerInfo | object | Customer information, {City, Number} |
FromQueue | string | Call source |
DisplayNum | string | Displayed number |
WorkFlow | string | Call direction (out_direct, in, out_callback) |
CallAuthority | object | Call permissions |
CallType | string | Call type (incoming, outgoing, three-way, consultation, etc.) |
12. Restore Previous Held Call
Basic Information
Method Name: Retrieved
Overview
This event listener is triggered when a previously held call is restored.
Example
Invocation
UdeskCCPaasApiClassInstance.on("Retrieved", function(resp) { })
Response
{
Code: "0000",
Data: {
CallID: "",
AgentInfo: {},
CustomerInfo: {},
FromQueue: "",
DisplayNum: undefined,
WorkFlow: "",
CallAuthority: "",
CallType: "",
},
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success, failure callback (failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Type | Description |
---|---|---|
CallID | string | The call ID. |
AgentInfo | object | Agent information, including {City}. |
CustomerInfo | object | Customer information, including {City, Number}. |
FromQueue | string | The source of the call. |
DisplayNum | string | The displayed phone number. |
WorkFlow | string | The call direction (out_direct, in, out_callback). |
CallAuthority | object | Call permissions. |
CallType | string | Call type (incoming, outgoing, three-way, consultation, etc.). |
13. Conference Event
Basic Information
Method Name: Conferenced
Overview
This event is triggered for a three-party conference.
Example
Invocation
UdeskCCPaasApiClassInstance.on("Conferenced", function(resp) {});
Response
{
Code: "0000",
Data: {
CallID: "",
AgentInfo: {},
CustomerInfo: {},
FromQueue: "",
DisplayNum: undefined,
WorkFlow: "",
CallAuthority: "",
CallType: "",
},
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (Failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Type | Description |
---|---|---|
CallID | string | The call ID |
AgentInfo | object | Agent information, {City} |
CustomerInfo | object | Customer information, {City, Number} |
FromQueue | string | The source of the call |
DisplayNum | string | The displayed phone number |
WorkFlow | string | Call direction (out_direct, in, out_callback) |
CallAuthority | object | Call permissions |
CallType | string | Call type (incoming, outgoing, three-party, consultation, etc.) |
14. Transferred
Basic Information
Method Name: Transferred
Overview
This is an event listener for call transfers.
Example
Invocation
UdeskCCPaasApiClassInstance.on("Transferred", function(resp) {});
Response
{
Code: "0000",
Data: {
CallID: "",
AgentInfo: {},
CustomerInfo: {},
FromQueue: "",
DisplayNum: undefined,
WorkFlow: "",
CallAuthority: "",
CallType: "",
},
Message: "",
Visible: false
}
Request Parameters
None
Return Data
Name | Type | Description |
---|---|---|
promise | promise | Success and failure callbacks (Failure callback parameters: Message, Code, Data, Visible) |
Return Data Description
Name | Type | Description |
---|---|---|
CallID | string | The call ID |
AgentInfo | object | Agent information, {City} |
CustomerInfo | object | Customer information, {City, Number} |
FromQueue | string | Call source |
DisplayNum | string | Displayed phone number |
WorkFlow | string | Call direction (out_direct, in, out_callback) |
CallAuthority | object | Call permissions |
CallType | string | Call type (incoming, outgoing, three-way, consultation, etc.) |