feat siprec custom header (#400)

* feat siprec custom header

* wip

* update verb specification

* add newline to info siprec body

* add newline to info siprec body
This commit is contained in:
Hoan Luu Huu
2023-07-20 20:10:41 +07:00
committed by GitHub
parent 66305b5aea
commit 7b11a56a53
3 changed files with 15 additions and 12 deletions

View File

@@ -423,7 +423,10 @@ class CallSession extends Emitter {
'X-Call-Sid': this.callSid,
'X-Account-Sid': this.accountSid,
'X-Application-Sid': this.applicationSid,
}
...(this.recordOptions.headers && {'Content-Type': 'application/json'})
},
// Siprect Client is initiated from startCallRecording, so just need to pass custom headers in startRecording
...(this.recordOptions.headers && {body: JSON.stringify(this.recordOptions.headers) + '\n'})
});
if (res.status === 200) {
this._recordState = RecordState.RecordingOn;
@@ -444,7 +447,7 @@ class CallSession extends Emitter {
const res = await this.dlg.request({
method: 'INFO',
headers: {
'X-Reason': 'stopCallRecording',
'X-Reason': 'stopCallRecording'
}
});
if (res.status === 200) {
@@ -466,7 +469,7 @@ class CallSession extends Emitter {
const res = await this.dlg.request({
method: 'INFO',
headers: {
'X-Reason': 'pauseCallRecording',
'X-Reason': 'pauseCallRecording'
}
});
if (res.status === 200) {
@@ -488,7 +491,7 @@ class CallSession extends Emitter {
const res = await this.dlg.request({
method: 'INFO',
headers: {
'X-Reason': 'resumeCallRecording',
'X-Reason': 'resumeCallRecording'
}
});
if (res.status === 200) {

14
package-lock.json generated
View File

@@ -17,7 +17,7 @@
"@jambonz/speech-utils": "^0.0.17",
"@jambonz/stats-collector": "^0.1.8",
"@jambonz/time-series": "^0.2.8",
"@jambonz/verb-specifications": "^0.0.25",
"@jambonz/verb-specifications": "^0.0.26",
"@opentelemetry/api": "^1.4.0",
"@opentelemetry/exporter-jaeger": "^1.9.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.35.0",
@@ -3019,9 +3019,9 @@
}
},
"node_modules/@jambonz/verb-specifications": {
"version": "0.0.25",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.25.tgz",
"integrity": "sha512-Dq8bS9hNCWGm7CbSaAwMv3YzG6PI1tk3lOj0bFIF74FiLq/cIHtm4KsUwUMQPgJhED8Lbi0v3q63L98737ndbg==",
"version": "0.0.26",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.26.tgz",
"integrity": "sha512-C/2KpX7dLPrEOFbcpyjJ3FkR8EEp+QbNmJoWbCcfYoZEyLiOcawWVwPRvz8hNPVa/Hf2Scth9OvjKeGuny33gQ==",
"dependencies": {
"debug": "^4.3.4",
"pino": "^8.8.0"
@@ -12985,9 +12985,9 @@
}
},
"@jambonz/verb-specifications": {
"version": "0.0.25",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.25.tgz",
"integrity": "sha512-Dq8bS9hNCWGm7CbSaAwMv3YzG6PI1tk3lOj0bFIF74FiLq/cIHtm4KsUwUMQPgJhED8Lbi0v3q63L98737ndbg==",
"version": "0.0.26",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.26.tgz",
"integrity": "sha512-C/2KpX7dLPrEOFbcpyjJ3FkR8EEp+QbNmJoWbCcfYoZEyLiOcawWVwPRvz8hNPVa/Hf2Scth9OvjKeGuny33gQ==",
"requires": {
"debug": "^4.3.4",
"pino": "^8.8.0"

View File

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