mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-21 17:17:58 +00:00
initial working version with ws api
This commit is contained in:
@@ -196,7 +196,7 @@ class WsRequestor extends BaseRequestor {
|
||||
|
||||
/* messages must be JSON format */
|
||||
try {
|
||||
const {type, msgid, command, call_sid, data} = JSON.parse(content);
|
||||
const {type, msgid, command, data} = JSON.parse(content);
|
||||
assert.ok(type, 'type property not supplied');
|
||||
|
||||
switch (type) {
|
||||
@@ -207,9 +207,8 @@ class WsRequestor extends BaseRequestor {
|
||||
|
||||
case 'command':
|
||||
assert.ok(command, 'command property not supplied');
|
||||
assert.ok(call_sid, 'call_sid property not supplied');
|
||||
assert.ok(data, 'data property not supplied');
|
||||
this._recvCommand(msgid, command, call_sid, data);
|
||||
this._recvCommand(msgid, command, data);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -232,8 +231,10 @@ class WsRequestor extends BaseRequestor {
|
||||
success && success(data);
|
||||
}
|
||||
|
||||
_recvCommand(msgid, command, call_sid, data) {
|
||||
// TODO: execute command
|
||||
_recvCommand(msgid, command, data) {
|
||||
// TODO: validate command
|
||||
this.logger.info({msgid, command, data}, 'received command');
|
||||
this.emit('command', {msgid, command, data});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user