diff --git a/lib/middleware.js b/lib/middleware.js index 5f911c5f..6d5e91f5 100644 --- a/lib/middleware.js +++ b/lib/middleware.js @@ -138,7 +138,7 @@ module.exports = function(srf, logger) { if (0 === app.tasks.length) throw new Error('no application provided'); next(); } catch (err) { - logger.info(`Error retrieving or parsing application: ${err.message}`); + logger.info({err}, `Error retrieving or parsing application: ${err.message}`); res.send(480, {headers: {'X-Reason': err.message}}); } } diff --git a/lib/tasks/specs.json b/lib/tasks/specs.json index 597f4862..c2ee7b7a 100644 --- a/lib/tasks/specs.json +++ b/lib/tasks/specs.json @@ -237,7 +237,8 @@ "sipUri": "string", "auth": "#auth", "vmail": "boolean", - "tenant": "string" + "tenant": "string", + "overrideTo": "string" }, "required": [ "type" diff --git a/lib/utils/place-outdial.js b/lib/utils/place-outdial.js index 885ca58d..1551fdad 100644 --- a/lib/utils/place-outdial.js +++ b/lib/utils/place-outdial.js @@ -59,6 +59,7 @@ class SingleDialer extends Emitter { async exec(srf, ms, opts) { opts = opts || {}; + opts.headers = opts.headers || {}; let uri, to; try { switch (this.target.type) { @@ -69,7 +70,6 @@ class SingleDialer extends Emitter { to = this.target.number; if ('teams' === this.target.type) { assert(this.target.teamsInfo); - opts.headers = opts.headers || {}; Object.assign(opts.headers, { 'X-MS-Teams-FQDN': this.target.teamsInfo.ms_teams_fqdn, 'X-MS-Teams-Tenant-FQDN': this.target.teamsInfo.tenant_fqdn @@ -83,6 +83,12 @@ class SingleDialer extends Emitter { uri = `sip:${this.target.name}`; to = this.target.name; + if (this.target.overrideTo) { + Object.assign(opts.headers, { + 'X-Override-To': this.target.overrideTo + }); + } + // need to send to the SBC registered on const reg = await registrar.query(aor); if (reg) {