drachtio-srf 4.5.25 → 4.5.27

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.
@@ -4,14 +4,25 @@ declare module 'drachtio-srf' {
4
4
 
5
5
  type SipMethod = 'ACK' | 'BYE' | 'CANCEL' | 'INFO' | 'INVITE' | 'MESSAGE' | 'NOTIFY' | 'OPTIONS' | 'PRACK' | 'PUBLISH' | 'REFER' | 'REGISTER' | 'SUBSCRIBE' | 'UPDATE';
6
6
 
7
- interface SrfConfig {
7
+ export interface SrfConfig {
8
8
  apiSecret?: string;
9
9
  host?: string;
10
10
  port?: number;
11
11
  secret?: string;
12
12
  }
13
13
 
14
- interface SrfRequest {
14
+ export interface SipMessage {
15
+ headers: {[name: string]: string | string[]};
16
+ raw: string;
17
+ body: string;
18
+ method: SipMethod;
19
+ version: string;
20
+ uri: string;
21
+ payload: object[];
22
+ get(name: string): string;
23
+ }
24
+
25
+ export interface SrfRequest {
15
26
  headers: {[name: string]: any};
16
27
  msg: any;
17
28
  method: SipMethod;
@@ -25,7 +36,7 @@ declare module 'drachtio-srf' {
25
36
  has(name: string): boolean;
26
37
  }
27
38
 
28
- interface SrfResponse {
39
+ export interface SrfResponse {
29
40
  headers: {[name: string]: any};
30
41
  status: number;
31
42
  send(sdp?: string): void;
@@ -34,7 +45,9 @@ declare module 'drachtio-srf' {
34
45
  get(name: string): string;
35
46
  }
36
47
 
37
- interface Srf extends EventEmitter {
48
+ class Srf extends EventEmitter {
49
+ constructor();
50
+ constructor(tags: string | string[]);
38
51
  connect(config?: SrfConfig): Promise<void>;
39
52
  disconnect(): void;
40
53
  register(options: any): void;
@@ -51,14 +64,19 @@ declare module 'drachtio-srf' {
51
64
  refer(request: SrfRequest, target: string, options: any): void;
52
65
  subscribe(request: SrfRequest, target: string, options: any): void;
53
66
  update(request: SrfRequest, options: any): void;
54
- on(event: 'connect' | 'error' | 'disconnect', listener: () => void): this;
67
+ on(event: 'connect', listener: (err: Error, hostPort: string) => void): this;
68
+ on(event: 'error', listener: (err: Error) => void): this;
69
+ on(event: 'disconnect', listener: () => void): this;
55
70
  on(event: 'message', listener: (req: SrfRequest, res: SrfResponse) => void): this;
56
71
  on(event: 'request', listener: (req: SrfRequest, res: SrfResponse) => void): this;
57
72
  on(event: 'register' | 'invite' | 'bye' | 'cancel' | 'ack' | 'info' | 'notify' | 'options' | 'prack' | 'publish' | 'refer' | 'subscribe' | 'update', listener: (req: SrfRequest, res: SrfResponse) => void): this;
73
+ on(event: 'cdr:attempt', listener: (source: string, time: string, msg: SipMessage) => void): this;
74
+ on(event: 'cdr:start', listener: (source: string, time: string, role: string, msg: SipMessage) => void): this;
75
+ on(event: 'cdr:stop', listener: (source: string, time: string, reason: string, msg: SipMessage) => void): this;
58
76
  locals: {[name: string]: any};
59
77
  socket: Socket;
60
78
  }
61
79
 
62
- export default function srf(config?: SrfConfig): Srf;
80
+ export default Srf
63
81
  }
64
82
 
@@ -45,7 +45,7 @@ function serverVersionAtLeast(serverVersion, minSupportedVersion) {
45
45
  }
46
46
  else assert.ok(false, `failed parsing actual ${serverVersion}, please fix`);
47
47
  } catch (err) {
48
- console.log(`Error parsing server version: ${serverVersion}: ${err}, please fix`);
48
+ //console.log(`Error parsing server version: ${serverVersion}: ${err}, please fix`);
49
49
  }
50
50
  }
51
51
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drachtio-srf",
3
- "version": "4.5.25",
3
+ "version": "4.5.27",
4
4
  "description": "drachtio signaling resource framework",
5
5
  "main": "lib/srf.js",
6
6
  "types": "lib/@types/index.d.ts",