feat: callerName to rest_dial and dial verb (#312)

* feat: callerName to rest_dial and dial verb

* update verb specification
This commit is contained in:
Hoan Luu Huu
2023-04-12 21:04:55 +07:00
committed by GitHub
parent 85ab75d8e3
commit fabf01f8b5
6 changed files with 15 additions and 9 deletions

View File

@@ -27,6 +27,7 @@ router.post('/', async(req, res) => {
const target = restDial.to;
const opts = {
callingNumber: restDial.from,
...(restDial.callerName && {callingName: restDial.callerName}),
headers: req.body.headers || {}
};

View File

@@ -85,6 +85,7 @@ class TaskDial extends Task {
this.earlyMedia = this.data.answerOnBridge === true;
this.callerId = this.data.callerId;
this.callerName = this.data.callerName;
this.dialMusic = this.data.dialMusic;
this.headers = this.data.headers || {};
this.method = this.data.method || 'POST';
@@ -415,7 +416,8 @@ class TaskDial extends Task {
const opts = {
headers: this.headers,
proxy: `sip:${sbcAddress}`,
callingNumber: this.callerId || req.callingNumber
callingNumber: this.callerId || req.callingNumber,
...(this.callerName && {callingName: this.callerName})
};
const t = this.target.find((t) => t.type === 'teams');

View File

@@ -11,6 +11,7 @@ class TaskRestDial extends Task {
super(logger, opts);
this.from = this.data.from;
this.callerName = this.data.callerName;
this.fromHost = this.data.fromHost;
this.to = this.data.to;
this.call_hook = this.data.call_hook;

14
package-lock.json generated
View File

@@ -15,7 +15,7 @@
"@jambonz/speech-utils": "^0.0.12",
"@jambonz/stats-collector": "^0.1.8",
"@jambonz/time-series": "^0.2.5",
"@jambonz/verb-specifications": "^0.0.12",
"@jambonz/verb-specifications": "^0.0.14",
"@opentelemetry/api": "^1.4.0",
"@opentelemetry/exporter-jaeger": "^1.9.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.35.0",
@@ -1664,9 +1664,9 @@
}
},
"node_modules/@jambonz/verb-specifications": {
"version": "0.0.12",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.12.tgz",
"integrity": "sha512-NU+9iVCqyn8GI/QG1gKhBb9h9poEIAxfydFdDOpXOXcT4nlwuT/RLM+6X2wJcysqcc2hA/4aPhk0lMnw0H6ejg==",
"version": "0.0.14",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.14.tgz",
"integrity": "sha512-yT7I8PmBgmt+GTCno4F5ryL4CQrgIVsE2YUfVjCMg09pjnrumdKVqArFXW8KZsNzbCKjhVTtQE60kJd6gWCQfg==",
"dependencies": {
"debug": "^4.3.4",
"pino": "^8.8.0"
@@ -10011,9 +10011,9 @@
}
},
"@jambonz/verb-specifications": {
"version": "0.0.12",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.12.tgz",
"integrity": "sha512-NU+9iVCqyn8GI/QG1gKhBb9h9poEIAxfydFdDOpXOXcT4nlwuT/RLM+6X2wJcysqcc2hA/4aPhk0lMnw0H6ejg==",
"version": "0.0.14",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.14.tgz",
"integrity": "sha512-yT7I8PmBgmt+GTCno4F5ryL4CQrgIVsE2YUfVjCMg09pjnrumdKVqArFXW8KZsNzbCKjhVTtQE60kJd6gWCQfg==",
"requires": {
"debug": "^4.3.4",
"pino": "^8.8.0"

View File

@@ -31,7 +31,7 @@
"@jambonz/speech-utils": "^0.0.12",
"@jambonz/stats-collector": "^0.1.8",
"@jambonz/time-series": "^0.2.5",
"@jambonz/verb-specifications": "^0.0.12",
"@jambonz/verb-specifications": "^0.0.14",
"@opentelemetry/api": "^1.4.0",
"@opentelemetry/exporter-jaeger": "^1.9.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.35.0",

View File

@@ -31,6 +31,7 @@ test('\'dial-phone\'', async(t) => {
{
"verb": "dial",
"callerId": from,
"callerName": "test_callerName",
"actionHook": "/actionHook",
"timeLimit": 5,
"target": [
@@ -56,6 +57,7 @@ test('\'dial-phone\'', async(t) => {
"method": "POST",
},
"from": from,
"callerName": "Tom",
"to": {
"type": "phone",
"number": "15583084808"