From fe2e4c56fc3f0bd140a02a1b1f2725f23b3132ca Mon Sep 17 00:00:00 2001 From: Matthew R Date: Mon, 30 Nov 2020 20:16:08 -0500 Subject: [PATCH] fixes --- src/commands/page.ts | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/commands/page.ts b/src/commands/page.ts index 5fc138f..36678bf 100644 --- a/src/commands/page.ts +++ b/src/commands/page.ts @@ -203,22 +203,26 @@ export default class Page extends Command { await fs.writeFile(`/tmp/${fileExtension}.ogg`, response.audioContent, 'binary'); await this.client.util.exec(`ffmpeg -i /tmp/${fileExtension}.ogg -af "highpass=f=300, lowpass=f=3400" -ar 8000 -ac 1 -ab 64k -f mulaw /tmp/${fileExtension}.ulaw`); - const chan = await this.client.util.ari.channels.originate({ - endpoint: `PJSIP/${member.extension}`, - extension: `${member.extension}`, - callerId: `LOC PBX - PAGE FRM ${senderNumber} <00>`, - context: 'from-internal', - priority: 1, - app: 'cr-zero', - }); - chan.on('StasisStart', async (event, channel) => { - const playback = await channel.play({ - media: `sound:/tmp/${fileExtension}`, - }, undefined); - playback.on('PlaybackFinished', () => { - channel.hangup(); + try { + const chan = await this.client.util.ari.channels.originate({ + endpoint: `PJSIP/${member.extension}`, + extension: `${member.extension}`, + callerId: `LOC PBX - PAGE FRM ${senderNumber} <00>`, + context: 'from-internal', + priority: 1, + app: 'cr-zero', }); - }); + chan.on('StasisStart', async (event, channel) => { + const playback = await channel.play({ + media: `sound:/tmp/${fileExtension}`, + }, undefined); + playback.on('PlaybackFinished', () => { + channel.hangup(); + }); + }); + } catch (err) { + this.client.util.signale.log(`Unable to Dial ${member.extension} | ${err}`); + } const recipient = this.mainGuild.members.get(recipientEntry.individualAssignID); const sender = this.mainGuild.members.get(senderEntry.individualAssignID);