Twilio - 将排队呼叫连接到代理 [英] Twilio - Connecting an Enqueued call to an Agent

查看:27
本文介绍了Twilio - 将排队呼叫连接到代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个电话系统,让呼叫者排队,理想情况下,系统会呼叫座席,然后座席接听并修改呼叫以桥接队列顶部.

I'm trying to create a phone system where a caller gets enqueued, and ideally, the system will then call out to an agent, who would then pickup and then modify the call to bridge the top of the queue.

到目前为止,我完成的是拨号循环,用户呼入,然后按顺序拨打座席,直到有人接听,或者让用户选择留下消息或在听到时保持在线状态它响了.以及带有保持音乐的简单入队.

What I've accomplished thus far is the dialing loop, where a user calls in, and it dials agents in sequence, until someone picks up, or gives the user the option to leave a message or stay on the line while hearing it ring. And a simple enqueue with hold music.

我似乎无法弄清楚如何将这两个系统结合起来.

I just can't seem to figure out how to combine these two systems.

我发现的最接近的是 这篇文章,很有帮助,但它掩盖了呼叫者入队后如何呼叫.

The closest I've found is this post, and it's helpful, but it glosses over how to call out once the caller is enqueued.

不幸的是,迄今为止我找到的唯一 Twilio 文档告诉我如何拨入队列,这不是我想要的.我希望该系统将呼叫者放入带有保留音乐的队列中,然后系统拨打座席号码,直到座席接听为止.

Unfortunately, the only Twilio documentation I've found thus far tells me how to dial into the queue, which isn't what I want out of this system. I want this system to place a caller in a queue with hold music, while the system then dials agent numbers until an agent picks up.

非常感谢任何和所有帮助.

Any and all help is much appreciated.

谢谢.

解决方案

index.php

这是调用者最初访问的通用 IVR 树.

This is the general IVR tree that the caller initially hits.

<Say>This hits your general IVR tree</Say>
<Say>As the last action, since the caller hasn't pressed anything and should be enqueued, redirect the caller to EnqueueCaller.php</Say>
<Redirect>./EnqueueCaller.php</Redirect>

由于 PHP 是一个预处理器,因此没有真正的方法可以使呼叫的拨号休眠或超时.IVR 树中的重定向是必要的,因此当用户仍在 IVR 树中时不会拨打代理.

Since PHP is a preprocessor, there's no real way to sleep or timeout the dialing of the call. The redirect in the IVR tree is necessary so the Agents aren't being dialed when the user is still in the IVR tree.

EnqueueCaller.php

这是一旦 IVR 树完成并且用户选择等待代理后呼叫者被重定向的地方.调用实际上发生在入队之前,因为 PHP 在读取 TwiML xml 之前首先加载(我认为?).但是由于呼叫时存在固有的延迟,因此呼叫者总是会在座席接听之前排队(我希望如此).

This is where the Caller gets redirected once the IVR tree has finished and the user has chosen to wait for an agent. The call actually happens before the Enqueue, since PHP loads first before the TwiML xml is read (I think?). But since there's an inherent delay when calling, the caller will always be enqueued before an agent can pick up (I hope).

<Enqueue waitUrl="wait_file.xml">name_of_queue</Enqueue>
$call = $client->account->calls->create($from, $to, "http://example.com/DialQueueHandler.php", array( "StatusCallback" => "DialQueueEventHandler.php" );

DialQueueHandler.php

这只是在代理和队列顶部的任何人之间架起桥梁.

This simply bridges the agent and whoevers at the top of the queue.

<Say>Connecting to caller now.</Say>
<Dial><Queue>name_of_queue</Queue></Dial>

DialQueueEventHandler.php

这个脚本包含了当被叫座席状态从 $_REQUEST['CallStatus'] 改变(应答、完成、启动、振铃)时发生的逻辑.就我而言,我从入队脚本中拨打了一个代理,在此脚本中,要么通过设置标志继续拨打下一个代理.

This script houses the logic for what happens when the dialed agent state changes (answered, complete, initiated, ringing) from $_REQUEST['CallStatus']. In my case, I dialed a single agent from the enqueue script, and in this script, either continue dialing the next agents via setting of a flag.

switch($_REQUEST['CallStatus'] {
    case 'answered':
    case 'completed':
        $next = false;
        break;
    default:
        $next = true;
        break;
}
if($next) { $call = $client->account->calls->create($from, $nextAgentNumber, "http://example.com/DialQueueHandler.php", array( "StatusCallback" => "DialQueueEventHandler.php?agentOffset=$num" ); } //same line from EnqueueCaller.php, and track where we are in agent array.

如果呼叫未接听或未完成,则拨打下一个座席.否则,当座席接听电话时,DialQueueHandler.php 文件会被命中,电话会被桥接.

If the call is not answered or completed, then dial the next agent. Otherwise when the call is picked up by an agent, the DialQueueHandler.php file gets hit and the call becomes bridged.

推荐答案

Jeff,我是来自 Twilio 的 Megan.

Jeff, I'm Megan from Twilio.

您可以利用 workflowSid 属性来配置一个 Task,该 Task 使用 TaskRouter 启动到可用代理的呼叫流.PHP 中有一个 TaskRouter quickstart,我认为鉴于您已经获得了到目前为止,您可以学习第三部分.

You can utilize the workflowSid attribute of <Enqueue> to configure a Task which initiates the call flow to an available agent using TaskRouter. There is a TaskRouter quickstart in PHP and I think given where you've gotten so far, you could pick up on the third part.

如果您觉得这有帮助,请告诉我.

Let me know if you find this to be helpful.

这篇关于Twilio - 将排队呼叫连接到代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆