diff --git a/lib/@types/index.d.ts b/lib/@types/index.d.ts index f71a82f458c1432202be8d4585fc70ba94bee4a4..4a6fee9f2aeac1a926d591aabab19f927d1bc3af 100644 --- a/lib/@types/index.d.ts +++ b/lib/@types/index.d.ts @@ -40,6 +40,7 @@ declare namespace Srf { stackTime: string; calledNumber: string; callingNumber: string; + callingName: string; raw: string; get(name: string): string; has(name: string): boolean; @@ -101,7 +102,7 @@ declare namespace Srf { local: { uri: string; sdp: string; }; remote: { uri: string; sdp: string; }; req: SrfRequest; - destroy(opts?: { headers: Record; }, callback?: (err: any, msg: SrfRequest) => void): void; + destroy(opts?: { headers: Record; }, callback?: (err: any, msg: SrfRequest) => void): Promise; modify(sdp: string, opts?: { noAck: boolean }): Promise; modify(opts: { noAck: boolean }): Promise; modify(sdp: string, opts?: { noAck: boolean }, callback?: (err: any, msg: SrfResponse) => void): void; @@ -119,12 +120,12 @@ declare namespace Srf { on(messageType: "modify", callback: (req: SrfRequest, res: SrfResponse) => void): void; once(messageType: string, callback: (msg: SrfResponse) => void): void; listeners(messageType: string): any[]; - request(opts?: SrfRequest): Promise; - request(opts: SrfRequest, callback?: (err: any, msg: SrfResponse) => void): void; + request(opts?: Partial): Promise; + request(opts: Partial, callback?: (err: any, msg: SrfResponse) => void): void; } export interface CreateUASOptions { - localSdp: string; + localSdp: string | (() => string | Promise); headers?: SipMessageHeaders; } @@ -135,6 +136,8 @@ declare namespace Srf { localSdp?: string; proxy?: string; auth?: { username: string; password: string; }; + callingName?: string; + callingNumber?: string; } export interface CreateB2BUAOptions { @@ -155,7 +158,7 @@ declare class Srf extends EventEmitter { constructor(); constructor(tags: string | string[]); connect(config?: Srf.SrfConfig): Promise; - disconnect(): void; + disconnect(socket?: Socket): void; use(callback: (req: Srf.SrfRequest, res: Srf.SrfResponse, next: Function) => void): void; use(messageType: string, callback: (req: Srf.SrfRequest, res: Srf.SrfResponse, next: Function) => void): void; invite(callback: (req: Srf.SrfRequest, res: Srf.SrfResponse) => void): void; @@ -164,12 +167,12 @@ declare class Srf extends EventEmitter { proxyRequest(req: Srf.SrfRequest, destination: string | string[], opts?: Srf.ProxyRequestOptions, callback?: (err: any, results: string) => void): void; createUAS(req: Srf.SrfRequest, res: Srf.SrfResponse, opts: Srf.CreateUASOptions): Promise; createUAS(req: Srf.SrfRequest, res: Srf.SrfResponse, opts: Srf.CreateUASOptions, callback?: (err: any, dialog: Srf.Dialog) => void): this; - createUAC(uri: string | Srf.CreateUACOptions, opts?: Srf.CreateUACOptions, progressCallbacks?: { cbRequest?: (req: Srf.SrfRequest) => void; cbProvisional?: (provisionalRes: Srf.SrfResponse) => void; }): Promise; - createUAC(uri: string | Srf.CreateUACOptions, opts?: Srf.CreateUACOptions, progressCallbacks?: { cbRequest?: (req: Srf.SrfRequest) => void; cbProvisional?: (provisionalRes: Srf.SrfResponse) => void; }, callback?: (err: any, dialog: Srf.Dialog) => void): this; - createB2BUA(req: Srf.SrfRequest, res: Srf.SrfResponse, uri: string, opts: Srf.CreateB2BUAOptions, progressCallbacks?: { cbRequest?: (req: Srf.SrfRequest) => void; cbProvisional?: (provisionalRes: Response) => void; cbFinalizedUac?: (uac: Srf.Dialog) => void; }): Promise<{ uas: Srf.Dialog; uac: Srf.Dialog }>; - createB2BUA(req: Srf.SrfRequest, res: Srf.SrfResponse, uri: string, opts: Srf.CreateB2BUAOptions, progressCallbacks?: { cbRequest?: (req: Srf.SrfRequest) => void; cbProvisional?: (provisionalRes: Response) => void; cbFinalizedUac?: (uac: Srf.Dialog) => void; }, callback?: (err: any, dialog: Srf.Dialog) => void): this; + createUAC(uri: string | Srf.CreateUACOptions, opts?: Srf.CreateUACOptions, progressCallbacks?: { cbRequest?: (error: unknown, req: Srf.SrfRequest) => void; cbProvisional?: (provisionalRes: Srf.SrfResponse) => void; }): Promise; + createUAC(uri: string | Srf.CreateUACOptions, opts?: Srf.CreateUACOptions, progressCallbacks?: { cbRequest?: (error: unknown, req: Srf.SrfRequest) => void; cbProvisional?: (provisionalRes: Srf.SrfResponse) => void; }, callback?: (err: any, dialog: Srf.Dialog) => void): this; + createB2BUA(req: Srf.SrfRequest, res: Srf.SrfResponse, uri: string, opts: Srf.CreateB2BUAOptions, progressCallbacks?: { cbRequest?: (error: unknown, req: Srf.SrfRequest) => void; cbProvisional?: (provisionalRes: Response) => void; cbFinalizedUac?: (uac: Srf.Dialog) => void; }): Promise<{ uas: Srf.Dialog; uac: Srf.Dialog }>; + createB2BUA(req: Srf.SrfRequest, res: Srf.SrfResponse, uri: string, opts: Srf.CreateB2BUAOptions, progressCallbacks?: { cbRequest?: (error: unknown, req: Srf.SrfRequest) => void; cbProvisional?: (provisionalRes: Response) => void; cbFinalizedUac?: (uac: Srf.Dialog) => void; }, callback?: (err: any, dialog: Srf.Dialog) => void): this; on(event: 'connect', listener: (err: Error, hostPort: string) => void): this; - on(event: 'error', listener: (err: Error) => void): this; + on(event: 'error', listener: (err: Error, socket?: Socket) => void): this; on(event: 'disconnect', listener: () => void): this; on(event: 'message', listener: (req: Srf.SrfRequest, res: Srf.SrfResponse) => void): this; on(event: 'request', listener: (req: Srf.SrfRequest, res: Srf.SrfResponse) => void): this;