mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-21 00:58:34 +00:00
fix device call prioritize call to registered client first
This commit is contained in:
@@ -190,16 +190,10 @@ module.exports = function(srf, logger) {
|
|||||||
const arr = /^(.*)@(.*)/.exec(req.locals.originatingUser);
|
const arr = /^(.*)@(.*)/.exec(req.locals.originatingUser);
|
||||||
if (arr) {
|
if (arr) {
|
||||||
const sipRealm = arr[2];
|
const sipRealm = arr[2];
|
||||||
logger.debug(`looking for device calling app for realm ${sipRealm}`);
|
|
||||||
app = await lookupAppByRealm(sipRealm);
|
|
||||||
if (app) {
|
|
||||||
logger.debug({app}, `retrieved device calling app for realm ${sipRealm}`);
|
|
||||||
} else {
|
|
||||||
const calledAor = `${req.calledNumber}@${sipRealm}`;
|
const calledAor = `${req.calledNumber}@${sipRealm}`;
|
||||||
const reg = await registrar.query(calledAor);
|
const reg = await registrar.query(calledAor);
|
||||||
if (reg) {
|
if (reg) {
|
||||||
logger.debug(`There is no device app found, called client is registered,
|
logger.debug(`called client ${calledAor} is registered, forwarding call to called client.`);
|
||||||
forwarding call to called client.`);
|
|
||||||
app = {
|
app = {
|
||||||
// Dummy hook to follow later feature server logic.
|
// Dummy hook to follow later feature server logic.
|
||||||
call_hook: {
|
call_hook: {
|
||||||
@@ -221,6 +215,11 @@ module.exports = function(srf, logger) {
|
|||||||
}]
|
}]
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
logger.debug(`looking for device calling app for realm ${sipRealm}`);
|
||||||
|
app = await lookupAppByRealm(sipRealm);
|
||||||
|
if (app) {
|
||||||
|
logger.debug({app}, `retrieved device calling app for realm ${sipRealm}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user