Создание маршрутизации для внутреннего звонка
Предварительные условия
-
Выполнить аутентификацию для выполнения запросов API.
-
Созданы как минимум 2 учетные записи sip-пользователей
Операции
1. Создать вектор маршрутизации.
$ curl -b <cookie_file_path> \
-X POST \
-H 'Content-Type: application/json' \
-d '{"vector":"<vector_name>","priority":"<priority>"}' \ (1) (2)
<api_prefix>/rest/v1/uc/routes (3)
1 | <vector_name> – название вектора. |
2 | <priority> – приоритет вектора. |
Например:
$ curl -b curl-worker.cookies \
-X POST \
-H 'Content-Type: application/json' \
-d '{"vector":"test_docs_internal","priority":"5000"}' \
http://192.168.0.35/rest/v1/uc/routes
{
"dir": "*",
"ext": {
"ct": "2019-11-01T09:22:45.29Z",
"lwt": "2019-11-01T09:22:45.29Z"
},
"fromdomain": "*",
"fromextaccount": "*",
"fromnumber": "*",
"id": "32a5e4ce-016e-2646-33ae-e0d55e0cd13e",
"opts": {
"comment": "",
"title": ""
},
"periods": [],
"priority": 5000,
"schedule": "all",
"tonumber": "*",
"vector": "test_docs_internal"
}
2. Создать правило маршрутизации.
$ curl -b <cookie_file_path> \
-X POST \
-H 'Content-Type: application/json' \
-d '{"vector":"<vector_name>","action":"internal","priority":"<priority>"}' \ (1) (2)
<api_prefix>/rest/v1/uc/vectorrules (3)
1 | <vector_name> – название вектора. |
2 | <priority> – приоритет вектора. |
Например:
$ curl -b curl-worker.cookies \
-X POST \
-H 'Content-Type: application/json' \
-d '{"vector":"test_docs_internal","action":"internal","priority":"5000"}' \
http://192.168.0.35/rest/v1/uc/vectorrules
{
"action": "internal",
"dir": "*",
"ext": {
"ct": "2019-11-01T10:21:34.50Z",
"lwt": "2019-11-01T10:21:34.50Z"
},
"fromdomain": "*",
"fromextaccount": "*",
"fromnumber": "*",
"id": "7aa0c406-016e-267c-0daa-e0d55e0cd13e",
"modfromnumber": "T",
"modtonumber": "T",
"opts": {
"comment": "",
"title": ""
},
"periods": [],
"priority": 5000,
"schedule": "all",
"todomain": "",
"toextaccount": "",
"tonumber": "*",
"vector": "test_docs_internal"
}