Wait queues (hunts)

Requests

HTTP verb Endpoint Description

POST

/rest/v1/uc/hunts

Creating a new wait queue

GET

/rest/v1/uc/hunts

Getting the list of wait queues

GET

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

Getting data of wait queue

PATCH

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

Modifying data of wait queue

DELETE

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

Deleting wait queue

LOOKUP

/rest/v1/uc/hunts

Searching for the identifier of wait queue


Creating a new wait queue

Request

Field description: hunt entity

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

hunt entity

Response

Field description: hunt entity

Example response
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 wait 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 output.

limit

int

Maximum number of resources in the list.

order

array<object|str>

Sorting order of resources in the list.

flat

bool

Transformation of composite fields to flat form.

Example request
GET /rest/v1/uc/hunts?offset=0&limit=2 HTTP/1.1

Response

Field description: hunt entity

Example response
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"
    }
  }
]

Getting data of wait queue

Request

Table 2. Request parameters
Name Type Description

mask

str

List of fields to output.

flat

bool

Transformation of composite fields to flat form.

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

Response

Field description: hunt entity

Example response
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"
  }
}

Modifying data of wait queue

Fields prohibited for modification: id

Request

Field description: hunt entity

Example request
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

Example response
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 wait queue

Request

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

Response

Example response
HTTP/1.1 204 No Content

Searching for the identifier of wait queue

Searches for a resource by the specified key and returns the identifier(s) for building the endpoint.

Key fields for search: id, code, phonenumber

Request

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

"hunt_4"

Response

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

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

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