Все коллекции
API и Webhooks
API
API Ringostat. Проверка доступности SIP-аккаунта
API Ringostat. Проверка доступности SIP-аккаунта
Katerina Tverdochleb avatar
Автор: Katerina Tverdochleb
Обновлено больше недели назад
  1. Проверка доступности SIP-аккаунта

Данный метод позволит определить какие sip-аккаунты активны. Возвращает массив c логинами sip-аккаунтов, которые в статусе "Online".

Описание параметров запроса

  • Адрес API-запроса: https://api.ringostat.net/sipstatus/online

  • API формат: json;

  • Метод: GET.

  • Auth-key: это электронный ключ для доступа к вашему проекту в Ringostat.

Пример для Node.js:

const https = require('https');
const config = {
host: 'api.ringostat.net',
path: '/sipstatus/online',
method: 'GET',
headers: {
'Auth-key': 'unique_auth_key_string'
}
};
const callback = response => {
let result = Buffer.alloc(0);
response.on('data', chunk => {
result = Buffer.concat([ result, chunk ]);
});
response.on('end', () => {
//handle response
});
};
const request = https.request(config, callback);
request.end();

Пример для Axios.js

axios({
url: 'https://api.ringostat.net/sipstatus/online',
method: 'GET',
headers: {
'Auth-key': 'unique_auth_key_string'
}
}).then(response => {
//handle response
}).catch(error => {
//handle error
})

Пример для cURL

curl "https://api.ringostat.net/sipstatus/online" \
-H "Auth-key: unique_auth_key_string"

Результат:

[ 
"supportrngst_manager1",
"supportrngst_manager2",
"supportrngst_manager3",
"supportrngst_manager4",
"supportrngst_manager5",
"supportrngst_manager6",
"supportrngst_manager7"
]

2. Проверка доступности SIP-аккаунта в Ringostat Smart Phone

Данный метод позволит определить какие sip-аккаунты активны в расширении Ringostat Smart Phone. Возвращает массив c логинами sip-аккаунтов, которые в статусе "Online".

Описание параметров запроса

  • Метод: GET.

  • Auth-key: это электронный ключ для доступа к вашему проекту в Ringostat.

  • project_id: Параметр project_id можно найти на любой странице личного кабинета в Url строке

    Пример для Node.js:


    const https = require('https');
    const config = {
    host: 'api.ringostat.net',
    path: '/sipstatus/online?project_id={your_project_id}&token={token}&withRspDoNotDisturbSips=false',
    method: 'GET',
    headers: {
    'Auth-key': 'unique_auth_key_string'
    }
    };
    const callback = response => {
    let result = Buffer.alloc(0);
    response.on('data', chunk => {
    result = Buffer.concat([ result, chunk ]);
    });
    response.on('end', () => {
    //handle response
    });
    };
    const request = https.request(config, callback);
    request.end();

    Пример для Axios.js

    axios({
    url: 'https://api.ringostat.net/sipstatus/online?project_id={your_project_id}&token={token}&withRspDoNotDisturbSips=false',
    method: 'GET',
    headers: {
    'Auth-key': 'unique_auth_key_string'
    }
    }).then(response => {
    //handle response
    }).catch(error => {
    //handle error
    })

    Пример для cURL

    curl "https://api.ringostat.net/sipstatus/online?project_id={your_project_id}&token={token}&withRspDoNotDisturbSips=false" \
    -H "Auth-key: unique_auth_key_string"

    Результат:

    [
    "supportrngst_manager1",
    "supportrngst_manager2",
    "supportrngst_manager3",
    "supportrngst_manager4",
    "supportrngst_manager5",
    "supportrngst_manager6",
    "supportrngst_manager7"
    ]

3. Проверка наличия активного звонка у SIP-аккаунта

Данный метод позволит определить какие sip-аккаунты не заняты. Возвращает массив логинов sip-аккаунтов проекта, которые в данный момент разговаривают.


Описание параметров запроса

  • Адрес API-запроса: https://api.ringostat.net/sipstatus/speaking

  • API формат: json;

  • Метод: GET.

  • Auth-key: это электронный ключ для доступа к вашему проекту в Ringostat.

Пример для Node.js:

const https = require('https');
const config = {
host: 'api.ringostat.net',
path: '/sipstatus/speaking',
method: 'GET',
headers: {
'Auth-key': 'unique_auth_key_string'
}
};
const callback = response => {
let result = Buffer.alloc(0);
response.on('data', chunk => {
result = Buffer.concat([ result, chunk ]);
});
response.on('end', () => {
//handle response
});
};
const request = https.request(config, callback);
request.end();

Пример для Axios.js

axios({
url: 'https://api.ringostat.net/sipstatus/speaking',
method: 'GET',
headers: {
'Content-Type': 'application/json; charset=utf-8',
'Auth-key': 'unique_auth_key_string'
}
}).then(response => {
//handle response
}).catch(error => {
//handle error
})

Пример для cURL

curl "https://api.ringostat.net/sipstatus/speaking" \
-H "Auth-key: unique_auth_key_string"

Результат:

[
"supportrngst_manager2",
"supportrngst_manager4",
"supportrngst_manager5",
"supportrngst_manager7"
]

Нашли ответ на свой вопрос?