适用于虚拟呼叫中心的Twilio IVR

时间:2020-02-11 01:05:23

标签: twilio twilio-twiml

我需要为虚拟呼叫中心创建一些基本要求的Twilio IVR。

  1. 来电连接并要求呼叫者输入。
  2. 根据数字输入或语音输入,创建到座席的呼出电话。可以同时调用,也可以通过TaskRouter先进先出。
  3. 呼叫需要具有计算机检测功能或收集输入以确保座席连接。主要目的是避免应答计算机,因为虚拟代表可能会忽略由于个人VM接听而导致的呼叫。
  4. 如果没有代理在超时时间内连接,则将入站呼叫定向到语音邮件,该语音邮件被转录并通过电子邮件发送到群组电子邮件。

最初,我们通过OpenVBX提供了一个解决方案,尽管我不认为这是受支持的(并且Twilio平台有所改进,从而产生了新的解决方案)。我试图仅利用Twilio托管平台(StudioFlow)和功能。

这是当前通向TaskRouter的StudioFlow流。然后,TaskRouter工作流会回调我试图用来连接到排队的调用方的函数。

enter image description here

TaskRoute工作流回调为:/ assignment

exports.handler = function(context, event, callback) {
    const taskAttributes = JSON.parse(event.TaskAttributes),
        workerAttributes = JSON.parse(event.WorkerAttributes),
        client = context.getTwilioClient();

    client.calls.create({
        machineDetection: 'Enable',
        url: 'https://' + context.DOMAIN_NAME + '/agent-response?ReservationSid='+event.ReservationSid+'&TaskSid='+event.TaskSid,
        from: taskAttributes.called,
        to: workerAttributes.contact_uri
    });
};

然后/ agent-response

exports.handler = function(context, event, callback) {
    var status = '';
    console.log(JSON.stringify(event));

    if (event.AnsweredBy !== 'machine_start') {
        status = 'accepted';
    }

    if (status == 'accepted') {
        return callback(null, {
            'instruction': 'dequeue',
            'post_work_activity_sid': '<AVAILABLE-SID>'
        });
    } else {
        return callback(null,{
            'instruction': 'reject'
        });
    }
};

因此,当前,该呼叫通过计算机检测传给座席。我无法弄清楚如何使出站代理程序调用与排队的TaskRouter调用出队/连接。

是否有人1)建议如何更有效地做到这一点和/或2)如何连接到排队的入站sid?

谢谢!

1 个答案:

答案 0 :(得分:0)

这是一种查看我的修复的方法:

1)您不需要使用TaskRoute Workflow callback is: /assignment。您可以在“工作流程配置”页面上设置所有必需的东西: enter image description here

2)将呼叫排入正确的队列后,您将与座席一起使用座席(您可以详细了解here

worker.on("reservation.created", function (reservation) {

            reservation.conference(reservation.task.attributes.from, 

//在此处使用会议,但您可以改用出队或呼叫。

                "IDLE ActivitySid",
                undefined,
                `client:${Current Agent Client Key}`,
                undefined,
                {

一些呼叫配置设置

                }); 
        });

3)最后一步是使用Twilio.Device(您可以阅读完整的规格here)来通过以下方式获取并启动此调用:

Twilio.Device.incoming(function (conn) {
                // accept the incoming connection and start two-way audio
                conn.accept();
        });

如果您需要建立Twilio呼叫中心的更多支持,请告诉我。