fix sip cmd

merge-requests/21/merge
Matthew 2021-03-06 18:05:11 -05:00
parent 79dae33fac
commit e43ecb8146
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 14 additions and 8 deletions

View File

@ -23,7 +23,10 @@ export default class SIP extends Command {
const bridge = await this.client.pbx.ari.Bridge().create();
let receiver: Channel = this.client.pbx.ari.Channel();
const sender = await this.client.pbx.ari.channels.originate({
let sender: Channel = this.client.pbx.ari.Channel();
try {
sender = await this.client.pbx.ari.channels.originate({
endpoint: `PJSIP/${staff.extension}`,
extension: staff.extension,
callerId: 'LOC PBX AUTO OPERATOR <operator>',
@ -31,6 +34,9 @@ export default class SIP extends Command {
priority: 1,
app: 'cr-zero',
});
} catch {
return this.error(message.channel, 'Unable to dial your extension.');
}
sender.once('StasisStart', async () => {
await Misc.play(this.client.pbx, sender, 'sound:pls-hold-while-try');