/** * CallService service * @module Calls */ import { CallDestination, CallRB, MediaType, Call } from "../../models/call.model"; import { Service } from '../../services/service'; import { Conversation, RBEvent, User } from '../../models'; import { ConversationRB } from '../../models/conversation.model'; import { Subscription } from 'rxjs/internal/Subscription'; /** * @internal */ export declare const CALL_SVC = "CallService"; export interface PhoneCallAdditionalData { /** * @internal * The subject of the call (The subject is shown only if the distant user is using Rainbow) */ callSubject?: string; /** * This allows to transport custom data through the PBX / CSTA between the caller and the callee */ correlatorData?: string; /** * The same as correlatorData but allows to use non-editable chars */ correlatorDataHex?: string; /** * @internal * In case a user wants to dial a number from its call log which contains a calledNumber, this parameter has to be used. * It is then used in priority to initiate the make call. * ONLY USED if USER is parameter is present */ calledNumber?: string; } /** * Call Service interface */ export interface CallService { /** * Subscribe to updates from the call service, all events are of RBEvent * @param callback - The callback function that will be called when events are received * @param eventNames - Array of event to listen * @returns Returns RxJS Subscription */ subscribe(callback: (event: RBEvent) => any, eventNames?: CallServiceEvents | CallServiceEvents[]): Subscription; /** * Make a standard WebRTC call toward a Rainbow user. * A new conversation with the user will be created if not existing already. * @param user - The user we want to call * @param medias - Array containing the media to be used when setting up the new call * By default, only the AUDIO media type will be added to the new call. * @param message - A complementary message send to the remote party informing about the reason of the call */ makeWebCall(user: User, medias?: MediaType[], message?: string): Promise; /** * Make a PBX Phone call towards a number * A new conversation will be created if not existing already (even if it's with an external number) * @param number - The number we want to call; The format could be anything the user can type, it will be transformed in E164 format. * @param user - A user to whom this number belongs to (in case of Rainbow User) * @param additionalData - An additional data that can be send during the make call */ makePhoneCall(number: string, user?: User, additionalData?: PhoneCallAdditionalData): Promise; /** * Find and return the current active call (the last one found), or null otherwise. * This method retrieves the current call that is in an active state. * @returns The current active call object if one exists, or null if no active call is found */ getActiveCall(): Call | null; } /** * @internal * Call service events send to other services * Can listen to it via `CallService.subscribe()` API. */ export declare enum CallServiceEvents { /** * @eventProperty * This RBEvent is sent when a call is accepted * * **Event Data** * - **call**: The call that is accepted */ ON_CALL_ACCEPTED = "ON_CALL_ACCEPTED", /** * @eventProperty * An audio call only has been requested */ ON_MAKE_AUDIO_CALL = "ON_MAKE_AUDIO_CALL", /** * @eventProperty * A phone call has been requested */ ON_MAKE_PHONE_CALL = "ON_MAKE_PHONE_CALL", /** * @eventProperty * The file of the recording of the call is ready to be downloaded */ ON_CALL_FILE_RECORDER_READY = "ON_CALL_FILE_RECORDER_READY", /** * @eventProperty * The file descriptor of the recording of the call is ready */ ON_CALL_RECORDER_FILE_DESCRIPTOR_READY = "ON_CALL_RECORDER_FILE_DESCRIPTOR_READY" } /** * @internal */ export declare class CallServiceRB extends Service implements CallService { private webrtcP2PService; private telephonyService; private webrtcGatewayService; private conversationService; private bubbleService; private webConferenceService; private contactService; private xmppService; private profileService; private logger; private webrtcConfigAndUtils; private mainService; private i18n; private ccdAgentService; private rxSubject; private jingleSubscription; private xmppMessageHandler; static getInstance(): CallServiceRB; static build(): CallServiceRB; private constructor(); start(): Promise; stop(): Promise; private onConnectionStateChangeEvent; private attachHandlers; private onJingleMessage; /** * Subscribe to updates from the call service, all events are of RBEvent * @param callback - The callback function that will be called when events are received * @param eventNames - (optional) array of event to listen * @returns Returns RxJS Subscription */ subscribe(callback: (event: RBEvent) => any, eventNames?: CallServiceEvents | CallServiceEvents[]): Subscription; sendEvent(name: CallServiceEvents, data?: any): void; /** * Find and return the current active call (the last one found), or null otherwise. * This method retrieves the current call that is in an active state. * @returns The current active call object if one exists, or null if no active call is found */ getActiveCall(): Call | null; /** * Make a PBX Phone call towards a number * A new conversation will be created if not existing already (even if it's with an external number) * @param number - The number we want to call; The format could be anything the user can type, it will be transformed in E164 format. * @param user - A user to whom this number belongs to (in case of Rainbow User) * @param additionalData - An additional data that can be send during the make call */ makePhoneCall(number: string, user?: User, additionalData?: PhoneCallAdditionalData): Promise; /** * Make a standard WebRTC call toward a Rainbow user. * A new conversation with the user will be created if not existing already. * @param user - The user we want to call * @param medias - Array containing the media to be used when setting up the new call * By default, only the AUDIO media type will be added to the new call. * @param message - A complementary message send to the remote party informing about the reason of the call */ makeWebCall(user: User, medias?: MediaType[], message?: string): Promise; /** * Answer the call specified by its object. * This feature can be used only if the "answer" call capability is 'True'. * By default, the answer is done with AUDIO only. * If the 'withVideo' option is set to 'True' and the incoming call contains video, the answer will directly be done with audio and video. * @param call - The Call object that we want to answer * @param withVideo - Option to answer the call directly with audio and video. Default value is 'False' */ answerCall(call: CallRB, withVideo?: boolean): Promise; /** * Release the call specified by its object. * This method allows to decline an incoming call or stop an outgoing call. * This feature can be used only if the "release" call capability is 'True'. * @param call - The Call object that we want to decline or release. * @param reason - Reason for releasing the call (only for Web calls) */ releaseCall(call: CallRB, reason?: string): Promise; /** * Deflect the incoming call to the voice mail. * This feature can be used only if the "deflectToVoicemail" call capability is 'True'. * The 'deflect to voice mail' is only available on HYBRID telephony systems. * For Cloud telephony systems, the release call will follow the user configuration (which could be deflect or other). * @param call - The Call object that we want to deflect to the voice mail. */ deflectToVoicemail(call: CallRB): Promise; /** * @public * Deflect (redirect) the current incoming call to the specified phone number. * This feature can be used only if the "deflectToPhoneNumber" call capability is 'True'. * The list of number where we can deflect the incoming call is available in the 'deflectPhoneNumberDestinations' call capability. * @param call - The Call object that we want to deflect. * @param number - The phone number the call will be deflected to. */ deflectToPhoneNumber(call: CallRB, number: string): Promise; /** * Mute/Unmute the call specified by its object. * This feature can be used only if the "mute"/"unmute" call capability is 'True'. * @param call - The call * @param state - if true, the audio in the call will be muted */ muteCall(call: CallRB, state: boolean): void; /** * Add a media to the call specified by its object. * This feature can be used only for WebRTC Calls. * It is checked that the specified media can be added according to the associated call capability, i.e. * - The "addAudio" call capability for "AUDIO" media * - The "addVideo" call capability for "VIDEO" media * - The "addSharing" call capability for "SHARING" media * Check the call capabilities (addAudio, addVideo, addSharing) * @param call - The call object * @param mediaType - The type of media to add to the call. */ addMediaToCall(call: CallRB, media: MediaType): Promise; /** * Remove a media from the call specified by its object. * This feature can be used only for WebRTC Calls. * It is checked that the specified media can be removed according to the associated call capability, i.e. * - The "removeVideo" call capability for "VIDEO" media * - The "removeSharing" call capability for "SHARING" media * @param call - The call object * @param mediaType - The type of media to remove from the call. */ removeMediaFromCall(call: CallRB, media: MediaType): Promise; /** * Put on hold the call specified by its object. * This feature can be used only if the "hold" call capability is 'True'. * @param call - The call object */ holdCall(call: CallRB): Promise; /** * Retrieve from hold the call specified by its object. * This feature can be used only if the "retrieve" call capability is 'True'. * @param call - The call object */ retrieveCall(call: CallRB): Promise; private mergeCallsInProgress; /** * Merge the current 2 calls into one single. * This feature can be used only if the "mergeCalls" call capability is 'True'. * In case of standard HYBRID conference, the return value is null. A new telephony conference (conversation with "conference" call) will be created. * Otherwise, the result will be a web conference (in the form of a Rainbow bubble) that will be created in a new bubble conversation. * @returns Bubble Conversation with active web conference or null in case of hybrid 3-party conference call. */ mergeCalls(): Promise; /** * Add participants to the the current call. * The participants could be other Rainbow users or phone numbers (if the PBX system supports it). * This will result in a new conversation being created with web conference inside. The active call will be "transferred" to the bubble conference; * @param participants - The list of participants to be added to the call * @returns The new bubble conversation where the web conference is active */ addParticipantsToCall(call: CallRB, participants?: CallDestination[]): Promise; /** * Blind transfer the current call another destination which could be any rainbow user or phone number. * A blind transfer is when you transfer a call directly to another party without consulting with the person receiving the call. * In other words, there is no need to call the other party to make the transfer. * This feature is available only if the connected user is behind a Rainbow Hub telephone system. * @param call - The call to be transferred * @param destination - The destination of the blind transfer */ blindTransfer(call: CallRB, destination: CallDestination): Promise; /** * Transfer the current call to another call. * If the destination call is not specified, then the transfer will be done towards the current active call. * The list of destination calls to which we can deflect the call current is available in the 'transferCallDestinations' call capability. * @param call - The call to be transferred * @param destinationCall - The destination call to which we want to transfer the current call. */ transferToOtherCall(call: CallRB, destinationCall?: CallRB): Promise; /** * Send DTMF signal to the call specified by its object. * This feature can be used only if the "dtmf" call capability is 'True'. * @param call - The call object * @param dialKey - the DTMF character sequences to be send * Only the following characters are authorised: the ten single digits (0..9), the letters (a,b,c,d), the asterisk (*) and the pound sign (#). */ sendDTMF(call: CallRB, dialKey: string): void; attachStreamToHtmlElement(call: CallRB, elementId: string, mediaType: number, local?: boolean): void; attachStreamToExternalHtmlElement(call: CallRB, element: HTMLElement, mediaType: number, local?: boolean): void; /** * Call REFER management * Private APIs related to the webrtc transfer calls / transfer PBX to webrtc / ad-hoc conferences */ private onMessageReceived; private onJingleSessionRefer; private onCallBlindTransfer; private jingleP2POnSetLocalDescription; private jingleP2PUpdateStream; } //# sourceMappingURL=call.service.d.ts.map