Queue Agent events (/agent/.../event/)

You can test API methods on the interactive API browser page and without writing code
Some of the resources described on the page may not be available by default due to the type of application (see Creating and authorizing applications).

You can use the resource to notify third-party applications about the inputs/outputs of queue agents.  For more information about queues and agents, click here.

The number of tracked events is limited, the limit can be obtained via the limits resource.

Generation features

Events are generated only when the status changes. For example, if the agent re-sent the login command to the queue, there will be no event.

If the request method is GET, the data will be contained in the request header, but if the request method is POST, the data will be contained in the request body. In both cases, the data is in the application/x-www-form-urlencoded format.

Description of data structures

 

Name

Type

Mandatory

Description

Name

Type

Mandatory

Description

url

string

yes

The URL to which the request is sent when the event occurs. For example: 'https://myshost.org/calls'

event_type

string

yes

The agent event to send the request when it occurs. Possible options:

  • 'agent-login' – agent login to the queue;

  • 'agent-logout' – exit of the agent from the queue

method

string

yes

Request method:

  • GET

  • POST 

Name

Type

Description

Name

Type

Description

agent_id

string

Unique ID of the queue agent

agent_status

string

New Agent status:

  • available – ready to receive calls from the queue;

  • logged_out – will not accept calls from the queue

agent_type

string

Agent Type:

  • local – local agent;

  • remote - external agent

agent_number

string

Present for agent_type 'remote': external agent number

extension_name

string

Present for agent_type 'local': name of the internal agent

event_source

string

Event source:

  • api - the status change is initiated via the API (for example, via the web interface);

  • phone - initiated by the login/logout command directly from the phone that is the agent

Example

Let's say a client with ID 12 has a local agent with ID 136, and this agent is assigned to the internal number "000*094". Let's add an event to this agent that is generated when it enters the queue:

System response:

{   "url": "https://somehost.com/fordel/show.php",   "id": 150,   "method": "GET",   "event_type": "agent-login" }

If on the side of somehost.com show.php script has the following content

<?php error_log("------"); foreach ($_GET as $key => $value){     error_log("$key => $value"); } ?>

then after logging in to the queue, you can see the following lines in the web server log:

[Tue May 30 15:07:50 2017] ------ [Tue May 30 15:07:50 2017] agent_status => available [Tue May 30 15:07:50 2017] agent_type => local [Tue May 30 15:07:50 2017] event_source => api [Tue May 30 15:07:50 2017] agent_id => 136 [Tue May 30 15:07:50 2017] extension_name => 000*094@ringme.ru

Resources of the "Client" section

Local Agents

POST /client/{client_id}/agent/local/{agent_id}/event/

Add the http event of the queue agent

URL Parameters

Name

Type

Name

Type

agent_id

integer

client_id

string

JSON parameters

Name

Type

Mandatory

Name

Type

Mandatory

event_type

string

yes

method

string

yes

url

string

yes

Response fields

Name

Type

Name

Type

event_type

string

id

long

method

string

url

string

GET /client/{client_id}/agent/local/{agent_id}/event/

Get the http event of the queue agent

URL Parameters

Name

Type

Name

Type

agent_id

integer

client_id

string

Response fields

Name

Type

Name

Type

event_type

string

id

long

method

string

url

string

PUT /client/{client_id}/agent/local/{agent_id}/event/{event_id}

Update the http event of the queue agent

URL Parameters

Name

Type

Name

Type

event_id

integer

agent_id

integer

client_id

string

JSON parameters

Name

Type

Mandatory

Name

Type

Mandatory

event_type

string

none

method

string

none

url

string

none

Response fields

Name

Type

Name

Type

event_type

string

id

long

method

string

url

string

External agents