Created
May 22, 2020 21:54
-
-
Save jfinstrom/d1b7c06fd00a053270ec590bacd6ce66 to your computer and use it in GitHub Desktop.
Concept of ARI connection with generators.....
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 ari = require("ari-client"); | |
const freepbx = new require("freepbx"); | |
const co = require("co"); | |
co(function*() { | |
var freepbxC = yield freepbx.connect(); | |
var ariC = yield ari.connect( | |
"http://localhost:8088/ari", | |
freepbxC.config.configs.FPBX_ARI_USER, | |
freepbxC.config.configs.FPBX_ARI_PASSWORD | |
); | |
yield ariC.start("my-app"); | |
return yield Promise.resolve({ freepbxC, ariC }); | |
}).then((ret) => { | |
const { ariC, freepbxC } = ret; | |
ariC.asterisk.getInfo().then((ret) => { | |
console.log(ret); | |
}); | |
}); |
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
{ "build":{ | |
"os":"Linux", | |
"kernel":"3.10.0-957.21.3.el7.x86_64", | |
"machine":"x86_64", | |
"options":"COMPILE_DOUBLE, OPTIONAL_API", | |
"date":"2019-09-19 20:49:31 UTC", | |
"user":"mockbuild" | |
}, | |
"system":{ | |
"version":"15.7.4", | |
"entity_id":"08:00:27:6b:aa:ad" | |
}, | |
"config":{ "name":"", | |
"default_language":"en", | |
"setid":{ | |
"user":"", | |
"group":"" | |
} | |
}, | |
"status":{ | |
"startup_time":"2020-05-22T11:02:27.446-0700", | |
"last_reload_time":"2020-05-22T11:02:27.446-0700" | |
} | |
} |
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
{ | |
"dependencies": { | |
"ari-client": "^2.2.0", | |
"co": "^4.6.0", | |
"freepbx": "^3.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment