@audc/rtpengine-client 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +91 -0
- package/package.json +3 -1
package/index.d.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { Socket as UdpSocket } from 'dgram';
|
|
3
|
+
import { Socket as TcpSocket } from 'net';
|
|
4
|
+
import { WebSocket } from 'ws';
|
|
5
|
+
|
|
6
|
+
interface BaseClientOptions {
|
|
7
|
+
timeout?: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ClientOptions extends BaseClientOptions {
|
|
11
|
+
type?: 'udp';
|
|
12
|
+
localAddress?: string;
|
|
13
|
+
localPort?: number;
|
|
14
|
+
rejectOnError?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface WsClientOptions extends BaseClientOptions {
|
|
18
|
+
type?: 'websocket';
|
|
19
|
+
url: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface TcpClientOptions extends BaseClientOptions {
|
|
23
|
+
type?: 'tcp';
|
|
24
|
+
hostport: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface InternalMessage {
|
|
28
|
+
id: string;
|
|
29
|
+
data: {
|
|
30
|
+
command: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare class CommandHandler extends EventEmitter {
|
|
35
|
+
answer(opts?: Record<string, unknown>): Promise<any>;
|
|
36
|
+
delete(opts?: Record<string, unknown>): Promise<any>;
|
|
37
|
+
list(opts?: Record<string, unknown>): Promise<any>;
|
|
38
|
+
offer(opts?: Record<string, unknown>): Promise<any>;
|
|
39
|
+
ping(opts?: Record<string, unknown>): Promise<any>;
|
|
40
|
+
query(opts?: Record<string, unknown>): Promise<any>;
|
|
41
|
+
startRecording(opts?: Record<string, unknown>): Promise<any>;
|
|
42
|
+
stopRecording(opts?: Record<string, unknown>): Promise<any>;
|
|
43
|
+
blockDTMF(opts?: Record<string, unknown>): Promise<any>;
|
|
44
|
+
unblockDTMF(opts?: Record<string, unknown>): Promise<any>;
|
|
45
|
+
playDTMF(opts?: Record<string, unknown>): Promise<any>;
|
|
46
|
+
blockMedia(opts?: Record<string, unknown>): Promise<any>;
|
|
47
|
+
unblockMedia(opts?: Record<string, unknown>): Promise<any>;
|
|
48
|
+
silenceMedia(opts?: Record<string, unknown>): Promise<any>;
|
|
49
|
+
unsilenceMedia(opts?: Record<string, unknown>): Promise<any>;
|
|
50
|
+
startForwarding(opts?: Record<string, unknown>): Promise<any>;
|
|
51
|
+
stopForwarding(opts?: Record<string, unknown>): Promise<any>;
|
|
52
|
+
playMedia(opts?: Record<string, unknown>): Promise<any>;
|
|
53
|
+
stopMedia(opts?: Record<string, unknown>): Promise<any>;
|
|
54
|
+
statistics(opts?: Record<string, unknown>): Promise<any>;
|
|
55
|
+
publish(opts?: Record<string, unknown>): Promise<any>;
|
|
56
|
+
subscribeRequest(opts?: Record<string, unknown>): Promise<any>;
|
|
57
|
+
subscribeAnswer(opts?: Record<string, unknown>): Promise<any>;
|
|
58
|
+
unsubscribe(opts?: Record<string, unknown>): Promise<any>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare class BaseClient extends CommandHandler {
|
|
62
|
+
messages: Map<string, (err?: any) => void>;
|
|
63
|
+
|
|
64
|
+
constructor(options: BaseClientOptions);
|
|
65
|
+
get connectionBased(): boolean;
|
|
66
|
+
close(): void;
|
|
67
|
+
static decodeMessage(message: string): InternalMessage;
|
|
68
|
+
static encodeMessage(id: string, data: any): string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export class Client extends BaseClient {
|
|
72
|
+
constructor(options: ClientOptions);
|
|
73
|
+
constructor(port?: number, host?: string);
|
|
74
|
+
declare socket: UdpSocket;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export class WsClient extends BaseClient {
|
|
78
|
+
constructor(options: WsClientOptions);
|
|
79
|
+
constructor(url: string);
|
|
80
|
+
declare socket: WebSocket;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export class TcpClient extends BaseClient {
|
|
84
|
+
constructor(options: TcpClientOptions);
|
|
85
|
+
constructor(hostport: string);
|
|
86
|
+
declare socket: TcpSocket;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export class RtpEngineError extends Error {
|
|
90
|
+
constructor(message: string);
|
|
91
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audc/rtpengine-client",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "node client for rtpengine daemon",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"author": "Dave Horton",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"files": [
|
|
14
|
+
"index.d.ts",
|
|
14
15
|
"index.js",
|
|
15
16
|
"lib/"
|
|
16
17
|
],
|
|
@@ -18,6 +19,7 @@
|
|
|
18
19
|
"@eslint/js": "^9.18.0",
|
|
19
20
|
"@types/bencode": "^2.0.4",
|
|
20
21
|
"@types/tape": "^5.8.1",
|
|
22
|
+
"@types/ws": "^8.5.13",
|
|
21
23
|
"c8": "^10.1.3",
|
|
22
24
|
"debug": "^4.4.0",
|
|
23
25
|
"eslint": "^9.18.0",
|