我在 Nodejs 应用程序中设置了一个星号模块,用于创建呼叫中心服务。我有一个 live_call_array 变量,它存储实时呼叫,例如:
[
{
caller : "somecaller",
queue : "somequeue",
agent : "someagent", }
]
星号事件“agentconnect”将具有相关信息的对象推送到数组中。另一个名为“agentcomplete”的星号事件从数组中拼接对象。在每个事件中,都会使用数组的有效负载触发 Websocket 函数。
示例:
this.ami.on('agentconnect', async (evt) => {
if (this.live_calls.length > 100) {
this.live_calls.shift();
}
const queues = await this.queuesService.findAll();
const matchingQueue = queues.find((queue) => queue.number === evt.queue);
const queueName = matchingQueue ? matchingQueue.name : 'Unknown';
const connectedExtension = evt.destchannel.split('/')[1].split(/[@-]/)[0];
const caller_in_live = this.live_calls.find(
(e) => e.caller == evt.calleridnum,
);
if (caller_in_live) {
this.live_calls.splice(this.live_calls.indexOf(caller_in_live), 1);
}
if (!caller_in_live) {
this.live_calls.unshift({
caller: evt.calleridnum,
queue: queueName,
extension: connectedExtension,
extensionName: evt.connectedlinename,
});
}
this.realtimeGateway.emitData('live-call-array', this.live_calls, [
Role.DASHBOARD,
]);
})
this.ami.on('agentcomplete', async (evt) => {
const caller_in_live = this.live_calls.find(
(e) => e.caller == evt.calleridnum,
);
if (caller_in_live) {
this.live_calls.splice(this.live_calls.indexOf(caller_in_live), 1);
}
this.realtimeGateway.emitData('live-call-array', this.live_calls, [
Role.DASHBOARD,
]);
通常这是可行的,但有时,在触发agentcomplete后,数组无法弹出对象,并且该对象永远保留在实时调用数组中。有什么解决方案或替代方法吗?
AMI 的所有这些功能都不能很好地发挥作用。
查看vicidial.org 拨号平台。他们每分钟都会重新询问多次。
只有100%工作的是CEL/CDR或外部计数。
附注在没有研究类似产品和丰富的 asterisk 经验的情况下编写基于 asterisk 的拨号器只是浪费时间。