From 63e9cb985e96eebe035a0b21d3cd02e2d9b3a24d Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Thu, 10 Feb 2022 14:34:21 -0500 Subject: [PATCH] allow target-level headers on outdials (#29) --- lib/tasks/specs.json | 1 + lib/utils/place-outdial.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/tasks/specs.json b/lib/tasks/specs.json index 9204711c..76171ca2 100644 --- a/lib/tasks/specs.json +++ b/lib/tasks/specs.json @@ -338,6 +338,7 @@ "type": "string", "enum": ["GET", "POST"] }, + "headers": "object", "name": "string", "number": "string", "sipUri": "string", diff --git a/lib/utils/place-outdial.js b/lib/utils/place-outdial.js index c6ddc3a2..d2e1062d 100644 --- a/lib/utils/place-outdial.js +++ b/lib/utils/place-outdial.js @@ -60,10 +60,16 @@ class SingleDialer extends Emitter { opts.headers = opts.headers || {}; opts.headers = { ...opts.headers, + ...(this.target.headers || {}), 'X-Jambonz-Routing': this.target.type, - 'X-Jambonz-FS-UUID': srf.locals.fsUUID, 'X-Call-Sid': this.callSid }; + if (srf.locals.fsUUID) { + opts.headers = { + ...opts.headers, + 'X-Jambonz-FS-UUID': srf.locals.fsUUID, + }; + } this.ms = ms; let uri, to; try {