このラボでは、Amazon Connect の CTR、エージェントイベントを Amazon S3 にストリーミング出力し、Amazon Athena を使用してクエリする方法を確認します。このソリューションは利用状況の可視化、分析ソリューションとの連携を行います。
このラボでは AWS CloudFormation を使い、環境のデプロイを行います。 こちらから yaml ファイルをダウンロードしてください。
このデプロイメントには、次のコンポーネントとアーキテクチャが含まれます(図の点線内が今回のデプロイ対象です)。
ctranalytics
等)。ctr
等)。AWS コンソールの Amazon Connect のインスタンス設定画面に戻り、Amazon Connect > [インスタンスエイリアス] > データストリーミング で以下の設定を行い、保存を押下します。
CloudFormation テンプレートによってデプロイされた Lambda 関数を、Amazon Connect のコンタクトフローから実行可能なリストに追加するため、以下の手順を実行します。
エージェントがコールに応答した時に、顧客ウィスパーフロー上で Lambda 関数を実行するために、以下の手順を実行します。
AgentArn
、タイプ:[エージェント]、属性:[ARN]InstanceCer
、タイプ:[システム]、属性:[インスタンス ARN]contactID
、タイプ:[システム]、属性:[初回のコンタクト ID]stepID
、値:DefaultCustomerWhisper
分析データ生成のため、Amazon Connect で取得した電話番号に対し、いくつかのインバウンド/アウトバウンドコールを行います。
AWS コンソールから Amazon Athena に移動します。クエリエディタを詳しく確認するをクリックします。
Athena のクエリ結果を保存する Amazon S3 バケットを指定します。Amazon Connect の初期設定時に作成したバケットを使用します。
Athena の保存したクエリから以下のクエリを実行してスキーマを作成します。これらは1度だけ実行します。
通話時間のクエリ(例:ctranalytics-ReconciliationReport)を実行すると、電話の使用状況のスナップショットとともに S3 バケットに出力します。実行時にエラーとなる場合は、クエリの56,57行を以下のように修正してください。
FROM "amazonconnect_ctr" ctr
LEFT JOIN "amazonconnect_apilogs" api
データ分析と確認を行うため、Athena でいくつかのサンプルクエリを実行してください。
SELECT ctr.queue.name as "Queue Name",
AVG(ctr.queue.duration) as "Average Hold Duration"
FROM "amazonconnect_ctr" ctr WHERE ctr.agent is null
AND ctr.queue is not null
AND ctr.queue.dequeuetimestamp = ctr.disconnectTimestamp
AND initiationmethod = 'INBOUND' GROUP BY ctr.queue.name;
SELECT
ctr.customerendpoint.address as "Customer Endpoint",
count(CASE WHEN ctr.initiationmethod = 'CALLBACK' THEN 1 END) as "Count of Callbacks",
count(CASE WHEN ctr.initiationmethod = 'CALLBACK' and ctr.agent is not NULL THEN 1 END) as "Count of Connected Callbacks",
count(CASE WHEN ctr.initiationmethod = 'OUTBOUND' THEN 1 END) as "Count of Outbound Contacts",
count(CASE WHEN ctr.initiationmethod = 'OUTBOUND' AND ctr.connectedtosystemtimestamp is not NULL THEN 1 END) as "Count of Connected Outbound Contacts",
count(CASE WHEN ctr.initiationmethod = 'INBOUND' THEN 1 END) as "Count of Inbound Contacts",
count(CASE WHEN ctr.initiationmethod = 'INBOUND' AND (ctr.agent is not NULL or ctr.transfercompletedtimestamp is not NULL) THEN 1 END) as "Count of Connected or Transferred Inbound Contacts",
count(CASE WHEN ctr.initiationmethod = 'API' THEN 1 END) as "Count of API Contacts",
count(ctr.customerendpoint.address) as "Total Contacts"
FROM "amazonconnect_ctr" ctr
WHERE ctr.customerendpoint.address is not null
AND ctr.customerendpoint.address <> '' GROUP BY ctr.customerendpoint.address;
SELECT
ctr.customerendpoint.address as "Customer Endpoint",
ctr.initiationmethod as CallInitiationMethod,
ctr.ContactId,
ctr.InitiationTimestamp as CallInitiationTimestamp,
ctr.Agent.ConnectedToAgentTimestamp as ConnectedToAgentTimestamp,
ctr.DisconnectTimestamp as DisconnectTimestamp,
ctr.ConnectedToSystemTimestamp as ConnectedToSystemTimestamp,
ctr.queue.enqueuetimestamp as EnqueuedTimestamp,
ctr.queue.dequeuetimestamp as DequeuedTimestamp,
ctr.transfercompletedtimestamp as ExternalTransferTimestamp,
CAST(to_unixtime(from_iso8601_timestamp(ctr.DisconnectTimestamp)) as
INTEGER)-CAST(to_unixtime(from_iso8601_timestamp(ctr.ConnectedToSystemTimestamp)) as
INTEGER) as CustomerCallLength_inSeconds
FROM "amazonconnect_ctr" ctr
ORDER BY ctr.InitiationTimestamp DESC
SELECT *, CAST((HandleRate.IVRHandleCount+HandleRate.AgentHandleCount) as
DECIMAL(16,2))/CAST(HandleRate.ContactCount as DECIMAL(16,2)) as
CaseHandleRate
FROM ( SELECT
ctr.queue.name as "QueueName",
SUM(CASE WHEN
(ctr.agent is null
AND ctr.agentconnectionattempts = 0
AND ctr.queue.dequeuetimestamp = ctr.disconnectTimestamp
AND ctr.attributes NOT LIKE '%"testattribute":"true"%')
THEN 1 ELSE 0 END) as "AbandonedCallCount",
SUM(CASE WHEN
(ctr.agent is null
AND ctr.queue.dequeuetimestamp = ctr.disconnectTimestamp
AND ctr.agentconnectionattempts > 0
AND ctr.attributes NOT LIKE '%"testattribute":"true"%')
THEN 1 ELSE 0 END) as "AbandonedCall-NoAgentAvailable-Count",
SUM( CASE WHEN
(ctr.agent is null
AND ctr.attributes LIKE '%"testattribute":"true"%')
-- Change this attribute to something in your flow that signifies the customer inquiry has been successfully closed
THEN 1 ELSE 0 END) as "IVRHandleCount",
SUM(CASE WHEN
(ctr.agent is not null)
THEN 1 ELSE 0 END) as "AgentHandleCount",
COUNT(ctr.contactId) as "ContactCount"
FROM "amazonconnect_ctr" ctr
WHERE initiationmethod = 'INBOUND'
GROUP BY ctr.queue.name ) as "HandleRate";
このラボでは、Amazon Connect の CTR、エージェントイベントをストリーミング出力する方法を確認しました。Amazon Athena のテーブルを Amazon Quicksight などの BI ソリューションで分析することで、より柔軟にコンタクトセンターの稼働状況を可視化することが可能になります。