{"size": 1040, "ext": "js", "max_stars_repo_path": "nodes/gather-begin.js", "max_stars_repo_name": "gofynd/node-red-contrib-twilio-ivr", "max_stars_repo_stars_event_min_datetime": "2018-12-21T05:52:52.000Z", "max_stars_repo_stars_event_max_datetime": "2020-05-22T08:55:49.000Z", "max_issues_repo_path": "nodes/gather-begin.js", "max_issues_repo_name": "gofynd/node-red-contrib-twilio-ivr", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "nodes/gather-begin.js", "max_forks_repo_name": "gofynd/node-red-contrib-twilio-ivr", "max_forks_repo_forks_event_min_datetime": "2019-10-11T15:40:41.000Z", "max_forks_repo_forks_event_max_datetime": "2019-10-11T15:40:41.000Z"}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 37.1428571429, "max_line_length": 130, "alphanum_fraction": 0.6057692308}
module.exports = function(RED) {
    function GatherBeginNode(config) {
		RED.nodes.createNode(this,config);
		var node = this;
		node.on('input', function(msg) {
			// Get session and store on msg for convenience.
			var global = node.context().global;
			msg.session = global.get("sessions")[msg.payload.CallSid];

			if (!msg.payload.twiml) msg.payload.twiml = "";
		    msg.payload.twiml += '<Gather action="' + config.action + '" input="' + config.input + '" timeout="' + config.timeout + '"';
		    if (config.numDigits.length > 0) {
		    	msg.payload.twiml += ' numDigits="' + config.numDigits + '"';
		    }
		    if (config.speechHints.length > 0) {
		    	msg.payload.twiml += ' hints="' + config.speechHints + '"';
		    }
		    if (config.speechTimeout.length > 0) {
		    	msg.payload.twiml += ' speechTimeout="' + config.speechTimeout + '"';
		    }
		    msg.payload.twiml += '>';
		    msg.session.menuMap = {}; // clear menu map

			node.send(msg);
		});
    }
    RED.nodes.registerType("gather-begin",GatherBeginNode);
}