///
import { EventEmitter } from 'events';
import { Extension, RingCentralCallControl } from 'ringcentral-call-control';
import RingCentralWebPhone from 'ringcentral-web-phone';
import { WebPhoneSession } from 'ringcentral-web-phone/lib/session';
import { ActiveCallInfo as ActiveCallInfoBase, InviteOptions } from 'ringcentral-web-phone/lib/userAgent';
import { SDK as RingCentralSDK } from '@ringcentral/sdk';
import { Subscriptions as RingCentralSubscriptions } from '@ringcentral/subscriptions';
import { Session } from './Session';
export interface MakeCallParams {
toNumber: string;
fromNumber?: string;
deviceId?: string;
type: 'webphone' | 'callControl';
homeCountryId?: string;
}
export declare enum events {
WEBPHONE_REGISTERED = "webphone-registered",
NEW = "new",
WEBPHONE_UNREGISTERED = "webphone-unregistered",
WEBPHONE_REGISTRATION_FAILED = "webphone-registration-failed",
CALL_CONTROL_READY = "call-control-ready",
CALL_CONTROL_NOTIFICATION_REDY = "call-control-notification-ready",
CALL_CONTROL_NOTIFICATION_ERROR = "call-control-notification-error",
WEBPHONE_INVITE = "webphone-invite",
WEBPHONE_INVITE_SENT = "webphone-invite-sent"
}
export interface ActiveCallInfo extends ActiveCallInfoBase {
telephonySessionId: string;
}
declare type ConstraintsMedia = boolean | {
deviceId: string;
};
export interface IPickUpCallParams {
sessionId: string;
toNumber: string;
fromNumber: string;
serverId: string;
telephonySessionId: string;
sessionDescriptionHandlerOptions: {
constraints?: {
audio: ConstraintsMedia;
video: ConstraintsMedia;
};
};
}
export declare const SUBSCRIPTION_CACHE_KEY = "rc-call-subscription-key";
export declare class RingCentralCall extends EventEmitter {
private _sdk;
private _subscriptions;
private _webphone;
private _callControl;
private _subscription;
private _subscriptionCacheKey;
private _subscriptionEventFilters;
private _sessions;
private _webphoneRegistered;
private _callControlNotificationReady;
private _enableSubscriptionHander;
private _userAgent;
private _callControlOptions;
private _webphoneInviteFromSDK;
constructor({ webphone, sdk, subscriptions, enableSubscriptionHander, userAgent, callControlOptions, }: {
webphone?: RingCentralWebPhone;
sdk: RingCentralSDK;
enableSubscriptionHander?: boolean;
subscriptions?: RingCentralSubscriptions;
userAgent?: String;
callControlOptions?: {
accountLevel?: boolean;
preloadSessions?: boolean;
preloadDevices?: boolean;
extensionInfo?: Extension;
};
});
makeCall(params: MakeCallParams): Promise;
pickupInboundCall({ sessionId, toNumber, fromNumber, serverId, telephonySessionId, sessionDescriptionHandlerOptions }: IPickUpCallParams): Promise;
_onNewWebPhoneSession(webphoneSession: any): Session;
_onWebPhoneSessionRing: (webphoneSession: WebPhoneSession) => void;
_onWebPhoneSessionInviteSent: (webphoneSession: WebPhoneSession) => void;
_onWebPhoneSessionInvite(webphoneSession: WebPhoneSession): Session;
_getSessionFromWebphoneSession(webphoneSession: WebPhoneSession): Session;
_getSessionFromTelephonySession(telephonySession: any): Session;
_onNewTelephonySession: (telephonySession: any, fromPreload?: boolean) => Session;
_onSessionDisconnected(session: any): void;
_onCallControlInitialized: () => void;
_onWebphoneRegistered: () => void;
_onWebphoneUnregistered: () => void;
_onWebphoneRegistrationFailed: (response: any, cause: any) => void;
setWebphone(webphone: any): void;
removeWebphone(): void;
_clearWebphone(): void;
initCallControl(sdk: RingCentralSDK): void;
_handleSubscription(): Promise;
_onSubscriptionCreateSuccess: () => void;
_onSubscriptionCreateError: () => void;
_onSubscriptionRenewFail: () => void;
_onSubscriptionAutomaticRenewError: () => void;
_clearSubscriptionHander(): void;
onNotificationEvent: (msg: any) => void;
loadSessions: (sessions: any) => Promise;
restoreSessions: (sessions: any) => Promise;
_clearCallControl(): void;
dispose(): Promise;
refreshDevices(): Promise;
/**
* Switch call voice transmission from other tabs or devices to current tab
*/
switchCall(telephonySessionId: string, options?: InviteOptions): Promise;
switchCallFromActiveCall(activeCall: ActiveCallInfo, options?: InviteOptions): Session;
get webphone(): RingCentralWebPhone;
get callControl(): RingCentralCallControl;
get sessions(): Session[];
get webphoneRegistered(): boolean;
get callControlReady(): boolean;
get callControlNotificationReady(): boolean;
get devices(): import("ringcentral-call-control").Device[];
}
export {};