@voicenter-team/opensips-js 1.0.22 → 1.0.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. package/dist/index.d.ts +737 -0
  2. package/dist/opensips-js.cjs.js +155 -0
  3. package/dist/opensips-js.es.js +21363 -0
  4. package/dist/opensips-js.iife.js +155 -0
  5. package/dist/opensips-js.umd.js +155 -0
  6. package/package.json +14 -8
  7. package/src/types/Dialog.d.ts +7 -0
  8. package/src/types/Socket.d.ts +8 -0
  9. package/src/types/UAExtended.d.ts +24 -12
  10. package/src/types/listeners.d.ts +12 -4
  11. package/src/types/msrp.d.ts +15 -9
  12. package/src/types/rtc.d.ts +15 -5
  13. package/src/types/timer.d.ts +7 -0
  14. package/build/enum/call.event.listener.type.d.ts +0 -7
  15. package/build/enum/call.event.listener.type.js +0 -10
  16. package/build/enum/message.event.listener.type.d.ts +0 -5
  17. package/build/enum/message.event.listener.type.js +0 -8
  18. package/build/enum/metric.keys.to.include.d.ts +0 -2
  19. package/build/enum/metric.keys.to.include.js +0 -4
  20. package/build/enum/session.direction.enum.d.ts +0 -2
  21. package/build/enum/session.direction.enum.js +0 -5
  22. package/build/helpers/UA/index.d.ts +0 -41
  23. package/build/helpers/UA/index.js +0 -318
  24. package/build/helpers/audio.helper.d.ts +0 -15
  25. package/build/helpers/audio.helper.js +0 -97
  26. package/build/helpers/filter.helper.d.ts +0 -2
  27. package/build/helpers/filter.helper.js +0 -14
  28. package/build/helpers/jssip.d.ts +0 -5
  29. package/build/helpers/jssip.js +0 -30
  30. package/build/helpers/time.helper.d.ts +0 -16
  31. package/build/helpers/time.helper.js +0 -28
  32. package/build/helpers/volume.helper.d.ts +0 -2
  33. package/build/helpers/volume.helper.js +0 -76
  34. package/build/helpers/webrtcmetrics/collector.d.ts +0 -32
  35. package/build/helpers/webrtcmetrics/collector.js +0 -282
  36. package/build/helpers/webrtcmetrics/engine.d.ts +0 -20
  37. package/build/helpers/webrtcmetrics/engine.js +0 -164
  38. package/build/helpers/webrtcmetrics/exporter.d.ts +0 -116
  39. package/build/helpers/webrtcmetrics/exporter.js +0 -528
  40. package/build/helpers/webrtcmetrics/extractor.d.ts +0 -1
  41. package/build/helpers/webrtcmetrics/extractor.js +0 -976
  42. package/build/helpers/webrtcmetrics/index.d.ts +0 -63
  43. package/build/helpers/webrtcmetrics/index.js +0 -93
  44. package/build/helpers/webrtcmetrics/metrics.d.ts +0 -2
  45. package/build/helpers/webrtcmetrics/metrics.js +0 -8
  46. package/build/helpers/webrtcmetrics/probe.d.ts +0 -76
  47. package/build/helpers/webrtcmetrics/probe.js +0 -153
  48. package/build/helpers/webrtcmetrics/utils/config.d.ts +0 -12
  49. package/build/helpers/webrtcmetrics/utils/config.js +0 -28
  50. package/build/helpers/webrtcmetrics/utils/helper.d.ts +0 -13
  51. package/build/helpers/webrtcmetrics/utils/helper.js +0 -134
  52. package/build/helpers/webrtcmetrics/utils/log.d.ts +0 -7
  53. package/build/helpers/webrtcmetrics/utils/log.js +0 -71
  54. package/build/helpers/webrtcmetrics/utils/models.d.ts +0 -309
  55. package/build/helpers/webrtcmetrics/utils/models.js +0 -298
  56. package/build/helpers/webrtcmetrics/utils/score.d.ts +0 -4
  57. package/build/helpers/webrtcmetrics/utils/score.js +0 -235
  58. package/build/helpers/webrtcmetrics/utils/shortUUId.d.ts +0 -1
  59. package/build/helpers/webrtcmetrics/utils/shortUUId.js +0 -7
  60. package/build/index.d.ts +0 -180
  61. package/build/index.js +0 -1141
  62. package/build/lib/msrp/message.d.ts +0 -12
  63. package/build/lib/msrp/message.js +0 -82
  64. package/build/lib/msrp/session.d.ts +0 -94
  65. package/build/lib/msrp/session.js +0 -621
package/package.json CHANGED
@@ -1,15 +1,19 @@
1
1
  {
2
2
  "name": "@voicenter-team/opensips-js",
3
- "version": "1.0.22",
3
+ "version": "1.0.42",
4
4
  "description": "The JS package for opensips",
5
5
  "default": "src/index.ts",
6
- "main": "build/index.js",
7
- "types": "build/index.d.ts",
6
+ "jsdelivr": "dist/opensips-js.umd.js",
7
+ "main": "dist/opensips-js.cjs.js",
8
+ "module": "dist/opensips-js.es.js",
9
+ "unpkg": "dist/opensips-js.umd.js",
10
+ "types": "dist/index.d.ts",
8
11
  "scripts": {
9
- "build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",
12
+ "build": "yarn run vite-build",
13
+ "build-no-check": "tsc --noEmit --skipLibCheck --project tsconfig.json && tsc-alias -p tsconfig.json",
10
14
  "dev": "vite",
11
- "demo-build": "vite build",
12
- "docs-build": "yarn run demo-build && cd docs && yarn && yarn run build",
15
+ "vite-build": "vite build",
16
+ "docs-build": "yarn run vite-build && cd docs && yarn && yarn run build",
13
17
  "test": "echo \"Error: no test specified\" && exit 1",
14
18
  "ts-check": "tsc --noEmit",
15
19
  "lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts --fix --ignore-path .gitignore"
@@ -35,6 +39,7 @@
35
39
  "@typescript-eslint/eslint-plugin": "^5.53.0",
36
40
  "@typescript-eslint/parser": "^5.53.0",
37
41
  "@vitejs/plugin-vue": "^4.2.3",
42
+ "@voicenter-team/eslint-config-ts": "^1.0.21",
38
43
  "dotenv": "^16.0.3",
39
44
  "eslint": "^8.35.0",
40
45
  "pre-commit": "^1.2.2",
@@ -42,7 +47,8 @@
42
47
  "regenerator-runtime": "^0.13.11",
43
48
  "tsc-alias": "^1.8.6",
44
49
  "typescript": "^4.9.5",
45
- "vite": "4.3.9",
50
+ "vite": "4.4.11",
51
+ "vite-plugin-dts": "3.5.3",
46
52
  "vite-plugin-singlefile": "^0.13.5",
47
53
  "vue": "3.2.25"
48
54
  },
@@ -55,7 +61,7 @@
55
61
  "p-iteration": "^1.1.8"
56
62
  },
57
63
  "files": [
58
- "build",
64
+ "dist",
59
65
  "src/types"
60
66
  ]
61
67
  }
@@ -0,0 +1,7 @@
1
+ declare module 'jssip/lib/Dialog' {
2
+ export namespace Dialog {
3
+ interface Dialog {
4
+ receiveRequest(arg1: string, arg2: number): void
5
+ }
6
+ }
7
+ }
@@ -0,0 +1,8 @@
1
+ declare module 'jssip/lib/Socket' {
2
+ export class Socket {
3
+
4
+ }
5
+ export class WeightedSocket {
6
+
7
+ }
8
+ }
@@ -1,7 +1,9 @@
1
1
  import { Transport } from 'jssip/lib/Transport'
2
- import { UAExtended } from '@/helpers/UA/index'
3
- import { AnswerOptions, MSRPSessionEventMap } from '@/lib/msrp/session'
2
+ import { MSRPSession, MSRPSessionEventMap, DialogType } from '@/lib/msrp/session'
4
3
  import { Socket, WeightedSocket } from 'jssip/lib/Socket'
4
+ import { IncomingRequest } from 'jssip/lib/SIPMessage'
5
+ import { AnswerOptions, RTCSession } from 'jssip/lib/RTCSession'
6
+ import { CallOptionsExtended } from '@/types/rtc'
5
7
 
6
8
  declare module 'jssip' {
7
9
  export class UA {
@@ -16,19 +18,20 @@ declare module 'jssip' {
16
18
  protected _configuration: any
17
19
  protected _contact: any
18
20
 
19
- _findDialog(call_id, from, to)
20
- _findSession(request)
21
- call(target, options)
21
+ _findDialog(call_id: string, from: string, to: string): DialogType
22
+ receiveRequest(request): void
23
+ _findSession(request): MSRPSession
24
+ call(target: string, options: CallOptionsExtended): RTCSession
22
25
  }
23
26
 
24
27
  export class Message {
25
- constructor(ua)
26
- init_incoming(request)
28
+ constructor(ua: UA)
29
+ init_incoming(request: IncomingRequest): void
27
30
  }
28
31
 
29
32
  export class Options {
30
- constructor(ua)
31
- init_incoming(request)
33
+ constructor(ua: UA)
34
+ init_incoming(request: IncomingRequest): void
32
35
  }
33
36
 
34
37
  export interface MSRPOptions extends AnswerOptions {
@@ -64,11 +67,20 @@ declare module 'jssip' {
64
67
  extra_headers?: string[];
65
68
  }
66
69
  export class RTCSessiono {
67
- init_incoming(request)
68
- constructor(ua)
70
+ init_incoming(request: IncomingRequest): void
71
+ constructor(ua: UA)
69
72
  }
73
+
74
+ /*export class Dialog {
75
+
76
+ }*/
70
77
  }
71
78
 
72
79
  declare module 'jssip/lib/URI' {
73
80
 
74
- }
81
+ }
82
+
83
+ /*declare module 'jssip/lib/Dialog' {
84
+ export class owner: object
85
+ receiveRequest (request: any): void
86
+ }*/
@@ -1,7 +1,15 @@
1
- import { ICall, RoomChangeEmitType, ICallStatus } from '@/types/rtc'
2
1
  import { UAEventMap } from 'jssip/lib/UA'
2
+
3
+ import { IMessage, MSRPSessionExtended } from '@/types/msrp'
4
+ import { ICall, RoomChangeEmitType, ICallStatus } from '@/types/rtc'
3
5
  import MSRPMessage from '@/lib/msrp/message'
4
- import { ITimeData } from '@/helpers/time.helper'
6
+ import { ITimeData } from '@/types/timer'
7
+ import { IncomingMSRPSessionEvent, OutgoingMSRPSessionEvent } from '@/helpers/UA'
8
+
9
+ export type MSRPMessageEventType = {
10
+ message: MSRPMessage,
11
+ session: MSRPSessionExtended
12
+ }
5
13
 
6
14
  export type readyListener = (value: boolean) => void
7
15
  export type changeActiveCallsListener = (event: { [key: string]: ICall }) => void
@@ -24,7 +32,7 @@ export type removeRoomListener = (value: RoomChangeEmitType) => void
24
32
  export type IncomingMSRPSessionListener = (event: IncomingMSRPSessionEvent) => void;
25
33
  export type OutgoingMSRPSessionListener = (event: OutgoingMSRPSessionEvent) => void;
26
34
  export type MSRPSessionListener = IncomingMSRPSessionListener | OutgoingMSRPSessionListener;
27
- export type MSRPMessageListener = MSRPMessage;
35
+ export type MSRPMessageListener = (event: MSRPMessageEventType) => void;
28
36
  export type changeCallStatusListener = (event: { [key: string]: ICallStatus }) => void
29
37
  export type changeCallTimeListener = (event: { [key: string]: ITimeData }) => void
30
38
  export type changeCallMetricsListener = (event: { [key: string]: any }) => void
@@ -51,8 +59,8 @@ export interface OpenSIPSEventMap extends UAEventMap {
51
59
  changeCallStatus: changeCallStatusListener
52
60
  changeCallTime: changeCallTimeListener
53
61
  changeCallMetrics: changeCallMetricsListener
54
- newMSRPSession: MSRPSessionListener
55
62
  newMSRPMessage: MSRPMessageListener
63
+ newMSRPSession: MSRPSessionListener
56
64
  }
57
65
 
58
66
  export type ListenersKeyType = keyof OpenSIPSEventMap
@@ -1,14 +1,18 @@
1
1
  import {
2
- AnswerOptions,
3
- EndEvent,
2
+ MSRPSession,
3
+ MSRPSessionEventMap
4
+ } from '@/lib/msrp/session'
5
+ import { EndEvent,
4
6
  IncomingAckEvent,
5
7
  IncomingEvent,
6
8
  OutgoingAckEvent,
7
9
  OutgoingEvent,
8
- MSRPSession, MSRPSessionEventMap
9
- } from '@/lib/msrp/session'
10
+ SessionDirection } from 'jssip/lib/RTCSession'
10
11
 
11
12
  import { StreamMediaType } from '@/types/rtc'
13
+ import MSRPMessage from '@/lib/msrp/message'
14
+
15
+ export { MSRPMessage }
12
16
 
13
17
  export type ListenerEventType = EndEvent | IncomingEvent | OutgoingEvent | IncomingAckEvent | OutgoingAckEvent
14
18
 
@@ -17,15 +21,16 @@ export interface IMessage extends MSRPSessionExtended {
17
21
  localMuted?: boolean
18
22
  localHold?: boolean
19
23
  audioTag?: StreamMediaType
24
+ terminate(): void
20
25
  }
21
26
 
22
27
 
23
28
  export interface MSRPSessionExtended extends MSRPSession {
24
29
  id: string
25
- _automaticHold: boolean
30
+ status: string
31
+ start_time: Date
32
+ direction: SessionDirection
26
33
  _id: string
27
- _localHold: boolean
28
- _audioMuted: boolean
29
34
  _cancel_reason: string
30
35
  _contact: string
31
36
  _end_time: Date
@@ -34,12 +39,13 @@ export interface MSRPSessionExtended extends MSRPSession {
34
39
  _is_canceled: boolean
35
40
  _is_confirmed: boolean
36
41
  _late_sdp: string
37
- _videoMuted: boolean
38
42
  _status: number
39
43
  _remote_identity: string
40
44
  target_addr: Array<string>
41
45
  answer(options?: any): void
42
- _init_incomeing()
46
+ _init_incomeing(): void
47
+ sendMSRP(body: string): void
48
+ on<T extends keyof MSRPSessionEventMap>(type: T, listener: MSRPSessionEventMap[T]): this;
43
49
  }
44
50
 
45
51
  export interface TriggerMSRPListenerOptions {
@@ -1,5 +1,3 @@
1
- import { MediaStreamConstraints } from 'lib.dom.d.ts'
2
- import { Partial } from 'lib.es5.d.ts'
3
1
  import {
4
2
  AnswerOptions,
5
3
  EndEvent,
@@ -7,8 +5,13 @@ import {
7
5
  IncomingEvent,
8
6
  OutgoingAckEvent,
9
7
  OutgoingEvent,
10
- RTCSession, RTCSessionEventMap,
8
+ RTCSession,
9
+ RTCSessionEventMap,
10
+ MediaConstraints
11
11
  } from 'jssip/lib/RTCSession'
12
+ import {
13
+ IncomingRequest
14
+ } from 'jssip/lib/SIPMessage'
12
15
  import { UAConfiguration } from 'jssip/lib/UA'
13
16
 
14
17
  export type IntervalType = ReturnType<typeof setInterval>
@@ -39,8 +42,15 @@ export interface StreamMediaType extends HTMLAudioElement {
39
42
  setSinkId (id: string): Promise<void>
40
43
  }
41
44
 
45
+ type ExactConstraints = {
46
+ audio?: {
47
+ deviceId: {exact: string}
48
+ }
49
+ video?: boolean;
50
+ }
51
+
42
52
  export interface AnswerOptionsExtended extends AnswerOptions {
43
- mediaConstraints?: MediaStreamConstraints
53
+ mediaConstraints?: MediaConstraints | ExactConstraints
44
54
  }
45
55
 
46
56
  export interface RemoteIdentityCallType {
@@ -68,7 +78,7 @@ export interface RTCSessionExtended extends RTCSession {
68
78
  _status: number
69
79
  _remote_identity: RemoteIdentityCallType
70
80
  answer(options?: AnswerOptionsExtended): void
71
- init_icncoming(request)
81
+ init_icncoming(request: IncomingRequest): void
72
82
  }
73
83
 
74
84
  export interface ICall extends RTCSessionExtended {
@@ -0,0 +1,7 @@
1
+ export interface ITimeData {
2
+ callId: string
3
+ hours: number
4
+ minutes: number
5
+ seconds: number
6
+ formatted: string
7
+ }
@@ -1,7 +0,0 @@
1
- export declare const CALL_EVENT_LISTENER_TYPE: {
2
- NEW_CALL: string;
3
- CALL_CONFIRMED: string;
4
- CALL_FAILED: string;
5
- CALL_PROGRESS: string;
6
- CALL_ENDED: string;
7
- };
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CALL_EVENT_LISTENER_TYPE = void 0;
4
- exports.CALL_EVENT_LISTENER_TYPE = {
5
- NEW_CALL: 'new_call',
6
- CALL_CONFIRMED: 'confirmed',
7
- CALL_FAILED: 'failed',
8
- CALL_PROGRESS: 'progress',
9
- CALL_ENDED: 'ended'
10
- };
@@ -1,5 +0,0 @@
1
- export declare const MESSAGE_EVENT_LISTENER_TYPE: {
2
- ACTIVE: string;
3
- FAILED: string;
4
- ENDED: string;
5
- };
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MESSAGE_EVENT_LISTENER_TYPE = void 0;
4
- exports.MESSAGE_EVENT_LISTENER_TYPE = {
5
- ACTIVE: 'active',
6
- FAILED: 'failed',
7
- ENDED: 'ended'
8
- };
@@ -1,2 +0,0 @@
1
- import { ProbeMetricInType } from '@/types/webrtcmetrics';
2
- export declare const METRIC_KEYS_TO_INCLUDE: (keyof ProbeMetricInType)[];
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.METRIC_KEYS_TO_INCLUDE = void 0;
4
- exports.METRIC_KEYS_TO_INCLUDE = ['mos_in', 'codec_in', 'delta_KBytes_in', 'delta_kbs_in', 'delta_jitter_ms_in', 'delta_packets_lost_in'];
@@ -1,2 +0,0 @@
1
- import { SessionDirection } from 'jssip/lib/RTCSession';
2
- export { SessionDirection };
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SessionDirection = void 0;
4
- const RTCSession_1 = require("jssip/lib/RTCSession");
5
- Object.defineProperty(exports, "SessionDirection", { enumerable: true, get: function () { return RTCSession_1.SessionDirection; } });
@@ -1,41 +0,0 @@
1
- import { MSRPOptions, UAConfiguration, UA as UAType } from 'jssip';
2
- import { Originator, RTCSession } from 'jssip/lib/RTCSession';
3
- import { IncomingRequest } from 'jssip/lib/SIPMessage';
4
- import { MSRPSession } from '../../lib/msrp/session';
5
- import { CallOptionsExtended } from '@/types/rtc';
6
- export interface IncomingMSRPSessionEvent {
7
- originator: Originator.REMOTE;
8
- session: MSRPSession;
9
- request: IncomingRequest;
10
- }
11
- export interface OutgoingMSRPSessionEvent {
12
- originator: Originator.LOCAL;
13
- session: MSRPSession;
14
- request: IncomingRequest;
15
- }
16
- export type MSRPSessionEvent = IncomingMSRPSessionEvent | OutgoingMSRPSessionEvent;
17
- declare const UAConstructor: typeof UAType;
18
- export default class UAExtended extends UAConstructor {
19
- _msrp_sessions: MSRPSession[];
20
- _transactions: {
21
- nist: {};
22
- nict: {};
23
- ist: {};
24
- ict: {};
25
- };
26
- constructor(configuration: UAConfiguration);
27
- call(target: string, options?: CallOptionsExtended): RTCSession;
28
- /**
29
- * new MSRPSession
30
- */
31
- newMSRPSession(session: MSRPSession, data: object): void;
32
- /**
33
- * MSRPSession destroyed.
34
- */
35
- destroyMSRPSession(session: MSRPSession): void;
36
- receiveRequest(request: any): void;
37
- startMSRP(target: string, options: MSRPOptions): MSRPSession;
38
- terminateMSRPSessions(options: object): void;
39
- stop(): void;
40
- }
41
- export {};