简体   繁体   English

记录对 Twilio 号码和 Flex 的呼叫作为单个事件

[英]Recording calls to Twilio number and to Flex as a single event

I set up a Twilio Flow to collect some data from the caller, using "Gather" widgets and connect the caller to FLEX agent.我设置了一个 Twilio 流来从调用者那里收集一些数据,使用“收集”小部件并将调用者连接到 FLEX 代理。

Every time someone calls and gets connected, Twilio creates two separate records in its "Calls" log:每次有人呼叫并连接时,Twilio 都会在其“呼叫”日志中创建两条单独的记录:

  1. Call, initiated by the caller dialing Twilio number呼叫,由呼叫者拨打 Twilio 号码发起
  2. Call, initiated in the Flow, connecting the caller to FLEX agent呼叫,在 Flow 中发起,将呼叫者连接到 FLEX 代理

Neither of the logs give me data points that would allow me to connect these two calls and record them as a single event.这两个日志都没有给我数据点,可以让我连接这两个呼叫并将它们记录为单个事件。

I tried passing {{widgets.SendCallToAgent.TaskSid}} from the Twilio Flow as a parameter to the function that posts caller's input to the database, but it returned no value.我尝试将 Twilio 流中的{{widgets.SendCallToAgent.TaskSid}}作为参数传递给将调用者的输入发布到数据库的 function,但它没有返回任何值。

The only reference I could find that pointed me to the original call from the second call log was in the request URL under Request Inspector section of Call Details screen.我能找到的唯一指向第二个通话记录中的原始通话的参考是在通话详细信息屏幕的请求检查器部分下的请求 URL 中。 CustomerCallSid key points to the call SID of the initial call. CustomerCallSid键指向初始呼叫的呼叫 SID。

http://torch.taskrouter.prod.twilio.com:19610/CallEvents?WorkspaceSid=WSXXXXXXXXXX&TaskSid=WTXXXXXXXXXXd&ReservationSid=WRXXXXXXXXXX&WorkerSid=WKXXXXXXXXXX&CustomerCallSid=CAXXXXXXXXXX

Is there a way to get CustomerCallSid as a separate data point in the flow or in the logs?有没有办法将CustomerCallSid作为流或日志中的单独数据点?

Are there any other common data points to relate these two records?是否有任何其他共同的数据点来关联这两条记录?

Flex TSE here.弹性 TSE 在这里。

By default, Flex uses Conferences to connect calls between agents and callers.默认情况下,Flex 使用会议连接座席和呼叫者之间的呼叫。 Your original assessment is correct - the inbound callSID from the Studio Flow becomes the customer leg of the resulting conference.您的原始评估是正确的 - 来自 Studio Flow 的入站 callSID 成为最终会议的客户分支。 The other callSID you are seeing is the agent leg.您看到的另一个 callSID 是代理分支。 The Conference SID (CF####) will have the record of both callSIDs, or you could implement something like the following in a Flex Plugin . Conference SID (CF####) 将包含两个 callSID 的记录,或者您可以在Flex Plugin中实现类似以下的内容。

This code adds a listener to the complete-task event, and then updates the task attributes with the participant call SIDs此代码将侦听器添加到完成任务事件,然后使用参与者调用 SID 更新任务属性

init(flex, manager) {
 this.registerReducers(manager);

 flex.Actions.addListener("beforeCompleteTask", (payload, abortFunction) => {
 console.log("Custom Code to add Call Sids to the task attributes");
 let task = payload.task
 if(task.channelType == "voice"){
 if(task.conference && task.conference.participants.length > 0){
 let current_conf = {"sid": task.conference.conferenceSid}
 let participant_list = {}
 task.conference.participants.forEach(participant => {
 if(participant.isMyself){
 participant_list.worker = participant.callSid
            }
 else {
 participant_list.customer = participant.callSid
            }
 current_conf.participants = participant_list
          })
 task.attributes.conference = current_conf
        }
 else{
 console.error("Conference Object Not Found")
        }
      }
 payload.task.setAttributes(task.attributes)
    });
  }

If this is an approach that works for you, I do recommend testing thoroughly for compatibility with your own Flex instance.如果这是一种适合您的方法,我建议您彻底测试与您自己的 Flex 实例的兼容性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM