機械翻訳について

Fusionアプリケーションまたはツールバー・アプリケーションからの着信コールの切断または拒否

ここで、着信コールを却下したり、受け入れられたコールを切断する機能を設定します。

メディア・ツールバー・アプリケーションおよびFusionアプリケーションからのコールを拒否または切断できます。

タスクの概要

次に、必要な作業の概要を示します:
  • パート1: メディア・ツールバー・アプリケーションからの通話の拒否/切断
    1. 「切断」ボタンのクリック・イベントのイベント・ハンドラを追加します。
    2. callDisconnectedEventHandlerファンクションを定義します。
    3. integrationActionHandler.tsファイルでファンクションdisconnectCallおよびrejectCall を定義します。
    4. CTIサプライヤのSDKに基づいて、vendorHandler.tsファイルにrejectCall()関数およびhangupCall()関数を実装します。
    5. fusionHandler.tsファイルでファンクションnotifyCallDisconnectedToFusionを定義します。
  • 第2部: Fusionアプリケーションからのコールの拒否または切断
    1. 拒否および切断のケースをintegrationEventsHandler.tsファイルの listenToToolbarInteractionCommandsFromFusionに追加します。

パート1: メディア・ツールバー・アプリケーションからの通話の拒否または切断

エージェントが「拒否」または「切断」ボタンをクリックすると、コール・パネル・コンポーネントは、コンポーネントがロードされたコンテナに通知するイベントを起動します。 この場合は、コンポーネントがメディア・ツールバー・アプリケーションにロードされます。 拒否ボタンを選択すると、イベントも同様に起動されます。 コールがエージェントによって受け入れられる前にコールが切断されると、ペイロードdisconnectionStateがREJECTであるイベントが起動され、コールがエージェントによって受け入れられた後にコールが切断されると、ペイロードdisconnectionStateがWRAPUPであるイベントが起動されます。

コンテナから、これらのイベントを処理するためにイベント・ハンドラを定義する必要があります。

次の図は、エージェントがメディア・ツールバー・アプリケーションからの呼び出しを受け入れるときに実行される一連のアクションを示しています:

メディア・ツールバー・シナリオからのコールの拒否または切断の図。

エージェント・コール・フローは次のとおりです:

  1. エージェントは、メディア・ツールバー・アプリケーションから「拒否」ボタンをクリックします。
  2. パートナ・アプリケーションは、コールを拒否するようにCTIサプライヤに通知します。
  3. CTIサプライヤがパートナ・アプリケーションにコールが拒否されたことを通知すると、パートナ・アプリケーションは、事由をREJECTとしてcloseCommEvent処理を起動できます。
  4. Fusionアプリケーションでこのアクションが識別されると、コール・ダイアログ・ボックスはUIから破棄されます。

    次のステップでは、これをツールバー・アプリケーションに実装する方法を示します:

1. 切断ボタンのクリック・イベントのイベント・ハンドラを追加

次のindex.htmlファイルの例のように、「拒否」ボタンがクリックされたイベント・ハンドラをコール・パネル・コンポーネントに追加します:

<oj-bind-if test="[[callContext().state === 'RINGING' || callContext().state === 'ACCEPTED']]">
    <call-panel call-context="[[callContext]]"
                on-accept-button-clicked="[[ callAcceptedEventHandler ]]"
                on-disconnect-button-clicked="[[ callDisconnectedEventHandler ]]"></call-panel>
</oj-bind-if>

2. callDisconnectedEventHandler関数の定義

次の例に示すように、appController.tsファイルでcallDisconnectedEventHandler関数を定義します。 callDisconnectedEventHandler関数は、integrationActionHandlerで定義される他の2つの関数disconnectCallと、appController.ts自体で定義されるupdateCallPanelStateを内部的にコールします。

//.....
//.....
import "oj-c/button";
// ....
  
class RootViewModel {
    // ....
  
    constructor() {
        // ....
    };
 
    public callDisconnectedEventHandler: (event: any) => void = (event:  any): void => {
        if (event.detail.disconnectionState === 'WRAPUP') {
            this.integrationActionHandler.disconnectCall(this.callContext().eventId, event.detail.disconnectionState).then(() => {
                this.updateCallPanelState('DISCONNECTED');
            }).catch(() => {
                console.log("Error: Unable to accept the call.")
            });
        } else if (event.detail.disconnectionState === 'REJECT') {
            this.integrationActionHandler.rejectCall(this.callContext().eventId, event.detail.disconnectionState).then(() => {
                this.updateCallPanelState('DISCONNECTED');
            }).catch(() => {
                console.log("Error: Unable to accept the call.")
            });
        }
  }
 
    public updateCallPanelState = (state: string) => {
        this.callContext({...this.callContext(), state: state});
    }
 
    //...
  }
     
}

3. integrationActionHandler.tsファイルでファンクションdisconnectCallおよびrejectCallを定義

disconnectCallファンクションには、コールのハングアップまたは拒否をCTIサプライヤに通知するロジックが含まれています。また、closeCommEventアクションを起動してコールが切断されたことをFusionアプリケーションに通知するロジックも含まれています。

import { IntegrationEventsHandler } from "./integrationEventsHandler";
import { ICtiVendorHandler } from "./vendor/ICtiVendorHandler";
import { VendorHandler } from "./vendor/vendorHandler";
import { FusionHandler } from "./fusion/fusionHandler";
  
export class IntegrationActionHandler {
    private vendor: ICtiVendorHandler;
    private integrationEventsHandler: IntegrationEventsHandler;
  
    constructor(integrationEventsHandler: IntegrationEventsHandler) {
        this.vendor = new VendorHandler();
        this.integrationEventsHandler = integrationEventsHandler;
    }
  
    // .....
 
    public async disconnectCall(eventId: string, disconnectionState: string): Promise<void> {
        await this.vendor.rejectCall();
        await FusionHandler.notifyCallDisconnectedToFusion(eventId, disconnectionState);
    }
 
    public async rejectCall(eventId: string, disconnectionState: string): Promise<void> {
        await this.vendor.rejectCall();
        await FusionHandler.notifyCallDisconnectedToFusion(eventId, disconnectionState);
    }
 
}

4. CTIプロバイダのSDKに基づいて、vendorHandler.tsファイルにrejectCall()関数およびhangupCall()関数を実装

CTIサプライヤのドキュメントを参照して、API.The incomingCallNotificationHandler関数を使用してCTIアプリケーションに着信コールが通知される方法をそこからコールする必要があります。 vendorHandler.tsファイルにロジックを追加できます:

import { ICtiVendorHandler } from './ICtiVendorHandler';
   
export class VendorHandler implements ICtiVendorHandler {
    // ....
    public async rejectCall() {
        // TODO: call the vendor specific api to reject a call
    }
    public async hangupCall() {
        // TODO: call the vendor specific api to hangup a call
    }
    // ....
}

5. fusionHandler.tsファイルにファンクションnotifyCallDisconnectedToFusionファンクションを定義

fusionHandler.tsから、closeCommEventアクションを起動してコールが拒否されたことをFusionアプリケーションに通知します。

export class FusionHandler {
    // ...
 
    public static async notifyCallDisconnectedToFusion(eventId: string, disconnectionState: string): Promise<void> {
        let request: IMcaCloseCommEventActionRequest = FusionHandler.frameworkProvider.requestHelper.createPublishRequest('closeCommEvent') as IMcaCloseCommEventActionRequest;
        request.setReason(disconnectionState);
        const newCommResponse: any = FusionHandler.callToNewCommResponseMap.get(eventId);
        if (newCommResponse) {
            for (const property in newCommResponse) {
                request.getInData().setInDataValueByAttribute(property, newCommResponse[property]);
            }
        }
        //TODO pass unique identifier from your CTI data
        request.setEventId(eventId);
        request.setAppClassification(FusionHandler.appClassification);
        const operationResponse: IMcaCloseComActionResponse = await FusionHandler.phoneContext.publish(request) as IMcaCloseComActionResponse;
    }
     
    // ...
}

第2部: Fusionアプリケーションからの着信コールの拒否または切断

エージェントがFusionコール通知から「拒否」ボタンをクリックすると、そのコールがエージェントによって切断されたことがメディア・ツールバー・アプリケーションとCTIサプライヤに通知されます。 次の図は、エージェントがFusionアプリケーションからのコールを拒否したときに実行される一連のアクションを示しています:

Fusionアプリケーション・シナリオからの着信コールの拒否または切断。

  1. エージェントがFusionアプリケーションの「拒否」ボタンをクリックすると、onToolbarInteractionCommandイベントがコマンドrejectで起動されます。
  2. パートナ・アプリケーションは、このイベントを受信し、イベントがコールを拒否する場合、パートナ・アプリケーションは、CTIサプライヤにコールを拒否するように通知します。
  3. CTIサプライヤがパートナ・アプリケーションにコールが拒否されたことを通知すると、パートナ・アプリケーションは、事由をREJECTとして closeCommEvent処理を起動できます。
  4. Fusionアプリケーションでこのアクションが識別されると、コール・ダイアログ・ボックスはUIから破棄されます。

次の図は、エージェントがFusionアプリケーションから進行中のコールを切断したときに実行される一連のアクションを示しています:

コール終了シナリオ。

  1. エージェントがFusionアプリケーションの「コール終了」ボタンをクリックすると、onToolbarInteractionCommandイベントがコマンドdisconnectで起動されます。
  2. パートナ・アプリケーションは、このイベントを受信し、イベントがコールを切断する場合、パートナ・アプリケーションは、CTIサプライヤにコールの切断を通知します。
  3. CTIサプライヤがパートナ・アプリケーションにコールが切断されたことを通知すると、パートナ・アプリケーションは closeCommEventアクションを起動できます。
  4. Fusionアプリケーションは、このアクションを識別すると、UIにラップ・アップ・ウィンドウを表示します。

1: 拒否および切断のケースをintegrationEventsHandler.tsのlistenToToolbarInteractionCommandsFromFusionに追加

export class IntegrationEventsHandler {
    // ....
    public listenToToolbarInteractionCommandsFromFusion(command: string): void {
        switch (command) {
            case "accept":
                this.ctiAppViewModel.callAcceptedEventHandler(null);
                break;
            case "disconnect":
                this.ctiAppViewModel.callDisconnectedEventHandler({detail: {disconnectionState: "WRAPUP"}});
                break;
            case "reject":
                this.ctiAppViewModel.callDisconnectedEventHandler({detail: {disconnectionState: "REJECT"}});
                break;
        }
    }
    // ....
  
}

進捗の確認

前述のステップを完了したら、ojet serveを使用してアプリケーションを起動し、Fusionアプリケーションにサインインします。 メディア・ツールバーを開き、エージェントの空き状況ボタンをクリックして、エージェントを呼び出せるようにします。 次に、カスタマ・ケア番号へのコールを開始します。 メディア・ツールバー・アプリケーションおよびFusionウィンドウで、着信コール通知を受信します。 このコールは、メディア・ツールバー・アプリケーションまたはFusionアプリケーションから受け入れることができます。 コールを受け入れると、メディア・ツールバーの状態がACCEPTED状態に変更され、エンゲージメントがFusionアプリケーションで開きます。 このコールは、メディア・ツールバー・アプリケーションまたはFusionアプリケーションから切断できます。 コールを切断すると、メディア・ツールバーの状態がDISCONNECTED状態に変わります。