diff --git a/CHANGELOG.md b/CHANGELOG.md index a2e2b38a..88c56aa9 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/lib/utils/plivoxml.js b/lib/utils/plivoxml.js index 0e3a818e..79ec7861 100644 --- a/lib/utils/plivoxml.js +++ b/lib/utils/plivoxml.js @@ -13,7 +13,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); @@ -164,6 +164,31 @@ 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] + * @param {string} [attributes.profanityFilter] + */ + addGetInput: function (attributes) { + return this.add(new GetInput(Response), '', attributes); + }, + /** * Add a Hangup element * @method @@ -487,6 +512,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', 'profanityFilter']; + this.nestables = ['Speak', 'Play', 'Wait']; +} +util.inherits(GetInput, Response); + /** * Hangup element * @constructor diff --git a/package.json b/package.json index a2dfa66e..5074efce 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": [