Created
October 6, 2017 16:13
-
-
Save ipoddubny/451c5a99378a450c0d1265f0f31d35fd to your computer and use it in GitHub Desktop.
ari-hello-world
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 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