ws command can have call_id

This commit is contained in:
Dave Horton
2022-03-10 10:52:48 -05:00
parent 15d784a4b0
commit 8c5cdd374b
2 changed files with 9 additions and 9 deletions

View File

@@ -726,7 +726,7 @@ class CallSession extends Emitter {
this.taskIdx = 0;
}
_onCommand({msgid, command, queueCommand, data}) {
_onCommand({msgid, command, call_sid, queueCommand, data}) {
this.logger.info({msgid, command, queueCommand}, 'CallSession:_onCommand - received command');
switch (command) {
case 'redirect':
@@ -751,7 +751,7 @@ class CallSession extends Emitter {
break;
case 'mute:status':
this._lccMuteStatus(this.callSid, data);
this._lccMuteStatus(call_sid, data);
break;
case 'conf:mute-status':
@@ -767,11 +767,11 @@ class CallSession extends Emitter {
break;
case 'whisper':
this._lccWhisper(data, this.callSid);
this._lccWhisper(data, call_sid);
break;
case 'sip:request':
this._lccSipRequest(data, this.callSid)
this._lccSipRequest(data, call_sid)
.catch((err) => {
this.logger.info({err, data}, `CallSession:_onCommand - error sending ${data.method}`);
});

View File

@@ -229,7 +229,7 @@ class WsRequestor extends BaseRequestor {
/* messages must be JSON format */
try {
const obj = JSON.parse(content);
const {type, msgid, command, queueCommand = false, data} = obj;
const {type, msgid, command, call_sid = this.call_sid, queueCommand = false, data} = obj;
this.logger.debug({obj}, 'WsRequestor:request websocket: received');
assert.ok(type, 'type property not supplied');
@@ -243,7 +243,7 @@ class WsRequestor extends BaseRequestor {
case 'command':
assert.ok(command, 'command property not supplied');
assert.ok(data, 'data property not supplied');
this._recvCommand(msgid, command, queueCommand, data);
this._recvCommand(msgid, command, call_sid, queueCommand, data);
break;
default:
@@ -266,10 +266,10 @@ class WsRequestor extends BaseRequestor {
success && success(data);
}
_recvCommand(msgid, command, queueCommand, data) {
_recvCommand(msgid, command, call_sid, queueCommand, data) {
// TODO: validate command
this.logger.info({msgid, command, queueCommand, data}, 'received command');
this.emit('command', {msgid, command, queueCommand, data});
this.logger.info({msgid, command, call_sid, queueCommand, data}, 'received command');
this.emit('command', {msgid, command, call_sid, queueCommand, data});
}
}