import { ConnectionManager, TParametersConnection } from '../ConnectionManager'; import { ConnectionQueueManager } from '../ConnectionQueueManager'; export type TNetworkEventPolicy = 'ignore' | 'probe' | 'reconnect'; export type TNetworkProbe = () => Promise; export type TNetworkEventsHandlers = { onChange: () => void; onOnline: () => void; onOffline: () => void; }; export type INetworkEventsSubscriber = { subscribe: (handlers: TNetworkEventsHandlers) => void; unsubscribe: () => void; }; export interface IAutoConnectorOptions { checkTelephonyRequestInterval?: number; timeoutBetweenAttempts?: number; canRetryOnError?: (error: unknown) => boolean; telephonyFailPolicy?: Partial; networkEventsSubscriber?: INetworkEventsSubscriber; offlineGraceMs?: number; onNetworkChangePolicy?: TNetworkEventPolicy; onNetworkOnlinePolicy?: TNetworkEventPolicy; } export interface ITelephonyFailPolicyOptions { baseRetryDelayMs: number; maxRetryDelayMs: number; warningThreshold: number; criticalThreshold: number; } export type ISubscriber = { subscribe: (callback: (value: T) => void) => void; unsubscribe: () => void; }; export type TParametersCheckTelephony = Parameters[0]; type TOptionsConnect = Parameters[1]; export type TParametersAutoConnect = { getParameters: () => Promise; options?: TOptionsConnect; }; export type TAttemptStatus = { isInProgress: boolean; }; export type TAutoConnectStartSuccessResult = { isSuccess: true; reason: 'started'; }; export type TAutoConnectStartFailureResult = { isSuccess: false; reason: 'coalesced' | 'failed-all-attempts' | 'stop-attempts-by-error' | 'limit-reached-attempts' | 'unexpected'; error?: unknown; }; export type TAutoConnectStartResult = TAutoConnectStartSuccessResult | TAutoConnectStartFailureResult; export declare const RECONNECT_REASONS: { readonly START: "start"; readonly MANUAL_RESTART: "manual-restart"; readonly REGISTRATION_FAILED_OUT_OF_CALL: "registration-failed-out-of-call"; readonly TELEPHONY_DISCONNECTED: "telephony-disconnected"; readonly TELEPHONY_CHECK_FAILED: "telephony-check-failed"; /** Порог неуспешных периодических SIP OPTIONS (`PingServerRequester`) в `connectedMonitoring`. */ readonly PERIODIC_PING_FAILED: "periodic-ping-failed"; readonly NETWORK_ONLINE: "network-online"; readonly NETWORK_CHANGE: "network-change"; }; export type TReconnectReason = (typeof RECONNECT_REASONS)[keyof typeof RECONNECT_REASONS]; export declare const RECONNECT_REASON_PRIORITY: Record; export declare const getReconnectReasonPriority: (reason: TReconnectReason) => number; export {};