From 2706bc250fa931b46e9dbb3987e5a302ca8a115d Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 16:15:41 -0400 Subject: [PATCH 01/34] Update setting.controller.js fix messaging profile creation in telnyx --- app/controller/setting.controller.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controller/setting.controller.js b/app/controller/setting.controller.js index 45e26921..47e058fb 100644 --- a/app/controller/setting.controller.js +++ b/app/controller/setting.controller.js @@ -237,6 +237,9 @@ exports.create = async (req, res) => { ).messagingProfiles.create({ name: "VoIP sms Web Application", enabled: true, + "whitelisted_destinations": [ + "US" + ], webhook_url: combineURLs( process.env.BASE_URL.trim(), "api/setting/receive-sms/", From 70ed7fd813f85f55ecfa1f72541e60f38c9ab183 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 16:21:47 -0400 Subject: [PATCH 02/34] Create Dockerfile --- Dockerfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..711fa013 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM docker.io/library/node:alpine + +# Choose the port +EXPOSE 3000:3000 + +# Environment variables +ENV NPM_CONFIG_PREFIX=/home/node/.npm-global +ENV PATH=$PATH:/home/node/.npm-global/bin +RUN apk update&&apk add git&&rm -rf /var/cache/apk/* +# Install app dependencies +WORKDIR /home/node/app +RUN git clone https://github.com/macide213/VoIP.git . +RUN npm install + +# Install app +RUN chown -R node:node . +USER node + +CMD [ "node", "app.js" ] From 19fa8c3bbbef9b410fb8266a86dcc7064b04a259 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 16:33:29 -0400 Subject: [PATCH 03/34] Update setting.controller.js --- app/controller/setting.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controller/setting.controller.js b/app/controller/setting.controller.js index 47e058fb..797099c3 100644 --- a/app/controller/setting.controller.js +++ b/app/controller/setting.controller.js @@ -488,7 +488,7 @@ exports.create = async (req, res) => { } } catch (error) { // console.log(error) - res.status(400).send({ status: false, message: error.message, data: [] }); + res.status(400).send({ status: false, message: error.message, data: error }); } }; exports.getSetting = async (req, res) => { From d0406f6fba53ec523efd92b9d66eab7ccdaf7665 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 16:39:19 -0400 Subject: [PATCH 04/34] Update setting.controller.js get stack trace on issue --- app/controller/setting.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controller/setting.controller.js b/app/controller/setting.controller.js index 797099c3..9553e348 100644 --- a/app/controller/setting.controller.js +++ b/app/controller/setting.controller.js @@ -488,7 +488,7 @@ exports.create = async (req, res) => { } } catch (error) { // console.log(error) - res.status(400).send({ status: false, message: error.message, data: error }); + res.status(400).send({ status: false, message: error.message, data: error.stack }); } }; exports.getSetting = async (req, res) => { From 00e75aa42bc582dcb530126d15c025ca56bb054b Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 16:44:33 -0400 Subject: [PATCH 05/34] Update package.json multer --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8f1b40b2..a47b7993 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "moment": "^2.29.1", "moment-timezone": "^0.5.33", "mongoose": "^5.13.8", - "multer": "^1.4.3", + "multer": "^1.4.4-lts.1", "node-cron": "^3.0.0", "nodemailer": "^6.6.3", "nodemailer-openpgp": "^2.1.0", From 3d7adbb24cf2f2f0348158959577c5b7e6366099 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:01:39 -0400 Subject: [PATCH 06/34] Update setting.controller.js --- app/controller/setting.controller.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controller/setting.controller.js b/app/controller/setting.controller.js index 9553e348..e8fd5999 100644 --- a/app/controller/setting.controller.js +++ b/app/controller/setting.controller.js @@ -184,6 +184,7 @@ exports.create = async (req, res) => { var outboundTel = await telnyxHelper.createOutboundVoice( req.body.api_key ); + console.log( outboundTel.data) settingCheck.telnyx_outbound = outboundTel.data.id; } From 4c50153e481dd4bac1044a153907246133059c47 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:10:44 -0400 Subject: [PATCH 07/34] Update setting.controller.js --- app/controller/setting.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controller/setting.controller.js b/app/controller/setting.controller.js index e8fd5999..74523ecc 100644 --- a/app/controller/setting.controller.js +++ b/app/controller/setting.controller.js @@ -184,7 +184,7 @@ exports.create = async (req, res) => { var outboundTel = await telnyxHelper.createOutboundVoice( req.body.api_key ); - console.log( outboundTel.data) + console.log( JSON.stringify(outboundTel)) settingCheck.telnyx_outbound = outboundTel.data.id; } From f9f813510662ad9cfa61cad07cecf70dda847a96 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:16:57 -0400 Subject: [PATCH 08/34] Update telnyx.helper.js --- app/helper/telnyx.helper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index 97dc14ff..e7b9df31 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -161,7 +161,7 @@ const createOutboundVoice = (apiKey) => { // console.log(outboundVoiceProfiles.data) resolve(outboundVoiceProfiles); }catch(error){ - // console.log(error) + console.log(JSON.stringify(error)) resolve(false); } }); @@ -342,4 +342,4 @@ const getNumberData = async (data) => { module.exports = { requestCurl, createTexmlApp, updateTexmlApp, deleteTexmlApp, createSIPApp, updateSIPApp, deleteSIPApp, createOutboundVoice, deleteOutboundVoice, updatePhoneNumber, emptyMessageProfile, deleteMessageProfile, messageProfileFallback, texmlAppFalback, sIPAppFallback, messageProfileGet, texmlAppGet, sIPAppGet, getNumberData -} \ No newline at end of file +} From b301da7a62cd183464ff222f1272990b2ffeab67 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:23:43 -0400 Subject: [PATCH 09/34] Update telnyx.helper.js --- app/helper/telnyx.helper.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index e7b9df31..ed386409 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -159,6 +159,7 @@ const createOutboundVoice = (apiKey) => { {"name": `outbound${moment().format('YYYYMMDDHHmm')}`} ); // console.log(outboundVoiceProfiles.data) + console.log(JSON.stringify(outboundVoiceProfiles.data)) resolve(outboundVoiceProfiles); }catch(error){ console.log(JSON.stringify(error)) From 23f8b71a5e222c66b5b78d097cfd19c956d50640 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:34:51 -0400 Subject: [PATCH 10/34] Update telnyx.helper.js --- app/helper/telnyx.helper.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index ed386409..381215f2 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -154,9 +154,12 @@ const createOutboundVoice = (apiKey) => { return new Promise(async (resolve,reject) => { try{ const telnyx = Telnyx(apiKey); + console.log(JSON.stringify(telnyx)) + name = `outbound${moment().format('YYYYMMDDHHmm')}` + console.log(JSON.stringify(name)) // In Node 10 const outboundVoiceProfiles = await telnyx.outboundVoiceProfiles.create( - {"name": `outbound${moment().format('YYYYMMDDHHmm')}`} + {"name": name} ); // console.log(outboundVoiceProfiles.data) console.log(JSON.stringify(outboundVoiceProfiles.data)) From a7477ccd9f4b433447ae64e2667b6556e5474410 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:49:09 -0400 Subject: [PATCH 11/34] Update telnyx.helper.js --- app/helper/telnyx.helper.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index 381215f2..797df31c 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -153,13 +153,14 @@ const deleteSIPApp = (apiKey, uuid) => { const createOutboundVoice = (apiKey) => { return new Promise(async (resolve,reject) => { try{ + console.log('createOutboundVoice') const telnyx = Telnyx(apiKey); console.log(JSON.stringify(telnyx)) - name = `outbound${moment().format('YYYYMMDDHHmm')}` - console.log(JSON.stringify(name)) + const myname = `outbound${moment().format('YYYYMMDDHHmm')}` + console.log(JSON.stringify(myname)) // In Node 10 const outboundVoiceProfiles = await telnyx.outboundVoiceProfiles.create( - {"name": name} + {"name": myname} ); // console.log(outboundVoiceProfiles.data) console.log(JSON.stringify(outboundVoiceProfiles.data)) From b10be69faeae1cfa6fb0722dc4fa71800066a8b7 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 18:22:21 -0400 Subject: [PATCH 12/34] Update telnyx.helper.js --- app/helper/telnyx.helper.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index 797df31c..18b8793e 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -166,7 +166,8 @@ const createOutboundVoice = (apiKey) => { console.log(JSON.stringify(outboundVoiceProfiles.data)) resolve(outboundVoiceProfiles); }catch(error){ - console.log(JSON.stringify(error)) + + console.log(error.trace) resolve(false); } }); From ae83ab96d22f8c1af96fb24a0e248885c69aa4c0 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 18:29:48 -0400 Subject: [PATCH 13/34] Update telnyx.helper.js --- app/helper/telnyx.helper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index 18b8793e..50d1a428 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -157,7 +157,7 @@ const createOutboundVoice = (apiKey) => { const telnyx = Telnyx(apiKey); console.log(JSON.stringify(telnyx)) const myname = `outbound${moment().format('YYYYMMDDHHmm')}` - console.log(JSON.stringify(myname)) + console.log(myname) // In Node 10 const outboundVoiceProfiles = await telnyx.outboundVoiceProfiles.create( {"name": myname} @@ -167,7 +167,7 @@ const createOutboundVoice = (apiKey) => { resolve(outboundVoiceProfiles); }catch(error){ - console.log(error.trace) + console.trace(error.message) resolve(false); } }); From c13218fd52eefb085911dae79501cbf1c62742c1 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 18:35:22 -0400 Subject: [PATCH 14/34] Update telnyx.helper.js --- app/helper/telnyx.helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index 50d1a428..965f35f4 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -166,7 +166,7 @@ const createOutboundVoice = (apiKey) => { console.log(JSON.stringify(outboundVoiceProfiles.data)) resolve(outboundVoiceProfiles); }catch(error){ - + console.log(error.message) console.trace(error.message) resolve(false); } From 32f4be0d8b643f1c5daecaf32b2bb7f6bca20f61 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:14:40 -0400 Subject: [PATCH 15/34] Update telnyx.helper.js --- app/helper/telnyx.helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index 965f35f4..89edf7a0 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -155,7 +155,7 @@ const createOutboundVoice = (apiKey) => { try{ console.log('createOutboundVoice') const telnyx = Telnyx(apiKey); - console.log(JSON.stringify(telnyx)) + const myname = `outbound${moment().format('YYYYMMDDHHmm')}` console.log(myname) // In Node 10 From 84ad108c2235a29091b5f589f917146f40f64b2e Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:32:58 -0400 Subject: [PATCH 16/34] Update telnyx.helper.js --- app/helper/telnyx.helper.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index 89edf7a0..ac67c94a 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -2,6 +2,7 @@ const Telnyx = require('telnyx'); var axios = require('axios'); const moment = require('moment'); const crypto = require('crypto') +var util = require('util'); const { combineURLs } = require("./common.helper") //Inside lib file declare functions @@ -155,7 +156,7 @@ const createOutboundVoice = (apiKey) => { try{ console.log('createOutboundVoice') const telnyx = Telnyx(apiKey); - + console.log(util.inspect(telnyx)); const myname = `outbound${moment().format('YYYYMMDDHHmm')}` console.log(myname) // In Node 10 From 20ca741e556ae29eef4fec318aaaa55e5a1ba2db Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:41:41 -0400 Subject: [PATCH 17/34] Update telnyx.helper.js --- app/helper/telnyx.helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index ac67c94a..5e87c86d 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -156,7 +156,7 @@ const createOutboundVoice = (apiKey) => { try{ console.log('createOutboundVoice') const telnyx = Telnyx(apiKey); - console.log(util.inspect(telnyx)); + console.log(util.inspect(telnyx.outboundVoiceProfiles)); const myname = `outbound${moment().format('YYYYMMDDHHmm')}` console.log(myname) // In Node 10 From 7d1be541fc0d5bbfb4e0f61fd6f3c110495af12b Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:55:30 -0400 Subject: [PATCH 18/34] update --- app/helper/telnyx.helper.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index 5e87c86d..644e7bda 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -156,9 +156,10 @@ const createOutboundVoice = (apiKey) => { try{ console.log('createOutboundVoice') const telnyx = Telnyx(apiKey); + console.log(util.inspect(telnyx.outboundVoiceProfiles.create)); + const myname = `outbound${moment().format('YYYYMMDDHHmm')}` + console.log(myname) console.log(util.inspect(telnyx.outboundVoiceProfiles)); - const myname = `outbound${moment().format('YYYYMMDDHHmm')}` - console.log(myname) // In Node 10 const outboundVoiceProfiles = await telnyx.outboundVoiceProfiles.create( {"name": myname} From 3f7ed8326114b201a6a5f7b85c8df0460a5068ac Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:05:55 -0400 Subject: [PATCH 19/34] updates --- app/controller/setting.controller.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controller/setting.controller.js b/app/controller/setting.controller.js index 74523ecc..cd8414d9 100644 --- a/app/controller/setting.controller.js +++ b/app/controller/setting.controller.js @@ -185,6 +185,9 @@ exports.create = async (req, res) => { req.body.api_key ); console.log( JSON.stringify(outboundTel)) + if(!outboundTel) + settingCheck.telnyx_outbound = 2390163376366945343; + else settingCheck.telnyx_outbound = outboundTel.data.id; } From 327820d5c418c5256510a4a7b82445efdca98d1b Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Fri, 22 Mar 2024 14:11:30 -0400 Subject: [PATCH 20/34] updates --- app/helper/telnyx.helper.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index 644e7bda..70fe4f0b 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -150,16 +150,24 @@ const deleteSIPApp = (apiKey, uuid) => { } }); } +function getAllMethods(object) { + return Object.getOwnPropertyNames(object).filter(function(property) { + return typeof object[property] == 'function'; + }); +} const createOutboundVoice = (apiKey) => { return new Promise(async (resolve,reject) => { try{ + console.log('createOutboundVoice') const telnyx = Telnyx(apiKey); - console.log(util.inspect(telnyx.outboundVoiceProfiles.create)); + console.log(getAllMethods(telnyx)); + const myname = `outbound${moment().format('YYYYMMDDHHmm')}` + console.log(getAllMethods(telnyx.outboundVoiceProfiles)); const myname = `outbound${moment().format('YYYYMMDDHHmm')}` console.log(myname) - console.log(util.inspect(telnyx.outboundVoiceProfiles)); + console.log(getAllMethods(telnyx.outboundVoiceProfiles.create)); // In Node 10 const outboundVoiceProfiles = await telnyx.outboundVoiceProfiles.create( {"name": myname} From 65fa55cc19195218d581cc1d3b3697a81c2acf36 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Fri, 22 Mar 2024 14:21:55 -0400 Subject: [PATCH 21/34] updates --- app/helper/telnyx.helper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index 70fe4f0b..96dbc4c0 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -160,12 +160,12 @@ const createOutboundVoice = (apiKey) => { return new Promise(async (resolve,reject) => { try{ + const myname = `outbound${moment().format('YYYYMMDDHHmm')}` console.log('createOutboundVoice') const telnyx = Telnyx(apiKey); console.log(getAllMethods(telnyx)); - const myname = `outbound${moment().format('YYYYMMDDHHmm')}` + console.log(myname) console.log(getAllMethods(telnyx.outboundVoiceProfiles)); - const myname = `outbound${moment().format('YYYYMMDDHHmm')}` console.log(myname) console.log(getAllMethods(telnyx.outboundVoiceProfiles.create)); // In Node 10 From df2991a96b875a71ced553778d3fed314d483f72 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Fri, 22 Mar 2024 14:49:22 -0400 Subject: [PATCH 22/34] updtes --- app/helper/telnyx.helper.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index 96dbc4c0..ef8a80f9 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -151,8 +151,8 @@ const deleteSIPApp = (apiKey, uuid) => { }); } function getAllMethods(object) { - return Object.getOwnPropertyNames(object).filter(function(property) { - return typeof object[property] == 'function'; + Object.getOwnPropertyNames(object).filter(function(property) { + console.log(typeof object[property] + ': ' + property); }); } @@ -161,13 +161,13 @@ const createOutboundVoice = (apiKey) => { try{ const myname = `outbound${moment().format('YYYYMMDDHHmm')}` - console.log('createOutboundVoice') + console.log('telnyx') const telnyx = Telnyx(apiKey); - console.log(getAllMethods(telnyx)); - console.log(myname) - console.log(getAllMethods(telnyx.outboundVoiceProfiles)); - console.log(myname) - console.log(getAllMethods(telnyx.outboundVoiceProfiles.create)); + getAllMethods(telnyx); + console.log('outboundVoiceProfiles') + getAllMethods(telnyx.outboundVoiceProfiles); + console.log('telnyx.outboundVoiceProfiles.create') + getAllMethods(telnyx.outboundVoiceProfiles.create); // In Node 10 const outboundVoiceProfiles = await telnyx.outboundVoiceProfiles.create( {"name": myname} From 51d3fd4517b3e03bbe9789dca0162defe0489c7b Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Fri, 22 Mar 2024 14:57:54 -0400 Subject: [PATCH 23/34] updates --- app/helper/telnyx.helper.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index ef8a80f9..c86b3555 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -163,11 +163,11 @@ const createOutboundVoice = (apiKey) => { const myname = `outbound${moment().format('YYYYMMDDHHmm')}` console.log('telnyx') const telnyx = Telnyx(apiKey); - getAllMethods(telnyx); + //getAllMethods(telnyx); console.log('outboundVoiceProfiles') getAllMethods(telnyx.outboundVoiceProfiles); - console.log('telnyx.outboundVoiceProfiles.create') - getAllMethods(telnyx.outboundVoiceProfiles.create); + //console.log('telnyx.outboundVoiceProfiles.create') + //getAllMethods(telnyx.outboundVoiceProfiles.create); // In Node 10 const outboundVoiceProfiles = await telnyx.outboundVoiceProfiles.create( {"name": myname} From bb3d6e4ad4b890d870baa6645fcca718f06b5ce5 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Fri, 22 Mar 2024 15:04:40 -0400 Subject: [PATCH 24/34] telnyx version to get outboundvoiceprofile create back --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a47b7993..5026c3a4 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "request": "^2.88.2", "socket.io": "^4.1.3", "speakeasy": "^2.0.0", - "telnyx": "^1.18.0", + "telnyx": "1.23.0", "twilio": "^3.67.0", "u2f": "^0.1.3", "validatorjs": "^3.22.1" From bcc70c43ea7507fe9aeed53fdf1ab90906c2d98b Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Fri, 22 Mar 2024 15:23:20 -0400 Subject: [PATCH 25/34] debug updates --- app/helper/telnyx.helper.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index c86b3555..b30fed14 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -152,7 +152,10 @@ const deleteSIPApp = (apiKey, uuid) => { } function getAllMethods(object) { Object.getOwnPropertyNames(object).filter(function(property) { - console.log(typeof object[property] + ': ' + property); + console.log(typeof object[property] + ': ' + object +'.'+ property); + if(typeof object[property] == 'object'){ + getAllMethods(object[property]) + } }); } @@ -163,7 +166,7 @@ const createOutboundVoice = (apiKey) => { const myname = `outbound${moment().format('YYYYMMDDHHmm')}` console.log('telnyx') const telnyx = Telnyx(apiKey); - //getAllMethods(telnyx); + getAllMethods(telnyx); console.log('outboundVoiceProfiles') getAllMethods(telnyx.outboundVoiceProfiles); //console.log('telnyx.outboundVoiceProfiles.create') From 17e07901765b500454dd0f652f6e0d7c4e3bec81 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Fri, 22 Mar 2024 15:28:18 -0400 Subject: [PATCH 26/34] debug --- app/helper/telnyx.helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index b30fed14..a7b804a2 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -152,7 +152,7 @@ const deleteSIPApp = (apiKey, uuid) => { } function getAllMethods(object) { Object.getOwnPropertyNames(object).filter(function(property) { - console.log(typeof object[property] + ': ' + object +'.'+ property); + console.log(typeof object[property] + ': ' + object.constructor.name +'.'+ property); if(typeof object[property] == 'object'){ getAllMethods(object[property]) } From ded1d693ef8ce38344462a43763fa59c7edf5b60 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Fri, 22 Mar 2024 15:34:08 -0400 Subject: [PATCH 27/34] ebug --- app/helper/telnyx.helper.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index a7b804a2..5dfe5e1f 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -152,9 +152,11 @@ const deleteSIPApp = (apiKey, uuid) => { } function getAllMethods(object) { Object.getOwnPropertyNames(object).filter(function(property) { - console.log(typeof object[property] + ': ' + object.constructor.name +'.'+ property); + console.log(typeof object[property] + ': ' + property); if(typeof object[property] == 'object'){ + console.log('----------------start ' + property) getAllMethods(object[property]) + console.log('----------------stop ' + property) } }); } @@ -164,10 +166,10 @@ const createOutboundVoice = (apiKey) => { try{ const myname = `outbound${moment().format('YYYYMMDDHHmm')}` - console.log('telnyx') + console.log('----------------telnyx') const telnyx = Telnyx(apiKey); getAllMethods(telnyx); - console.log('outboundVoiceProfiles') + console.log('-------------outboundVoiceProfiles') getAllMethods(telnyx.outboundVoiceProfiles); //console.log('telnyx.outboundVoiceProfiles.create') //getAllMethods(telnyx.outboundVoiceProfiles.create); From d697a2b49df35e7cda5c488f25094946894c477e Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Fri, 22 Mar 2024 15:40:42 -0400 Subject: [PATCH 28/34] debuging --- app/helper/telnyx.helper.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index 5dfe5e1f..c025e655 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -152,10 +152,20 @@ const deleteSIPApp = (apiKey, uuid) => { } function getAllMethods(object) { Object.getOwnPropertyNames(object).filter(function(property) { - console.log(typeof object[property] + ': ' + property); + try { + console.log(typeof object[property] + ': ' + property); + } catch (error) { + console.log(error.message) + } + if(typeof object[property] == 'object'){ console.log('----------------start ' + property) + try { getAllMethods(object[property]) + } catch (error) { + console.log(error.message) + } + console.log('----------------stop ' + property) } }); From 0893388ed44f17f56903dd858c9d4347d4799a8d Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Fri, 22 Mar 2024 15:47:14 -0400 Subject: [PATCH 29/34] debug --- app/helper/telnyx.helper.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index c025e655..560b32d8 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -152,6 +152,9 @@ const deleteSIPApp = (apiKey, uuid) => { } function getAllMethods(object) { Object.getOwnPropertyNames(object).filter(function(property) { + if(property.substring(0,1)=='_'){ + + }else{ try { console.log(typeof object[property] + ': ' + property); } catch (error) { @@ -168,6 +171,7 @@ function getAllMethods(object) { console.log('----------------stop ' + property) } + } }); } From 07b236875c7c70ef588377339355c0825aaeccd3 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Fri, 22 Mar 2024 16:13:26 -0400 Subject: [PATCH 30/34] db --- app/helper/telnyx.helper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helper/telnyx.helper.js b/app/helper/telnyx.helper.js index 560b32d8..4cf9dd27 100644 --- a/app/helper/telnyx.helper.js +++ b/app/helper/telnyx.helper.js @@ -192,11 +192,11 @@ const createOutboundVoice = (apiKey) => { {"name": myname} ); // console.log(outboundVoiceProfiles.data) - console.log(JSON.stringify(outboundVoiceProfiles.data)) + getAllMethods(outboundVoiceProfiles) resolve(outboundVoiceProfiles); }catch(error){ console.log(error.message) - console.trace(error.message) + console.log(error.stack) resolve(false); } }); From d7892066662b90f1e04c1f53fd2b686a201d3d0d Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Fri, 22 Mar 2024 16:34:12 -0400 Subject: [PATCH 31/34] db --- app/controller/setting.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controller/setting.controller.js b/app/controller/setting.controller.js index cd8414d9..baff0716 100644 --- a/app/controller/setting.controller.js +++ b/app/controller/setting.controller.js @@ -184,7 +184,7 @@ exports.create = async (req, res) => { var outboundTel = await telnyxHelper.createOutboundVoice( req.body.api_key ); - console.log( JSON.stringify(outboundTel)) + //console.log( JSON.stringify(outboundTel)) if(!outboundTel) settingCheck.telnyx_outbound = 2390163376366945343; else From c5bfdec09073a3a2a702986c056c50df8551053f Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Mon, 25 Mar 2024 13:31:05 -0400 Subject: [PATCH 32/34] gfd --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index 8bf56376..f1604c00 100644 --- a/app.js +++ b/app.js @@ -9,7 +9,7 @@ const path = require('path'); var session = require('cookie-session') var compression = require('compression') app.use(compression()) - +console.log('new') var expiryDate = new Date(Date.now() + 60 * 60 * (1000 * 12 * 30)) // 30 day app.use(session({ name: 'session', From bde88f5205e35af4e128f6964aa7f68e041e0d88 Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Mon, 25 Mar 2024 13:36:32 -0400 Subject: [PATCH 33/34] Create docker-image.yml --- .github/workflows/docker-image.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 00000000..d2e78cfc --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,24 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag macide/voipsuite:git + - name: Invoke deployment hook + uses: distributhor/workflow-webhook@v3 + with: + webhook_type: 'json-extended' + webhook_url: 'https://portainer.derek.bartoli.me/api/stacks/webhooks/d0710922-0f3f-4a54-8035-eae4a4fe8bd6' + data: '{ }' From 143881bb794320f3416b0bb5750868df4283545a Mon Sep 17 00:00:00 2001 From: macide213 <39203769+macide213@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:01:32 -0500 Subject: [PATCH 34/34] Update setting.controller.js --- app/controller/setting.controller.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/app/controller/setting.controller.js b/app/controller/setting.controller.js index 16cac46e..4a2ca2c1 100644 --- a/app/controller/setting.controller.js +++ b/app/controller/setting.controller.js @@ -184,10 +184,6 @@ exports.create = async (req, res) => { var outboundTel = await telnyxHelper.createOutboundVoice( req.body.api_key ); - //console.log( JSON.stringify(outboundTel)) - if(!outboundTel) - settingCheck.telnyx_outbound = 2390163376366945343; - else settingCheck.telnyx_outbound = outboundTel.data.id; } @@ -241,9 +237,6 @@ exports.create = async (req, res) => { ).messagingProfiles.create({ name: "VoIP sms Web Application", enabled: true, - "whitelisted_destinations": [ - "US" - ], webhook_url: combineURLs( process.env.BASE_URL.trim(), "api/setting/receive-sms/", @@ -493,7 +486,7 @@ exports.create = async (req, res) => { } } catch (error) { // console.log(error) - res.status(400).send({ status: false, message: error.message, data: error.stack }); + res.status(400).send({ status: false, message: error.message, data: [] }); } }; exports.getSetting = async (req, res) => {