twilio - After creating conference in Twilio Flex using voice API, how do I add hangup button call controls for each participant?
问题描述
Ive successfully been able to create a custom directory popout component on the right of flex in order to transfer to an external number. Ive used the Voice API through flex manually, and after doing so I notice that flex automatically adds most of the necessary controls to both the TaskDetailsPanel > ParticipantCanvas and TaskDetailsButtons. The only part missing is the hangup buttons, in ParticipantCanvas. How can I create them myself whil still perhaps using the controls provided by default if possible?
Also, I noticed that the mute button for participant 2 works, except it simply mutes the wrong participant, participant 1. (1 being first caller that is added to conference) I don't necessarily need the 'toggle' feature that the native flex has for warm transfer. I just the ability to mute, and remove participant(s) to start.
Here is the link for what its worth to the warm-transfer that was built into flex as of v1.11
https://www.twilio.com/docs/flex/warm-transfer-end-user-guide
I will eventually use this native transfer feature, but right now I need to transfer to external numbers only so I can roll out incrementally.
One approach I think might work is to listen for changes to voice task attributes, specifically the
task.attributes.conference
How can I watch for task attribute changes and respond accordingly?
I see I can invoke 'KickParticipant' as described here.
https://www.twilio.com/docs/flex/actions-framework
Just need to figure out how to add UI controls which have references to each participant other than myself (since there are 3 participants technically). Hopefully this is possible within the existing TaskDetailsPanel so that I dont have to completely rewrite both TaskDetailsPanel and perhaps TaskDetailsButtons.
UPDATE: I have been able to successfully create a twilio function which kicks the participant. Ill update when I have a working version. Still need to figure out how to add kick buttons for each participant since there can be more than 1?
解决方案
通过将它放在我的插件中,我现在能够找到解决方案。
const liveParticipantCountGreaterThan2 = (props) => {
return props.task && props.task.conference && props.task.conference.liveParticipantCount > 2;
};
flex.DefaultTaskChannels.Call.addedComponents = [{
target: "CallCanvasActions",
component: <CustomCancelTransferButton key="someKeyName" />,
options: { if: liveParticipantCountGreaterThan2 }
}];
然而,为每个参与者添加一个挂断按钮会很好,但也许是另一个迭代。
推荐阅读
- go - 如何访问 proto.EnumValueOptions 扩展值
- python - Python中其他字典值函数的最大键
- r - R中的感知器算法,该过程卡在第一个时期
- python - 在将点添加到节点之前是否预先制作了二元分区树?
- javascript - 滚动并向后滚动后,使计数器上的动画自行重复
- ios - 在不移动 ViewController 的情况下将数据推送到另一个 ViewController
- scala - 如何从列表中获取特定项目?
- python - 运行使用 pyinstaller 创建的 exe 时如何使“Kivy”用户界面持续存在
- bash - 在 sed 中替换 env var
- css - 子菜单在主菜单元素悬停时显示内容