mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-11-10 11:52:01 +00:00
feat get registered client status (#251)
This commit is contained in:
1 parent
72d2877ddf
commit
1e9f388f51
2 files changed
+71
-1
No files matched your search
@@ -145,6 +145,7 @@ router.post('/:sid/VoipCarriers', async(req, res) => {
|
|||||||
sysError(logger, res, err);
|
sysError(logger, res, err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/:sid/RegisteredSipUsers', async(req, res) => {
|
router.get('/:sid/RegisteredSipUsers', async(req, res) => {
|
||||||
const {logger, registrar} = req.app.locals;
|
const {logger, registrar} = req.app.locals;
|
||||||
try {
|
try {
|
||||||
@@ -161,6 +162,29 @@ router.get('/:sid/RegisteredSipUsers', async(req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.get('/:sid/RegisteredSipUsers/:client', async(req, res) => {
|
||||||
|
const {logger, registrar} = req.app.locals;
|
||||||
|
const client = req.params.client;
|
||||||
|
try {
|
||||||
|
const account_sid = parseAccountSid(req);
|
||||||
|
await validateRequest(req, account_sid);
|
||||||
|
const result = await Account.retrieve(account_sid);
|
||||||
|
if (!result || result.length === 0) {
|
||||||
|
throw new DbErrorBadRequest(`account not found for sid ${account_sid}`);
|
||||||
|
}
|
||||||
|
const user = await registrar.query(`${client}@${result[0].sip_realm}`);
|
||||||
|
res.status(200).json({
|
||||||
|
name: client,
|
||||||
|
contact: user ? user.contact : null,
|
||||||
|
expiryTime: user ? user.expiryTime : 0,
|
||||||
|
protocol: user ? user.protocol : null,
|
||||||
|
registered_status: user ? 'active' : 'inactive'
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
sysError(logger, res, err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function coerceNumbers(callInfo) {
|
function coerceNumbers(callInfo) {
|
||||||
if (Array.isArray(callInfo)) {
|
if (Array.isArray(callInfo)) {
|
||||||
return callInfo.map((ci) => {
|
return callInfo.map((ci) => {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ tags:
|
|||||||
description: Least Cost Routing Routes operations
|
description: Least Cost Routing Routes operations
|
||||||
- name: LcrCarrierSetEntries
|
- name: LcrCarrierSetEntries
|
||||||
description: Least Cost Routing Carrier Set Entries operation
|
description: Least Cost Routing Carrier Set Entries operation
|
||||||
- name: GoogleCustomVOices
|
- name: GoogleCustomVoices
|
||||||
description: Google Custom voices operation
|
description: Google Custom voices operation
|
||||||
paths:
|
paths:
|
||||||
/BetaInviteCodes:
|
/BetaInviteCodes:
|
||||||
@@ -4188,6 +4188,27 @@ paths:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
|
/Accounts/{AccountSid}/RegisteredSipUsers/{Client}:
|
||||||
|
parameters:
|
||||||
|
- name: Client
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
style: simple
|
||||||
|
explode: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Accounts
|
||||||
|
summary: retrieve registered client registration
|
||||||
|
operationId: getRegisteredClient
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: registered client found
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/RegisteredClient'
|
||||||
/Lcrs:
|
/Lcrs:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@@ -5772,6 +5793,31 @@ components:
|
|||||||
- name
|
- name
|
||||||
- reported_usage
|
- reported_usage
|
||||||
- model
|
- model
|
||||||
|
RegisteredClient:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
example: xhoaluu
|
||||||
|
contact:
|
||||||
|
type: string
|
||||||
|
example: sip:0dluqjt6@od41sl9jfc9m.invalid;transport=ws
|
||||||
|
expiryTime:
|
||||||
|
type: number
|
||||||
|
example: 1698981449173
|
||||||
|
protocol:
|
||||||
|
type: string
|
||||||
|
example: wss
|
||||||
|
registered_status:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- active
|
||||||
|
- inactive
|
||||||
|
required:
|
||||||
|
- speech_credential_sid
|
||||||
|
- name
|
||||||
|
- reported_usage
|
||||||
|
- model
|
||||||
|
|
||||||
security:
|
security:
|
||||||
- bearerAuth: []
|
- bearerAuth: []
|
||||||
Reference in new issue
Block a user