change ari to ami in intercom
parent
139ef1f88d
commit
5dc02ac1b2
|
@ -33,6 +33,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google-cloud/text-to-speech": "^3.1.2",
|
"@google-cloud/text-to-speech": "^3.1.2",
|
||||||
"ari-client": "^2.2.0",
|
"ari-client": "^2.2.0",
|
||||||
|
"asterisk-manager": "^0.1.16",
|
||||||
"awesome-phonenumber": "^2.41.0",
|
"awesome-phonenumber": "^2.41.0",
|
||||||
"axios": "^0.19.2",
|
"axios": "^0.19.2",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
|
|
|
@ -20,28 +20,22 @@ export default class Intercom extends Command {
|
||||||
|
|
||||||
const recordingLocation = await MiscPBXActions.TTS(this.client.util.pbx, `Hello, this is the Library of Code Private Branch Exchange dialing you at the request of ${message.author.username} to deliver you a message. Playing message: ${args.slice(1).join(' ')}`, 'MALE');
|
const recordingLocation = await MiscPBXActions.TTS(this.client.util.pbx, `Hello, this is the Library of Code Private Branch Exchange dialing you at the request of ${message.author.username} to deliver you a message. Playing message: ${args.slice(1).join(' ')}`, 'MALE');
|
||||||
await loading.edit(`***${this.client.util.emojis.LOADING} Preparing to dial...***`);
|
await loading.edit(`***${this.client.util.emojis.LOADING} Preparing to dial...***`);
|
||||||
const channel = await this.client.util.ari.channels.originate({
|
this.client.util.ami.action({
|
||||||
endpoint: `PJSIP/${args[0]}`,
|
action: 'originate',
|
||||||
extension: args[0],
|
channel: `PJSIP/${args[0]}`,
|
||||||
callerId: `TTS PAGE FRM ${message.author.username} <00>`,
|
exten: args[0],
|
||||||
priority: 1,
|
context: 'from-internal',
|
||||||
app: 'cr-zero',
|
CallerID: `TTS PAGE FRM ${message.author.username} <*0>`,
|
||||||
variables: {
|
application: 'PlayBack',
|
||||||
|
priority: '1',
|
||||||
|
data: `beep&${recordingLocation}`,
|
||||||
|
variable: {
|
||||||
'PJSIP_HEADER(add,Call-Info)': '<uri>;answer-after=0',
|
'PJSIP_HEADER(add,Call-Info)': '<uri>;answer-after=0',
|
||||||
'PJSIP_HEADER(add,Alert-Info)': 'Ring Answer',
|
'PJSIP_HEADER(add,Alert-Info)': 'Ring Answer',
|
||||||
},
|
},
|
||||||
});
|
}, async (err: Error) => {
|
||||||
await loading.edit(`***${this.client.util.emojis.LOADING} Dialing call...***`);
|
if (err) return loading.edit(`***${this.client.util.emojis.ERROR} Failed to dial extension. | ${err}`);
|
||||||
channel.once('StasisStart', async (_, chan) => {
|
return loading.edit(`***${this.client.util.emojis.SUCCESS} Successfully queued intercom message to EXT \`${args[0]}\`.***`);
|
||||||
chan.answer();
|
|
||||||
await loading.edit(`***${this.client.util.emojis.LOADING} Answer received, starting playback...***`);
|
|
||||||
const playback = await chan.play({
|
|
||||||
media: ['sound:beep', recordingLocation],
|
|
||||||
}, undefined);
|
|
||||||
playback.once('PlaybackFinished', async () => {
|
|
||||||
chan.hangup();
|
|
||||||
await loading.edit(`***${this.client.util.emojis.LOADING} Successfully delivered intercom message to EXT \`${args[0]}\`.***`);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
return undefined;
|
return undefined;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { Client, Command, RichEmbed } from '../class';
|
||||||
import { version as erisVersion } from '../../node_modules/eris/package.json';
|
import { version as erisVersion } from '../../node_modules/eris/package.json';
|
||||||
import { version as mongooseVersion } from '../../node_modules/mongoose/package.json';
|
import { version as mongooseVersion } from '../../node_modules/mongoose/package.json';
|
||||||
import { version as ariVersion } from '../../node_modules/ari-client/package.json';
|
import { version as ariVersion } from '../../node_modules/ari-client/package.json';
|
||||||
|
import { version as amiVersion } from '../../node_modules/asterisk-manager/package.json';
|
||||||
import { version as nodeMailerVersion } from '../../node_modules/nodemailer/package.json';
|
import { version as nodeMailerVersion } from '../../node_modules/nodemailer/package.json';
|
||||||
import { version as ioredisVersion } from '../../node_modules/ioredis/package.json';
|
import { version as ioredisVersion } from '../../node_modules/ioredis/package.json';
|
||||||
import { version as stripeVersion } from '../../node_modules/stripe/package.json';
|
import { version as stripeVersion } from '../../node_modules/stripe/package.json';
|
||||||
|
@ -37,7 +38,7 @@ export default class SysInfo extends Command {
|
||||||
const asteriskInformation = await this.client.util.ari.asterisk.getInfo();
|
const asteriskInformation = await this.client.util.ari.asterisk.getInfo();
|
||||||
const redisVersion = await this.client.util.exec('redis-cli info | grep "redis_version"');
|
const redisVersion = await this.client.util.exec('redis-cli info | grep "redis_version"');
|
||||||
embed.addField('Database', `- [MongoDB v${mongoBuild.version}](https://www.mongodb.com/) + Documents: ${mongoDatabase.objects} | [Mongoose ODM v${mongooseVersion}](https://github.com/Automattic/mongoose)\n- CR Local Storage w/ GZIP Compression | Internal\n- [Redis v${redisVersion.split(':')[1]}](https://redis.io/) | [IORedis v${ioredisVersion}](https://github.com/luin/ioredis)`, true);
|
embed.addField('Database', `- [MongoDB v${mongoBuild.version}](https://www.mongodb.com/) + Documents: ${mongoDatabase.objects} | [Mongoose ODM v${mongooseVersion}](https://github.com/Automattic/mongoose)\n- CR Local Storage w/ GZIP Compression | Internal\n- [Redis v${redisVersion.split(':')[1]}](https://redis.io/) | [IORedis v${ioredisVersion}](https://github.com/luin/ioredis)`, true);
|
||||||
embed.addField('Telephony/PBX', `- [Asterisk v${asteriskInformation.system.version}](https://www.asterisk.org/) | [Asterisk ARI Node.js Client v${ariVersion}](https://github.com/asterisk/node-ari-client)`, true);
|
embed.addField('Telephony/PBX', `- [Asterisk v${asteriskInformation.system.version}](https://www.asterisk.org/) | [Asterisk ARI Node.js Client v${ariVersion}](https://github.com/asterisk/node-ari-client) & [Asterisk AMI Node.js Client v${amiVersion}](https://github.com/danjenkins/node-asterisk-ami)`, true);
|
||||||
embed.addField('Email', `- [Postfix SMTP v3.1.12](http://www.postfix.org/) | [Nodemailer v${nodeMailerVersion}](https://github.com/nodemailer/nodemailer)`, true);
|
embed.addField('Email', `- [Postfix SMTP v3.1.12](http://www.postfix.org/) | [Nodemailer v${nodeMailerVersion}](https://github.com/nodemailer/nodemailer)`, true);
|
||||||
embed.addField('Discord', `- N/A | [Eris v${erisVersion}](https://github.com/abalabahaha/eris)`, true);
|
embed.addField('Discord', `- N/A | [Eris v${erisVersion}](https://github.com/abalabahaha/eris)`, true);
|
||||||
embed.addField('Payments', `- [Stripe API](https://stripe.com/) | [Stripe Node.js Client v${stripeVersion}](https://github.com/stripe/stripe-node)`, true);
|
embed.addField('Payments', `- [Stripe API](https://stripe.com/) | [Stripe Node.js Client v${stripeVersion}](https://github.com/stripe/stripe-node)`, true);
|
||||||
|
|
|
@ -10,4 +10,5 @@ export declare interface Config {
|
||||||
stripeKey: string;
|
stripeKey: string;
|
||||||
stripeSubSigningSecret: string;
|
stripeSubSigningSecret: string;
|
||||||
ariClientKey: string;
|
ariClientKey: string;
|
||||||
|
amiClientKey: string;
|
||||||
}
|
}
|
||||||
|
|
14
yarn.lock
14
yarn.lock
|
@ -537,6 +537,11 @@ assert-plus@1.0.0, assert-plus@^1.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525"
|
resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525"
|
||||||
integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=
|
integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=
|
||||||
|
|
||||||
|
asterisk-manager@^0.1.16:
|
||||||
|
version "0.1.16"
|
||||||
|
resolved "https://registry.yarnpkg.com/asterisk-manager/-/asterisk-manager-0.1.16.tgz#4afc7d669e0ae86f24d2d18b7d91c9fa7044fc36"
|
||||||
|
integrity sha512-JxcgSutGhz6B2XtYkqkOI/sRH3hCGHmeNXuqNBw1JMtDMrRzpfuXB0keH4ouRtQPxdb2LIj83RWdR5uVnFim9A==
|
||||||
|
|
||||||
astral-regex@^1.0.0:
|
astral-regex@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9"
|
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9"
|
||||||
|
@ -611,7 +616,7 @@ bignumber.js@^9.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.1.tgz#8d7ba124c882bfd8e43260c67475518d0689e4e5"
|
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.1.tgz#8d7ba124c882bfd8e43260c67475518d0689e4e5"
|
||||||
integrity sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==
|
integrity sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==
|
||||||
|
|
||||||
bindings@^1.5.0:
|
bindings@1.5.0, bindings@^1.5.0:
|
||||||
version "1.5.0"
|
version "1.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df"
|
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df"
|
||||||
integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==
|
integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==
|
||||||
|
@ -3339,6 +3344,13 @@ saslprep@^1.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
sparse-bitfield "^3.0.3"
|
sparse-bitfield "^3.0.3"
|
||||||
|
|
||||||
|
sd-notify@^2.8.0:
|
||||||
|
version "2.8.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/sd-notify/-/sd-notify-2.8.0.tgz#a8e4477efac8426084e235d5d6a89f2af75571fd"
|
||||||
|
integrity sha512-e+D1v0Y6UzmqXcPlaTkHk1QMdqk36mF/jIYv5gwry/N2Tb8/UNnpfG6ktGLpeBOR6TCC5hPKgqA+0hTl9sm2tA==
|
||||||
|
dependencies:
|
||||||
|
bindings "1.5.0"
|
||||||
|
|
||||||
seed-random@^2.2.0:
|
seed-random@^2.2.0:
|
||||||
version "2.2.0"
|
version "2.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/seed-random/-/seed-random-2.2.0.tgz#2a9b19e250a817099231a5b99a4daf80b7fbed54"
|
resolved "https://registry.yarnpkg.com/seed-random/-/seed-random-2.2.0.tgz#2a9b19e250a817099231a5b99a4daf80b7fbed54"
|
||||||
|
|
Loading…
Reference in New Issue