IPhoneContext

PhoneContext is the object that encapsulates the UIEF-provided telephonic events and act icons. This object can be derived from MultiChann elAdaptorContext object by calling getCommunicationChannelContext API by passing channelType as PHONE.

Here's the syntax:
getCommunicationChannelContext(channelType: McaChannels): Promise<ICommunicationChannelContext>; 
The following is a code sample in 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;  
  
The following is a code sample in Javascript.
const uiEventsFrameworkInstance = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
  const multiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
  const phoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE'); 

Functions

subscribe

Use this function toto listen to a PhoneContext supported Event. For example, onToolbarInteractionCommand, onDataUpdated, onOutgoingEvent.

The following sample shows the syntax:
subscribe: (requestObject: IEventRequest, callbackFunction: (response:IEventResponse) => void) => ISubscriptionContext;  
The following is a code sample in 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: IMcaEventRequest = uiEventsFrameworkInstance.requestHelper.createSubscriptionRequest('onDataUpdated') as IMcaEventRequest;
      request.setAppClassification('_appClassfication');
      phoneContext.subscribe(request, (response: IEventResponse) => {
          const dataUpdateResponse = response as IMcaOnDataUpdatedEventResponse;
          const data: IMcaOnDataUpdatedData = dataUpdateResponse.getResponseData();
      });
  
The following is a code sample in 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.createSubscriptionRequest('onDataUpdated') as IMcaEventRequest;
      request.setAppClassification('_appClassfication');
      phoneContext.subscribe(request, (response) => {
          const data = response.getResponseData();
      });

subscribeOnce

Use this function to listen only once to a PhoneContext supported Event. For example,. onToolbarInteractionCommand, onDataUpdated, onOutgoingEvent.

The following code sample shows the syntax:
subscribeOnce: (requestObject: IEventRequest, callbackFunction: (response:IEventResponse) => void) => ISubscriptionContext; 
The following is a code sample in 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: IMcaEventRequest = uiEventsFrameworkInstance.requestHelper.createSubscriptionRequest('onDataUpdated') as IMcaEventRequest;
      request.setAppClassification('_appClassfication');
      phoneContext.subscribeOnce(request, (response: IEventResponse) => {
          const dataUpdateResponse = response as IMcaOnDataUpdatedEventResponse;
          const data: IMcaOnDataUpdatedData = dataUpdateResponse.getResponseData();
      });
The following is a code sample in 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.createSubscriptionRequest('onDataUpdated') as IMcaEventRequest;
      request.setAppClassification('_appClassfication');
      phoneContext.subscribeOnce(request, (response) => {
          const data = response.getResponseData();
   });

publish

Use this function to publish a PhoneContext-supported operation on PhoneContext object..

The following code sample shows the syntax:
publish: (requestObject: IOperationRequest) => Promise<IOperationResponse>;
The following is a code sample in 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: IMcaNewCommEventActionRequest = uiEventsFrameworkInstance.requestHelper.createPublishRequest('newCommEvent') as IMcaNewCommEventActionRequest;
      request.setAppClassification('self.appClassfication');
      request.setLookupObject('lookup');
      request.setInputData(_inboundData);// _inboundData of type - IMcaNewCommInData
      const inData: IMcaInDataRequest = request.getInData();
      inData.setCallStatus('INCOMING');
      phoneContext.publish(request).then((response: IOperationResponse) => {
          const newCommResponse: IMcaNewComActionResponse = response as IMcaNewComActionResponse;
      }).catch(()=>{
  });
The following is a code sample in 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('newCommEvent');
      request.setAppClassification('self.appClassfication');
      request.setLookupObject('lookup');
      request.setInputData(_inboundData);// _inboundData of type - IMcaNewCommInData
      const inData = request.getInData();
      inData.setCallStatus('INCOMING');
      phoneContext.publish(request).then((response) => {       
   // custom code    
  }).catch(()=>{
  });

dispose

Use this function to remove all events subscribed subscribed on the PhoneContext object.
dispose:() => void;
The following code sample shows an example in 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;
      phoneContext.dispose(); 
The following code sample shows an example in JavaScript:
const uiEventsFrameworkInstance = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('appname', 'v1');
      const multiChannelAdaptorContext = await uiEventsFrameworkInstance.getMultiChannelAdaptorContext();
      const phoneContext = await multiChannelAdaptorContext.getCommunicationChannelContext('PHONE');
      phoneContext.dispose();

getSupportedEvents

Use this function to get all the supported events on the PhoneContext object.

The following code sample shows the syntax:
getSupportedEvents(): string[];
The following code sample shows example in 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 supportedEvents:string[] = phoneContext.getSupportedEvents();
The following code sample shows example in 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 supportedEvents = phoneContext.getSupportedEvents();

getSupportedActions

Use this function to get all the supported actions on the PhoneContext object.

The following code sample shows the syntax:
getSupportedActions(): string[];
The following code sample shows example in 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 supportedActions: string[] = phoneContext.getSupportedActions();    
The following code sample shows example for getSupportedActions in 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 supportedActions = phoneContext.getSupportedActions();  

getChannelType

Use this function to get the channel type in PhoneContext API requests. For example, ORA_SVC_PHONE.

The following sample shows the syntax:
getChannelType(): string;
The following is a code sample in 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 channelType: string = phoneContext.getChannelType(); 
  
The following is a code sample in 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 channelType = phoneContext.getChannelType(); 

getChannel

Use this function to get the type in context object. The value will be PHONE.

The following sample shows the syntax:
getChannel(): string;
The following is a code sample in 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 channel: string = phoneContext.getChannel();  // 'PHONE'
  
The following is a code sample in 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 channel = phoneContext.getChannel();    // 'PHONE'     

getFrameOrigin

Use this function to get the frame origin in PhoneContext object requests.

The following sample shows the syntax:
getFrameOrigin(): string;
The following is a code sample in 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 frameOrigin: string = phoneContext.getFrameOrigin();
  
The following is a code sample in 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 frameOrigin = phoneContext.getFrameOrigin();  

getToolbarName

Use this function to get the toolbar name in PhoneContext object request

The following sample shows the syntax:
getToolbarName(): string;
The following is a code sample in 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 toolbarName: string = phoneContext.getToolbarName(); 
  
The following is a code sample in 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 toolbarName = phoneContext.getToolbarName();    

getVersion

Use this function to get the version in PhoneContext object reques.

The following sample shows the syntax:
getVersion(): string;
The following is a code sample in 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 version: string = phoneContext.getVersion(); 
  
The following is a code sample in 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 version = phoneContext.getVersion();   

getEventSource

Use this function to get the event source in PhoneContext object requests.

The following sample shows the syntax:
getEventSource(): string;
The following is a code sample in 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 eventSource: string = phoneContext.getEventSource(); 
  
The following is a code sample in 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 eventSource = phoneContext.getEventSource();