remove call_sid from sendCommand

This commit is contained in:
Dave Horton committed 2022-02-21 18:12:17 -05:00
1 parent db7fb5880d
commit 5cbdddffc9
3 files changed
+4 -6

No files matched your search

+1 -3
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; 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, assert.ok(typeof payload === 'object' && Object.keys(payload).length > 0,
'invalid or missing payload'); 'invalid or missing payload');
//TODO: validate command //TODO: validate command
@@ -29,7 +28,6 @@ module.exports = (ws, {logger, req}) => {
const msg = { const msg = {
type: 'command', type: 'command',
command, command,
call_sid,
data: payload data: payload
}; };
try { try {
+2 -2
View File
@@ -41,7 +41,7 @@ class WsSession extends Emitter {
return; return;
} }
try { 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(type, 'missing type property');
assert.ok(msgid, 'missing msgid property'); assert.ok(msgid, 'missing msgid property');
if (!this._initialMsgRecvd) { if (!this._initialMsgRecvd) {
@@ -52,7 +52,7 @@ class WsSession extends Emitter {
this.ws.close(); 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) { switch (type) {
case 'session:new': case 'session:new':
case 'session:reconnect': case 'session:reconnect':
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@jambonz/node-client", "name": "@jambonz/node-client",
"version": "0.3.3", "version": "0.3.4",
"description": "Node.js client for building jambonz applications (jambonz.org)", "description": "Node.js client for building jambonz applications (jambonz.org)",
"main": "lib/index.js", "main": "lib/index.js",
"scripts": { "scripts": {