feature: specify user or host part of From uri on outdial

This commit is contained in:
Dave Horton
2022-10-23 15:24:30 -04:00
parent dc378cd065
commit e0607b9c2e
4 changed files with 1056 additions and 330 deletions

View File

@@ -387,6 +387,7 @@
"enum": ["GET", "POST"]
},
"headers": "object",
"from": "#dialFrom",
"name": "string",
"number": "string",
"sipUri": "string",
@@ -400,6 +401,14 @@
"type"
]
},
"dialFrom": {
"properties": {
"user": "string",
"host": "string"
},
"required": [
]
},
"auth": {
"properties": {
"username": "string",

View File

@@ -21,6 +21,7 @@ class SingleDialer extends Emitter {
this.logger = logger;
this.target = target;
this.from = target.from || {};
this.sbcAddress = sbcAddress;
this.opts = opts;
this.application = application;
@@ -66,6 +67,8 @@ class SingleDialer extends Emitter {
opts.headers = {
...opts.headers,
...(this.target.headers || {}),
...(this.from.user && {'X-Preferred-From-User': this.from.user}),
...(this.from.host && {'X-Preferred-From-Host': this.from.host}),
'X-Jambonz-Routing': this.target.type,
'X-Call-Sid': this.callSid,
...(this.applicationSid && {'X-Application-Sid': this.applicationSid})