Waiting queues (hunts)

Requests

HTTP verb Endpoint Description

POST

/rest/v1/uc/hunts

Creating a new waiting list

GET

/rest/v1/uc/hunts

Getting the list of waiting queues

GET

/rest/v1/uc/hunts/<id>

Obtaining waiting list data

PATCH

/rest/v1/uc/hunts/<id>

Changing waiting queue data

DELETE

/rest/v1/uc/hunts/<id>

Deleting the waiting list

LOOKUP

/rest/v1/uc/hunts

Searching for a waiting queue identifier


Creating a new waiting list

Request

Field Description: hunt entity

Request example
POST /rest/v1/uc/hunts HTTP/1.1
Content-Type: application/json; charset=utf-8

hunt entity

Response

Field Description: hunt entity

Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "a9667bcc-016c-cd71-6d06-50e54938780c",
  "code": "hunt_4",
  "phonenumber": "402",
  "priority": 5,
  "type": "sipuser",
  "resources": [
    {
      "id": "65ac9beb-016c-b372-e769-50e54938780c",
      "priority": 100
    },
    {
      "id": "0007f945-016c-b373-2772-50e54938780c",
      "priority": 99
    }
  ],
  "strategy": {
    "mode": "timers",
    "seconds": [5]
  },
  "resmode": "priorityrandom",
  "objmode": "spqwfq",
  "weight": 10,
  "wivrscript": "welcome",
  "qivrscript": "queue_bob_marley",
  "preivrscript": "notify",
  "reslimit": 0,
  "maxattempts": 10,
  "maxattemptstrannumber": "401",
  "timeout": 0,
  "timeouttrannumber": "401",
  "resdialtimeout": 0,
  "displayname": "",
  "huntblock": {
    "enabled": true,
    "expires": 30,
    "reason": "simple_pause"
  },
  "resbansec": 20,
  "opts": {
    "title": "",
    "comment": "",
    "exit_no_resource": false
  },
  "ext": {
    "ct": "2019-08-26T10:20:58.50Z",
    "lwt": "2019-08-26T10:20:58.50Z"
  }
}

Getting the list of waiting queues

Request

Table 1. Request parameters
Name Type Description

filter

object

Filter by field values.

mask

str

List of fields to output. Available fields for output: id, code, phonenumber, priority, type, strategy, resmode, objmode, weight, reslimit, maxattempts, maxattemptstrannumber, resdialtimeout, timeout, timeouttrannumber, displayname, huntblock, resbansec, opts.title, opts.exit_no_resource, ext.lwt, ext.ct.

offset

int

Offset in the list of resources to be issued.

limit

int

The maximum number of resources in the list.

order

array<object|str>

The sort order of the resources in the list.

flat

bool

Conversion to flat form of composite fields.

Request example
GET /rest/v1/uc/hunts?offset=0&limit=2 HTTP/1.1

Response

Field Description: hunt entity

Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
  {
    "id": "a9667bcc-016c-cd71-6d06-50e54938780c",
    "code": "hunt_4",
    "phonenumber": "402",
    "priority": 5,
    "type": "sipuser",
    "strategy": {
      "mode": "timers",
      "seconds": [5]
    },
    "resmode": "priorityrandom",
    "objmode": "spqwfq",
    "weight": 10,
    "wivrscript": "welcome",
    "qivrscript": "queue_bob_marley",
    "preivrscript": "notify",
    "reslimit": 0,
    "maxattempts": 10,
    "maxattemptstrannumber": "401",
    "timeout": 0,
    "timeouttrannumber": "401",
    "resdialtimeout": 0,
    "displayname": "",
    "huntblock": {
      "enabled": true,
      "expires": 30,
      "reason": "simple_pause"
    },
    "resbansec": 20,
    "opts": {
      "title": "",
      "exit_no_resource": false
    },
    "ext": {
      "ct": "2019-08-26T10:20:58.50Z",
      "lwt": "2019-08-26T10:20:58.50Z"
    }
  },
  {
    "id": "a9667bcc-016c-cd71-6d06-50e54938780c",
    "code": "hunt_5",
    "phonenumber": "405",
    "priority": 50,
    "type": "sipuser",
    "strategy": {
      "mode": "simple"
    },
    "resmode": "priorityrandom",
    "objmode": "spq",
    "weight": 15,
    "wivrscript": "welcome",
    "qivrscript": "play_long",
    "preivrscript": "notify",
    "reslimit": 0,
    "maxattempts": 10,
    "maxattemptstrannumber": "401",
    "timeout": 0,
    "timeouttrannumber": "401",
    "resdialtimeout": 0,
    "displayname": "",
    "huntblock": {
      "enabled": true,
      "expires": 30,
      "reason": "simple_pause"
    },
    "resbansec": 20,
    "opts": {
      "title": "",
      "exit_no_resource": false
    },
    "ext": {
      "ct": "2019-08-26T10:20:58.50Z",
      "lwt": "2019-08-26T10:20:58.50Z"
    }
  }
]

Obtaining waiting list data

Request

Table 2. Request parameters
Name Type Description

mask

str

A list of fields to output.

flat

bool

Conversion to flat form of composite fields.

Request example
GET /rest/v1/uc/hunts/142e6187-016c-cd70-0da4-50e54938780c HTTP/1.1

Response

Field Description: hunt entity

Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "a9667bcc-016c-cd71-6d06-50e54938780c",
  "code": "hunt_4",
  "phonenumber": "402",
  "priority": 5,
  "type": "sipuser",
  "resources": [
    {
      "id": "65ac9beb-016c-b372-e769-50e54938780c",
      "priority": 100
    },
    {
      "id": "0007f945-016c-b373-2772-50e54938780c",
      "priority": 99
    }
  ],
  "strategy": {
    "mode": "timers",
    "seconds": [ 5 ]
  },
  "resmode": "priorityrandom",
  "objmode": "spqwfq",
  "weight": 10,
  "wivrscript": "welcome",
  "qivrscript": "queue_bob_marley",
  "preivrscript": "notify",
  "reslimit": 0,
  "maxattempts": 10,
  "maxattemptstrannumber": "401",
  "timeout": 0,
  "timeouttrannumber": "401",
  "resdialtimeout": 0,
  "displayname": "",
  "huntblock": {
    "enabled": true,
    "expires": 30,
    "reason": "simple_pause"
  },
  "resbansec": 20,
  "opts": {
    "title": "",
    "comment": "",
    "exit_no_resource": false
  },
  "ext": {
    "ct": "2019-08-26T10:20:58.50Z",
    "lwt": "2019-08-26T10:20:58.50Z"
  }
}

Changing waiting queue data

Fields prohibited for modification: id

Request

Field Description: hunt entity

Request example
PATCH /rest/v1/uc/hunts/142e6187-016c-cd70-0da4-50e54938780c HTTP/1.1
Content-Type: application/json; charset=utf-8

hunt entity

Response

Field Description: hunt entity

Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "a9667bcc-016c-cd71-6d06-50e54938780c",
  "code": "hunt_4",
  "phonenumber": "402",
  "priority": 5,
  "type": "sipuser",
  "resources": [
    {
      "id": "65ac9beb-016c-b372-e769-50e54938780c",
      "priority": 100
    },
    {
      "id": "0007f945-016c-b373-2772-50e54938780c",
      "priority": 99
    },
    {
      "id": "66297232-9f5b-371a-2202-394fa940f3882",
      "priority": 95
    }
  ],
  "strategy": {
    "mode": "timers",
    "seconds": [5, 10]
  },
  "resmode": "priorityrandom",
  "objmode": "spqwfq",
  "weight": 10,
  "wivrscript": "welcome",
  "qivrscript": "queue_bob_marley",
  "preivrscript": "notify",
  "reslimit": 0,
  "maxattempts": 10,
  "maxattemptstrannumber": "401",
  "timeout": 0,
  "timeouttrannumber": "401",
  "resdialtimeout": 0,
  "displayname": "",
  "huntblock": {
    "enabled": true,
    "expires": 30,
    "reason": "simple_pause"
  },
  "resbansec": 20,
  "opts": {
    "title": "",
    "comment": "",
    "exit_no_resource": false
  },
  "ext": {
    "ct": "2019-08-26T10:20:58.50Z",
    "lwt": "2019-09-09T17:46:31.25Z"
  }
}

Deleting the waiting list

Request

Request example
DELETE /rest/v1/uc/hunts/142e6187-016c-cd70-0da4-50e54938780c HTTP/1.1

Response

Response example
HTTP/1.1 204 No Content

Searching for a waiting queue identifier

Searches the resource for the specified key, returns the identifier(s) to build the endpoint.

Key fields to search for: id, code, phonenumber

Request

Request example
LOOKUP /rest/v1/uc/hunts HTTP/1.1
Content-Type: application/json; charset=utf-8

"hunt_4"

Response

Example of a successful response
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8

[
  "142e6187-016c-cd70-0da4-50e54938780c"
]
Example of an unsuccessful response
HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8

{
  "error_code": 1404,
  "error_message": "Lookup failed"
}