diff --git a/lib/http-routes/api/create-call.js b/lib/http-routes/api/create-call.js index b1be271a..8ffb132f 100644 --- a/lib/http-routes/api/create-call.js +++ b/lib/http-routes/api/create-call.js @@ -57,6 +57,11 @@ router.post('/', async(req, res) => { case 'user': uri = `sip:${target.name}`; to = target.name; + if (this.target.overrideTo) { + Object.assign(opts.headers, { + 'X-Override-To': this.target.overrideTo + }); + } break; case 'sip': uri = target.sipUri; @@ -105,7 +110,7 @@ router.post('/', async(req, res) => { /* now launch the outdial */ try { - const dlg = await srf.createUAC(uri, opts, { + const dlg = await srf.createUAC(uri, {...opts, followRedirects: true, keepUriOnRedirect: true}, { cbRequest: (err, inviteReq) => { if (err) { logger.error(err, 'createCall Error creating call'); diff --git a/lib/utils/place-outdial.js b/lib/utils/place-outdial.js index fd8f8e9f..93939536 100644 --- a/lib/utils/place-outdial.js +++ b/lib/utils/place-outdial.js @@ -85,6 +85,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) {