import { Subject } from 'rxjs'; import { CallRB } from '../../models/call.model'; import { Service } from '../../services/service'; import type { TelephonyService } from '../../services/telephony/telephony.service'; export declare const WEBRTC_GATEWAY_SVC = "WebrtcGatewayService"; export declare enum MPCallState { Unknow = "Unknown", Free = "Free", WaitWebrtc = "WaitWebrtc", WaitTelephony = "WaitTelephony", CallOffer = "CallOffer", CallOnGoing = "CallOnGoing", CallActive = "CallActive", CallActiveNoWebMedia = "CallActiveNoWebMedia", TelCallReleasing = "TelCallReleasing", WebCallReleasing = "WebCallReleasing", RemoteControled = "RemoteControled", AnomalyCCS = "AnomalyCCS" } interface MediaPillarStates { mediaPillarConfigured: boolean; mediaPillarAlive: boolean; } interface MediaPillarConnection { keepAlive_TO: any; mediaPillarJidArray: string[]; rainbowPhoneNumber: string; remoteExtension: string; mediaPillarStatesPool: Partial; } interface MediaPillarCallContext { id: number; callState: MPCallState; callState_TO: any; waitTelephony_TO: any; isOutgoingCall3PCC: boolean; telephonyCallRefs: any[]; webrtcCallRef: any; previousCallConnectionId: string; previousCallStatus: string; updateContactFlag: boolean; getMediaPillarJid: any; onGoingCallMediaPillarJid: string; callOwnerForOxoMultiClientFlag: boolean; } export declare class WebrtcGatewayService extends Service { private portalURL; started: boolean; private listeners; private myContact; private mediaPillarContact; private mediaPillarConfigured; private mediaPillarAlive; private evtQueue; private SEM; private mediaPillarPollingSelected; private TO_transition; private TO_transition_long; private TO_NoWebMedia; private TO_NoWebMediaNotel; private TO_PILLAR_POLLING; private TO_waitTelephony; private mediaPillarKeepAliveSuspend; private keepAliveIterationCpt; mediaPillarConnection: MediaPillarConnection; mediaPillarCallContext: MediaPillarCallContext; mediaPillarCallContexts: MediaPillarCallContext[]; mediaPillarCallContextId: number; private isMixPstnWebRtcAllowed; private systemId; private displayName; private oxeBusyCapability; private systDeviceName; private startRetryTimer; private xmppConnectionSubscription; private subscriptions; rxSubject: Subject; private mainService; private xmppService; private logger; private authService; private profileService; private errorHelperService; private contactService; private eventService; private webrtcConfigAndUtils; private settingsService; private conversationService; private userService; private webrtcP2PService; telephonyService: TelephonyService; private supervisionService; static getInstance(): WebrtcGatewayService; static build(): WebrtcGatewayService; protected constructor(); /** * Start service method * @public * @async * @memberof WebrtcGatewayService */ start(): Promise; private telConfigChanged; stop(): void; private setMediaPillarConfigured; private onCallEventPreProcessing; /** * Method onCallEvent * @private * @memberof WebrtcGatewayService * Manage call events (but only if media pillar situation) * @param __event * @param call * @param infoEvt */ private onCallEvent; /** * Method processEvt * @private * @param callEvent * @param {object} Call call evt * @memberof WebrtcGatewayService * Event processing */ private processEvt; getOrCreateMediaPIllarCallContext(call: CallRB): MediaPillarCallContext | { id: number; callState: MPCallState; callState_TO: any; waitTelephony_TO: any; isOutgoingCall3PCC: boolean; telephonyCallRefs: any[]; webrtcCallRef: any; previousCallConnectionId: any; previousCallStatus: any; updateContactFlag: boolean; onGoingCallMediaPillarJid: string; callOwnerForOxoMultiClientFlag: boolean; getMediaPillarJid: () => string; }; getOrCreateContextForTelCall(call: CallRB): MediaPillarCallContext | { id: number; callState: MPCallState; callState_TO: any; waitTelephony_TO: any; isOutgoingCall3PCC: boolean; telephonyCallRefs: any[]; webrtcCallRef: any; previousCallConnectionId: any; previousCallStatus: any; updateContactFlag: boolean; onGoingCallMediaPillarJid: string; callOwnerForOxoMultiClientFlag: boolean; getMediaPillarJid: () => string; }; getOrCreateContextForWebrtcCallIncoming(call: CallRB): MediaPillarCallContext | { id: number; callState: MPCallState; callState_TO: any; waitTelephony_TO: any; isOutgoingCall3PCC: boolean; telephonyCallRefs: any[]; webrtcCallRef: any; previousCallConnectionId: any; previousCallStatus: any; updateContactFlag: boolean; onGoingCallMediaPillarJid: string; callOwnerForOxoMultiClientFlag: boolean; getMediaPillarJid: () => string; }; getContextForWebrtcCallExisting(call: CallRB): MediaPillarCallContext; createMediaPIllarCallContext(): { id: number; callState: MPCallState; callState_TO: any; waitTelephony_TO: any; isOutgoingCall3PCC: boolean; telephonyCallRefs: any[]; webrtcCallRef: any; previousCallConnectionId: any; previousCallStatus: any; updateContactFlag: boolean; onGoingCallMediaPillarJid: string; callOwnerForOxoMultiClientFlag: boolean; getMediaPillarJid: () => string; }; /** * Method releaseMediaPillarCallContext * @public * @memberof WebrtcGatewayService * Allow to free the media pillar call context (all field except mediaPillarJid) * but do not check the associated calls (tel and webrtc) * @param mediaPillarCallContext */ releaseMediaPillarCallContext(mediaPillarCallContext?: MediaPillarCallContext): void; /** * Method resetEvtAutomaton * @public * @memberof WebrtcGatewayService * Allow to reset the eventing automaton * linked to onCallEvent */ resetEvtAutomaton(): void; /** * Method stopCallStateTimeOut * @private * @memberof WebrtcGatewayService * @param mediaPillarCallContext */ private stopCallStateTimeOut; /** * Method stopWaitTelephonyTimeOut * @private * @memberof WebrtcGatewayService * @param mediaPillarCallContext */ private stopWaitTelephonyTimeOut; /** * Method onRemoteCtrlCall * @private * @memberof WebrtcGatewayService * Traitment of multi ressources case when other ressource manage the call * @param __event * @param call */ private onRemoteCtrlCall; /** * Method onRemoteReservedCall * @private * @memberof WebrtcGatewayService * Traitment of multi ressources case when other ressource reserve the call * @param __event * @param call */ private onRemoteReservedCall; /** * Method addTelCallRefs * @private * @memberof WebrtcGatewayService * add/push telcall ref in telephonyCallRefs if not already in * @param callRef */ private addTelCallRefs; /** * Method removeTelCallRefs * @private * @memberof WebrtcGatewayService * remove telcall ref in telephonyCallRefs * @param callRef */ private removeTelCallRefs; /** * Method putAsMasterTelCallRefs * @private * @memberof WebrtcGatewayService * The telephonyCallRefs[0] is intended to be the main telcall ref * usually the one which was handled as 1st to mediaPillaryse the call * @param callRef */ private putAsMasterTelCallRefs; /** * Method isMasterTelCallRefs * @public * @memberof WebrtcGatewayService * return true if callRef is the master telcallref * @param callRef */ isMasterTelCallRefs(callRef: any): boolean; /** * Method isInTelCallRefs * @private * @memberof WebrtcGatewayService * @returns true if callRef is in telephonyCallRefs * @param callRef */ private isInTelCallRefs; /** * Method replaceCallRefs * @private * @memberof WebrtcGatewayService * replace one callref with another * @param newCallRef * @param oldCallRef */ replaceCallRefs(newCallRef: any, oldCallRef: any): void; /** * Method automatonDefenseTimout * @private * @memberof WebrtcGatewayService * @param call * @param mediaPillarCallContext */ private automatonDefenseTimout; /** ======================================================================================== */ /** ==================================== TELEPHONY EVENT =================================== */ /** ======================================================================================== */ /** * Method onTelCallIncomming * @private * @param {call} call [required] the call * @memberof WebrtcGatewayService */ private onTelCallIncomming; /** * Method onTelCallDialling * @private * @param {call} call [required] the tel call * @memberof WebrtcGatewayService */ private onTelCallDialling; /** * Method onTelCallOutgoing * @private * @param {call} call [required] the tel call * @memberof WebrtcGatewayService */ private onTelCallOutgoing; /** * Method onTelCallActive * @private * @param {call} call [required] the tel call * @memberof WebrtcGatewayService */ private onTelCallActive; /** * Method onTelCallReleasing * @private * @param {call} call [required] the tel call * @memberof WebrtcGatewayService */ private onTelCallReleasing; /** ======================================================================================== */ /** ==================================== WEBRTC EVENT ==================================== */ /** ======================================================================================== */ /** * Method onWebrtcCallIncomming * @private * @param {call} call [required] the call * @memberof WebrtcGatewayService */ private onWebrtcCallIncomming; /** * Method onWebrtcCallConnecting * @private * @param {call} call [required] the webrtc call * @memberof WebrtcGatewayService */ private onWebrtcCallConnecting; /** * Method onWebrtcCallActive * @private * @param {call} call [required] the webrtc call * @memberof WebrtcGatewayService */ private onWebrtcCallActive; /** * Method onWebrtcCallAnswering * @private * @param {call} call [required] the webrtc call * @memberof WebrtcGatewayService */ private onWebrtcCallAnswering; /** * Method onWebrtcCallReleasing * @private * @param {call} call [required] the webrtc call * @memberof WebrtcGatewayService */ private onWebrtcCallReleasing; /** * Method waitTelephonyTimeout * @private * @memberof WebrtcGatewayService * No incoming telephony call received before timeout * We display an incoming call popup with the mediapillar webrtc call if no call exists on secondary device * @param call * @param mediaPillarCallContext */ private waitTelephonyTimeout; /** * Method releasePbxCallIfPbxConnectionDown * @private * @memberof WebrtcGatewayService * release the active pbx call if the pbx connection is down: this is called when we receive the session termination on the mp webrtc call */ private releasePbxCallIfPbxConnectionDown; /** * Method mediaPillarMakeCall1PCC * @private * @param {number} phoneNumber [required] the number to join by mediaPillar * @param {contact} contact [optional] the called contact if available * @returns {call} call : the 1PCC call object * @memberof WebrtcGatewayService * make a media pillar call 1PCC to the phoneNumber */ mediaPillarMakeCall1PCC(phoneNumber: any, contact: any): CallRB; /** * Method mediaPillarReleaseCall1PCC * @private * @param {call} call [required] the 1PCC call to release * @memberof WebrtcGatewayService * release media pillar call 1PCC previously initiated */ mediaPillarReleaseCall1PCC(call: any): void; /** * Method mediaPillarMakeCall * @private * @param {number} phoneNumber [required] the number to join by mediaPillar * @param contact * @param {contact} [optional] the called contact if available * @memberof WebrtcGatewayService * make a media pillar call to the phoneNumber */ mediaPillarMakeCall(phoneNumber: any, contact: any): void; /** * Method mediaPillarStartCall * @private * @param {call} call [required] the call to abort * @param {number} phoneNumber [required] the number to join by mediaPillar * @param {mediaPillarJid} mediaPillarJid [required] * @memberof WebrtcGatewayService */ private mediaPillarStartCall; /** * Method abortCall * @private * @param {call} call [required] the call to abort * @memberof WebrtcGatewayService */ private abortCall; /** * Method initiateMediaPillarCall * @private * @memberof WebrtcGatewayService * inspired by webrtcP2PServiceEventHandler.prototype.sendProposition * @param call */ private initiateMediaPillarCall; /** * Method registerOneMediaPillar * @private * @memberof WebrtcGatewayService * @param MPJid */ private registerOneMediaPillar; /** * Method registerMediaPillarPool * @private * @memberof WebrtcGatewayService */ private registerMediaPillarPool; /** * Method getMediaPillarData * @public * @returns {Promise} the mediaPillarJid data associated to the system & user * @memberof WebrtcGatewayService */ getMediaPillarData(): Promise; /** * Method mediaPillarKeepAlivePolling * @private * @param {cmd} cmd [required] the keep alive command * @param {timer} timer [required] the keep alive timer * @memberof WebrtcGatewayService */ private mediaPillarKeepAlivePolling; /** * Method mediaPillarUserSelectAndPolling * @public * @param {boolean} selected [required] selected, true if MP is selected in nomadic menu * @memberof WebrtcGatewayService */ mediaPillarUserSelectAndPolling(selected: any): void; /** * Method mediaPillarKeepAlive * @private * @memberof WebrtcGatewayService */ mediaPillarKeepAlive(): Promise; /** * Method forceMPpooling * @public * @memberof WebrtcGatewayService */ forceMPpooling(): void; /** * Method isMediaPillarPoolConfigured * @private * @returns {boolean} true if at least one MP is configured (or the specified one when jid is given as parameter) * @memberof WebrtcGatewayService * @param MPJid when null check all MPs for at least one configured else check only the given MP jid */ isMediaPillarPoolConfigured(MPJid: string): boolean; /** * Method isMediaPillarPoolAlive * @private * @returns {boolean} true if at least one MP is alive (or the specified one when jid is given as parameter) * @memberof WebrtcGatewayService * @param MPJid when null check all MPs for at least one alive else check only the given MP jid */ isMediaPillarPoolAlive(MPJid: string): boolean; /** * Method getAllMediaPillarJid * @public * @returns {string[]} all mediaPillar Jid * @memberof WebrtcGatewayService */ getAllMediaPillarJid(): string[]; /** * Method getDefaultMediaPillarJid * @public * @returns {string} the default mediaPillar Jid * @memberof WebrtcGatewayService */ getDefaultMediaPillarJid(): string; /** * Method getOnGoingMediaPillarJid * @public * @returns {string} the current mediaPillar Jid for active call (default otherwise) * @memberof WebrtcGatewayService */ getOnGoingMediaPillarJid(): string; /** * Method getMyMediaPillarRemoteExtension * @public * @returns {string} my mediaPillar remote extension ("" if not already obtained from server ) * @memberof WebrtcGatewayService */ getMyMediaPillarRemoteExtension(): string; /** * Method shouldUseMediaPillar * @public * @returns {boolean} true if media pillar should be used for PBX calls * @memberof WebrtcGatewayService */ shouldUseMediaPillar(): boolean; /** * Method isMediaPillarConfigured * @public * @returns {boolean} true if media pillar is configured for this user (configuration + rights) * @memberof WebrtcGatewayService */ isMediaPillarConfigured(): boolean; /** * Method isMediaPillarAvailable * @public * @returns {boolean} true if media pillar is available for this user (configuration + infra Up) * @memberof WebrtcGatewayService */ isMediaPillarAvailable(): boolean; /** * Method isMediaPillarUserSelected * @public * @returns {boolean} true if media pillar is selected (through Nomadic) for this user * @memberof WebrtcGatewayService */ isMediaPillarUserSelected(): boolean; /** * Method isMediaPillarJid * @public * @param {string} fromJid the from jid * @returns {boolean} true if it is the media pillar Jid * @memberof WebrtcGatewayService */ isMediaPillarJid(fromJid: string): boolean; /** * Method isMediaPillarCallCase * @public * @returns {boolean} true if Media pillar call * @memberof WebrtcGatewayService * check only the media pillar profile */ isMediaPillarCallCase(): boolean; /** * Method isMediaPillarSituation * @public * @param {object} call a call * @returns {boolean} true if Media pillar call situation * @memberof WebrtcGatewayService * In all cases test profile and Media pilar availability * If call provided check also that the call is linked to the centralized media pillar context * or if from jid is media pillar */ isMediaPillarCallSituation(call?: any): boolean; /** * Method mediaPillaryseTheCall * @public * @param {object} telephonyCall the telephonic call ref * @param {object} webrtcCall the web rtc call ref * @returns {string} operation status * @memberof WebrtcGatewayService */ mediaPillaryseTheCall(telephonyCall: any, webrtcCall: any): string; /** * Method getMediaPillarCallContext * @public * @returns {object} the media pillar call context * @memberof WebrtcGatewayService * Allow to link a call (tel or webrtc) to the media pillar call context * @param call */ getMediaPillarCallContext(call?: CallRB): any; /** * Method isMediaPillarOutgoingCall * @public * @param * @returns {boolean} true if outgoing 3PCC call * @memberof WebrtcGatewayService * return true if the mediaPillarCallContext is used for an outgoing 3PCC call */ isMediaPillarOutgoingCall(): boolean; /** * Method isMediaPillarActivableCall * @private * @param * @returns {boolean} true if * @memberof WebrtcGatewayService * return true if */ /** * Method isMediaPillarReleasableCall * @private * @param * @returns {boolean} true if * @memberof WebrtcGatewayService * return true if */ private isMediaPillarReleasableCall; /** * Method mediaPillarReleaseWebrtcCall * @public * @memberof WebrtcGatewayService * release only webrtc call (not tel part) * @param mediaPillarCallContext */ mediaPillarReleaseWebrtcCall(mediaPillarCallContext: MediaPillarCallContext): void; /** * Method timeOutCallActiveNoWebMedia * @public * @memberof WebrtcGatewayService * @param mediaPillarCallContext */ timeOutCallActiveNoWebMedia(mediaPillarCallContext: any): void; /** * Method mediaPillarCallTerminator * @public * @memberof WebrtcGatewayService * Deep release of media pillar context including release of associated calls * @param mediaPillarCallContext */ mediaPillarCallTerminator(mediaPillarCallContext?: MediaPillarCallContext): void; /** * @param jid */ private createMediaPillarContact; muteAudio(pbxCall: any, muted: any, conversation: any): void; private getActivePbxCall; /** * @param call */ answerCall(call: CallRB): Promise; actionOnActiveCallIfNecessary(incomingcall: CallRB): Promise; releaseCall(call: CallRB): void; private specialCaseNotComputerModeButMPCall; } export {}; //# sourceMappingURL=webrtcGateway.service.d.ts.map