Skip to content

Commit

Permalink
Merge pull request #126 from plivo/get-input
Browse files Browse the repository at this point in the history
Get input
  • Loading branch information
nixonsam authored Nov 13, 2019
2 parents cb1b257 + bedaa3e commit 4bc5f0d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
41 changes: 40 additions & 1 deletion lib/utils/plivoxml.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down

0 comments on commit 4bc5f0d

Please sign in to comment.