Skip to content

Instantly share code, notes, and snippets.

@ipoddubny
Created October 6, 2017 16:13
Show Gist options
  • Save ipoddubny/451c5a99378a450c0d1265f0f31d35fd to your computer and use it in GitHub Desktop.
Save ipoddubny/451c5a99378a450c0d1265f0f31d35fd to your computer and use it in GitHub Desktop.
ari-hello-world
const client = require('ari-client');
const url = "http://localhost:8088";
const [username, password] = ["test", "test"];
async function main()
{
try {
const ari = await client.connect(url, username, password);
ari.start('app');
const channel = ari.Channel();
channel.on('StasisStart', (event, channel) => {
console.log('stasis start', event);
});
channel.on('ChannelDtmfReceived', (event, channel) => {
console.log('channel dtmf received', event);
});
channel.on('StasisStop', (event, channel) => {
ari.stop();
console.log('mojn mojn');
});
await channel.originate({
endpoint: 'PJSIP/1114',
app: 'app',
appArgs: 'hello,world'
/*
extension: "echo",
context:"from-internal",
priority: "1"
*/
});
} catch (e) {
console.log('err:', err);
}
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment