diff --git a/lib/tasks/sip_refer.js b/lib/tasks/sip_refer.js index 3b307517..6a31b57a 100644 --- a/lib/tasks/sip_refer.js +++ b/lib/tasks/sip_refer.js @@ -12,6 +12,7 @@ class TaskSipRefer extends Task { this.referTo = this.data.referTo; this.referredBy = this.data.referredBy; + this.referredByDisplayName = this.data.referredByDisplayName; this.headers = this.data.headers || {}; this.eventHook = this.data.eventHook; } @@ -105,7 +106,7 @@ class TaskSipRefer extends Task { } _normalizeReferHeaders(cs, dlg) { - let {referTo, referredBy} = this; + let {referTo, referredBy, referredByDisplayName} = this; /* get IP address of the SBC to use as hostname if needed */ const {host} = parseUri(dlg.remote.uri); @@ -120,9 +121,12 @@ class TaskSipRefer extends Task { referredBy = cs.req?.callingNumber || dlg.local.uri; this.logger.info({referredBy}, 'setting referredby'); } + if (!referredByDisplayName) { + referredByDisplayName = cs.req?.callingName; + } if (!referredBy.startsWith('<') && !referredBy.startsWith('sip') && !referredBy.startsWith('"')) { /* they may have only provided a phone number/user */ - referredBy = `sip:${referredBy}@${host}`; + referredBy = `${referredByDisplayName ? `"${referredByDisplayName}"` : ''}`; } return {referTo, referredBy}; } diff --git a/package-lock.json b/package-lock.json index 1b561e71..1a26a3e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@jambonz/speech-utils": "^0.1.22", "@jambonz/stats-collector": "^0.1.10", "@jambonz/time-series": "^0.2.12", - "@jambonz/verb-specifications": "^0.0.86", + "@jambonz/verb-specifications": "^0.0.90", "@opentelemetry/api": "^1.8.0", "@opentelemetry/exporter-jaeger": "^1.23.0", "@opentelemetry/exporter-trace-otlp-http": "^0.50.0", @@ -1582,9 +1582,10 @@ } }, "node_modules/@jambonz/verb-specifications": { - "version": "0.0.86", - "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.86.tgz", - "integrity": "sha512-nTMMeFJtkSIVD3icQajOKv+zFBiAaUNuky2htVgYKipE2AIq/H/SsdurYdBij3KQq1o58/FuUuXcqCwjnZnoUg==", + "version": "0.0.90", + "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.90.tgz", + "integrity": "sha512-ix2XByDTSroWlEMMY26ba2mbON4Yh3911Agm44GeV3ygmJMGABwCv28KqItOVBW0Ro5uSM+cQ0vEacPVnmAldA==", + "license": "MIT", "dependencies": { "debug": "^4.3.4", "pino": "^8.8.0" @@ -10753,9 +10754,9 @@ } }, "@jambonz/verb-specifications": { - "version": "0.0.86", - "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.86.tgz", - "integrity": "sha512-nTMMeFJtkSIVD3icQajOKv+zFBiAaUNuky2htVgYKipE2AIq/H/SsdurYdBij3KQq1o58/FuUuXcqCwjnZnoUg==", + "version": "0.0.90", + "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.90.tgz", + "integrity": "sha512-ix2XByDTSroWlEMMY26ba2mbON4Yh3911Agm44GeV3ygmJMGABwCv28KqItOVBW0Ro5uSM+cQ0vEacPVnmAldA==", "requires": { "debug": "^4.3.4", "pino": "^8.8.0" diff --git a/package.json b/package.json index e619b269..485dcc4d 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@jambonz/speech-utils": "^0.1.22", "@jambonz/stats-collector": "^0.1.10", "@jambonz/time-series": "^0.2.12", - "@jambonz/verb-specifications": "^0.0.86", + "@jambonz/verb-specifications": "^0.0.90", "@opentelemetry/api": "^1.8.0", "@opentelemetry/exporter-jaeger": "^1.23.0", "@opentelemetry/exporter-trace-otlp-http": "^0.50.0",