From b88e697d616671a8385148ed9b77d8b48afa2f5e Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Sat, 5 Mar 2022 12:06:46 -0500 Subject: [PATCH] add support for sip_request in updateCall --- lib/utils.js | 15 ++++++++++++++- package.json | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index e17017e..b41c19e 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -74,7 +74,16 @@ function validate(name, data) { * Validate the payload for an updateCall request */ const validateCallUpdate = (opts) => { - const {call_hook, child_call_hook, call_status, listen_status, mute_status, whisper, conf_hold_status} = opts; + const { + call_hook, + child_call_hook, + call_status, + listen_status, + mute_status, + whisper, + conf_hold_status, + sip_request + } = opts; assert.ok(call_hook || child_call_hook || call_status || listen_status || mute_status || whisper || conf_hold_status, `calls.update: invalid request ${JSON.stringify(opts)}`); @@ -90,6 +99,10 @@ const validateCallUpdate = (opts) => { if (whisper) assert.ok(whisper.verb, `invalid whisper: ${JSON.stringify(whisper)}, must be a 'play' or 'say' verb`); + + if (sip_request) assert.ok(sip_request.method, + `invalid sip_request: ${JSON.stringify(whisper)}, must include a 'method' property`); + }; /** diff --git a/package.json b/package.json index 7bba169..e919cad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jambonz/node-client", - "version": "0.3.10", + "version": "0.3.11", "description": "Node.js client for building jambonz applications (jambonz.org)", "main": "lib/index.js", "scripts": {