Genesysでの着信コール通知の表示
メディア・ツールバー・アプリケーションは、マイクロサービスから公開された様々なイベントをリスニングします。
次のフロー図は、顧客がサービス・センターの電話番号を電話からダイヤルしたときに実行される一連の操作を示しています:
- Genesysサーバーは、
EventRinging
イベントをペイロードとしてEventData
とともに起動することで、マイクロサービスへの着信コールを通知します。EventData
ペイロードは、コール固有の詳細で構成されます。 - ツールバー・アプリケーションのwebソケット
onmessge
リスナーは、EventDataペイロードとともに、マイクロサービスから伝播されたこのEventRinging
イベントを受信します。 - newCommイベントは、ツールバー・アプリケーションから起動されます。
- Fusionアプリケーションは、このアクションを識別すると、担当者番号参照を実行し、アクション・レスポンスの担当者詳細を返します。
要件に合わせてデフォルトの逆参照を構成するには、「参照フィルタの作成」を参照してください。
-
最後に、Fusionアプリケーションは、ダイアログ・ボックスを介して着信コール・オファー通知についてエージェントに通知し、エージェントはコールに応答または拒否できます。
Genesysサーバーは、EventRingingメッセージを起動してマイクロサービスへの着信コールを通知
Genesysが着信コールを受信すると、EventRinging
メッセージがマイクロサービスを介してメディア・ツールバー・アプリケーションに伝播されます。 メッセージには、コール固有の詳細で構成されるEventData
ペイロードが含まれます。
メディア・ツールバー・アプリケーションでEventRingingメッセージを受信しました
EventRingin
gメッセージは、メディア・ツールバー・アプリケーションのwebsocketリスナーによって受信されます。
メディア・ツールバー・アプリケーションからnewCommEventアクションをコール
EventRinging
メッセージがwebソケットを介して受信されると、次の例に示すように、incomingCallHandler
ファンクションがintegrationEventsHandler.ts
ファイルからコールされます:
public webSocketOnMessage(event: MessageEvent): void {
const jsonMessage = JSON.parse(event.data);
console.log(jsonMessage);
if (jsonMessage.eventName === "EventRegistered") {
// Genesys notifies that the agent is ready
this.integrationEventsHandler.makeAgentAvailable();
} else if (jsonMessage.eventName === "EventRinging") {
// Show incoming call notification
this.integrationEventsHandler.incomingCallHandler(jsonMessage.ANI, jsonMessage.eventId);
VendorHandler.connectionId = jsonMessage.connectionId;
} else if (jsonMessage.eventName === "EventEstablished") {
// Genesys notifies that the call is accepted
} else if (jsonMessage.eventName === "EventReleased") {
// Genesys notifies that the call is disconnected
}
console.log("Message is received");
}
Fusionアプリケーションは、担当者番号参照を実行
newCommEvent
アクションがFusionアプリケーションによって受信されると、担当者番号参照が実行され、アクション・レスポンスの担当者詳細が返されます。 返されたデータを使用して、メディア・ツールバーのアプリケーションUIをレンダリングできます。
着信コール・オファー通知は、Fusionに表示されます
newCommEvent
を受信すると、Fusionアプリケーションにも、UIで着信コール・オファー通知が表示されます。
エージェントがコールを受け入れるか拒否
着信コール・オファー通知から、エージェントはコールに応答するか拒否できます。
完全なコード
import { ICtiVendorHandler } from './ICtiVendorHandler';
import { IntegrationEventsHandler } from '../integrationEventsHandler';
export class VendorHandler implements ICtiVendorHandler {
public static connectionId: string;
private static REST_ENDPOINT_URL: string = 'http://localhost:8087/genesys/events';
private static WS_ENDPOINT_URL: string = 'ws://localhost:8087/genesysWs';
private integrationEventsHandler: IntegrationEventsHandler;
constructor(integrationEventsHandler: IntegrationEventsHandler) {
this.integrationEventsHandler = integrationEventsHandler;
}
public async webSocketOnOpenHandler(): Promise<void> {
console.log("WebSocket opened");
const headers: Headers = (new Headers()) as Headers;
headers.set('Content-type', 'application/json');
const message: any = {
"type": "initialize"
};
const request: Request = new Request(`${VendorHandler.REST_ENDPOINT_URL}`, {
method: 'POST',
headers: headers,
body: JSON.stringify(message)
}) as Request;
await fetch(request);
}
public webSocketErrorHandler(error: any): void {
console.log("WebSocket error", error);
}
public webSocketCloseHandler(event: Event): void {
console.log("WebSocket is closed", event);
}
public webSocketOnMessage(event: MessageEvent): void {
const jsonMessage = JSON.parse(event.data);
console.log(jsonMessage);
if (jsonMessage.eventName === "EventRegistered") {
// Genesys notifies that the agent is ready
this.integrationEventsHandler.makeAgentAvailable();
} else if (jsonMessage.eventName === "EventRinging") {
// Show incoming call notification
this.integrationEventsHandler.incomingCallHandler(jsonMessage.ANI, jsonMessage.eventId);
VendorHandler.connectionId = jsonMessage.connectionId;
} else if (jsonMessage.eventName === "EventEstablished") {
// Genesys notifies that the call is accepted
} else if (jsonMessage.eventName === "EventReleased") {
// Genesys notifies that the call is disconnected
}
console.log("Message is received");
}
public async makeAgentAvailable(): Promise<void> {
let webSocket: WebSocket = new WebSocket(`${VendorHandler.WS_ENDPOINT_URL}`);
webSocket.onopen = this.webSocketOnOpenHandler.bind(this);
webSocket.onmessage = this.webSocketOnMessage.bind(this);
webSocket.onclose = this.webSocketCloseHandler.bind(this);
webSocket.onerror = this.webSocketErrorHandler.bind(this);
}
public async makeAgentUnavailable(): Promise<void> {
// TODO: call the vendor specific api to make the agent available
}
public async makeOutboundCall(phoneNumber: string, eventId: string): Promise<void> {
// TODO: call the vendor specific api to make the make an outbound call
}
public async acceptCall(): Promise<void> {
// TODO: call the vendor specific api to accept a call
}
public async rejectCall(): Promise<void> {
// TODO: call the vendor specific api to reject a call
}
public async hangupCall(): Promise<void> {
// TODO: call the vendor specific api to hangup a call
}
}
進捗の確認
Fusionアプリケーションにサインインし、メディア・ツールバーを開きます。 メディア・ツールバー・アプリケーションから「エージェント可用性」ボタンをクリックします。 次に、カスタマ・ケア番号へのコールを開始します。 メディア・ツールバーの状態がRINGING状態に変更され、メディア・ツールバー・アプリケーションに受信通知が表示されます。