node-red-contrib-wazo-platform
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -90,3 +90,3 @@ module.exports = function(RED) { | ||
node.log('Session will expire, force Refresh Token'); | ||
client.forceRefreshToken(); | ||
node.client.forceRefreshToken(); | ||
} | ||
@@ -93,0 +93,0 @@ } |
@@ -50,17 +50,15 @@ module.exports = function (RED) { | ||
const message_id = msg.payload.message_id; | ||
const user_uuid = msg.payload.user_uuid; | ||
node.status({fill:"blue", shape:"dot", text: 'Fetch voicemail'}); | ||
getVoicemail(voicemail_id, message_id); | ||
getVoicemail(voicemail_id, message_id, user_uuid); | ||
} | ||
} | ||
const getVoicemail = (voicemail_id, message_id) => { | ||
conn.authenticate().then(data => { | ||
if (data) { | ||
let url = `https://${conn.host}:${conn.port}/api/calld/1.0/voicemails/${voicemail_id}/messages/${message_id}/recording?download=1`; | ||
if (node.is_user) { | ||
url = `https://${conn.host}:${conn.port}/api/calld/1.0/users/me/voicemails/messages/${message_id}/recording?download=1`; | ||
} | ||
getVoicemailRecording(url, voicemail_id, message_id, data.token, node); | ||
} | ||
}); | ||
const getVoicemail = async (voicemail_id, message_id, user_uuid) => { | ||
const auth = await conn.authenticate(); | ||
let url = `https://${conn.host}:${conn.port}/api/calld/1.0/voicemails/${voicemail_id}/messages/${message_id}/recording?download=1`; | ||
if (node.is_user) { | ||
url = `https://${conn.host}:${conn.port}/api/calld/1.0/users/me/voicemails/messages/${message_id}/recording?download=1`; | ||
} | ||
getVoicemailRecording(url, voicemail_id, message_id, auth.token, node, user_uuid); | ||
} | ||
@@ -70,3 +68,3 @@ | ||
const getVoicemailRecording = (url, voicemail_id, message_id, token, node) => { | ||
const getVoicemailRecording = (url, voicemail_id, message_id, token, node, user_uuid) => { | ||
const options = { | ||
@@ -102,2 +100,3 @@ method: 'GET', | ||
payload: { | ||
user_uuid: user_uuid, | ||
buffer: buffer, | ||
@@ -109,3 +108,4 @@ file: dest | ||
node.send({ | ||
payload: buffer | ||
payload: buffer, | ||
user_uuid: user_uuid, | ||
}); | ||
@@ -112,0 +112,0 @@ } |
{ | ||
"name": "node-red-contrib-wazo-platform", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Node Red module for the Wazo Platform API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
901476