Compare commits
1 Commits
master
...
d44aae0eff
Author | SHA1 | Date | |
---|---|---|---|
d44aae0eff |
15
README.md
15
README.md
@ -8,15 +8,14 @@
|
||||
# Required API endpoint/authentication variables
|
||||
SONAR_URL=https://instance.sonar.software/api/graphql
|
||||
SONAR_TOKEN=
|
||||
RINGCENTRAL_CLIENT_ID=
|
||||
RINGCENTRAL_CLIENT_SECRET=
|
||||
RINGCENTRAL_USERNAME=
|
||||
RINGCENTRAL_EXTENSION=
|
||||
RINGCENTRAL_PASSWORD=
|
||||
RC_APP_KEY=
|
||||
RC_APP_SECRET=
|
||||
RC_LOGIN_USERNAME=
|
||||
RC_LOGIN_EXT=
|
||||
RC_LOGIN_PASSWORD=
|
||||
|
||||
# Set to 'sandbox' to use RingCentral's sandbox API
|
||||
# Any other value will result in using RingCentral's production API
|
||||
RINGCENTRAL_SERVER=production
|
||||
# Set to any value to enable use of RingCentral's sandbox API
|
||||
RC_SANDBOX=
|
||||
|
||||
# The database to use
|
||||
# valid options: pg, sqlite
|
||||
|
27
src/index.ts
27
src/index.ts
@ -9,11 +9,11 @@ function checkEnv() {
|
||||
[
|
||||
"SONAR_URL",
|
||||
"SONAR_TOKEN",
|
||||
"RINGCENTRAL_CLIENT_ID",
|
||||
"RINGCENTRAL_CLIENT_SECRET",
|
||||
"RINGCENTRAL_USERNAME",
|
||||
"RINGCENTRAL_EXTENSION",
|
||||
"RINGCENTRAL_PASSWORD",
|
||||
"RC_APP_KEY",
|
||||
"RC_APP_SECRET",
|
||||
"RC_LOGIN_USERNAME",
|
||||
"RC_LOGIN_EXT",
|
||||
"RC_LOGIN_PASSWORD",
|
||||
"EXTENSION_TICKET_GROUPS",
|
||||
].forEach((env) => {
|
||||
if (process.env[env] === undefined) {
|
||||
@ -65,19 +65,16 @@ async function initSonar() {
|
||||
|
||||
async function initRingCentralSDK() {
|
||||
const sdk = new SDK({
|
||||
server:
|
||||
SDK.server[
|
||||
process.env.RINGCENTRAL_SERVER === "sandbox" ? "sandbox" : "production"
|
||||
],
|
||||
clientId: process.env.RINGCENTRAL_CLIENT_ID,
|
||||
clientSecret: process.env.RINGCENTRAL_CLIENT_SECRET,
|
||||
server: SDK.server[process.env.RC_SANDBOX ? "sandbox" : "production"],
|
||||
clientId: process.env.RC_APP_KEY,
|
||||
clientSecret: process.env.RC_APP_SECRET,
|
||||
});
|
||||
|
||||
const login = () =>
|
||||
sdk.login({
|
||||
username: process.env.RINGCENTRAL_USERNAME,
|
||||
extension: process.env.RINGCENTRAL_EXTENSION,
|
||||
password: process.env.RINGCENTRAL_PASSWORD,
|
||||
username: process.env.RC_LOGIN_USERNAME,
|
||||
extension: process.env.RC_LOGIN_EXT,
|
||||
password: process.env.RC_LOGIN_PASSWORD,
|
||||
});
|
||||
|
||||
if (DEBUG) {
|
||||
@ -123,7 +120,7 @@ async function main() {
|
||||
|
||||
["SIGINT", "SIGTERM", "SIGQUIT"].forEach((sig) => {
|
||||
process.on(sig, async () => {
|
||||
logger.info(`Caught ${sig}, shutting down...`);
|
||||
logger.info(`\nCaught ${sig}, shutting down...`);
|
||||
const results = await Promise.allSettled(
|
||||
intervals.map((interval) => interval.clear())
|
||||
);
|
||||
|
@ -340,7 +340,7 @@ export function ticketize(
|
||||
* @param firstRun whether this is the first run
|
||||
*/
|
||||
async function fetchAndStoreNewVoicemails(firstRun = false) {
|
||||
logger.verbose("Checking for new voicemails");
|
||||
logger.info("Checking for new voicemails");
|
||||
const extensions = await getValidRCExtensions();
|
||||
return Promise.all(
|
||||
extensions.map((extension) =>
|
||||
|
Reference in New Issue
Block a user