-
Notifications
You must be signed in to change notification settings - Fork 702
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { IncomingByeRequest, IncomingRequestMessage, ResponseOptions } from "../core"; | ||
/** | ||
* A request to end a {@link Session} (incoming BYE). | ||
* @public | ||
*/ | ||
export declare class Bye { | ||
private incomingByeRequest; | ||
/** @internal */ | ||
constructor(incomingByeRequest: IncomingByeRequest); | ||
/** Incoming BYE request message. */ | ||
get request(): IncomingRequestMessage; | ||
/** Accept the request. */ | ||
accept(options?: ResponseOptions): Promise<void>; | ||
/** Reject the request. */ | ||
reject(options?: ResponseOptions): Promise<void>; | ||
} | ||
//# sourceMappingURL=bye.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* A request to end a {@link Session} (incoming BYE). | ||
* @public | ||
*/ | ||
export class Bye { | ||
/** @internal */ | ||
constructor(incomingByeRequest) { | ||
this.incomingByeRequest = incomingByeRequest; | ||
} | ||
/** Incoming BYE request message. */ | ||
get request() { | ||
return this.incomingByeRequest.message; | ||
} | ||
/** Accept the request. */ | ||
accept(options) { | ||
this.incomingByeRequest.accept(options); | ||
return Promise.resolve(); | ||
} | ||
/** Reject the request. */ | ||
reject(options) { | ||
this.incomingByeRequest.reject(options); | ||
return Promise.resolve(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { IncomingInfoRequest } from "../core"; | ||
import { Info } from "./info"; | ||
/** | ||
* A DTMF signal (incoming INFO). | ||
* @deprecated Use `Info`. | ||
* @internal | ||
*/ | ||
export declare class DTMF extends Info { | ||
private _tone; | ||
private _duration; | ||
/** @internal */ | ||
constructor(incomingInfoRequest: IncomingInfoRequest, tone: string, duration: number); | ||
get tone(): string; | ||
get duration(): number; | ||
} | ||
//# sourceMappingURL=dtmf.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Info } from "./info"; | ||
/** | ||
* A DTMF signal (incoming INFO). | ||
* @deprecated Use `Info`. | ||
* @internal | ||
*/ | ||
export class DTMF extends Info { | ||
/** @internal */ | ||
constructor(incomingInfoRequest, tone, duration) { | ||
super(incomingInfoRequest); | ||
this._tone = tone; | ||
this._duration = duration; | ||
} | ||
get tone() { | ||
return this._tone; | ||
} | ||
get duration() { | ||
return this._duration; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/** | ||
* Generic observable. | ||
* @public | ||
*/ | ||
export interface Emitter<T> { | ||
/** | ||
* Sets up a function that will be called whenever the target changes. | ||
* @param listener - Callback function. | ||
* @param options - An options object that specifies characteristics about the listener. | ||
* If once true, indicates that the listener should be invoked at most once after being added. | ||
* If once true, the listener would be automatically removed when invoked. | ||
*/ | ||
addListener(listener: (data: T) => void, options?: { | ||
once?: boolean; | ||
}): void; | ||
/** | ||
* Removes from the listener previously registered with addListener. | ||
* @param listener - Callback function. | ||
*/ | ||
removeListener(listener: (data: T) => void): void; | ||
/** | ||
* Registers a listener. | ||
* @param listener - Callback function. | ||
* @deprecated Use addListener. | ||
*/ | ||
on(listener: (data: T) => void): void; | ||
/** | ||
* Unregisters a listener. | ||
* @param listener - Callback function. | ||
* @deprecated Use removeListener. | ||
*/ | ||
off(listener: (data: T) => void): void; | ||
/** | ||
* Registers a listener then unregisters the listener after one event emission. | ||
* @param listener - Callback function. | ||
* @deprecated Use addListener. | ||
*/ | ||
once(listener: (data: T) => void): void; | ||
} | ||
/** | ||
* An {@link Emitter} implementation. | ||
* @internal | ||
*/ | ||
export declare class EmitterImpl<T> implements Emitter<T> { | ||
private listeners; | ||
/** | ||
* Sets up a function that will be called whenever the target changes. | ||
* @param listener - Callback function. | ||
* @param options - An options object that specifies characteristics about the listener. | ||
* If once true, indicates that the listener should be invoked at most once after being added. | ||
* If once true, the listener would be automatically removed when invoked. | ||
*/ | ||
addListener(listener: (data: T) => void, options?: { | ||
once?: boolean; | ||
}): void; | ||
/** | ||
* Emit change. | ||
* @param data - Data to emit. | ||
*/ | ||
emit(data: T): void; | ||
/** | ||
* Removes all listeners previously registered with addListener. | ||
*/ | ||
removeAllListeners(): void; | ||
/** | ||
* Removes a listener previously registered with addListener. | ||
* @param listener - Callback function. | ||
*/ | ||
removeListener(listener: (data: T) => void): void; | ||
/** | ||
* Registers a listener. | ||
* @param listener - Callback function. | ||
* @deprecated Use addListener. | ||
*/ | ||
on(listener: (data: T) => void): void; | ||
/** | ||
* Unregisters a listener. | ||
* @param listener - Callback function. | ||
* @deprecated Use removeListener. | ||
*/ | ||
off(listener: (data: T) => void): void; | ||
/** | ||
* Registers a listener then unregisters the listener after one event emission. | ||
* @param listener - Callback function. | ||
* @deprecated Use addListener. | ||
*/ | ||
once(listener: (data: T) => void): void; | ||
} | ||
//# sourceMappingURL=emitter.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* An {@link Emitter} implementation. | ||
* @internal | ||
*/ | ||
export class EmitterImpl { | ||
constructor() { | ||
this.listeners = new Array(); | ||
} | ||
/** | ||
* Sets up a function that will be called whenever the target changes. | ||
* @param listener - Callback function. | ||
* @param options - An options object that specifies characteristics about the listener. | ||
* If once true, indicates that the listener should be invoked at most once after being added. | ||
* If once true, the listener would be automatically removed when invoked. | ||
*/ | ||
addListener(listener, options) { | ||
const onceWrapper = (data) => { | ||
this.removeListener(onceWrapper); | ||
listener(data); | ||
}; | ||
(options === null || options === void 0 ? void 0 : options.once) === true ? this.listeners.push(onceWrapper) : this.listeners.push(listener); | ||
} | ||
/** | ||
* Emit change. | ||
* @param data - Data to emit. | ||
*/ | ||
emit(data) { | ||
this.listeners.slice().forEach((listener) => listener(data)); | ||
} | ||
/** | ||
* Removes all listeners previously registered with addListener. | ||
*/ | ||
removeAllListeners() { | ||
this.listeners = []; | ||
} | ||
/** | ||
* Removes a listener previously registered with addListener. | ||
* @param listener - Callback function. | ||
*/ | ||
removeListener(listener) { | ||
this.listeners = this.listeners.filter((l) => l !== listener); | ||
} | ||
/** | ||
* Registers a listener. | ||
* @param listener - Callback function. | ||
* @deprecated Use addListener. | ||
*/ | ||
on(listener) { | ||
return this.addListener(listener); | ||
} | ||
/** | ||
* Unregisters a listener. | ||
* @param listener - Callback function. | ||
* @deprecated Use removeListener. | ||
*/ | ||
off(listener) { | ||
return this.removeListener(listener); | ||
} | ||
/** | ||
* Registers a listener then unregisters the listener after one event emission. | ||
* @param listener - Callback function. | ||
* @deprecated Use addListener. | ||
*/ | ||
once(listener) { | ||
return this.addListener(listener, { once: true }); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Exception } from "../../core"; | ||
/** | ||
* An exception indicating an unsupported content type prevented execution. | ||
* @public | ||
*/ | ||
export declare class ContentTypeUnsupportedError extends Exception { | ||
constructor(message?: string); | ||
} | ||
//# sourceMappingURL=content-type-unsupported.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Exception } from "../../core"; | ||
/** | ||
* An exception indicating an unsupported content type prevented execution. | ||
* @public | ||
*/ | ||
export class ContentTypeUnsupportedError extends Exception { | ||
constructor(message) { | ||
super(message ? message : "Unsupported content type."); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export * from "./content-type-unsupported"; | ||
export * from "./request-pending"; | ||
export * from "./session-description-handler"; | ||
export * from "./session-terminated"; | ||
export * from "./state-transition"; | ||
//# sourceMappingURL=index.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export * from "./content-type-unsupported"; | ||
export * from "./request-pending"; | ||
export * from "./session-description-handler"; | ||
export * from "./session-terminated"; | ||
export * from "./state-transition"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Exception } from "../../core"; | ||
/** | ||
* An exception indicating an outstanding prior request prevented execution. | ||
* @public | ||
*/ | ||
export declare class RequestPendingError extends Exception { | ||
/** @internal */ | ||
constructor(message?: string); | ||
} | ||
//# sourceMappingURL=request-pending.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Exception } from "../../core"; | ||
/** | ||
* An exception indicating an outstanding prior request prevented execution. | ||
* @public | ||
*/ | ||
export class RequestPendingError extends Exception { | ||
/** @internal */ | ||
constructor(message) { | ||
super(message ? message : "Request pending."); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Exception } from "../../core"; | ||
/** | ||
* An exception indicating a session description handler error occured. | ||
* @public | ||
*/ | ||
export declare class SessionDescriptionHandlerError extends Exception { | ||
constructor(message?: string); | ||
} | ||
//# sourceMappingURL=session-description-handler.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Exception } from "../../core"; | ||
/** | ||
* An exception indicating a session description handler error occured. | ||
* @public | ||
*/ | ||
export class SessionDescriptionHandlerError extends Exception { | ||
constructor(message) { | ||
super(message ? message : "Unspecified session description handler error."); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Exception } from "../../core"; | ||
/** | ||
* An exception indicating the session terminated before the action completed. | ||
* @public | ||
*/ | ||
export declare class SessionTerminatedError extends Exception { | ||
constructor(); | ||
} | ||
//# sourceMappingURL=session-terminated.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Exception } from "../../core"; | ||
/** | ||
* An exception indicating the session terminated before the action completed. | ||
* @public | ||
*/ | ||
export class SessionTerminatedError extends Exception { | ||
constructor() { | ||
super("The session has terminated."); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Exception } from "../../core"; | ||
/** | ||
* An exception indicating an invalid state transition error occured. | ||
* @public | ||
*/ | ||
export declare class StateTransitionError extends Exception { | ||
constructor(message?: string); | ||
} | ||
//# sourceMappingURL=state-transition.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Exception } from "../../core"; | ||
/** | ||
* An exception indicating an invalid state transition error occured. | ||
* @public | ||
*/ | ||
export class StateTransitionError extends Exception { | ||
constructor(message) { | ||
super(message ? message : "An error occurred during state transition."); | ||
} | ||
} |