From 40c3dcd75921c14e50be6375c27c4dbc3baf4de1 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 14 Feb 2020 13:23:14 -0500 Subject: [PATCH] pass application sid in custom header if provided during authentication --- lib/call-session.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/call-session.js b/lib/call-session.js index 6c67110..bc5b217 100644 --- a/lib/call-session.js +++ b/lib/call-session.js @@ -57,6 +57,11 @@ class CallSession extends Emitter { if (this.req.locals.application_sid) { Object.assign(headers, {'X-Application-Sid': this.req.locals.application_sid}); } + else if (this.req.authorization && + this.req.authorization.grant && + this.req.authorization.grant.application_sid) { + Object.assign(headers, {'X-Application-Sid': this.req.authorization.grant.application_sid}); + } debug(`sending INVITE to ${proxy} with ${uri}`); const {uas, uac} = await this.srf.createB2BUA(this.req, this.res, uri, {