версия от 2025-05-21 |
Группа методов позволяет подключать и отключать телефонные номера других операторов для приёма входящих вызовов.
Адрес: https://restapi.plusofon.ru
GET
api/v1/number/external
Метод позволяет получить список всех настроенных в текущем личном кабинете внешних номеров.
Не имеет параметров.
curl -X GET \
-G "https://restapi.plusofon.ru/api/v1/number/external" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}"
const url = new URL(
"https://restapi.plusofon.ru/api/v1/number/external"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://restapi.plusofon.ru/api/v1/number/external',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/number/external'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
В ответе возвращается массив external_numbers
:
number
номер в международном формате
source
SIP-аккаунт или перечень SIP-серверов
customer_id
ИД текущего личного кабинета
type
тип подключения внешнего номера
АТС
— тип «АТС», регистрация на SIP-сервере по логину и паролю
SIP-URI
— тип «SIP-URI», приём вызовов на выделенный адрес
status
"АТС"
){
"external_numbers": [
{
"number": "79104445566",
"source": "21201588169353@sip.plusofon.ru",
"customer_id": 42291,
"type": "АТС",
"status": false
},
{
"number": "79104445567",
"source": "sip.plusofon.ru,sip.plusofon.ru1,sip.plusofon.ru2",
"host": "4229179104445567@ext.plusofon.ru",
"customer_id": 42291,
"type": "SIP-URI"
}
],
"success": true
}
GET
api/v1/number/external/status
Метод позволяет получить список статусов регистрации в сети внешнего номера. Работает только для типа «АТС».
Body
logins
arraycurl -X GET \
-G "https://restapi.plusofon.ru/api/v1/number/external/status" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"logins":[]}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/number/external/status"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"logins": []
}
fetch(url, {
method: "GET",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://restapi.plusofon.ru/api/v1/number/external/status',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'logins' => [],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/number/external/status'
payload = {
"logins": []
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers, json=payload)
response.json()
В ответе возвращается массив status
:
login
логин подключения
status
статус регистрации в сети
date
дата и время обновления статуса
{
"status": [
{
"login": "111",
"status": "OK",
"date": "2021-02-10 00:00:00"
},
{
"login": "222",
"status": "OK",
"date": "2021-02-10 00:00:00"
}
],
"success": true
}
PUT
api/v1/number/external/{type}
Метод позволяет настроить новое подключение внешнего номера.
Path
type
stringate
— тип «АТС», регистрация на SIP-сервере по логину и паролю
sipuri
— тип «SIP-URI», приём вызовов на выделенный адрес
Body
host
string
⁎ SIP-сервер внешнего номера
number
integer
⁎ внешний номер в международном формате
port
integer
⁎ только для типа «АТС» — порт подключения
login
string
⁎ только для типа «АТС» — логин подключения
secret
string
⁎ только для типа «АТС» — пароль
curl -X PUT \
"https://restapi.plusofon.ru/api/v1/number/external/ate" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"host":"et","number":18,"port":1,"login":"aperiam","secret":"non"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/number/external/ate"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"host": "et",
"number": 18,
"port": 1,
"login": "aperiam",
"secret": "non"
}
fetch(url, {
method: "PUT",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://restapi.plusofon.ru/api/v1/number/external/ate',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'host' => 'et',
'number' => 18,
'port' => 1,
'login' => 'aperiam',
'secret' => 'non',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/number/external/ate'
payload = {
"host": "et",
"number": 18,
"port": 1,
"login": "aperiam",
"secret": "non"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
В ответе может возвращаться:
success
признак успешно выполненного запроса
message
сообщение об ошибке
Внешний номер успешно подключен:
{
"success": true
}
PATCH
api/v1/number/external/{type}/{id}
Метод позволяет обновить параметры подключения внешнего номера.
Path
type
stringate
— тип «АТС», регистрация на SIP-сервере по логину и паролю
sipuri
— тип «SIP-URI», приём вызовов на выделенный адрес
id
stringBody
host
string
⁎ SIP-сервер внешнего номера
number
integer
⁎ внешний номер в международном формате
port
integer
⁎ только для типа «АТС» — порт подключения
login
string
⁎ только для типа «АТС» — логин подключения
secret
string
⁎ только для типа «АТС» — пароль
curl -X PATCH \
"https://restapi.plusofon.ru/api/v1/number/external/ate/1" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"host":"voluptas","number":6,"port":6,"login":"repudiandae","secret":"repellat"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/number/external/ate/1"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"host": "voluptas",
"number": 6,
"port": 6,
"login": "repudiandae",
"secret": "repellat"
}
fetch(url, {
method: "PATCH",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->patch(
'https://restapi.plusofon.ru/api/v1/number/external/ate/1',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'host' => 'voluptas',
'number' => 6,
'port' => 6,
'login' => 'repudiandae',
'secret' => 'repellat',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/number/external/ate/1'
payload = {
"host": "voluptas",
"number": 6,
"port": 6,
"login": "repudiandae",
"secret": "repellat"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('PATCH', url, headers=headers, json=payload)
response.json()
В ответе может возвращаться:
success
признак успешно выполненного запроса
message
сообщение об ошибке
Внешний номер успешно обновлён:
{
"success": true
}
POST
api/v1/number/external/follow
Метод позволяет установить переадресацию внешнего номера на сторонний телефонный номер.
Body
number_type
string"ate"
— тип «АТС», регистрация на SIP-сервере по логину и паролю
"sipuri"
— тип «SIP-URI», приём вызовов на выделенный адрес
number_id
integer
⁎ ИД внешнего номера, на котором устанавливается переадресация
type
string
⁎ код типа переадресации [ ? ]
type_default
string
[только для типов "bitrix"
, "amo"
и "retail"
] код типа переадресации [ ? ] по умолчанию (если маршрут не получен из CRM)
sip_id
integer
[только для типа "sip"
] ИД SIP-аккаунта [ ? ] , на который устанавливается переадресация
destination_number
string
[только для типа "number"
] телефонный номер, на который устанавливается переадресация
group_id
integer
[только для типа "group"
] ИД группы [ ? ] , на которую устанавливается переадресация
scenario_id
integer
[только для типа "scenario"
] ИД сценария [ ? ] , на который устанавливается переадресация
call_queue_id
integer
[только для типа "call_queue"
] ИД очереди вызовов [ ? ] , на которую устанавливается переадресация
destination_uri
integer
[только для типа "sip_uri"
] адрес SIP URI, на который устанавливается переадресация
host
Хост
[только для типов "bitrix"
, "amo"
и "retail"
] адрес хоста интеграции (CRM-системы)
cli_type
string
⁎ [для всех типов, кроме "empty"
] код типа показа АОНа [ ? ] при переадресации
"Y"
— отображать в АОНе номер звонящего
"N"
— отображать в АОНе переадресующий номер (не работает при переадресации на сторонние номера)
cli_type_default
string"bitrix"
, "amo"
и "retail"
] код типа показа АОНа [ ? ] при переадресации"Y"
— отображать в АОНе номер звонящего
"N"
— отображать в АОНе переадресующий номер (не работает при переадресации на сторонние номера)
curl -X POST \
"https://restapi.plusofon.ru/api/v1/number/external/follow" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"number_type":"ate","number_id":17,"type":"sip","type_default":"sip","sip_id":4,"destination_number":"79993332210","group_id":9,"scenario_id":18,"call_queue_id":14,"destination_uri":"123456789@ext.plusofon.ru","host":"plusofon.bitrix24.ru","cli_type":"Y","cli_type_default":"Y"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/number/external/follow"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"number_type": "ate",
"number_id": 17,
"type": "sip",
"type_default": "sip",
"sip_id": 4,
"destination_number": "79993332210",
"group_id": 9,
"scenario_id": 18,
"call_queue_id": 14,
"destination_uri": "123456789@ext.plusofon.ru",
"host": "plusofon.bitrix24.ru",
"cli_type": "Y",
"cli_type_default": "Y"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://restapi.plusofon.ru/api/v1/number/external/follow',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'number_type' => 'ate',
'number_id' => 17,
'type' => 'sip',
'type_default' => 'sip',
'sip_id' => 4,
'destination_number' => '79993332210',
'group_id' => 9,
'scenario_id' => 18,
'call_queue_id' => 14,
'destination_uri' => '123456789@ext.plusofon.ru',
'host' => 'plusofon.bitrix24.ru',
'cli_type' => 'Y',
'cli_type_default' => 'Y',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/number/external/follow'
payload = {
"number_type": "ate",
"number_id": 17,
"type": "sip",
"type_default": "sip",
"sip_id": 4,
"destination_number": "79993332210",
"group_id": 9,
"scenario_id": 18,
"call_queue_id": 14,
"destination_uri": "123456789@ext.plusofon.ru",
"host": "plusofon.bitrix24.ru",
"cli_type": "Y",
"cli_type_default": "Y"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
В ответе может возвращаться:
success
признак успешно выполненного запроса
message
сообщение об ошибке
Переадресация успешно установлена:
{
"success": true
}
DELETE
api/v1/number/external/{type}/{id}
Метод позволяет удалить подключение внешнего номера.
Path
type
stringate
— тип «АТС», регистрация на SIP-сервере по логину и паролю
sipuri
— тип «SIP-URI», приём вызовов на выделенный адрес
id
stringcurl -X DELETE \
"https://restapi.plusofon.ru/api/v1/number/external/ate/1" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}"
const url = new URL(
"https://restapi.plusofon.ru/api/v1/number/external/ate/1"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://restapi.plusofon.ru/api/v1/number/external/ate/1',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/number/external/ate/1'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
В ответе может возвращаться:
success
признак успешно выполненного запроса
message
сообщение об ошибке
Внешний номер успешно удалён:
{
"success": true
}