startCommEvent

This is the action the user must publish when there's a call-accepted scenario and the real call connection needs to be established

For instance, when an agent clicks Accept on a call notification, the CTI integration code base would get notification for onAgentInteractionCommand Event with command as Accept, if it has a subscription added for the same.

Once it gets a notification for the call accept command, the CTI integration should publish a startCommEvent operation, which enables the call connection and also loads the interaction component for this call in UI. For outgoing event also, when the CTI gets an event notification for onOutgoingEvent, it needs to call the startCommEvent publish API to establish a outgoing call.

Note: This API is called for establishing the call connection. The inData parameter that must be passed for StartCommEvent operation request should be matching with the outData response we get in the newCommEvent operation response. Similarly the inData for StartCommEvent operation request, for an OutGoingCall event from fusion application must be the response for the OutGoingCallEvent notification.

Here's a Typescript example calling the startCommEvent operation.

/// <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(() => {
    })          

Here's a JavaScript example calling the startCommEvent operation.

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(() => {
})

EngagementContext to interact with UI Events Framework integrated objects

Here's a Typescript example for startCommEvent using UEF for subscribing to context open events from the tab context retrieved from the engagement context. From this tab context, active record can be retrieved using tabContext.getActiveRecord() method.

  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());
        });    

Here's a JavaScript example for startCommEvent using UEF for subscribing to context open events from the tab context retrieved from the engagement context. From this tab context, active record can be retrieved using tabContext.getActiveRecord() method.

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());
});