mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
allow dial to user without supplying sip_realm (will default to that configured for the caller account)
This commit is contained in:
@@ -246,9 +246,10 @@ class TaskDial extends Task {
|
||||
async _attemptCalls(cs) {
|
||||
const {req, srf} = cs;
|
||||
const {getSBC} = srf.locals;
|
||||
const {lookupTeamsByAccount} = srf.locals.dbHelpers;
|
||||
const {lookupTeamsByAccount, lookupAccountBySid} = srf.locals.dbHelpers;
|
||||
const sbcAddress = this.proxy || getSBC();
|
||||
const teamsInfo = {};
|
||||
let fqdn;
|
||||
|
||||
if (!sbcAddress) throw new Error('no SBC found for outbound call');
|
||||
const opts = {
|
||||
@@ -270,11 +271,23 @@ class TaskDial extends Task {
|
||||
this._killOutdials();
|
||||
}, this.timeout * 1000);
|
||||
|
||||
this.target.forEach((t) => {
|
||||
this.target.forEach(async(t) => {
|
||||
try {
|
||||
t.url = t.url || this.confirmUrl;
|
||||
t.method = t.method || this.confirmMethod || 'POST';
|
||||
if (t.type === 'teams') t.teamsInfo = teamsInfo;
|
||||
if (t.type === 'user' && !t.name.includes('@') && !fqdn) {
|
||||
const user = t.name;
|
||||
try {
|
||||
const {sip_realm} = await lookupAccountBySid(cs.accountSid);
|
||||
if (sip_realm) {
|
||||
t.name = `${user}@${sip_realm}`;
|
||||
this.logger.debug(`appending sip realm ${sip_realm} to dial target user ${user}`);
|
||||
}
|
||||
} catch (err) {
|
||||
this.logger.error({err}, 'Error looking up account by sid');
|
||||
}
|
||||
}
|
||||
const sd = placeCall({
|
||||
logger: this.logger,
|
||||
application: cs.application,
|
||||
|
||||
Reference in New Issue
Block a user