diff --git a/sipml/sipml.d.ts b/sipml/sipml.d.ts index d033565e7..b6c77d898 100644 --- a/sipml/sipml.d.ts +++ b/sipml/sipml.d.ts @@ -1,37 +1,37 @@ -// Type definitions for SIPml5 -// Project: http://sipml5.org/ -// Definitions by: A. Groenenboom -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare namespace SIPml { - class Event { - public description: string; - public type: string; - - public getContent(): Object; - public getContentString(): string; - public getContentType(): Object; - public getSipResponseCode(): number; - } - - class EventTarget { - public addEventListener(type: EventSubscriptionType, listener: (e: EventType) => void): void; - public removeEventListener(type: EventSubscriptionType): void; - } - - class Session extends EventTarget { - public accept(configuration?: Session.Configuration): number; - public getId(): number; - public getRemoteFriendlyName(): string; - public getRemoteUri(): string; - public reject(configuration?: Session.Configuration): number; - public setConfiguration(configuration?: Session.Configuration): void; - } - - export namespace Session { - /** - * Should be - * +// Type definitions for SIPml5 +// Project: http://sipml5.org/ +// Definitions by: A. Groenenboom +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare namespace SIPml { + class Event { + public description: string; + public type: string; + + public getContent(): Object; + public getContentString(): string; + public getContentType(): Object; + public getSipResponseCode(): number; + } + + class EventTarget { + public addEventListener(type: EventSubscriptionType, listener: (e: EventType) => void): void; + public removeEventListener(type: EventSubscriptionType): void; + } + + class Session extends EventTarget { + public accept(configuration?: Session.Configuration): number; + public getId(): number; + public getRemoteFriendlyName(): string; + public getRemoteUri(): string; + public reject(configuration?: Session.Configuration): number; + public setConfiguration(configuration?: Session.Configuration): void; + } + + export namespace Session { + /** + * Should be + * * "*" | * "connecting" | * "connected" | @@ -47,48 +47,48 @@ declare namespace SIPml { * "transport_error" | * "global_error" | * "message_error" | - * "webrtc_error" | - */ - type EventSubscriptionType = string; - - interface Configuration { - audio_remote?: HTMLElement; - bandwidth?: { audio: number; video: number; }; - events_listener?: { - events: EventSubscriptionType | EventSubscriptionType[]; - listener: (e: Session.Event) => void - }; - expires?: number; - from?: string; - sip_caps?: Object[]; - sip_headers?: Object[]; - video_local?: HTMLElement; - video_remote?: HTMLElement; - video_size?: { - minWidth?: number; - maxWidth?: number; - minHeight?: number; - maxHeight?: number; - }; - } - - class Call extends Session implements EventTarget { - public acceptTransfer(configuration?: Session.Configuration): number; - public call(to: string, configuration?: Session.Configuration): number; - public dtmf(): number; - public hangup(configuration?: Session.Configuration): number; - public hold(configuration?: Session.Configuration): number; - public info(): number; - public rejectTransfer(): number; - public resume(): number; - public transfer(): number; - } - - namespace Call { - /** - * Should be - * - * Session.EventSubscriptionType | + * "webrtc_error" | + */ + type EventSubscriptionType = string; + + interface Configuration { + audio_remote?: HTMLElement; + bandwidth?: { audio: number; video: number; }; + events_listener?: { + events: EventSubscriptionType | EventSubscriptionType[]; + listener: (e: Session.Event) => void + }; + expires?: number; + from?: string; + sip_caps?: Object[]; + sip_headers?: Object[]; + video_local?: HTMLElement; + video_remote?: HTMLElement; + video_size?: { + minWidth?: number; + maxWidth?: number; + minHeight?: number; + maxHeight?: number; + }; + } + + class Call extends Session implements EventTarget { + public acceptTransfer(configuration?: Session.Configuration): number; + public call(to: string, configuration?: Session.Configuration): number; + public dtmf(): number; + public hangup(configuration?: Session.Configuration): number; + public hold(configuration?: Session.Configuration): number; + public info(): number; + public rejectTransfer(): number; + public resume(): number; + public transfer(): number; + } + + namespace Call { + /** + * Should be + * + * Session.EventSubscriptionType | * "m_early_media" | * "m_local_hold_ok" | * "m_local_hold_nok" | @@ -115,57 +115,57 @@ declare namespace SIPml { * "i_ect_notify" | * "i_ect_requested " | * "m_bfcp_info" | - * "i_info" | - */ - type EventSubscriptionType = Session.EventSubscriptionType; - } - - class Event extends SIPml.Event { - public session: Session; - - public getTransferDestinationFriendlyName(): string; - } - - class Message extends Session { - public send(to: string, content?: any, contentType?: string, configuration?: Session.Configuration): number; - } - - class Publish extends Session { - public publish(content?: any, contentType?: string, configuration?: Session.Configuration): number; - - public unpublish(configuration?: Session.Configuration): void; - } - - class Registration extends Session { - public register(configuration?: Session.Configuration): void; - public unregister(configuration?: Session.Configuration): void; - } - - class Subscribe extends Session implements EventTarget { - public subscribe(to: string, configuration?: Session.Configuration): number; - public unsubscribe(configuration?: Session.Configuration): number; - } - - namespace Subscribe { - /** - * Should be - * - * Session.EventSubscriptionType | "i_notify" - */ - type EventSubscriptionType = Session.EventSubscriptionType; - } - } - - class Stack extends EventTarget { - public constructor(configuration?: Stack.Configuration); - public setConfiguration(configuration: Stack.Configuration): number; - public newSession(type: string, configuration?: Session.Configuration): any; - public start(): number; - public stop(timeout?: number): number; - } - - export namespace Stack { - /** + * "i_info" | + */ + type EventSubscriptionType = Session.EventSubscriptionType; + } + + class Event extends SIPml.Event { + public session: Session; + + public getTransferDestinationFriendlyName(): string; + } + + class Message extends Session { + public send(to: string, content?: any, contentType?: string, configuration?: Session.Configuration): number; + } + + class Publish extends Session { + public publish(content?: any, contentType?: string, configuration?: Session.Configuration): number; + + public unpublish(configuration?: Session.Configuration): void; + } + + class Registration extends Session { + public register(configuration?: Session.Configuration): void; + public unregister(configuration?: Session.Configuration): void; + } + + class Subscribe extends Session implements EventTarget { + public subscribe(to: string, configuration?: Session.Configuration): number; + public unsubscribe(configuration?: Session.Configuration): number; + } + + namespace Subscribe { + /** + * Should be + * + * Session.EventSubscriptionType | "i_notify" + */ + type EventSubscriptionType = Session.EventSubscriptionType; + } + } + + class Stack extends EventTarget { + public constructor(configuration?: Stack.Configuration); + public setConfiguration(configuration: Stack.Configuration): number; + public newSession(type: string, configuration?: Session.Configuration): any; + public start(): number; + public stop(timeout?: number): number; + } + + export namespace Stack { + /** * Should be * * "*" | @@ -179,74 +179,74 @@ declare namespace SIPml { * "i_new_message" | * "m_permission_requested" | * "m_permission_accepted" | - * "m_permission_refused"; - */ - type EventSubscriptionType = string; - - interface Configuration { - bandwidth?: { audio: number; video: number; }; - display_name?: string; - enable_click2call?: boolean; - enable_early_ims?: boolean; - enable_media_stream_cache?: boolean; - enable_rtcweb_breaker?: boolean; - events_listener?: { - events: EventSubscriptionType | EventSubscriptionType[]; - listener: (e: Stack.Event) => void - }; - ice_servers?: Object[]; - impi?: string; - impu?: string; - outbound_proxy_url?: string; - password?: string; - realm?: string; - sip_headers?: Object[]; - video_size?: { - minWidth?: number; - maxWidth?: number; - minHeight?: number; - maxHeight?: number; - }; - websocket_proxy_url?: string; - } - - class Event extends SIPml.Event { - public description: string; - public newSession: Session; - public type: string; - } - } - - function getNavigatorFriendlyName(): string; - - function getNavigatorVersion(): string; - - function getSystemFriendlyName(): string; - - function getWebRtc4AllVersion(): string; - - function haveMediaStream(): boolean; - - function init(readyCallback?: (e:any) => any, errorCallback?: (e:any) => any): boolean; - - function isInitialized(): boolean; - - function isNavigatorOutdated(): boolean; - - function isReady(): boolean; - - function isScreenShareSupported(): boolean; - - function isWebRtcPluginOutdated(): boolean; - - function isWebRtc4AllSupported(): boolean; - - function isWebRtcSupported(): boolean; - - function isWebSocketSupported(): boolean; - - function setDebugLevel(level: string): void; - - function setWebRtcType(type: string): boolean; -} - + * "m_permission_refused"; + */ + type EventSubscriptionType = string; + + interface Configuration { + bandwidth?: { audio: number; video: number; }; + display_name?: string; + enable_click2call?: boolean; + enable_early_ims?: boolean; + enable_media_stream_cache?: boolean; + enable_rtcweb_breaker?: boolean; + events_listener?: { + events: EventSubscriptionType | EventSubscriptionType[]; + listener: (e: Stack.Event) => void + }; + ice_servers?: Object[]; + impi?: string; + impu?: string; + outbound_proxy_url?: string; + password?: string; + realm?: string; + sip_headers?: Object[]; + video_size?: { + minWidth?: number; + maxWidth?: number; + minHeight?: number; + maxHeight?: number; + }; + websocket_proxy_url?: string; + } + + class Event extends SIPml.Event { + public description: string; + public newSession: Session; + public type: string; + } + } + + function getNavigatorFriendlyName(): string; + + function getNavigatorVersion(): string; + + function getSystemFriendlyName(): string; + + function getWebRtc4AllVersion(): string; + + function haveMediaStream(): boolean; + + function init(readyCallback?: (e:any) => any, errorCallback?: (e:any) => any): boolean; + + function isInitialized(): boolean; + + function isNavigatorOutdated(): boolean; + + function isReady(): boolean; + + function isScreenShareSupported(): boolean; + + function isWebRtcPluginOutdated(): boolean; + + function isWebRtc4AllSupported(): boolean; + + function isWebRtcSupported(): boolean; + + function isWebSocketSupported(): boolean; + + function setDebugLevel(level: string): void; + + function setWebRtcType(type: string): boolean; +} +