This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const removeColors = (string) => { | |
const pattern = [ | |
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', | |
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' | |
].join('|'); | |
return typeof string === 'string' ? string.replace(new RegExp(pattern, 'g'), '') : string; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
module.exports = (app) => { | |
fs.readdirSync(__dirname).forEach( file => { | |
if (file === "index.js" || file.substr(file.lastIndexOf('.') + 1) !== 'js') | |
return; | |
let name = file.substr(0, file.indexOf('.')); | |
require('./' + name)(app); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const controller = module.exports; | |
const models = require('../models/mongoose'); | |
controller.list = async (req, res) => { | |
const list = await models.integrations.find(); | |
let integrations = Array.from(list).map((integration) => { | |
return { | |
icon: integration.name.toLowerCase().trim() + '.png', | |
_id: integration.id, | |
name: integration.name, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const callControl = require('./node-kamailio-callcontrol')({socket: "/opt/callcontrol/socket", heartbeat: 60000, redis: { server: '127.0.0.1', port: 6379}}); | |
const evapi = require('./node-kamailio-evapi/index')({hostname:"127.0.0.1", port: 8449}); | |
evapi.connect(); | |
evapi.on('connected', () => { | |
console.log('server connected'); | |
}); | |
evapi.on('connecting', (msg) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const callControl = require('node-kamailio-callcontrol')({socket: "/opt/callcontrol/socket", heartbeat: 60000, redis: { server: '127.0.0.1', port: 4289}}); | |
callControl.on('init', (call) => { | |
console.log('received init', call); | |
}); | |
callControl.on('start', (call) => { | |
console.log('received start', call); | |
call.heartbeat.createEvent(1, function(count, last) { |