機械翻訳について

Amazonでの着信コールの受入

コール受入れ、拒否、切断、ミュートなどのすべてのコール関連操作は、Connect Streams APIで実行されます。 contact.accept()関数を使用してコールを受け入れることができます。

次のフロー図は、エージェントがFusionアプリケーションまたはメディア・ツールバー・アプリケーションからのコールを受け入れると実行される一連の操作を示しています:

Amazonでの着信コールの受け入れシナリオ。

  1. エージェントは、Fusionアプリケーションまたはメディア・ツールバー・アプリケーションからコールを受け入れることができます。 エージェントがFusionアプリケーションの「回答」ボタンをクリックすると、onToolbarInteractionCommandイベントがacceptのコマンドで起動されます。 エージェントがメディア・ツールバー・アプリケーションからのコールを受け入れると、サプライヤAPI acceptを直接コールできます。
  2. メディア・ツールバー・アプリケーションは、このイベントを受信し、イベントがコールを受け入れる場合は、コールを受け入れるAmazon Connect Streams APIがコールされます。
  3. CTIサプライヤがメディア・ツールバー・アプリケーションにコールが受諾されたことを通知すると、パートナ・アプリケーションはstartCommEventアクションを起動できます。
  4. Fusionアプリケーションがこのアクションを識別すると、一致した担当者とエンゲージメント・パネルが、スクリーン・ポップのFusion構成管理で構成されたルールに基づいて開きます。 詳細は、「スクリーン・ポップ・ページの構成」を参照してください。

受信イベント中に、次の例に示すように、contact.accept()関数を使用してコールを受け入れることができます:

public async acceptCall(): Promise<void> {
    this.contact.accept();
}

また、次の例のようにsubscribeContactEventsを更新します:

private subscribeContactEvents() {
    this.connect.contact((contact: any) => {
        this.contact = contact;
        this.eventId = contact.contactId;
        contact.onConnecting((contact: any) => {
            console.log("Contact onConnecting >", contact);
            const phoneNumber = contact.getActiveInitialConnection().getEndpoint().phoneNumber;
            this.integrationEventsHandler.incomingCallHandler(phoneNumber, this.eventId);
        });
        contact.onAccepted((contact: any) => {
            console.log("Contact onAccepted >", contact);
            this.integrationEventsHandler.outboundCallAcceptedHandler(this.eventId);
        });
        contact.onEnded(async (contact: any) => {
            console.log("Contact onEnded >", contact);
        });
        contact.onMissed((contact: any) => {
            console.log("Contact onMissed >", contact);
        });
    });
}

完全なコード

import { ICtiVendorHandler } from './ICtiVendorHandler';
import "amazon-connect-streams";
import { IntegrationEventsHandler } from '../integrationEventsHandler';
 
export class VendorHandler implements ICtiVendorHandler {
    private connect: any;
    private agent: any;
    private contact: any;
    private integrationEventsHandler: IntegrationEventsHandler;
    private eventId: string = '';
 
    constructor(integrationEventsHandler: IntegrationEventsHandler) {
        this.integrationEventsHandler = integrationEventsHandler;
        this.connect = (window as any)["connect"];
    }
    public async makeAgentAvailable(): Promise<void> {
        if (!this.agent) {
            this.init();
            this.subscribeForAmazonEvents();
            this.subscribeContactEvents();
        } else {
            let state = this.agent.getAgentStates()[0];
            this.agent.setState(state);
        }
    }
    public async makeAgentUnavailable(): Promise<void> {
        let state = this.agent.getAgentStates()[1];
        this.agent.setState(state);
    }
    public async makeOutboundCall(phoneNumber: string, eventId: string): Promise<void> {
    }
    public async acceptCall(): Promise<void> {
        this.contact.accept();
    }
    public async rejectCall(): Promise<void> {
    }
    public async hangupCall(): Promise<void> {
    }
 
    // Intialize Amazon connect ccp
    private init() {
        const containerDiv = document.getElementById("amazon-connect-cca-container");
        this.connect.core.initCCP(containerDiv, {
            ccpUrl: 'https://cti-amazon-connect-demo.my.connect.aws/ccp-v2', // REQUIRED
            loginPopup: true, // optional, defaults to `true`
            loginPopupAutoClose: true, // optional, defaults to `false`
            loginOptions: {
                // optional, if provided opens login in new window
                autoClose: true, // optional, defaults to `false`
                height: 600, // optional, defaults to 578
                width: 400, // optional, defaults to 433
                top: 0, // optional, defaults to 0
                left: 0, // optional, defaults to 0
            },
            region: "eu-west-2", // REQUIRED for `CHAT`, optional otherwise
            softphone: {
                // optional, defaults below apply if not provided
                allowFramedSoftphone: true, // optional, defaults to false
                disableRingtone: false, // optional, defaults to false
            },
            pageOptions: {
                //optional
                enableAudioDeviceSettings: false, //optional, defaults to 'false'
                enableVideoDeviceSettings: false, //optional, defaults to 'false'
                enablePhoneTypeSettings: true, //optional, defaults to 'true'
            },
            ccpAckTimeout: 5000, //optional, defaults to 3000 (ms)
            ccpSynTimeout: 3000, //optional, defaults to 1000 (ms)
            ccpLoadTimeout: 10000, //optional, defaults to 5000 (ms)
        });
    }
 
    private subscribeForAmazonEvents() {
        this.connect.agent((agent: any) => {
            this.agent = agent;
            let state = this.agent.getAgentStates()[0];
            this.agent.setState(state);
        });
    }
 
    private subscribeContactEvents() {
        this.connect.contact((contact: any) => {
            this.contact = contact;
            this.eventId = contact.contactId;
            contact.onConnecting((contact: any) => {
                console.log("Contact onConnecting >", contact);
                const phoneNumber = contact.getActiveInitialConnection().getEndpoint().phoneNumber;
                this.integrationEventsHandler.incomingCallHandler(phoneNumber, this.eventId);
            });
            contact.onAccepted((contact: any) => {
                console.log("Contact onAccepted >", contact);
                this.integrationEventsHandler.outboundCallAcceptedHandler(this.eventId);
            });
            contact.onEnded(async (contact: any) => {
                console.log("Contact onEnded >", contact);
            });
            contact.onMissed((contact: any) => {
                console.log("Contact onMissed >", contact);
            });
        });
    }
 
}

進捗の確認

Fusionアプリケーションにサインインし、メディア・ツールバーを開きます。 メディア・ツールバー・アプリケーションの「エージェント可用性」ボタンをクリックします。 インバウンド・コールを実行すると、Fusionアプリケーションとツールバー・ウィンドウの両方に着信コール通知が表示されます。 コールを受け入れ、新しい担当者が表示される画面ポップアップが表示されます。