startCommEvent
これは、コール受入済シナリオがあり、実際のコール接続を確立する必要がある場合にユーザーが公開する必要がある処理です
たとえば、エージェントがコール通知で「受理」をクリックすると、CTI統合コード・ベースは、同じサブスクリプションが追加されている場合、コマンドがAcceptのonAgentInteractionCommandイベントの通知を受け取ります。
コールacceptコマンドの通知を取得したら、CTI統合でstartCommEvent操作を公開する必要があります。これにより、コール接続が有効になり、このコールの相互作用コンポーネントがUIにロードされます。 送信イベントの場合も、CTIがonOutgoingEventのイベント通知を取得する場合は、startCommEventパブリッシュAPIをコールして送信コールを確立する必要があります。
startCommEvent操作をコールするTypescriptの例を次に示します。
/// <reference path="uiEventsFramework.d.ts"/>
const uiEventsFrameworkInstance: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
const multiChannelAdaptorContext: IMultiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
const phoneContext: IPhoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE') as IPhoneContext;
const request: IMcaStartCommEventActionRequest = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent') as IMcaStartCommEventActionRequest;
// You should set correct appClassification here. eg: ORA_SERVICE for Service App
// Refer https://docs.oracle.com/en/cloud/saas/fusion-service/fairs/application-classification-code.html#s20059918 for the list of supported app classifications
request.setAppClassification('appClassfication');
request.setEventId('1'); // Set the event ID here
// request.setInputData(_inboundData);// _inboundData of type - IMcaStartCommInData
const inData: IMcaStartCommInDataRequest = request.getInData();
phoneContext.publish(request).then((res: IOperationResponse) => {
const response: IMcaStartComActionResponse = res as IMcaStartComActionResponse;
}).catch(() => {
})
startCommEvent操作をコールするJavaScriptの例を次に示します。
const uiEventsFrameworkInstance = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
const multiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
const phoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE');
const request = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent');
// You should set correct appClassification here. eg: ORA_SERVICE for Service App
// Refer https://docs.oracle.com/en/cloud/saas/fusion-service/fairs/application-classification-code.html#s20059918 for the list of supported app classifications
request.setAppClassification('appClassfication');
// request.setInputData(_inboundData);// _inboundData of type - IMcaStartCommInData
const inData = request.getInData();
phoneContext.publish(request).then((res) => {
}).catch(() => {
})
UIイベント・フレームワーク統合オブジェクトと対話するためのEngagementContext
ここでは、エンゲージメント・コンテキストから取得されたタブ・コンテキストからコンテキスト・オープン・イベントをサブスクライブするためのUEFを使用したstartCommEventのTypescriptの例を示します。 このタブ・コンテキストから、tabContext.getActiveRecord()メソッドを使用してアクティブ・レコードを取得できます。
const uiEventsFrameworkInstance = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
const multiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
const phoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE');
const request: IMcaStartCommEventActionRequest = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent') as IMcaStartCommEventActionRequest;
// You should set correct appClassification here. eg: ORA_SERVICE for Service App
// Refer https://docs.oracle.com/en/cloud/saas/fusion-service/fairs/application-classification-code.html#s20059918 for the list of supported app classifications
request.setAppClassification('self.appClassfication');
request.setEventId('1'); // Set the event ID here
request.getInData().setInDataValueByAttribute("SVCMCA_SR_NUM", "SR00001"); // Pass a valid SR number here, so that this R will gets opened when startComm is fired
const response: IMcaStartComActionResponse = await phoneContext.publish(request) as IMcaStartComActionResponse;
const contactId: string = response.getResponseData().getEngagementContext().getEngagementData().getOutputData().getSVCMCA_CONTACT_NUMBER();
// get tab context from startComm event's engagementContext.
const engagementContext: IEngagementContext = response.getResponseData().getEngagementContext();
const tabContext: ITabContext = await engagementContext.getTabContext();
// listen to context open event from the tabContext retrieved from engagementContext
const coPayload = uiEventsFrameworkInstance.requestHelper.createSubscriptionRequest('cxEventBusContextOpenEvent') as IFieldValueChangeEventRequest;
tabContext.subscribe(coPayload, (coRes) => {
const coResponse = coRes as IContextOpenEventResponse;
console.log("Object Type: ", coResponse.getResponseData().getRecordType());
console.log("Object ID: ", coResponse.getResponseData().getRecordId());
});
ここでは、エンゲージメント・コンテキストから取得されたタブ・コンテキストからコンテキスト・オープン・イベントをサブスクライブするためのUEFを使用したstartCommEventのJavaScriptの例を示します。 このタブ・コンテキストから、tabContext.getActiveRecord()メソッドを使用してアクティブ・レコードを取得できます。
const uiEventsFrameworkInstance = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
const multiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
const phoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE');
const request = uiEventsFrameworkInstance.requestHelper.createPublishRequest('startCommEvent');
// You should set correct appClassification here. eg: ORA_SERVICE for Service App
// Refer to Application Classification Code for the list of supported app classifications
request.setAppClassification('self.appClassfication');
request.setEventId('1'); // Set the event ID here
request.getInData().setInDataValueByAttribute("SVCMCA_SR_NUM", "SR00001"); // Pass a valid SR number here, so that this R will gets opened when startComm is fired
const response = await phoneContext.publish(request);
const contactId = response.getResponseData().getEngagementContext().getEngagementData().getOutputData().getSVCMCA_CONTACT_NUMBER();
// get tab context from startComm event's engagementContext.
const engagementContext = response.getResponseData().getEngagementContext();
const tabContext = await engagementContext.getTabContext();
// listen to context open event from the tabContext retrieved from engagementContext
const coPayload = uiEventsFrameworkInstance.requestHelper.createSubscriptionRequest('cxEventBusContextOpenEvent');
tabContext.subscribe(coPayload, (coRes) => {
const coResponse = coRes;
console.log("Object Type: ", coResponse.getResponseData().getRecordType());
console.log("Object ID: ", coResponse.getResponseData().getRecordId());
});