node-red-contrib-nexmo
Advanced tools
Comparing version 3.0.8 to 3.1.0
const Nexmo = require('nexmo'); | ||
const version = require('../package.json').version | ||
@@ -37,7 +38,10 @@ | ||
RED.httpAdmin.post('/nexmo-auth/new-voice-app', RED.auth.needsPermission('nexmo.write'), function(req,res){ | ||
console.log(req.body); | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
if (debug == true){ | ||
console.log(req.body); | ||
} | ||
const nexmo = new Nexmo({ | ||
apiKey: req.body.api_key, | ||
apiSecret: req.body.api_secret | ||
}, {debug: false, appendToUserAgent: "nexmo-nodered/3.0.0"} | ||
}, {debug: false, appendToUserAgent: "nexmo-nodered/"+version} | ||
); | ||
@@ -44,0 +48,0 @@ const options = {}; |
const Nexmo = require('nexmo'); | ||
const mustache = require("mustache"); | ||
const version = require('../package.json').version | ||
module.exports = function (RED) { | ||
@@ -8,3 +10,2 @@ | ||
RED.nodes.createNode(this, config); | ||
const debug = (this.context().global.get('nexmoDebug') | false); | ||
this.creds = RED.nodes.getNode(config.creds); | ||
@@ -15,2 +16,3 @@ this.ni_type = config.ni_type; | ||
node.on('input', function (msg) { | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
var data = dataobject(this.context(), msg) | ||
@@ -23,3 +25,3 @@ this.number = mustache.render(config.number, data); | ||
apiSecret: this.creds.credentials.apisecret | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/3.0.0"} | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/"+version} | ||
); | ||
@@ -26,0 +28,0 @@ nexmo.numberInsight.get({level: this.ni_type, number: this.number, callback: this.url}, (error, response) => { |
@@ -129,3 +129,4 @@ var mustache = require("mustache"); | ||
} | ||
//conversaton | ||
function conversation(config){ | ||
@@ -139,2 +140,3 @@ RED.nodes.createNode(this, config); | ||
node.on('input', function (msg) { | ||
console.log(config); | ||
var data = dataobject(this.context(), msg); | ||
@@ -144,2 +146,4 @@ this.name = mustache.render(config.name, data); | ||
this.eventurl = mustache.render(config.eventurl, data); | ||
this.canhear = mustache.render(config.canhear, data); | ||
this.canspeak = mustache.render(config.canspeak, data); | ||
if ( 'ncco' in msg){ | ||
@@ -161,2 +165,8 @@ var resp = msg.ncco; | ||
ncco.musicOnHoldUrl=this.musiconholdurl; | ||
if (this.canhear != ""){ | ||
ncco.canHear = this.canhear.split(",") | ||
} | ||
if (this.canspeak != ""){ | ||
ncco.canSpeak = this.canspeak.split(",") | ||
} | ||
clean(ncco); | ||
@@ -169,3 +179,3 @@ resp.push(ncco); | ||
//connect | ||
function connect(config){ | ||
@@ -244,4 +254,31 @@ RED.nodes.createNode(this, config); | ||
} | ||
//Notify | ||
function notify(config){ | ||
RED.nodes.createNode(this, config); | ||
this.eventmethod = config.eventmethod; | ||
var node = this; | ||
node.on('input', function (msg) { | ||
var data = dataobject(this.context(), msg); | ||
this.payload = mustache.render(config.payload, data); | ||
this.eventurl = mustache.render(config.eventurl, data); | ||
if ( 'ncco' in msg){ | ||
var resp = msg.ncco; | ||
}else{ | ||
var resp = []; | ||
} | ||
var ncco = {}; | ||
ncco.action="notify"; | ||
ncco.eventUrl= [this.eventurl]; | ||
ncco.eventMethod=this.eventmethod; | ||
ncco.payload=JSON.parse(this.payload); | ||
clean(ncco); | ||
resp.push(ncco); | ||
msg.ncco = resp; | ||
node.send(msg); | ||
}); | ||
} | ||
function clean(obj) { | ||
//Helper Functions | ||
function clean(obj) { | ||
for (var propName in obj) { | ||
@@ -252,12 +289,11 @@ if (obj[propName] === null || obj[propName] === undefined || obj[propName] === "") { | ||
} | ||
} | ||
} | ||
RED.nodes.registerType("talk", talk); | ||
RED.nodes.registerType("stream", stream); | ||
RED.nodes.registerType("input", input); | ||
RED.nodes.registerType("record", record); | ||
RED.nodes.registerType("conversation", conversation); | ||
RED.nodes.registerType("connect", connect); | ||
RED.nodes.registerType("talk", talk); | ||
RED.nodes.registerType("stream", stream); | ||
RED.nodes.registerType("input", input); | ||
RED.nodes.registerType("record", record); | ||
RED.nodes.registerType("conversation", conversation); | ||
RED.nodes.registerType("connect", connect); | ||
RED.nodes.registerType("notify", notify); | ||
} | ||
@@ -264,0 +300,0 @@ |
const Nexmo = require('nexmo'); | ||
const mustache = require("mustache"); | ||
const version = require('../package.json').version | ||
@@ -10,3 +11,2 @@ | ||
RED.nodes.createNode(this, config); | ||
const debug = (this.context().global.get('nexmoDebug') | false); | ||
this.creds = RED.nodes.getNode(config.creds); | ||
@@ -17,2 +17,3 @@ this.unicode = config.unicode; | ||
node.on('input', function (msg) { | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
var data = dataobject(this.context(), msg) | ||
@@ -25,3 +26,3 @@ this.to = mustache.render(config.to, data); | ||
apiSecret: this.creds.credentials.apisecret | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/3.0.0"} | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/"+version} | ||
); | ||
@@ -28,0 +29,0 @@ const opts = {} |
const Nexmo = require('nexmo'); | ||
const mustache = require("mustache"); | ||
const version = require('../package.json').version | ||
module.exports = function (RED) { | ||
function createCall(config){ | ||
RED.nodes.createNode(this, config); | ||
this.creds = RED.nodes.getNode(config.creds); | ||
this.eventmethod = config.eventmethod; | ||
this.answertype = config.answertype; | ||
this.endpoint = config.endpoint; | ||
this.machinedetection = config.machinedetection | ||
this.contenttype = config.contenttype | ||
var node = this; | ||
node.on('input', function (msg) { | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
var data = dataobject(this.context(), msg); | ||
this.to = mustache.render(config.to, data); | ||
this.wsuri = mustache.render(config.wsuri, data); | ||
this.sipuri = mustache.render(config.sipuri, data); | ||
this.extension = mustache.render(config.extension, data); | ||
this.headers = mustache.render(config.headers, data); | ||
this.from = mustache.render(config.from, data); | ||
this.eventurl = mustache.render(config.eventurl, data); | ||
this.ringingtimer = mustache.render(config.ringingtimer, data); | ||
this.lengthtimer = mustache.render(config.lengthtimer, data); | ||
this.dtmfanswer = mustache.render(config.dtmfanswer, data); | ||
if ( this.answertype == 'url'){ | ||
this.answerurl = mustache.render(config.answer, data); | ||
} else if (this.answertype == 'json'){ | ||
this.ncco = JSON.parse(mustache.render(config.answer, data)); | ||
} else if (this.answertype == 'fixed'){ | ||
this.ncco = msg.ncco | ||
} | ||
const nexmo = new Nexmo({ | ||
apiKey: this.creds.credentials.apikey, | ||
apiSecret: this.creds.credentials.apisecret, | ||
applicationId: this.creds.credentials.appid, | ||
privateKey: this.creds.credentials.privatekey | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/"+version} | ||
); | ||
if (this.endpoint == "phone"){ | ||
var ep = {} | ||
ep.type = "phone" | ||
ep.number = this.to | ||
if (this.dtmfanswer != ""){ | ||
ep.dtmfAnswer = this.dtmfanswer | ||
} | ||
} else if (this.endpoint == "sip"){ | ||
var ep = {} | ||
ep.type = "sip" | ||
ep.uri = this.sipuri | ||
}else if (this.endpoint == "websocket"){ | ||
var ep = {} | ||
ep.type = "websocket" | ||
ep.uri = this.wsuri | ||
ep['content-type'] = this.contenttype | ||
ep.headers = JSON.parse(this.headers) | ||
} else if (this.endpoint == "vbc"){ | ||
var ep = {} | ||
ep.type = "vbc" | ||
ep.extension = this.extension | ||
} | ||
var request = { | ||
to: [ep], | ||
from: { type: 'phone', number: this.from}, | ||
event_method : this.eventmethod, | ||
machine_detection : this.machinedetection, | ||
length_timer : this.lengthtimer, | ||
ringing_timer: this.ringingtimer | ||
}; | ||
if ( this.answertype == 'url'){ | ||
request.answer_url = [this.answerurl] | ||
} else { | ||
request.ncco = this.ncco | ||
} | ||
if (this.eventurl != ""){ | ||
request.event_url= [this.eventurl]; | ||
} | ||
clean(request); | ||
nexmo.calls.create(request, (err, response) => { | ||
if(err) { console.error(err); } | ||
else { | ||
msg.payload=response; | ||
node.send(msg) | ||
} | ||
}); | ||
}); | ||
} | ||
function GetRecording(config){ | ||
RED.nodes.createNode(this, config); | ||
const debug = (this.context().global.get('nexmoDebug') | false); | ||
this.creds = RED.nodes.getNode(config.creds); | ||
var node = this; | ||
node.on('input', function (msg) { | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
this.filename = mustache.render(config.filename, dataobject(this.context(), msg)); | ||
@@ -24,3 +107,3 @@ if (this.filename){ | ||
privateKey: this.creds.credentials.privatekey | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/3.0.0"} | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/"+version} | ||
); | ||
@@ -42,3 +125,2 @@ nexmo.files.get(msg.payload.recording_url, (error, data) => { | ||
RED.nodes.createNode(this, config); | ||
const debug = (this.context().global.get('nexmoDebug') | false); | ||
this.creds = RED.nodes.getNode(config.creds); | ||
@@ -48,2 +130,3 @@ this.state = config.state; | ||
node.on('input', function (msg) { | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
this.calluuid = mustache.render(config.calluuid, dataobject(this.context(), msg)); | ||
@@ -55,3 +138,3 @@ const nexmo = new Nexmo({ | ||
privateKey: this.creds.credentials.privatekey | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/3.0.0"} | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/"+version} | ||
); | ||
@@ -71,3 +154,3 @@ if (this.state == "on"){ | ||
msg.payload=response; | ||
node.send(response) | ||
node.send(msg) | ||
} | ||
@@ -82,8 +165,7 @@ }); | ||
RED.nodes.createNode(this, config); | ||
const debug = (this.context().global.get('nexmoDebug') | false); | ||
this.creds = RED.nodes.getNode(config.creds); | ||
this.state = config.state; | ||
var node = this; | ||
node.on('input', function (msg) { | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
this.calluuid = mustache.render(config.calluuid, dataobject(this.context(), msg)); | ||
@@ -95,3 +177,3 @@ const nexmo = new Nexmo({ | ||
privateKey: this.creds.credentials.privatekey | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/3.0.0"} | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/"+version} | ||
); | ||
@@ -111,3 +193,3 @@ if (this.state == "on"){ | ||
msg.payload=response; | ||
node.send(response) | ||
node.send(msg) | ||
} | ||
@@ -122,6 +204,6 @@ }); | ||
RED.nodes.createNode(this, config); | ||
const debug = (this.context().global.get('nexmoDebug') | false); | ||
this.creds = RED.nodes.getNode(config.creds); | ||
var node = this; | ||
node.on('input', function (msg) { | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
this.calluuid = mustache.render(config.calluuid, dataobject(this.context(), msg)); | ||
@@ -133,3 +215,3 @@ const nexmo = new Nexmo({ | ||
privateKey: this.creds.credentials.privatekey | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/3.0.0"} | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/"+version} | ||
); | ||
@@ -140,3 +222,3 @@ nexmo.calls.update(this.calluuid, { action: 'hangup' }, (err, response) => { | ||
msg.payload=response; | ||
node.send(response) | ||
node.send(msg) | ||
} | ||
@@ -150,6 +232,6 @@ }); | ||
RED.nodes.createNode(this, config); | ||
const debug = (this.context().global.get('nexmoDebug') | false); | ||
this.creds = RED.nodes.getNode(config.creds); | ||
var node = this; | ||
node.on('input', function (msg) { | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
var data = dataobject(this.context(), msg); | ||
@@ -163,3 +245,3 @@ this.calluuid = mustache.render(config.calluuid, data); | ||
privateKey: this.creds.credentials.privatekey | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/3.0.0"} | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/"+version} | ||
); | ||
@@ -170,3 +252,3 @@ nexmo.calls.update(this.calluuid, {action: 'transfer', destination: {"type": "ncco", "url": [this.url]}}, (err, response) => { | ||
msg.payload=response; | ||
node.send(response) | ||
node.send(msg) | ||
} | ||
@@ -179,81 +261,6 @@ }); | ||
function createCall(config){ | ||
RED.nodes.createNode(this, config); | ||
const debug = (this.context().global.get('nexmoDebug') | false); | ||
this.creds = RED.nodes.getNode(config.creds); | ||
this.eventmethod = config.eventmethod; | ||
this.answermethod = config.answermethod; | ||
this.endpoint = config.endpoint; | ||
this.machinedetection = config.machinedetection | ||
this.contenttype = config.contenttype | ||
var node = this; | ||
node.on('input', function (msg) { | ||
var data = dataobject(this.context(), msg); | ||
this.to = mustache.render(config.to, data); | ||
this.wsuri = mustache.render(config.wsuri, data); | ||
this.sipuri = mustache.render(config.sipuri, data); | ||
this.extension = mustache.render(config.extension, data); | ||
this.headers = mustache.render(config.headers, data); | ||
this.from = mustache.render(config.from, data); | ||
this.eventurl = mustache.render(config.eventurl, data); | ||
this.answerurl = mustache.render(config.answerurl, data); | ||
this.ringingtimer = mustache.render(config.ringingtimer, data); | ||
this.lengthtimer = mustache.render(config.lengthtimer, data); | ||
this.dtmfanswer = mustache.render(config.dtmfanswer, data); | ||
const nexmo = new Nexmo({ | ||
apiKey: this.creds.credentials.apikey, | ||
apiSecret: this.creds.credentials.apisecret, | ||
applicationId: this.creds.credentials.appid, | ||
privateKey: this.creds.credentials.privatekey | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/3.0.0"} | ||
); | ||
if (this.endpoint == "phone"){ | ||
var ep = {} | ||
ep.type = "phone" | ||
ep.number = this.to | ||
if (this.dtmfanswer != ""){ | ||
ep.dtmfAnswer = this.dtmfanswer | ||
} | ||
} else if (this.endpoint == "sip"){ | ||
var ep = {} | ||
ep.type = "sip" | ||
ep.uri = this.sipuri | ||
}else if (this.endpoint == "websocket"){ | ||
var ep = {} | ||
ep.type = "websocket" | ||
ep.uri = this.wsuri | ||
ep['content-type'] = this.contenttype | ||
ep.headers = JSON.parse(this.headers) | ||
} else if (this.endpoint == "vbc"){ | ||
var ep = {} | ||
ep.type = "vbc" | ||
ep.extension = this.extension | ||
} | ||
var request = { | ||
to: [ep], | ||
from: { type: 'phone', number: this.from}, | ||
answer_url: [this.answerurl], | ||
answer_method : this.answermethod, | ||
event_method : this.eventmethod, | ||
machine_detection : this.machinedetection, | ||
length_timer : this.lengthtimer, | ||
ringing_timer: this.ringingtimer | ||
}; | ||
if (this.eventurl != ""){ | ||
request.event_url= [this.eventurl]; | ||
} | ||
clean(request); | ||
nexmo.calls.create(request, (err, response) => { | ||
if(err) { console.error(err); } | ||
else { | ||
msg.payload=response; | ||
node.send(response) | ||
} | ||
}); | ||
}); | ||
} | ||
function playaudio(config){ | ||
RED.nodes.createNode(this, config); | ||
const debug = (this.context().global.get('nexmoDebug') | false); | ||
console.log(debug); | ||
@@ -266,2 +273,3 @@ this.creds = RED.nodes.getNode(config.creds); | ||
node.on('input', function (msg) { | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
var data = dataobject(this.context(), msg); | ||
@@ -275,3 +283,3 @@ this.calluuid = mustache.render(config.calluuid, data); | ||
privateKey: this.creds.credentials.privatekey | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/3.0.0"} | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/"+version} | ||
); | ||
@@ -291,3 +299,3 @@ if (this.action == 'on'){ | ||
msg.payload=response; | ||
node.send(response) | ||
node.send(msg) | ||
} | ||
@@ -302,3 +310,2 @@ }); | ||
RED.nodes.createNode(this, config); | ||
const debug = (this.context().global.get('nexmoDebug') | false); | ||
this.creds = RED.nodes.getNode(config.creds); | ||
@@ -311,2 +318,3 @@ this.action = config.action; | ||
node.on('input', function (msg) { | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
var data = dataobject(this.context(), msg); | ||
@@ -320,3 +328,3 @@ this.calluuid = mustache.render(config.calluuid, data); | ||
privateKey: this.creds.credentials.privatekey | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/3.0.0"} | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/"+version} | ||
); | ||
@@ -336,3 +344,3 @@ if (this.action == 'on'){ | ||
msg.payload=response; | ||
node.send(response) | ||
node.send(msg) | ||
} | ||
@@ -346,6 +354,6 @@ }); | ||
RED.nodes.createNode(this, config); | ||
const debug = (this.context().global.get('nexmoDebug') | false); | ||
this.creds = RED.nodes.getNode(config.creds); | ||
var node = this; | ||
node.on('input', function (msg) { | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
var data = dataobject(this.context(), msg); | ||
@@ -359,3 +367,3 @@ this.calluuid = mustache.render(config.calluuid, data); | ||
privateKey: this.creds.credentials.privatekey | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/3.0.0"} | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/"+version} | ||
); | ||
@@ -367,3 +375,3 @@ nexmo.calls.dtmf.send(this.calluuid, { digits: this.digits }, (err, response) => { | ||
msg.payload=response; | ||
node.send(response) | ||
node.send(msg) | ||
} | ||
@@ -375,4 +383,2 @@ }); | ||
@@ -386,3 +392,3 @@ function clean(obj) { | ||
} | ||
RED.nodes.registerType("createcall",createCall); | ||
RED.nodes.registerType("earmuff",earmuff); | ||
@@ -393,3 +399,2 @@ RED.nodes.registerType("getrecording",GetRecording); | ||
RED.nodes.registerType("transfer",transfer); | ||
RED.nodes.registerType("createcall",createCall); | ||
RED.nodes.registerType("playaudio",playaudio); | ||
@@ -399,2 +404,3 @@ RED.nodes.registerType("playtts",playtts); | ||
function dataobject(context, msg){ | ||
@@ -401,0 +407,0 @@ data = {} |
const Nexmo = require('nexmo'); | ||
const mustache = require("mustache"); | ||
const version = require('../package.json').version | ||
@@ -8,3 +9,2 @@ module.exports = function (RED) { | ||
RED.nodes.createNode(this, config); | ||
const debug = (this.context().global.get('nexmoDebug') | false); | ||
this.creds = RED.nodes.getNode(config.creds); | ||
@@ -14,2 +14,3 @@ var node = this; | ||
node.on('input', function (msg) { | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
var data = dataobject(this.context(), msg) | ||
@@ -35,3 +36,2 @@ this.to = mustache.render(config.to, data); | ||
RED.nodes.createNode(this, config); | ||
const debug = (this.context().global.get('nexmoDebug') | false); | ||
this.creds = RED.nodes.getNode(config.creds); | ||
@@ -41,2 +41,3 @@ var node = this; | ||
node.on('input', function (msg) { | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
var data = dataobject(this.context(), msg) | ||
@@ -48,3 +49,3 @@ this.verify_id = mustache.render(config.verify_id, data); | ||
apiSecret: this.creds.credentials.apisecret | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/3.0.0"} | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/"+version} | ||
); | ||
@@ -63,3 +64,2 @@ nexmo.verify.check({request_id: this.verify_id, code: this.code}, function(err, response) { | ||
RED.nodes.createNode(this, config); | ||
const debug = (this.context().global.get('nexmoDebug') | false); | ||
this.creds = RED.nodes.getNode(config.creds); | ||
@@ -69,2 +69,3 @@ var node = this; | ||
node.on('input', function (msg) { | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
this.verify_id = mustache.render(config.verify_id, dataobject(this.context(), msg)); | ||
@@ -74,3 +75,3 @@ const nexmo = new Nexmo({ | ||
apiSecret: this.creds.credentials.apisecret | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/3.0.0"} | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/"+version} | ||
); | ||
@@ -88,3 +89,2 @@ nexmo.verify.control({request_id: this.verify_id, cmd: 'cancel'}, function(err, response) { | ||
RED.nodes.createNode(this, config); | ||
const debug = (this.context().global.get('nexmoDebug') | false); | ||
this.creds = RED.nodes.getNode(config.creds); | ||
@@ -94,2 +94,3 @@ var node = this; | ||
node.on('input', function (msg) { | ||
var debug = (this.context().global.get('nexmoDebug') | false); | ||
this.verify_id = mustache.render(config.verify_id, dataobject(this.context(), msg)); | ||
@@ -99,3 +100,3 @@ const nexmo = new Nexmo({ | ||
apiSecret: this.creds.credentials.apisecret | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/3.0.0"} | ||
}, {debug: debug, appendToUserAgent: "nexmo-nodered/"+version} | ||
); | ||
@@ -102,0 +103,0 @@ nexmo.verify.control({request_id: this.verify_id, cmd: 'trigger_next_event'}, function(err, response) { |
@@ -193,6 +193,7 @@ /** | ||
res._msgid = msgid; | ||
if (node.method.match(/^(post|delete|put|options|patch)$/)) { | ||
node.send({_msgid:msgid,req:req,res:createResponseWrapper(node,res),call:req.body}); | ||
if (node.method == "post") { | ||
extend(req.body, req.query); | ||
node.send({_msgid:msgid,req:req,res:createResponseWrapper(node,res),call:req.body}); | ||
} else if (node.method == "get") { | ||
node.send({_msgid:msgid,req:req,res:createResponseWrapper(node,res),call:req.query}); | ||
node.send({_msgid:msgid,req:req,res:createResponseWrapper(node,res),call:req.query}); | ||
} else { | ||
@@ -263,2 +264,10 @@ node.send({_msgid:msgid,req:req,res:createResponseWrapper(node,res)}); | ||
} | ||
function extend(obj, src) { | ||
if (src){ | ||
Object.keys(src).forEach(function(key) { obj[key] = src[key]; }); | ||
} | ||
return obj; | ||
} | ||
RED.nodes.registerType("voice webhook",voicewebhook); | ||
@@ -265,0 +274,0 @@ |
{ | ||
"name": "node-red-contrib-nexmo", | ||
"version": "3.0.8", | ||
"description": "Node Red module for an Nexmo API", | ||
"version": "3.1.0", | ||
"description": "Node Red module for the Nexmo API", | ||
"main": "ncco.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121428
1219