From ab0452879eaee988b00aa6f0ed4372edd56dc31c Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 9 Jun 2023 12:57:35 -0400 Subject: [PATCH] add X-Application-Sid in outdials so it ends up in cdr (#374) --- lib/http-routes/api/create-call.js | 1 + lib/tasks/dial.js | 2 +- lib/utils/place-outdial.js | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/http-routes/api/create-call.js b/lib/http-routes/api/create-call.js index d9a2f2b6..e8815dee 100644 --- a/lib/http-routes/api/create-call.js +++ b/lib/http-routes/api/create-call.js @@ -48,6 +48,7 @@ router.post('/', async(req, res) => { 'X-Jambonz-FS-UUID': srf.locals.fsUUID, 'X-Call-Sid': callSid, 'X-Account-Sid': accountSid, + ...(req.body?.application_sid && {'X-Application-Sid': req.body.application_sid}), ...(restDial.fromHost && {'X-Preferred-From-Host': restDial.fromHost}) }; diff --git a/lib/tasks/dial.js b/lib/tasks/dial.js index 5beb1c4f..6ceabdb9 100644 --- a/lib/tasks/dial.js +++ b/lib/tasks/dial.js @@ -668,7 +668,7 @@ class TaskDial extends Task { if (this.parentDtmfCollector) this._installDtmfDetection(cs, cs.dlg); if (this.childDtmfCollector) this._installDtmfDetection(cs, this.dlg); - if (this.transcribeTask) this.transcribeTask.exec(cs, {ep2: this.epOther, ep:this.ep}); + if (this.transcribeTask) this.transcribeTask.exec(cs, {ep: this.epOther, ep2:this.ep}); if (this.listenTask) this.listenTask.exec(cs, {ep: this.epOther}); if (this.startAmd) { try { diff --git a/lib/utils/place-outdial.js b/lib/utils/place-outdial.js index 1e695896..b119e3af 100644 --- a/lib/utils/place-outdial.js +++ b/lib/utils/place-outdial.js @@ -45,6 +45,10 @@ class SingleDialer extends Emitter { return this.callInfo.callStatus; } + get applicationSid() { + return this.application?.application_sid || this.callInfo?.applicationSid; + } + /** * can be used for all http requests within this session */