29 lines
648 B
TypeScript
29 lines
648 B
TypeScript
import ARI from 'ari-client';
|
|
import { PBX } from '.';
|
|
|
|
export default class Handler {
|
|
public pbx: PBX;
|
|
|
|
public app: string;
|
|
|
|
public options: {
|
|
available?: boolean,
|
|
}
|
|
|
|
constructor(pbx: PBX) {
|
|
this.pbx = pbx;
|
|
this.options = {};
|
|
}
|
|
|
|
get client() { return this.pbx.client; }
|
|
|
|
public run(event: ARI.Event, channel: ARI.Channel): Promise<any> { return Promise.resolve(); }
|
|
|
|
public async unavailable(event: ARI.Event, channel: ARI.Channel) {
|
|
const playback = await channel.play({
|
|
media: 'sound:all-outgoing-lines-unavailable',
|
|
}, undefined);
|
|
playback.once('PlaybackFinished', () => channel.hangup());
|
|
}
|
|
}
|