mirror of
https://github.com/jambonz/jambonz-node.git
synced 2026-01-25 02:08:15 +00:00
remove call_sid from sendCommand
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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':
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user