Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Протестировать методы API можно на странице интерактивного обозревателя API и без написания кода
Некоторые ресурсы, описанные на странице, по умолчанию могут быть не доступны из-за типа приложения (см. Создание и авторизация приложений)

Ресурс позволяет управлять группами внутренних номеров клиента. Группы внутренних номеров предназначены для объединения внутренних номеров клиента в группу, что позволяет:

  • работать с рядом ресурсов (записи разговоров, голосовая почта, входящие факсы) на уровне групп. Например, можно получить список записей разговора для внутренних номеров, находящихся в определенной группе;

  • организовывать доступ к ресурсам внутренних номеров с помощью создания пользователя типа "группа внутренних номеров". Такой пользователь, в отличие отличии от пользователя типа "внутренний номер", может использовать ресурсы нескольких внутренних номеров, но, в отличие от пользователя типа "клиент", ему доступны ресурсы только тех внутренних номеров, которые находятся в его группе.

Table of Contents

Описание структур данных

Имя

Тип

Описание

id 

long

Уникальный идентификатор группы внутренних номеров

name 

string

Имя группы внутренних номеров

client_id

long

Идентификатор клиента, которому принадлежит группа

extra_params 

string

Дополнительные параметры

Примеры

Создание группы внутренних номеров:

Tabs
[{"content":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"В разделе "},{"type":"text","text":"authentication","marks":[{"type":"strong"}]},{"type":"text","text":" в поля "},{"type":"text","text":"client_id","marks":[{"type":"strong"}]},{"type":"text","text":" и "},{"type":"text","text":"client_secret","marks":[{"type":"strong"}]},{"type":"text","text":"  требуется ввести полученные при регистрации приложения значения "},{"type":"text","text":"Application_ID","marks":[{"type":"strong"}]},{"type":"text","text":" и "},{"type":"text","text":"Application_Secret","marks":[{"type":"strong"}]},{"type":"text","text":", затем нажать на кнопку \""},{"type":"text","text":"Try it out!","marks":[{"type":"strong"}]},{"type":"text","text":"\". Если данные приложения верны, в ответ вернётся токен доступа ("},{"type":"text","text":"access_token","marks":[{"type":"strong"}]},{"type":"text","text":"). Полученный токен доступа следует ввести в поле \""},{"type":"text","text":"Access Token Field","marks":[{"type":"strong"}]},{"type":"text","text":"\" вверху страницы и сохранить его нажатием кнопки \""},{"type":"text","text":"Set Token","marks":[{"type":"strong"}]},{"type":"text","text":"\"."}]},{"type":"table","attrs":{"isNumberColumnEnabled":false,"layout":"default"},"content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"метод","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"ресурс","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"данные","marks":[{"type":"strong"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"POST"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"/client/@me/extension_group/"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"{"},{"type":"hardBreak"},{"type":"text","text":"\"name\": \"Новая группа внутренних номеров\""},{"type":"hardBreak"},{"type":"text","text":"}"}]}]}]}]},{"type":"paragraph","content":[]}]},"id":"c132159b-0524-4c8c-b273-865a030c1390","label":"Интерактивный обозреватель API    ","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"Для отправки запросов с помощью программы cURL установим значения переменных "},{"type":"text","text":"url ","marks":[{"type":"strong"}]},{"type":"text","text":"и "},{"type":"text","text":"access_token","marks":[{"type":"strong"}]},{"type":"text","text":":"}]},{"type":"paragraph","content":[{"type":"text","text":"export url=\"https://<hostname>/api/ver1.0\"","marks":[{"type":"code"}]},{"type":"text","text":" "},{"type":"hardBreak"},{"type":"text","text":"(где hostname — hostname API-сервера провайдера IP-телефонии),"}]},{"type":"paragraph","content":[{"type":"text","text":"export access_token=\"8SNsrS0jV35vfmKqKeKtRrHfpbg4UX\"","marks":[{"type":"code"}]},{"type":"text","text":" "},{"type":"hardBreak"},{"type":"text","text":"(полученный токен доступа)."}]},{"type":"paragraph","content":[{"type":"text","text":"Отправим запрос:"}]},{"type":"codeBlock","attrs":{"language":"shell"},"content":[{"type":"text","text":"curl \\\r\n-H \"Authorization: Bearer ${access_token}\" \\\r\n-H \"Content-Type: application/json\" \\\r\n-d '{\r\n    \"name\": \"Новая группа внутренних номеров\"\r\n}' \\\r\n-X POST ${url}/client/@me/extension_group/"}]}]},"id":"197877b2-cb0d-44dc-89e9-79eb7e8d3306","label":"Программа cURL    ","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"Для отправки запросов на языке Python установим значения переменных URL и ACCESS_TOKEN:"}]},{"type":"paragraph","content":[{"type":"text","text":"URL = \"https://<hostname>/api/ver1.0\"","marks":[{"type":"code"}]},{"type":"hardBreak"},{"type":"text","text":"(где hostname — hostname API-сервера провайдера IP-телефонии),"}]},{"type":"paragraph","content":[{"type":"text","text":"ACCESS_TOKEN = \"8SNsrS0jV35vfmKqKeKtRrHfpbg4UX\"","marks":[{"type":"code"}]},{"type":"hardBreak"},{"type":"text","text":"(полученный токен доступа)."}]},{"type":"codeBlock","attrs":{"language":"python"},"content":[{"type":"text","text":"#!/usr/bin/python\n\nimport requests\nimport json\r\n\nurl = f\"{URL}/client/@me/extension_group/\"\nheaders = {\n    'Authorization': f'Bearer {ACCESS_TOKEN}',\n    'Content-Type': 'application/json'\n}\ndata = {\"name\": \"Новая группа внутренних номеров\"}\nresponse = requests.post(url, headers=headers, data=json.dumps(data))\nprint(response.text)"}]}]},"id":"12f0efae-483e-4568-bf58-8cbaff89a531","label":"На языке Python3    ","type":"tab"}]

Ответ системы:

Code Block
languagejson
{
  "id": 14,
  "name": "Новая группа внутренних номеров",
  "client_id": 12,
  "extra_params": null
}

Помещение внутреннего номера c идентификатором 30 в ранее созданную группу
(для этого внутренний номер должен быть предварительно создан):

Tabs
[{"content":{"version":1,"type":"doc","content":[{"type":"table","attrs":{"isNumberColumnEnabled":false,"layout":"default"},"content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"метод","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"ресурс","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"данные","marks":[{"type":"strong"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"PUT"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"/client/@me/extension/30"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"{"},{"type":"hardBreak"},{"type":"text","text":"\"extension_group_id\": 14"},{"type":"hardBreak"},{"type":"text","text":"}"}]}]}]}]},{"type":"paragraph","content":[]}]},"id":"b238998b-2f09-4de2-abc0-dcfc7a8d1b0a","label":"Интерактивный обозреватель API    ","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"codeBlock","attrs":{"language":"shell"},"content":[{"type":"text","text":"curl \\\r\n-H \"Authorization: Bearer ${access_token}\" \\\r\n-H \"Content-Type: application/json\" \\\r\n-d '{\"extension_group_id\": 14}' \\\r\n-X PUT ${url}/client/@me/extension/30"}]}]},"id":"42f89de4-f7fa-4d49-915d-af9838fc3f27","label":"Программа cURL    ","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"codeBlock","attrs":{"language":"python"},"content":[{"type":"text","text":"#!/usr/bin/python\n\nimport requests\nimport json\n\nurl = f\"{URL}/client/@me/extension/30\"\nheaders = {\n    'Authorization': f'Bearer {ACCESS_TOKEN}',\r\n    'content-type': 'application/json'\n}\ndata = {\"extension_group_id\": 14}\nresponse = requests.put(url, headers=headers, data=json.dumps(data))\nprint(response.text)"}]}]},"id":"0a9def86-b8d9-4a32-be6b-2c1f4912756c","label":"На языке Python3    ","type":"tab"}]

Ответ системы:

Code Block
languagejson
{
  "status": "active",
  "domain": "sip.ringme.ru",
  "create_date": "2020-03-16 12:18:08",
  "name": "000*300",
  "dial_rule_limit": null,
  "extension_group_id": 14,
  "label": "Петров",
  "caller_id_name": "Петров П.П.",
  "client_id": 12,
  "extra_params": "null",
  "message_did": "string",
  "dial_rule_id": null,
  "ani_rfc3325": false,
  "type": "phone",
  "id": 30,
  "did_as_transfer_caller_id": null
}

Аналогично помещаем ранее созданный внутренний номер c идентификатором 28 в ранее созданную группу:

Tabs
[{"content":{"version":1,"type":"doc","content":[{"type":"table","attrs":{"isNumberColumnEnabled":false,"layout":"default"},"content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"метод","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"ресурс","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"данные","marks":[{"type":"strong"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"PUT"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"/client/@me/extension/28"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"{"},{"type":"hardBreak"},{"type":"text","text":"\"extension_group_id\": 14"},{"type":"hardBreak"},{"type":"text","text":"}"}]}]}]}]},{"type":"paragraph","content":[]}]},"id":"da1f7ee8-6266-4e2c-bc26-7acfb2516132","label":"Интерактивный обозреватель API    ","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"codeBlock","attrs":{"language":"shell"},"content":[{"type":"text","text":"curl \\\n-H \"Authorization: Bearer ${access_token}\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\"extension_group_id\": 14}' \\\n-X PUT ${url}/client/@me/extension/28"}]}]},"id":"3add583a-e1f5-4521-a2de-6f582b08de34","label":"Программа cURL    ","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"codeBlock","attrs":{"language":"python"},"content":[{"type":"text","text":"#!/usr/bin/python\n\nimport requests\nimport json\n\nurl = f\"{URL}/client/@me/extension/28\"\nheaders = {\n    'Authorization': f'Bearer {ACCESS_TOKEN}',\r\n    'content-type': 'application/json'\n}\ndata = {\"extension_group_id\": 14}\nresponse = requests.put(url, headers=headers, data=json.dumps(data))\nprint(response.text)"}]}]},"id":"e0e3058f-5173-4a32-bc59-ab45898d1942","label":"На языке Python3    ","type":"tab"}]

Ответ системы:

Code Block
languagejson
{
  "status": "active",
  "domain": "sip.ringme.ru",
  "create_date": "2020-03-16 12:18:08",
  "name": "000*301",
  "dial_rule_limit": null,
  "extension_group_id": 14,
  "label": "Сидоров",
  "caller_id_name": "Сидоров С.С.",
  "client_id": 12,
  "extra_params": "312",
  "message_did": "string",
  "dial_rule_id": null,
  "ani_rfc3325": false,
  "type": "phone",
  "id": 28,
  "did_as_transfer_caller_id": null
}

Получение списка всех внутренних номеров в данной группе:

Tabs
[{"content":{"version":1,"type":"doc","content":[{"type":"table","attrs":{"isNumberColumnEnabled":false,"layout":"default"},"content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"метод","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"ресурс","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"данные","marks":[{"type":"strong"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"GET"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"/extension_group/14/extension/"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[]}]}]}]},{"type":"paragraph","content":[]}]},"id":"4436f7a8-6ed4-415f-9433-7cc9d7f4c6c1","label":"Интерактивный обозреватель API   ","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"codeBlock","attrs":{"language":"shell"},"content":[{"type":"text","text":"curl \\\r\n-H \"Authorization: Bearer ${access_token}\" \\\r\n-X GET ${url}/extension_group/14/extension/"}]}]},"id":"fa7d7b70-c8c3-44f7-872a-41f651774c77","label":"Программа cURL    ","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"codeBlock","attrs":{"language":"python"},"content":[{"type":"text","text":"#!/usr/bin/python\n\nimport requests\n\nurl = f\"{URL}/extension_group/14/extension/\"\nheaders = {\n    'Authorization': f'Bearer {ACCESS_TOKEN}'\n}\nresponse = requests.get(url, headers=headers)\nprint(response.text)"}]}]},"id":"b002622d-ce93-4356-8374-f41a1e00ebef","label":"На языке Python3   ","type":"tab"}]
Expand
titleОтвет системы:
Code Block
languagejson
[
  {
    "status": "active",
    "domain": "sip.ringme.ru",
    "create_date": "2020-03-16 12:11:13",
    "name": "000*301",
    "extra_params": "312",
    "label": "Сидоров",
    "caller_id_name": "Сидоров С.С.",
    "client_id": 12,
    "extension_group_id": 14,
    "message_did": "string",
    "dial_rule_limit": null,
    "ani_rfc3325": false,
    "type": "phone",
    "id": 28,
    "did_as_transfer_caller_id": null
  },
  {
  "status": "active",
  "domain": "sip.ringme.ru",
  "create_date": "2020-03-16 12:18:08",
  "name": "000*300",
  "dial_rule_limit": null,
  "extension_group_id": 14,
  "label": "Петров",
  "caller_id_name": "Петров П.П.",
  "client_id": 12,
  "extra_params": "null",
  "message_did": "string",
  "dial_rule_id": null,
  "ani_rfc3325": false,
  "type": "phone",
  "id": 30,
  "did_as_transfer_caller_id": null
 } 
]

Получение списка записей разговоров внутренних номеров в заданной группе с 1 по 21 апреля 2016 года:

Tabs
[{"content":{"version":1,"type":"doc","content":[{"type":"table","attrs":{"isNumberColumnEnabled":false,"layout":"default"},"content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"метод","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"ресурс","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"данные","marks":[{"type":"strong"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"GET"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"/extension_group/14/record/?start_datetime=2016-04-01%2000%3A00%3A00&end_datetime=2016-04-21%2000%3A00%3A00"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[]}]}]}]},{"type":"paragraph","content":[]}]},"id":"c3e014f5-aaa5-4a73-b852-64b45f7b907d","label":"Интерактивный обозреватель API    ","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"codeBlock","attrs":{"language":"shell"},"content":[{"type":"text","text":"curl \\\r\n-H \"Authorization: Bearer ${access_token}\" \\\r\n-X GET \"${url}/extension_group/14/record/?start_datetime=2016-04-01%2000:00:00&end_datetime=2016-04-21%2000:00:00&order=desc\""}]}]},"id":"730b6d99-21bb-4b81-801a-ab7dbba6d6ba","label":"Программа cURL    ","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"codeBlock","attrs":{"language":"python"},"content":[{"type":"text","text":"#!/usr/bin/python\n\nimport requests\n\nurl = f'{URL}/extension_group/14/record/?start_datetime=2016-04-01%2000%3A00%3A00&end_datetime=2016-04-21%2000%3A00%3A00'\nheaders = {\n    'Authorization': f'Bearer {ACCESS_TOKEN}'\n}\nresponse = requests.get(url, headers=headers)\nprint(response.text)"}]}]},"id":"afd91314-2a55-4a0d-8506-a44b65876d70","label":"На языке Python3    ","type":"tab"}]
Expand
titleОтвет системы:
Code Block
languagejson
[
 {
   "to_username": "000*300",
   "source_number": "000*306",
   "result": "answered",
   "duration": 1,
   "hangup_time_gmt": "2016-04-12 11:59:31",
   "dealer_owner_id": 1,
   "to_domain": "siptest.ringme.ru",
   "record_file_size": 2304,
   "from_username": "000*306",
   "start_time_gmt": "2016-04-12 11:59:30",
   "ext_number_reg": null,
   "hangup_cause": "NORMAL_CLEARING",
   "extension_group_owner_id": 14,
   "init_time_gmt": "2016-04-12 11:59:28.410000",
   "dest_domain": null,
   "from_domain": "siptest.ringme.ru",
   "source_domain": "siptest.ringme.ru",
   "extension_type": "phone",
   "record_uuid": "30-45331F7000A611E686F30968F8BBCB45",
   "from_screen_name": "000*306",
   "extension_name": "000*300@siptest.ringme.ru",
   "flow": "in","dest_number": null,
   "extension_id": 30,
   "did_number": null,
   "client_owner_id": 12,
   "did_domain": null
  },
  {
   "to_username": "000*301",
   "source_number": "000*306",
   "result": "answered",
   "duration": 1,
   "hangup_time_gmt": "2016-04-12 11:59:23",
   "dealer_owner_id": 1,
   "to_domain": "siptest.ringme.ru",
   "record_file_size": 2016,
   "from_username": "000*306",
   "start_time_gmt": "2016-04-12 11:59:22",
   "ext_number_reg": null,
   "hangup_cause": "NORMAL_CLEARING",
   "extension_group_owner_id": 14,
   "init_time_gmt": "2016-04-12 11:59:21.640000",
   "dest_domain": null,
   "from_domain": "siptest.ringme.ru",
   "source_domain": "siptest.ringme.ru",
   "extension_type": "phone",
   "record_uuid": "30-412A038000A611E686700968F8BBCB45",
   "from_screen_name": "000*306",
   "extension_name": "000*301@siptest.ringme.ru",
   "flow": "in",
   "dest_number": null,
   "extension_id": 28,
   "did_number": null,
   "client_owner_id": 12,
   "did_domain": null
  }
]

Ресурсы раздела "Клиент"

Expand
titlePOST /client/{client_id}/extension_group/

POST /client/{client_id}/extension_group/

Добавить группу внутренних номеров

Параметры URL

Имя

Тип

client_id

string

Параметры JSON

Имя

Тип

Обязательный

name

string

нет

extra_params 

string

нет

Поля ответа

Имя

Тип

id

integer

client_id

integer

name

string

extra_params 

string

Expand
titleGET /client/{client_id}/extension_group/

GET /client/{client_id}/extension_group/

Получить список групп внутренних номеров клиента

Параметры URL

Имя

Тип

client_id

string

Параметры запроса

Имя

Тип

id

array [string]

name

array [string]

Поля ответа

Имя

Тип

id

integer

client_id

integer

name

string

extra_params 

string

Expand
titlePUT /client/{client_id}/extension_group/{ext_group_id}

PUT /client/{client_id}/extension_group/{ext_group_id}

Обновить группу внутренних номеров

Параметры URL

Имя

Тип

ext_group_id

integer

client_id

string

Параметры JSON

Имя

Тип

Обязательный

name

string

нет

extra_params 

string

нет

Поля ответа

Имя

Тип

id

integer

client_id

integer

name

string

extra_params 

string

Expand
titleGET /client/{client_id}/extension_group/{ext_group_id}

GET /client/{client_id}/extension_group/{ext_group_id}

Получить группу внутренних номеров

Параметры URL

Имя

Тип

ext_group_id

integer

client_id

string

Поля ответа

Имя

Тип

id

integer

client_id

integer

name

string

extra_params 

string

Expand
titleDELETE /client/{client_id}/extension_group/{ext_group_id}

DELETE /client/{client_id}/extension_group/{ext_group_id}

Удалить группу внутренних номеров

Параметры URL

Имя

Тип

ext_group_id

integer

client_id

string

Ресурсы раздела "Группа внутренних номеров"

Expand
titleGET /extension_group/{ext_group_id}/extension_group/

GET /extension_group/{ext_group_id}/extension_group/

Получить группу внутренних номеров

Параметры URL

Имя

Тип

ext_group_id

string

Поля ответа

Имя

Тип

id

integer

client_id

integer

name

string

extra_params 

string