bugfix: sip_refer sending body

This commit is contained in:
Dave Horton
2022-03-10 06:45:27 -05:00
parent 7188648d3b
commit 15d784a4b0

View File

@@ -584,7 +584,7 @@ class CallSession extends Emitter {
task.doConferenceMuteNonModerators(this, opts); task.doConferenceMuteNonModerators(this, opts);
} }
async _lccSipRequest(opts) { async _lccSipRequest(opts, callSid) {
const {sip_request} = opts; const {sip_request} = opts;
const {method, content_type, content, headers = {}} = sip_request; const {method, content_type, content, headers = {}} = sip_request;
if (!this.hasStableDialog) { if (!this.hasStableDialog) {
@@ -592,13 +592,14 @@ class CallSession extends Emitter {
return; return;
} }
try { try {
const res = await this.dlg.request({ const dlg = callSid === this.callSid ? this.dlg : this.currentTask.dlg;
const res = await dlg.request({
method, method,
headers: { headers: {
...headers, ...headers,
'Content-Type': content_type, 'Content-Type': content_type
'Content': content },
} body: content
}); });
this.logger.debug({res}, `CallSession:_lccSipRequest got response to ${method}`); this.logger.debug({res}, `CallSession:_lccSipRequest got response to ${method}`);
return res; return res;
@@ -683,7 +684,7 @@ class CallSession extends Emitter {
await this._lccConfMuteStatus(opts); await this._lccConfMuteStatus(opts);
} }
else if (opts.sip_request) { else if (opts.sip_request) {
const res = await this._lccSipRequest(opts); const res = await this._lccSipRequest(opts, callSid);
return {status: res.status, reason: res.reason}; return {status: res.status, reason: res.reason};
} }
@@ -770,7 +771,7 @@ class CallSession extends Emitter {
break; break;
case 'sip:request': case 'sip:request':
this._lccSipRequest(data) this._lccSipRequest(data, this.callSid)
.catch((err) => { .catch((err) => {
this.logger.info({err, data}, `CallSession:_onCommand - error sending ${data.method}`); this.logger.info({err, data}, `CallSession:_onCommand - error sending ${data.method}`);
}); });