From 53395f11274265b4173f08cbf63d1ad41f0a6ef1 Mon Sep 17 00:00:00 2001 From: qyunal Date: Tue, 15 Oct 2019 18:12:55 +0530 Subject: [PATCH 1/4] adds support for getInput --- lib/utils/plivoxml.js | 40 +++++++++++++++++++++++++++++++++++++++- test/xml.js | 1 + 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/lib/utils/plivoxml.js b/lib/utils/plivoxml.js index 94f5266..af4c522 100644 --- a/lib/utils/plivoxml.js +++ b/lib/utils/plivoxml.js @@ -11,7 +11,7 @@ export class PlivoXMLError extends Error { } */ export function Response() { this.element = 'Response'; - this.nestables = ['Speak', 'Play', 'GetDigits', 'Record', 'Dial', 'Message', + this.nestables = ['Speak', 'Play', 'GetDigits', 'GetInput', 'Record', 'Dial', 'Message', 'Redirect', 'Wait', 'Hangup', 'PreAnswer', 'Conference', 'DTMF']; this.valid_attributes = []; this.elem = xmlBuilder.begin().ele(this.element); @@ -162,6 +162,30 @@ Response.prototype = { return this.add(new GetDigits(Response), '', attributes); }, + /** + * Add a GetInput element + * @method + * @param {object} attributes + * @param {string} [attributes.action] + * @param {string} [attributes.method] + * @param {string} [attributes.inputType] + * @param {number} [attributes.executionTimeout] + * @param {number} [attributes.digitEndTimeout] + * @param {number} [attributes.speechEndTimeout] + * @param {string} [attributes.finishOnKey] + * @param {number} [attributes.numDigits] + * @param {string} [attributes.speechModel] + * @param {string} [attributes.hints] + * @param {string} [attributes.language] + * @param {string} [attributes.interimSpeechResultsCallback] + * @param {string} [attributes.interimSpeechResultsCallbackMethod] + * @param {boolean} [attributes.log] + * @param {boolean} [attributes.redirect] + */ + addGetInput: function (attributes) { + return this.add(new GetInput(Response), '', attributes); + }, + /** * Add a Hangup element * @method @@ -366,6 +390,20 @@ function GetDigits(Response) { } util.inherits(GetDigits, Response); +/** + * GetInput element + * @constructor + */ +function GetInput(Response) { + this.element = 'GetInput'; + this.valid_attributes = ['action', 'method', 'inputType', 'executionTimeout', + 'digitEndTimeout', 'speechEndTimeout', 'finishOnKey', 'numDigits', + 'speechModel', 'hints','language', 'interimSpeechResultsCallback', + 'interimSpeechResultsCallbackMethod', 'log', 'redirect']; + this.nestables = ['Speak', 'Play', 'Wait']; +} +util.inherits(GetInput, Response); + /** * Hangup element * @constructor diff --git a/test/xml.js b/test/xml.js index 9b935fd..6a1e451 100644 --- a/test/xml.js +++ b/test/xml.js @@ -14,6 +14,7 @@ describe('PlivoXML', function () { response.addConference('test'); response.addRedirect('url'); response.addGetDigits(); + response.addGetInput(); response.addPlay('url'); const dial = response.addDial(); dial.addNumber('123'); From 690998ca43be6093313816a92aedf48f1fd9f418 Mon Sep 17 00:00:00 2001 From: qyunal Date: Wed, 16 Oct 2019 02:23:26 +0530 Subject: [PATCH 2/4] fix tests --- test/xml.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/xml.js b/test/xml.js index 6a1e451..ca6068a 100644 --- a/test/xml.js +++ b/test/xml.js @@ -23,6 +23,6 @@ describe('PlivoXML', function () { src: '123', dst: '456', }); - assert.equal('text123testurlurl123sip:test@sip.plivo.com∫test', response.toXML()); + assert.equal('text123testurlurl123sip:test@sip.plivo.com∫test', response.toXML()); }); }); From 49bfb987c18af9861ede88ec5565f6dc6163ff98 Mon Sep 17 00:00:00 2001 From: qyunal Date: Wed, 16 Oct 2019 17:06:08 +0530 Subject: [PATCH 3/4] adds profanityFilter --- lib/utils/plivoxml.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/utils/plivoxml.js b/lib/utils/plivoxml.js index af4c522..ec0b72f 100644 --- a/lib/utils/plivoxml.js +++ b/lib/utils/plivoxml.js @@ -181,6 +181,7 @@ Response.prototype = { * @param {string} [attributes.interimSpeechResultsCallbackMethod] * @param {boolean} [attributes.log] * @param {boolean} [attributes.redirect] + * @param {string} [attributes.profanityFilter] */ addGetInput: function (attributes) { return this.add(new GetInput(Response), '', attributes); @@ -399,7 +400,7 @@ function GetInput(Response) { this.valid_attributes = ['action', 'method', 'inputType', 'executionTimeout', 'digitEndTimeout', 'speechEndTimeout', 'finishOnKey', 'numDigits', 'speechModel', 'hints','language', 'interimSpeechResultsCallback', - 'interimSpeechResultsCallbackMethod', 'log', 'redirect']; + 'interimSpeechResultsCallbackMethod', 'log', 'redirect', 'profanityFilter']; this.nestables = ['Speak', 'Play', 'Wait']; } util.inherits(GetInput, Response); From bedaa3ef8b0558eddffad2ff2243591ae8c08f92 Mon Sep 17 00:00:00 2001 From: nixonsamuel Date: Wed, 13 Nov 2019 12:40:13 +0530 Subject: [PATCH 4/4] bump version to 4.1.5 --- CHANGELOG.md | 3 +++ package.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2e2b38..88c56aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## [4.1.5](https://github.com/plivo/plivo-node/releases/tag/v4.1.5)(2019-11-13) +- Add GetInput XML support + ## [4.1.4](https://github.com/plivo/plivo-node/releases/tag/v4.1.4)(2019-11-06) - Add SSML support diff --git a/package.json b/package.json index a2dfa66..5074efc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plivo", - "version": "4.1.4", + "version": "4.1.5", "description": "A Node.js SDK to make voice calls and send SMS using Plivo and to generate Plivo XML", "homepage": "https://github.com/plivo/plivo-node", "files": [