Skip to main content

Precautions:

  • It is recommended to use Chrome browser first. It is not supported for use in mobile H5 pages. This version has only been fully tested for PC browsers. There may be unknown compatibility issues when used in mobile H5 pages.
  • Since softphones need to rely on the WebRTC capabilities provided by the browser, when using softphones, it is recommended to use browsers with better support for WebRTC, such as Chrome or Firefox browsers.
  • Integrating the SDK requires the use of the HTTPS protocol.
  • Chrome browser needs to enable microphone and sound permissions. Firefox browser needs to enable microphone and speaker permissions.
  • When using in an iFrame, the iframe needs to add an allow attribute. iframe.allow = “midi;encrypted-media;microphone *;camera *;“Only in this way can the relevant capabilities of WebRTC be used in the iframe.

javascript-sdk plug-in reference URL

Note: When using the SDK, please add the sysnum parameter in the following way. The sysnum corresponds to the enterprise ID of Sobot (which can be viewed in Sobot management background => Management Center => Account Management => Enterprise Account => Enterprise Information). Do not download the SDK code to the local area and use it on your own server to avoid being unable to obtain SDK updates in the future, resulting in the unavailability of the SDK.

Initialization

● Initialize Plug-in

The first step for using the JavaScript SDK is to create an example
The second step is to initialize
Table 1 Initialization request param description
Request param
Return value of success callback function
Return value of failure callback function
Table 2 EventAgentRegainStatus event param description
Table 3 agentStateInfo event param description
Table 4 workStatusInfo event param description
DNRole description
The third step is to subscribe to the required talk events and events related to the agent status changes (choose either one of example 1 or 2. If they are both used, you will receive the event push from the two)
Example 1: Monitor all agent related events
Example 2: Monitor the required agent related events (refer to Call Capability Message Format File for the complete events)
Method to unsubscribe events

Login Operation

● Login

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. The system obtains the latest agent work no. in this API. In case of any work no. change, please log in again, so that the changed work no. will take effect.
  3. Calling the login API from one end will cause the disconnection of the other end (not agent offline);
  4. Login is available when agent server status = offline, online and all other status. However, it is unavailable when the work status on the agent server = calling, dialing, talking, holding and sorting.
Example:
Request param
Return value of success callback function
Return value of failure callback function

● Logout

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. It is only available when agent work status is ready, occupied or locking. Otherwise, it is unavailable.
Example:
Request param
Return value of success callback function
Return value of failure callback function

● Occupied

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
Example:
Request param
Return value of success callback function
Return value of failure callback function

● Available

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
Example:
Request param
Return value of success callback function
Return value of failure callback function

● Agent Reset Offline

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. The agent can enforce to hang up the phone and log out to offline status in any login status and any call status;
  3. It can be used to reset the agent to offline during the agent status exception.
Example:
Request param
Return value of success callback function
Return value of failure callback function

● Query Agent Login Status

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. Query only the break status and custom break status set available to the agent.
Example:
Request param
Return value of success callback function
Table 1 states login status list
Return value of failure callback function

● Query Agent Answering Method

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. Query the answering method set for which the agent has permission, and return the default answering method (in the admin console, setting the UI to modify the agent answering method permission will reset the default answering method).
Example:
Request param
Return value of success callback function
Table 1 phoneTypes answering method list
Return value of failure callback function

● Query Enterprise Extension List

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
Example:
Request param
Return value of success callback function
Table 1 exts description
Return value of failure callback function

● Query skill groups the agent can log in

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. Query the call skill group of the agent that can be used for logging in. When “Call Function Setting\Agents select skill groups manually to log in” settings are enabled, data is returned according to the skill group configured by the agent. If the settings are not enabled, returned skill group data is blank (at this time, there is no need to pass skill group for logging in. The system will pass all skill groups added by the agent).
Example:
Request param
Return value of success callback function
Table 1 queues list of skill groups joined
Return value of failure callback function

● Query agent login info

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
Example:
Request param
Return value of success callback function
| receptionQueues | List of receiving skill groups | object | Query skill group data logged in real time (receiving skill groups generated at that time). (See Table 2 below) |
Table 1 phoneTypes answering method list
Table 2 receptionQueues list of receiving skill groups
Return value of failure callback function

● Query agent login data

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
Example:
Request param
Return value of success callback function
Table 1 info
Table 2 phoneTypes answering method list
Table 3 checkableQueues list of skill groups joined
Table 4 Login status list
Return value of failure callback function

Call Operation

● Outbound

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
Example:
Request param

● Reject

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
Example:

● Answer

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
Example:

● Hang up

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
Example:

● Hold

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. After temporarily hanging up the talk between the agent and the customer and holding, the customer will hear holding sound and the agent’s side is muted.
  3. This operation supports 3 kinds of answering methods, including SIP phone; web page; cell phone.
Example:

● Cancel Call Holding

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. After resuming the hung-up talk between the agent and the customer and canceling the hold, the talk resumes as normal.
Example:

● Mute

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. Turn off the operation agent’s MIC so that no one else can hear the current agent. E.g.: When agent A inquires agent B, both agents can mute their MIC.
  3. This operation is unavailable to the monitor initiator (the initiator’s MIC keeps off during the monitoring).
  4. This operation supports 3 kinds of answering methods, including SIP phone; web page; cell phone.
Example:

● Unmute

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. Unmute the MIC on the agent side, allowing others to resume normal talks with the agent.
Example:

● Transfer

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. Make direct call transfer of the customer to another skill group/another agent/phone number/extension number, and hang up the current agent’s call after successful operation. If the relay number has only 1 concurrent channel and the only channel is occupied by an inbound call, the number cannot be transferred to a third-party phone number (the transferred call will fail).
Example:
Request param

● Inquiry

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. Before inviting a third party (agent/3rd-party number) to join the current talk, inquire the third party and ask if it wants to join the talk.
  3. If the relay number has only 1 concurrent channel and the only channel is occupied by an inbound call, the number cannot be used to inquire a third-party phone number (the inquired call will fail).
Example:
Request param

● Inquiry Cancellation

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. The initiator can cancel the inquiry before the inquired party (the 3rd party) is connected.
Example:

● Retrieve After Inquiry

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. End the talk of the third party (agent/3rd-party number) and resume the talk between the previous agent and the customer. This API is also used for scenarios including “retrieval after inquiring the third party”.
Example:

● Transfer After Inquiry

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. After inquiring a third party (agent/3rd-party number), the talk is transferred to the third party, and the talk with the previous agent ends. This API is also used for scenarios including “transfer after inquiring the third party”.
Example:

● 3rd-Party Call After Inquiry

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. After inquiring the third party (agent/3rd-party number), the third party agrees to join the three-person talk, and then the previous agent adds the third party into the current talk, forming a three-party talk.
Example:

● Send Satisfaction

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. After the agent sends satisfaction, the system disconnects all agent-side channels (including monitoring, 3rd-party, etc.), keeps the customer-side channels, plays satisfaction evaluation, and hangs up all agent-side channels.
Example:

● Extend Sorting Duration

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. When agent call is in the sorting status, the sorting duration can be extended for 30-900s.
Example:
Request param

● End Sorting

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. When agent call is in the sorting status, the status can be ended in advance.
Example:

● End Sorting and Set Occupied

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. When agent call is in the sorting status, the status can be ended in advance and set as DND.
Example:

● Send Key

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
Example:
Request param

Assistance Operation

● Query Agent Outbound Routing Rules

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. After agent logs in, the outbound call routing rules set in the “Outbound Routing” of the agent can be queried.
Example:
Request param
Return value
Table 1 explicitrule display rule array description
Table 2 explicitschema display scheme array description
Table 3 explicitnumbers display number array description
Return value of failure callback function

● Modify Agent Outbound Routing Rules

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. When the agent is available, the last used display rule of the agent can be switched.
Example:
Request param
Return value
Table 1 explicitrule display rule array description
Table 2 explicitschema display scheme array description
Table 3 explicitnumbers display number array description
Return value of failure callback function

● Query Enterprise Skill Group List

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
Example:
Request param
Return value of success callback function
Table 1 queues param description
Return value of failure callback function

● Query Enterprise Agent List

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
Example:
Request param
Return value of success callback function
Table 1 queues param description
Return value of failure callback function

Supervisor Operation

● Enforce Logout

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. The agent will be enforced to log out after the operation.
Example:
Request param
Return value of success callback function
Return value of failure callback function

● Enforce Occupied

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. The agent will be enforced to be occupied after the operation.
Example:
Request param
Return value of success callback function
Return value of failure callback function

● Enforce Available

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. The agent will be enforced to be ready after the operation.
Example:
Request param
Return value of success callback function
Return value of failure callback function

Extension Function

● Query Skill Group Queuing No.

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. Query the number of customers queuing for the skill group that the agent added.
Example:
Request param
Return value of success callback function
Table 1 queues param description
Return value of failure callback function

● Subscribe to voice communication network quality data

  1. The return value of this API will continue to increase its attributes. Please use the correct compatible coding method to ensure that the code of the calling end will not throw errors when the return value attributes are increased!
  2. Only when the answering method is “web phone + SIP phone”, query the network delay from the agent to the communication service side (CTI).
Example:
Return value of success callback function