You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have trying fetching data from Asterisk (ARI) and can`t catch events. When nodemon started i can get some data(what i want like channels ari.channels.list(()=>...)), but if call is incoming i cant catch data realtime and i need reload server for grab data(like phone number). Thank you so much! P.s. stackoverflow dont work on this question...
I have trying fetching data from Asterisk (ARI) and can`t catch events. When nodemon started i can get some data(what i want like channels ari.channels.list(()=>...)), but if call is incoming i cant catch data realtime and i need reload server for grab data(like phone number). Thank you so much! P.s. stackoverflow dont work on this question...
Simple code:
server.js
`const http = require('http');
const app = require('./app');
const PORT = process.env.PORT || 3008;
http.createServer(app)
.listen(PORT, 'localhost', () => {
console.log(PORT)
})`
and second with logic app.js:
`const express = require('express');
const util = require('util');
require('dotenv').config();
const app = express();
const client = require('ari-client');
const config = {
host: process.env.ARI_HOST,
user: process.env.ARI_USER,
pass: process.env.ARI_PASS
}
client.connect(config.host, config.user, config.pass, client_loaded);
function client_loaded (err, ari) {
if (err) {
throw err; // program will crash if it fails to connect
}
//GRAB phone number
ari.channels.list((err, channels) => {
channels.forEach(channel => {
console.log(channel.caller.number)
})
})
//Events doesn`t work
ari.on('StasisStart', ()=> console.log('work pls;)'));
///.......
ari.start('hello');
}`
The text was updated successfully, but these errors were encountered: