logo

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

  1. Include the SDK file in the page where you need to embed the call-out component;
  2. The CC PaaS system server provides a method to obtain an encrypted Token;
  3. Copy the sample code, modify the configuration parameters, and call the corresponding method to use the SDK;
  4. The API-SDK can be used independently. If you need a UI interface, please read the UI-SDK documentation. Download Address:

Notes

Browser Compatibility
  1. The SDK currently supports IE9+ (including) and browsers based on its kernel (360/qq/…), as well as other mainstream browsers (chrome/firefox/…).
  2. If possible, it is recommended to upgrade to IE10 or higher to get the best user experience.
  3. 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

  1. Obtain the AppDataProvider Class through UdeskCCPaasApiClass.AppDataProvider;
  2. Add a class that inherits from AppDataProvider, and the new class can override the following methods;
  3. 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

NameTypeDescriptionDefault ValueRequired
AppIdstringTenant Identification""Yes
AgentIdstringAgent Identification""Yes
LanguageCodestringLanguage"ZH-CN"No
AutoConnectBoolAuto Connect by DefaulttrueNo
AppDataProviderobjectData Provider ClassnullYes
DomainstringWebSocket Connection""Yes
HttpDomainstringInterface Address" "Yes
method
Method NameTypeDescription
GetTokenfunctionGet Authentication
Glossary
Advanced Call FeaturesFeature Description
Three-party TransferThe agent can transfer the call to another agent after a three-party call.
Three-party External LineThe agent can introduce an external line agent during a three-party call.
Three-party CallThe agent can introduce another agent during a call.
Three-party RetrieveThe agent can retrieve the call after introducing another agent.
ConsultThe 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-partyAfter the agent consults with another agent, they can continue the three-party call with the customer.
Consult then TransferThe agent can transfer the call to another agent after consulting with them.
Consult External LineThe 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 RetrieveThe agent can retrieve the call after consulting with another agent.
WhisperThe supervisor can have a private conversation with the agent without the customer hearing it.
BargeThe supervisor can join the call and have a three-party conversation with the agent and the customer.
InterceptThe supervisor can hang up the agent and then continue the call with the customer.
MonitorThe supervisor can listen to the call between the agent and the customer without being heard by either party.
TransferThe agent can transfer the call to another agent.
Transfer External LineThe agent can transfer the call to an external line agent.

Five: Interface API

Return Parameter Description

NameTypeDescription
MessagestringInformation on successful or failed method execution
CodestringCorresponding code
Dataobject/ArrayReturned data
VisibleBoolWhether 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
NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

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

NameTypeRequiredDescription
NumberstringtrueThe number to dial
OptionsobjectfalseAdditional data, e.g.: { BizId: "" }

Return Data

NameTypeDescription
promisepromiseSuccess, 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

NameTypeRequiredDescription
OptionsStringTrueCall ID (obtained during ringing or call)

Return Data

NameTypeDescription
promisepromiseSuccess, 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

NameTypeDescription
promisepromiseSuccess, 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

NameTypeRequiredDescription
PhoneModestringtrueAgent call mode (voip, cellphone, webrtc)

Parameter Description

NameDescription
voipIP Phone
cellphoneMobile Phone
webrtcWeb Phone

Return Data

NameTypeDescription
promisepromiseSuccess, 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

NameTypeDescription
promisepromiseSuccess, 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

NameTypeDescription
promisepromiseSuccess 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

NameValueRequiredDescription
StatestringtrueAgent status ("idle", "busy", "onBreak", "offline")
SubStatestringfalseCustom status value (Required if switching to a custom break, pass the corresponding code)

Return Data

NameTypeDescription
promisepromiseSuccess 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

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameTypeDescription
SipServerstringSIP server address
NumberstringAccount number
PasswordstringPassword

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

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameTypeDescription
WrapUpTimenumberWrap-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

NameTypeRequiredDescription
Optionsobjecttrue{ OwnerType: "app" }

Request Parameters Description

NameTypeDescription
OwnerTypestringTenant: app
Agent: agent

Return Data

NameTypeDescription
promisepromiseSuccess, 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

NameTypeRequiredDescription
Optionsobjecttrue{ OwnerType: "app" }

Request Parameters Description

NameTypeDescription
OwnerTypestringTenant: app
Agent: agent

Return Data

NameTypeDescription
promisepromiseSuccess, 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

NameTypeRequiredDescription
Optionsobjecttrue{ OwnerType: "app", DisplayNumber: "xxxxxxxx" }

Request Parameters Description

NameTypeDescription
OwnerTypestringTenant: app
Seat: agent
DisplayNumberstringThe set relay number

Return Data

NameTypeDescription
promisepromiseSuccess, 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

NameTypeRequiredDescription
Optionsobjecttrue{TerminalType: "voip"}

Request Parameters Description

NameTypeDescription
TerminalTypestringIP Phone: voip
Web Phone: webrtc

Return Data

NameTypeDescription
promisepromiseSuccess, 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

NameTypeRequiredDescription
OptionsobjecttrueCall ID, { CallId: "xxxxxxxxx" }

Return Data

NameTypeDescription
promisepromiseSuccess, 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

NameTypeRequiredDescription
OptionsobjecttrueCall ID, { CallId: "xxxxxxxxx" }

Return Data

NameTypeDescription
promisepromiseSuccess, 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

NameTypeRequiredDescription
OptionsobjecttrueCall ID, { CallId: "xxxxxxxxx" }

Return Data

NameTypeDescription
promisepromiseSuccess 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

NameTypeRequiredDescription
OptionsobjecttrueCall ID, { CallId: "xxxxxxxxx" }

Return Data

NameTypeDescription
promisepromiseSuccess 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

NameTypeRequiredDescription
OptionsobjecttrueCall ID, { CallId: "xxxxxxxxx" }

Return Data

NameTypeDescription
promisepromiseSuccess 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

NameTypeRequiredDescription
OptionsobjecttrueCall ID, { CallId: "xxxxxxxxx" }

Request Parameters Description:

NameValueRequiredDescription
CallIdstringtrueCall ID
AgentIdstringtrueID of the agent being whispered to

Return Data

NameTypeDescription
promisepromiseSuccess 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

NameTypeRequiredDescription
OptionsobjecttrueCall ID, { CallId: "xxxxxxxxx" }

Request Parameters Description:

NameValueRequiredDescription
CallIdstringtrueCall ID
AgentIdstringtrueID of the whispered to
AgentPhonestringtruePhone number of the agent

Return Data

NameTypeDescription
promisepromiseSuccess, 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

NameTypeRequiredDescription
Optionsobjecttrue{ CallId: "xxxxxxxxx", IvrId: "xx", NodeId: "xx", JumpType: "agent_hangup" }

Request Parameters Description:

NameValueRequiredDescription
CallIdstringtrueCall ID
IvrIdstringtrueIVR ID
NodeIdstringtrueNode ID
JumpTypestringtrueTransfer mode

Return Data

NameTypeDescription
promisepromiseSuccess, 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

NameTypeRequiredDescription
idstringtrueThe node ID of the IVR

Return Data

NameTypeDescription
promisepromiseSuccess 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

NameValueRequiredDescription
CallIdstringtrueCall ID
IvrIdstringtrueIVR ID
NodeIdstringtrueNode ID
JumpTypestringtrueTransfer mode

Return Data

NameTypeDescription
promisepromiseSuccess and failure callbacks (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameValueDescription
NamestringQueue name
QueueIdstringQueue 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

NameTypeRequiredDescription
Optionsobjecttrue{ CallId: "xxxxxxxxx", AgentId: "xxxxxxxxx" }

Request Parameters Description:

NameValueRequiredDescription
CallIdstringtrueCall ID
AgentIdstringtrueID of the seat to transfer to
AgentPhonestringtrueThe number of the external line to transfer to

Return Data

NameTypeDescription
promisepromiseSuccess, 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

NameTypeRequiredDescription
Optionsobjecttrue{ CallId: "xxxxxxxxx" }

Request Parameters Description

NameValueRequiredDescription
CallIdstringtrueCall ID

Return Data

NameTypeDescription
promisepromiseSuccess, 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

NameTypeRequiredDescription
Optionsobjecttrue{ CallId: "xxxxxxxxx", AgentId: "xxx" }

Request Parameters Description

NameValueRequiredDescription
CallIdstringtrueCall ID
AgentIdstringtrueID of the agent for consultation

Return Data

NameTypeDescription
promisepromiseSuccess 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

NameTypeRequiredDescription
Optionsobjecttrue{ CallId: "xxxxxxxxx", AgentId: "xxx" }

Request Parameters Description:

NameValueRequiredDescription
CallIdstringtrueCall ID
AgentIdstringtrueID of the agent for the three-way call

Return Data

NameTypeDescription
promisepromiseSuccess 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

NameTypeRequiredDescription
Optionsobjecttrue{ CallId: "xxxxxxxxx", AgentId: "xxx" }

Request Parameters Description:

NameValueRequiredDescription
CallIdstringtrueCall ID
AgentIdstringtrueID of the agent to transfer to

Return Data

NameTypeDescription
promisepromiseSuccess 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

NameTypeRequiredDescription
Optionsobjecttrue{ CallId: "xxxxxxxxx", QueueId: "xxx" }

Request Parameters Description:

NameValueRequiredDescription
CallIdstringtrueCall ID
QueueIdstringtrueID of the queue to transfer to

Return Data

NameTypeDescription
promisepromiseSuccess 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

NameTypeRequiredDescription
Optionsobjecttrue{ CallId: "xxxxxxxxx", AgentId: "xxx" }

Request Parameters Description:

NameValueRequiredDescription
CallIdstringtrueCall ID
AgentIdstringtrueTarget agent ID for interception

Return Data

NameTypeDescription
promisepromiseSuccess 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

NameTypeRequiredDescription
Optionsobjecttrue{ CallId: "xxxxxxxxx", AgentId: "xxx" }

Request Parameters Description:

NameValueRequiredDescription
CallIdstringtrueCall ID
AgentIdstringtrueTarget agent ID for monitoring

Return Data

NameTypeDescription
promisepromiseSuccess 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

NameTypeRequiredDescription
OptionsobjectTrue{ State: 'idle' }

Request Parameters Description:

NameValueRequiredDescription
StatestringFalseAgent status: idle

Return Data

NameTypeDescription
promisepromiseSuccess, failure callback (Failure parameters: Message, Code, Data, Visible)

Return Data Description

NameValueDescription
AgentIdstringAgent ID
AppIdstringApp ID
EnablestringIs 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

NameTypeRequiredDescription
typestringTrue{ type: 1 for trunk numbers, type: 2 for number pool }

Return Data

NameTypeDescription
promisepromiseSuccess, failure callback (Failure parameters: Message, Code, Data, Visible)

Return Data Description

NameValueDescription
Number Pool or Trunk Listarrayresp.Data.list
Selected ID in the Liststringresp.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

NameTypeRequiredDescription
typestringtrue{ type: 1 represents the selected relay number, type: 2 represents the selected number pool }
idstringtrueThe ID of the selected number pool or relay number

Return Data

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameValueDescription
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

NameTypeRequiredDescription
callIdstringtrue

Return Data

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameValueDescription

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

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameValueDescription
CurStatestringCurrent agent status
CurStateSubIdstringCurrent agent's subId
OldStatestringPrevious 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

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameValueDescription
CurContactstringCurrent device mode
CurExtStatestringCurrent device status
CurNumberstringCurrent 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

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameValueDescription
CallIDstringCall ID
CurStatestringCurrent 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

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameValueDescription
CurExtStatestringCurrent device status
CurModestringCurrent phone mode
CurStatestringCurrent 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

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameValueDescription
OnBarButtonSwitchboolVisibility of the retrieve button
AllowTransferAfterThreeWayboolVisibility of the transfer button after three-way call
AllowHoldboolVisibility of the hold button
AllowConsultationboolVisibility of the consultation button
AllowThreeWayAfterConsultationboolVisibility of the three-way button after consultation
AllowTransferAfterConsultationboolVisibility of the transfer button after consultation
AllowHangupboolVisibility of the hangup button
AllowAnswerboolVisibility of the answer button
AllowTransferboolVisibility of the transfer button
AllowEndConsultationboolVisibility of the consultation retrieve button
AllowCancelboolVisibility of the three-way retrieve button
AllowUnHoldboolVisibility of the resume button
AllowThreeWayboolVisibility of the three-way button
AdvancedCallStatusboolCurrent 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

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameValueDescription
CallDirectionstringCall direction (if currently in a call)
CallIDstringCall ID (if currently in a call)
CurExtStatestringCurrent phone status
CurModestringCurrent phone mode
CurStatestringCurrent agent state
CurSubStateIdstringCurrent agent's sub-state of rest
DestNumberstringCall number (if currently in a call)
StartTimestringStart 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

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameTypeDescription
CallIDstringCall ID
AgentInfoobjectAgent information, {City}
CustomerInfoobjectCustomer information, {City, Number}
FromQueuestringCall source
DisplayNumstringDisplay number
WorkFlowstringCall 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

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameTypeDescription
CallIDstringCall ID
AgentInfoobjectAgent information, {City}
CustomerInfoobjectCustomer information, {City, Number}
FromQueuestringCall source
DisplayNumstringDisplayed number
WorkFlowstringCall direction (out_direct, in, out_callback)
CallAuthorityobjectCall permissions
CallTypestringCall 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

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameTypeDescription
CallIDstringCall ID
AgentInfoobjectAgent information, {City}
CustomerInfoobjectCustomer information, {City, Number}
FromQueuestringCall source
DisplayNumstringDisplayed number
WorkFlowstringCall direction (out_direct, in, out_callback)
CallAuthorityobjectCall permissions
CallTypestringCall 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

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameTypeDescription
CallIDstringCall ID
AgentInfoobjectAgent information, {City}
CustomerInfoobjectCustomer information, {City, Number}
FromQueuestringCall source
DisplayNumstringDisplayed number
WorkFlowstringCall direction (out_direct, in, out_callback)
CallAuthorityobjectCall permissions
CallTypestringCall 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

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameTypeDescription
CallIDstringCall ID
AgentInfoobjectAgent information, {City}
CustomerInfoobjectCustomer information, {City, Number}
FromQueuestringCall source
DisplayNumstringDisplayed number
WorkFlowstringCall direction (out_direct, in, out_callback)
CallAuthorityobjectCall permissions
CallTypestringCall 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

NameTypeDescription
promisepromiseSuccess, failure callback (failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameTypeDescription
CallIDstringThe call ID.
AgentInfoobjectAgent information, including {City}.
CustomerInfoobjectCustomer information, including {City, Number}.
FromQueuestringThe source of the call.
DisplayNumstringThe displayed phone number.
WorkFlowstringThe call direction (out_direct, in, out_callback).
CallAuthorityobjectCall permissions.
CallTypestringCall 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

NameTypeDescription
promisepromiseSuccess and failure callbacks (Failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameTypeDescription
CallIDstringThe call ID
AgentInfoobjectAgent information, {City}
CustomerInfoobjectCustomer information, {City, Number}
FromQueuestringThe source of the call
DisplayNumstringThe displayed phone number
WorkFlowstringCall direction (out_direct, in, out_callback)
CallAuthorityobjectCall permissions
CallTypestringCall 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

NameTypeDescription
promisepromiseSuccess and failure callbacks (Failure callback parameters: Message, Code, Data, Visible)

Return Data Description

NameTypeDescription
CallIDstringThe call ID
AgentInfoobjectAgent information, {City}
CustomerInfoobjectCustomer information, {City, Number}
FromQueuestringCall source
DisplayNumstringDisplayed phone number
WorkFlowstringCall direction (out_direct, in, out_callback)
CallAuthorityobjectCall permissions
CallTypestringCall type (incoming, outgoing, three-way, consultation, etc.)