remove call_sid from sendCommand

This commit is contained in:
Dave Horton
2022-02-21 18:12:17 -05:00
parent db7fb5880d
commit 5cbdddffc9
3 changed files with 4 additions and 6 deletions

View File

@@ -19,9 +19,8 @@ module.exports = (ws, {logger, req}) => {
}
};
ws.sendCommand = (command, call_sid, payload) => {
ws.sendCommand = (command, payload) => {
payload = payload instanceof WebhookResponse ? payload.toJSON() : payload;
assert.ok(typeof call_sid === 'string', 'invalid or missing call_sid');
assert.ok(typeof payload === 'object' && Object.keys(payload).length > 0,
'invalid or missing payload');
//TODO: validate command
@@ -29,7 +28,6 @@ module.exports = (ws, {logger, req}) => {
const msg = {
type: 'command',
command,
call_sid,
data: payload
};
try {

View File

@@ -41,7 +41,7 @@ class WsSession extends Emitter {
return;
}
try {
const {type, msgid, call_sid, hook, data:payload = {}} = JSON.parse(data);
const {type, msgid, hook, data:payload = {}} = JSON.parse(data);
assert.ok(type, 'missing type property');
assert.ok(msgid, 'missing msgid property');
if (!this._initialMsgRecvd) {
@@ -52,7 +52,7 @@ class WsSession extends Emitter {
this.ws.close();
}
}
this.logger.debug({type, msgid, call_sid, payload}, 'Received message from jambonz');
this.logger.debug({type, msgid, payload}, 'Received message from jambonz');
switch (type) {
case 'session:new':
case 'session:reconnect':

View File

@@ -1,6 +1,6 @@
{
"name": "@jambonz/node-client",
"version": "0.3.3",
"version": "0.3.4",
"description": "Node.js client for building jambonz applications (jambonz.org)",
"main": "lib/index.js",
"scripts": {