gpt4 book ai didi

amazon-connect - 如何在 Amazon Connect 上自动更改代理状态?

转载 作者:行者123 更新时间:2023-12-03 19:12:02 25 4
gpt4 key购买 nike

我需要有关如何将 CCP 加载到网页并使用流 API 的分步说明。我需要 javascript 在 25 秒后将代理从“错过”变为“可用”。

目前我们必须手动更新状态,这对我们的用例没有意义。

我在 Amazon Connect 论坛上看到有人提到了一种自动将状态从“未命中”更改为“可用”的方法。

If you're embedding the CCP and using the Streams API, you can check the agent status on refresh, and if it's in Missed Call, set it to Available. I have this set to happen after 10 seconds.

最佳答案

对于嵌入式 CCP,您可以使用 Stream API 执行此操作。您可以订阅代理刷新状态,并在那里进行。

connect.agent(function (agent) {
logInfoMsg("Subscribing to events for agent " + agent.getName());
logInfoMsg("Agent is currently in status of " + agent.getStatus().name);
agent.onRefresh(handleAgentRefresh);
}

function handleAgentRefresh(agent) {
var status = agent.getStatus().name;
logInfoEvent("[agent.onRefresh] Agent data refreshed. Agent status is " + status);

//if status == Missed Call,
// set it to Available after 25 seconds."
//For example -but maybe this is not the best approach

if (status == "Missed") { //PLEASE review if "Missed" and "Availble" are proper codes
setTimeout(function () {
agent.setState("Available", {
success: function () {
logInfoEvent(" Agent is now Available");
},
failure: function (err) {
logInfoEvent("Couldn't change Agent status to Available. Maybe already in another call?");
}
});
;
}, 25000);
}
}

如果您还需要知道如何在网站中嵌入 CCP,您可以这样做
<!DOCTYPE html>
<meta charset="UTF-8">
<html>
<head>
<script type="text/javascript" src="amazon-connect-1.4.js"></script>
</head>
<!-- Add the call to init() as an onload so it will only run once the page is loaded -->
<body onload="init()">
<div id=containerDiv style="width: 400px;height: 800px;"></div>
<script type="text/javascript">
var instanceURL = "https://my-instance-domain.awsapps.com/connect/ccp-v2/";
// initialise the streams api
function init() {
// initialize the ccp
connect.core.initCCP(containerDiv, {
ccpUrl: instanceURL, // REQUIRED
loginPopup: true, // optional, defaults to `true`
region: "eu-central-1", // REQUIRED for `CHAT`, optional otherwise
softphone: { // optional
allowFramedSoftphone: true, // optional
disableRingtone: false, // optional
ringtoneUrl: "./ringtone.mp3" // optional
}
});
}
</script>
</body>
</html>

您可以在此处查看 StreamsAPI 的文档 https://github.com/amazon-connect/amazon-connect-streams/blob/master/Documentation.md

关于amazon-connect - 如何在 Amazon Connect 上自动更改代理状态?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61756180/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com