user retriction (#254)

* user retriction

* wip

* wip

* wip
This commit is contained in:
Hoan Luu Huu
2023-11-09 00:40:28 +07:00
committed by GitHub
parent e6168d0a3c
commit 43344ae14b
5 changed files with 25 additions and 10 deletions

View File

@@ -163,7 +163,7 @@ router.get('/:sid/RegisteredSipUsers', async(req, res) => {
});
router.get('/:sid/RegisteredSipUsers/:client', async(req, res) => {
const {logger, registrar} = req.app.locals;
const {logger, registrar, lookupClientByAccountAndUsername} = req.app.locals;
const client = req.params.client;
try {
const account_sid = parseAccountSid(req);
@@ -173,11 +173,15 @@ router.get('/:sid/RegisteredSipUsers/:client', async(req, res) => {
throw new DbErrorBadRequest(`account not found for sid ${account_sid}`);
}
const user = await registrar.query(`${client}@${result[0].sip_realm}`);
const [clientDb] = await lookupClientByAccountAndUsername(account_sid, client);
res.status(200).json({
name: client,
contact: user ? user.contact : null,
expiryTime: user ? user.expiryTime : 0,
protocol: user ? user.protocol : null,
allow_direct_app_calling: clientDb ? clientDb.allow_direct_app_calling : 0,
allow_direct_queue_calling: clientDb ? clientDb.allow_direct_queue_calling : 0,
allow_direct_user_calling: clientDb ? clientDb.allow_direct_user_calling : 0,
registered_status: user ? 'active' : 'inactive'
});
} catch (err) {

View File

@@ -5867,6 +5867,15 @@ components:
protocol:
type: string
example: wss
allow_direct_app_calling:
type: number
example: 1
allow_direct_queue_calling:
type: number
example: 1
allow_direct_user_calling:
type: number
example: 1
registered_status:
type: string
enum: