import { AckableIncomingResponseWithSession, Body, IncomingAckRequest, IncomingByeRequest, IncomingInfoRequest, IncomingInviteRequest, IncomingNotifyRequest, IncomingPrackRequest, IncomingReferRequest, Logger, NameAddrHeader, OutgoingByeRequest, OutgoingInviteRequest, OutgoingRequestDelegate, RequestOptions, Session as SessionDialog } from "../core"; import { Emitter } from "./emitter"; import { Inviter } from "./inviter"; import { InviterOptions } from "./inviter-options"; import { Referrer } from "./referrer"; import { SessionDelegate } from "./session-delegate"; import { SessionDescriptionHandler, SessionDescriptionHandlerModifier, SessionDescriptionHandlerOptions } from "./session-description-handler"; import { SessionDescriptionHandlerFactory } from "./session-description-handler-factory"; import { SessionInviteOptions } from "./session-invite-options"; import { SessionOptions } from "./session-options"; import { SessionState } from "./session-state"; import { UserAgent } from "./user-agent"; /** * A session provides real time communication between one or more participants. * * @remarks * The transport behaves in a deterministic manner according to the * the state defined in {@link SessionState}. * @public */ export declare abstract class Session { /** * Property reserved for use by instance owner. * @defaultValue `undefined` */ data: any; /** * The session delegate. * @defaultValue `undefined` */ delegate: SessionDelegate | undefined; /** * The identity of the local user. */ abstract readonly localIdentity: NameAddrHeader; /** * The identity of the remote user. */ abstract readonly remoteIdentity: NameAddrHeader; /** @internal */ _contact: string | undefined; /** @internal */ _referral: Inviter | undefined; /** @internal */ _referrer: Referrer | undefined; /** @internal */ _replacee: Session | undefined; /** * Logger. */ protected abstract logger: Logger; /** @internal */ protected abstract _id: string; /** @internal */ protected _assertedIdentity: NameAddrHeader | undefined; /** @internal */ protected _dialog: SessionDialog | undefined; /** @internal */ protected _referralInviterOptions: InviterOptions | undefined; /** @internal */ protected _renderbody: string | undefined; /** @internal */ protected _rendertype: string | undefined; /** @internal */ protected _sessionDescriptionHandlerModifiers: Array | undefined; /** @internal */ protected _sessionDescriptionHandlerOptions: SessionDescriptionHandlerOptions | undefined; /** True if there is a re-INVITE request outstanding. */ private pendingReinvite; /** Dialogs session description handler. */ private _sessionDescriptionHandler; /** Session state. */ private _state; /** Session state emitter. */ private _stateEventEmitter; /** User agent. */ private _userAgent; /** * Constructor. * @param userAgent - User agent. See {@link UserAgent} for details. * @internal */ protected constructor(userAgent: UserAgent, options?: SessionOptions); /** * Destructor. */ dispose(): Promise; /** * The asserted identity of the remote user. */ readonly assertedIdentity: NameAddrHeader | undefined; /** * The confirmed session dialog. */ readonly dialog: SessionDialog | undefined; /** * A unique identifier for this session. */ readonly id: string; /** * The session being replace by this one. */ readonly replacee: Session | undefined; /** * Session description handler. * @remarks * If `this` is an instance of `Invitation`, * `sessionDescriptionHandler` will be defined when the session state changes to "established". * If `this` is an instance of `Inviter` and an offer was sent in the INVITE, * `sessionDescriptionHandler` will be defined when the session state changes to "establishing". * If `this` is an instance of `Inviter` and an offer was not sent in the INVITE, * `sessionDescriptionHandler` will be defined when the session state changes to "established". * Otherwise `undefined`. */ readonly sessionDescriptionHandler: SessionDescriptionHandler | undefined; /** * Session description handler factory. */ readonly sessionDescriptionHandlerFactory: SessionDescriptionHandlerFactory; /** * Session state. */ readonly state: SessionState; /** * Session state change emitter. */ readonly stateChange: Emitter; /** * The user agent. */ readonly userAgent: UserAgent; /** * Renegotiate the session. Sends a re-INVITE. * @param options - Options bucket. */ invite(options?: SessionInviteOptions): Promise; /** * Send REFER. * @param referrer - Referrer. * @param delegate - Request delegate. * @param options - Request options bucket. * @internal */ refer(referrer: Referrer, delegate?: OutgoingRequestDelegate, options?: RequestOptions): Promise; /** * Send BYE. * @param delegate - Request delegate. * @param options - Request options bucket. * @internal */ _bye(delegate?: OutgoingRequestDelegate, options?: RequestOptions): Promise; /** * Send INFO. * @param delegate - Request delegate. * @param options - Request options bucket. * @internal */ _info(delegate?: OutgoingRequestDelegate, options?: RequestOptions): Promise; /** * Send ACK and then BYE. There are unrecoverable errors which can occur * while handling dialog forming and in-dialog INVITE responses and when * they occur we ACK the response and send a BYE. * Note that the BYE is sent in the dialog associated with the response * which is not necessarily `this.dialog`. And, accordingly, the * session state is not transitioned to terminated and session is not closed. * @param inviteResponse - The response causing the error. * @param statusCode - Status code for he reason phrase. * @param reasonPhrase - Reason phrase for the BYE. * @internal */ protected ackAndBye(response: AckableIncomingResponseWithSession, statusCode?: number, reasonPhrase?: string): void; /** * Handle in dialog ACK request. * @internal */ protected onAckRequest(request: IncomingAckRequest): void; /** * Handle in dialog BYE request. * @internal */ protected onByeRequest(request: IncomingByeRequest): void; /** * Handle in dialog INFO request. * @internal */ protected onInfoRequest(request: IncomingInfoRequest): void; /** * Handle in dialog INVITE request. * @internal */ protected onInviteRequest(request: IncomingInviteRequest): void; /** * Handle in dialog NOTIFY request. * @internal */ protected onNotifyRequest(request: IncomingNotifyRequest): void; /** * Handle in dialog PRACK request. * @internal */ protected onPrackRequest(request: IncomingPrackRequest): void; /** * Handle in dialog REFER request. * @internal */ protected onReferRequest(request: IncomingReferRequest): void; /** * Generate an offer or answer for a response to an INVITE request. * If a remote offer was provided in the request, set the remote * description and get a local answer. If a remote offer was not * provided, generates a local offer. * @internal */ protected generateResponseOfferAnswer(request: IncomingInviteRequest, options: { sessionDescriptionHandlerOptions?: SessionDescriptionHandlerOptions; sessionDescriptionHandlerModifiers?: Array; }): Promise; /** * Generate an offer or answer for a response to an INVITE request * when a dialog (early or otherwise) has already been established. * This method may NOT be called if a dialog has yet to be established. * @internal */ protected generateResponseOfferAnswerInDialog(options: { sessionDescriptionHandlerOptions?: SessionDescriptionHandlerOptions; sessionDescriptionHandlerModifiers?: Array; }): Promise; /** * Get local offer. * @internal */ protected getOffer(options: { sessionDescriptionHandlerOptions?: SessionDescriptionHandlerOptions; sessionDescriptionHandlerModifiers?: Array; }): Promise; /** * Rollback local/remote offer. * @internal */ protected rollbackOffer(): Promise; /** * Set remote answer. * @internal */ protected setAnswer(answer: Body, options: { sessionDescriptionHandlerOptions?: SessionDescriptionHandlerOptions; sessionDescriptionHandlerModifiers?: Array; }): Promise; /** * Set remote offer and get local answer. * @internal */ protected setOfferAndGetAnswer(offer: Body, options: { sessionDescriptionHandlerOptions?: SessionDescriptionHandlerOptions; sessionDescriptionHandlerModifiers?: Array; }): Promise; /** * SDH for confirmed dialog. * @internal */ protected setSessionDescriptionHandler(sdh: SessionDescriptionHandler): void; /** * SDH for confirmed dialog. * @internal */ protected setupSessionDescriptionHandler(): SessionDescriptionHandler; /** * Transition session state. * @internal */ protected stateTransition(newState: SessionState): void; private getReasonHeaderValue; } //# sourceMappingURL=session.d.ts.map