sip-connector 4.1.0 → 5.1.1

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.
Files changed (76) hide show
  1. package/dist/SipConnector.d.ts +10 -0
  2. package/dist/SipConnector.d.ts.map +1 -1
  3. package/dist/SipConnector.js +72 -58
  4. package/dist/SipConnector.js.map +1 -1
  5. package/dist/__mocks__/BaseSession.mock.d.ts +3 -3
  6. package/dist/__mocks__/BaseSession.mock.d.ts.map +1 -1
  7. package/dist/__mocks__/BaseSession.mock.js +1 -0
  8. package/dist/__mocks__/BaseSession.mock.js.map +1 -1
  9. package/dist/__mocks__/UA.mock.js +1 -1
  10. package/dist/__mocks__/UA.mock.js.map +1 -1
  11. package/dist/__mocks__/conferenceParticipantTokenIssuedNotify.d.ts +7 -0
  12. package/dist/__mocks__/conferenceParticipantTokenIssuedNotify.d.ts.map +1 -0
  13. package/dist/__mocks__/conferenceParticipantTokenIssuedNotify.js +22 -0
  14. package/dist/__mocks__/conferenceParticipantTokenIssuedNotify.js.map +1 -0
  15. package/dist/constants.d.ts +63 -0
  16. package/dist/constants.d.ts.map +1 -0
  17. package/dist/constants.js +67 -0
  18. package/dist/constants.js.map +1 -0
  19. package/dist/eventNames.d.ts +4 -2
  20. package/dist/eventNames.d.ts.map +1 -1
  21. package/dist/eventNames.js +69 -67
  22. package/dist/eventNames.js.map +1 -1
  23. package/dist/index.d.ts +3 -2
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.es5.js +3 -2
  26. package/dist/index.es5.js.map +1 -1
  27. package/dist/index.js +4 -2
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.umd.js +13 -13
  30. package/dist/index.umd.js.map +1 -1
  31. package/dist/{videoSendingBalancer/342/200/216 → utils}/findSenderByStream.d.ts +0 -0
  32. package/dist/utils/findSenderByStream.d.ts.map +1 -0
  33. package/dist/{videoSendingBalancer/342/200/216 → utils}/findSenderByStream.js +0 -0
  34. package/dist/utils/findSenderByStream.js.map +1 -0
  35. package/dist/utils/findVideoSender.d.ts +3 -0
  36. package/dist/utils/findVideoSender.d.ts.map +1 -0
  37. package/dist/utils/findVideoSender.js +10 -0
  38. package/dist/utils/findVideoSender.js.map +1 -0
  39. package/dist/utils/getCodecFromSender.d.ts +3 -0
  40. package/dist/utils/getCodecFromSender.d.ts.map +1 -0
  41. package/dist/utils/getCodecFromSender.js +20 -0
  42. package/dist/utils/getCodecFromSender.js.map +1 -0
  43. package/dist/videoSendingBalancer/{342/200/216/getMaxBitrateByWidth.d.ts → getMaxBitrateByWidth.d.ts} +0 -0
  44. package/dist/videoSendingBalancer/getMaxBitrateByWidth.d.ts.map +1 -0
  45. package/dist/videoSendingBalancer/{342/200/216/getMaxBitrateByWidth.js → getMaxBitrateByWidth.js} +0 -0
  46. package/dist/videoSendingBalancer/getMaxBitrateByWidth.js.map +1 -0
  47. package/dist/videoSendingBalancer/{342/200/216/index.d.ts → index.d.ts} +6 -2
  48. package/dist/videoSendingBalancer/index.d.ts.map +1 -0
  49. package/dist/videoSendingBalancer/index.js +59 -0
  50. package/dist/videoSendingBalancer/index.js.map +1 -0
  51. package/dist/videoSendingBalancer/{342/200/216/processSender.d.ts → processSender.d.ts} +0 -0
  52. package/dist/videoSendingBalancer/processSender.d.ts.map +1 -0
  53. package/dist/videoSendingBalancer/{342/200/216/processSender.js → processSender.js} +1 -1
  54. package/dist/videoSendingBalancer/processSender.js.map +1 -0
  55. package/dist/videoSendingBalancer/{342/200/216/scaleBitrate.d.ts → scaleBitrate.d.ts} +0 -0
  56. package/dist/videoSendingBalancer/scaleBitrate.d.ts.map +1 -0
  57. package/dist/videoSendingBalancer/{342/200/216/scaleBitrate.js → scaleBitrate.js} +1 -1
  58. package/dist/videoSendingBalancer/scaleBitrate.js.map +1 -0
  59. package/dist/videoSendingBalancer/{342/200/216/setEncodingsToSender.d.ts → setEncodingsToSender.d.ts} +0 -0
  60. package/dist/videoSendingBalancer/setEncodingsToSender.d.ts.map +1 -0
  61. package/dist/videoSendingBalancer/{342/200/216/setEncodingsToSender.js → setEncodingsToSender.js} +0 -0
  62. package/dist/videoSendingBalancer/setEncodingsToSender.js.map +1 -0
  63. package/package.json +21 -21
  64. package/dist/videoSendingBalancer/342/200/216/findSenderByStream.d.ts.map +0 -1
  65. package/dist/videoSendingBalancer/342/200/216/findSenderByStream.js.map +0 -1
  66. package/dist/videoSendingBalancer/342/200/216/getMaxBitrateByWidth.d.ts.map +0 -1
  67. package/dist/videoSendingBalancer/342/200/216/getMaxBitrateByWidth.js.map +0 -1
  68. package/dist/videoSendingBalancer/342/200/216/index.d.ts.map +0 -1
  69. package/dist/videoSendingBalancer/342/200/216/index.js +0 -44
  70. package/dist/videoSendingBalancer/342/200/216/index.js.map +0 -1
  71. package/dist/videoSendingBalancer/342/200/216/processSender.d.ts.map +0 -1
  72. package/dist/videoSendingBalancer/342/200/216/processSender.js.map +0 -1
  73. package/dist/videoSendingBalancer/342/200/216/scaleBitrate.d.ts.map +0 -1
  74. package/dist/videoSendingBalancer/342/200/216/scaleBitrate.js.map +0 -1
  75. package/dist/videoSendingBalancer/342/200/216/setEncodingsToSender.d.ts.map +0 -1
  76. package/dist/videoSendingBalancer/342/200/216/setEncodingsToSender.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"BaseSession.mock.js","sourceRoot":"","sources":["../../src/__mocks__/BaseSession.mock.ts"],"names":[],"mappings":";;;;;AAeA,4EAAwC;AACxC,8CAAoD;AAKpD,2CAA2C;AAE3C;;;GAGG;AACH,MAAM,WAAW;IASf,YAAY,EAAE,UAAU,GAAG,OAAO,EAAE,aAAa,EAAE;QAFnD,kBAAa,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QAG7C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,4BAAM,CAA6B,gCAAmB,CAAC,CAAC;QAC3E,IAAI,CAAC,UAAU,CAA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jC,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,kBAAe,WAAW,CAAC"}
@@ -111,7 +111,7 @@ class UA {
111
111
  this._isRegistered = false;
112
112
  this._isConnected = false;
113
113
  this._startedTimeout = setTimeout(() => {
114
- this.trigger('registrationFailed');
114
+ this.trigger('registrationFailed', { response: null, cause: 'Wrong credentials' });
115
115
  }, CONNECTION_DELAY);
116
116
  }
117
117
  this.trigger('connected');
@@ -1 +1 @@
1
- {"version":3,"file":"UA.mock.js","sourceRoot":"","sources":["../../src/__mocks__/UA.mock.ts"],"names":[],"mappings":";;;;;;AAEA,4EAAwC;AAExC,8CAA+C;AAE/C,kEAAqC;AACrC,0EAA6C;AAEhC,QAAA,gBAAgB,GAAG,kBAAkB,CAAC;AACtC,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,cAAc,GAAG,gBAAgB,CAAC;AAE/C,MAAM,gBAAgB,GAAG,GAAG,CAAC,CAAC,mDAAmD;AAEjF,2CAA2C;AAE3C,MAAM,EAAE;IAgBN,YAAY,aAA8B;QACxC,IAAI,CAAC,OAAO,GAAG,IAAI,4BAAM,CAAwB,2BAAc,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,IAAI,0BAAW,EAAE,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACH,IAAI;QACF,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SACpC;QAED,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACnC;QAED,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE;YACpB,IAAI,CAAC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Y,GAAG,KAAK,CAAC;YAC1B,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,GAAG,EAAE;gBACrC,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC,CAAC;YACrF,CAAC,EAAE,gBAAgB,CAAC,CAAC;SACtB;QAED,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC1B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACH,UAAU;QACR,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAE1B,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,YAAY;QACV,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,SAAS;QACP,OAAO,CACL,IAAI,CAAC,aAAa;YAClB,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC;gBACpD,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CACzD,CAAC;IACJ,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,WAAW,CAAC,IAAkC;QAC5C,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;CACF;AAED,kBAAe,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare const conferenceParticipantTokenIssuedHeaders: string[][];
2
+ export declare const conferenceParticipantTokenIssuedData: {
3
+ conference: string;
4
+ participant: string;
5
+ jwt: string;
6
+ };
7
+ //# sourceMappingURL=conferenceParticipantTokenIssuedNotify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conferenceParticipantTokenIssuedNotify.d.ts","sourceRoot":"","sources":["../../src/__mocks__/conferenceParticipantTokenIssuedNotify.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,uCAAuC,YAGnD,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;;CAIhD,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.conferenceParticipantTokenIssuedData = exports.conferenceParticipantTokenIssuedHeaders = void 0;
4
+ const headers_1 = require("../headers");
5
+ const conferenceParticipantTokenIssued = {
6
+ cmd: 'ConferenceParticipantTokenIssued',
7
+ body: {
8
+ conference: '111',
9
+ participant: 'SIP/participant',
10
+ jwt: 'jwt',
11
+ },
12
+ };
13
+ exports.conferenceParticipantTokenIssuedHeaders = [
14
+ [headers_1.HEADER_CONTENT_TYPE_NAME, headers_1.CONTENT_TYPE_NOTIFY],
15
+ [headers_1.HEADER_NOTIFY, JSON.stringify(conferenceParticipantTokenIssued)],
16
+ ];
17
+ exports.conferenceParticipantTokenIssuedData = {
18
+ conference: conferenceParticipantTokenIssued.body.conference,
19
+ participant: conferenceParticipantTokenIssued.body.participant,
20
+ jwt: conferenceParticipantTokenIssued.body.jwt,
21
+ };
22
+ //# sourceMappingURL=conferenceParticipantTokenIssuedNotify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conferenceParticipantTokenIssuedNotify.js","sourceRoot":"","sources":["../../src/__mocks__/conferenceParticipantTokenIssuedNotify.ts"],"names":[],"mappings":";;;AAAA,wCAA0F;AAE1F,MAAM,gCAAgC,GAAG;IACvC,GAAG,EAAE,kCAAkC;IACvC,IAAI,EAAE;QACJ,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,iBAAiB;QAC9B,GAAG,EAAE,KAAK;KACX;CACF,CAAC;AAEW,QAAA,uCAAuC,GAAG;IACrD,CAAC,kCAAwB,EAAE,6BAAmB,CAAC;IAC/C,CAAC,uBAAa,EAAE,IAAI,CAAC,SAAS,CAAC,gCAAgC,CAAC,CAAC;CAClE,CAAC;AAEW,QAAA,oCAAoC,GAAG;IAClD,UAAU,EAAE,gCAAgC,CAAC,IAAI,CAAC,UAAU;IAC5D,WAAW,EAAE,gCAAgC,CAAC,IAAI,CAAC,WAAW;IAC9D,GAAG,EAAE,gCAAgC,CAAC,IAAI,CAAC,GAAG;CAC/C,CAAC"}
@@ -0,0 +1,63 @@
1
+ export declare const INCOMING_CALL = "incomingCall";
2
+ export declare const DECLINED_INCOMING_CALL = "declinedIncomingCall";
3
+ export declare const FAILED_INCOMING_CALL = "failedIncomingCall";
4
+ export declare const CONNECTING = "connecting";
5
+ export declare const CONNECTED = "connected";
6
+ export declare const DISCONNECTED = "disconnected";
7
+ export declare const NEW_RTC_SESSION = "newRTCSession";
8
+ export declare const REGISTERED = "registered";
9
+ export declare const UNREGISTERED = "unregistered";
10
+ export declare const REGISTRATION_FAILED = "registrationFailed";
11
+ export declare const NEW_MESSAGE = "newMessage";
12
+ export declare const SIP_EVENT = "sipEvent";
13
+ export declare const AVAILABLE_SECOND_REMOTE_STREAM_EVENT = "availableSecondRemoteStream";
14
+ export declare const NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT = "notAvailableSecondRemoteStream";
15
+ export declare const MUST_STOP_PRESENTATION_EVENT = "mustStopPresentation";
16
+ export declare const SHARE_STATE = "shareState";
17
+ export declare const ENTER_ROOM = "enterRoom";
18
+ export declare const PEER_CONNECTION_CONFIRMED = "peerconnection:confirmed";
19
+ export declare const PEER_CONNECTION_ONTRACK = "peerconnection:ontrack";
20
+ export declare const CHANNELS = "channels";
21
+ export declare const CHANNELS_NOTIFY = "channels:notify";
22
+ export declare const ENDED_FROM_SERVER = "ended:fromserver";
23
+ export declare const MAIN_CAM_CONTROL = "main-cam-control";
24
+ export declare const PARTICIPANT_ADDED_TO_LIST_MODERATORS = "participant:added-to-list-moderators";
25
+ export declare const PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = "participant:removed-from-list-moderators";
26
+ export declare const PARTICIPANT_MOVE_REQUEST_TO_CONFERENCE = "participant:move-request-to-conference";
27
+ export declare const PARTICIPANT_MOVE_REQUEST_TO_STREAM = "participant:move-request-to-stream";
28
+ export declare const PARTICIPANT_CANCELLING_WORD_REQUEST = "participant:canceling-word-request";
29
+ export declare const WEBCAST_STARTED = "webcast:started";
30
+ export declare const WEBCAST_STOPPED = "webcast:stopped";
31
+ export declare const ACCOUNT_CHANGED = "account:changed";
32
+ export declare const ACCOUNT_DELETED = "account:deleted";
33
+ export declare const CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "conference:participant-token-issued";
34
+ export declare const ENDED = "ended";
35
+ export declare const SENDING = "sending";
36
+ export declare const REINVITE = "reinvite";
37
+ export declare const REPLACES = "replaces";
38
+ export declare const REFER = "refer";
39
+ export declare const PROGRESS = "progress";
40
+ export declare const ACCEPTED = "accepted";
41
+ export declare const CONFIRMED = "confirmed";
42
+ export declare const PEER_CONNECTION = "peerconnection";
43
+ export declare const FAILED = "failed";
44
+ export declare const MUTED = "muted";
45
+ export declare const UNMUTED = "unmuted";
46
+ export declare const NEW_DTMF = "newDTMF";
47
+ export declare const NEW_INFO = "newInfo";
48
+ export declare const HOLD = "hold";
49
+ export declare const UNHOLD = "unhold";
50
+ export declare const UPDATE = "update";
51
+ export declare const SDP = "sdp";
52
+ export declare const ICE_CANDIDATE = "icecandidate";
53
+ export declare const GET_USER_MEDIA_FAILED = "getusermediafailed";
54
+ export declare const PEER_CONNECTION_CREATE_OFFER_FAILED = "peerconnection:createofferfailed";
55
+ export declare const PEER_CONNECTION_CREATE_ANSWER_FAILED = "peerconnection:createanswerfailed";
56
+ export declare const PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED = "peerconnection:setlocaldescriptionfailed";
57
+ export declare const PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED = "peerconnection:setremotedescriptionfailed";
58
+ export declare const PRESENTATION_START = "presentation:start";
59
+ export declare const PRESENTATION_STARTED = "presentation:started";
60
+ export declare const PRESENTATION_END = "presentation:end";
61
+ export declare const PRESENTATION_ENDED = "presentation:ended";
62
+ export declare const PRESENTATION_FAILED = "presentation:failed";
63
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,iBAAiB,CAAC;AAC5C,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAC7D,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AACzD,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,SAAS,cAAc,CAAC;AACrC,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAC/C,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,mBAAmB,uBAAuB,CAAC;AACxD,eAAO,MAAM,WAAW,eAAe,CAAC;AACxC,eAAO,MAAM,SAAS,aAAa,CAAC;AACpC,eAAO,MAAM,oCAAoC,gCAAgC,CAAC;AAClF,eAAO,MAAM,wCAAwC,mCAAmC,CAAC;AACzF,eAAO,MAAM,4BAA4B,yBAAyB,CAAC;AACnE,eAAO,MAAM,WAAW,eAAe,CAAC;AACxC,eAAO,MAAM,UAAU,cAAc,CAAC;AACtC,eAAO,MAAM,yBAAyB,6BAA6B,CAAC;AACpE,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;AAChE,eAAO,MAAM,QAAQ,aAAa,CAAC;AACnC,eAAO,MAAM,eAAe,oBAAoB,CAAC;AACjD,eAAO,MAAM,iBAAiB,qBAAqB,CAAC;AACpD,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,eAAO,MAAM,oCAAoC,yCAAyC,CAAC;AAC3F,eAAO,MAAM,wC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AA6C,8CACb,CAAC;AAC9C,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAC3D,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,mBAAmB,wBAAwB,CAAC"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UPDATE = exports.UNHOLD = exports.HOLD = exports.NEW_INFO = exports.NEW_DTMF = exports.UNMUTED = exports.MUTED = exports.FAILED = exports.PEER_CONNECTION = exports.CONFIRMED = exports.ACCEPTED = exports.PROGRESS = exports.REFER = exports.REPLACES = exports.REINVITE = exports.SENDING = exports.ENDED = exports.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = exports.ACCOUNT_DELETED = exports.ACCOUNT_CHANGED = exports.WEBCAST_STOPPED = exports.WEBCAST_STARTED = exports.PARTICIPANT_CANCELLING_WORD_REQUEST = exports.PARTICIPANT_MOVE_REQUEST_TO_STREAM = exports.PARTICIPANT_MOVE_REQUEST_TO_CONFERENCE = exports.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = exports.PARTICIPANT_ADDED_TO_LIST_MODERATORS = exports.MAIN_CAM_CONTROL = exports.ENDED_FROM_SERVER = exports.CHANNELS_NOTIFY = exports.CHANNELS = exports.PEER_CONNECTION_ONTRACK = exports.PEER_CONNECTION_CONFIRMED = exports.ENTER_ROOM = exports.SHARE_STATE = exports.MUST_STOP_PRESENTATION_EVENT = exports.NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT = exports.AVAILABLE_SECOND_REMOTE_STREAM_EVENT = exports.SIP_EVENT = exports.NEW_MESSAGE = exports.REGISTRATION_FAILED = exports.UNREGISTERED = exports.REGISTERED = exports.NEW_RTC_SESSION = exports.DISCONNECTED = exports.CONNECTED = exports.CONNECTING = exports.FAILED_INCOMING_CALL = exports.DECLINED_INCOMING_CALL = exports.INCOMING_CALL = void 0;
4
+ exports.PRESENTATION_FAILED = exports.PRESENTATION_ENDED = exports.PRESENTATION_END = exports.PRESENTATION_STARTED = exports.PRESENTATION_START = exports.PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED = exports.PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED = exports.PEER_CONNECTION_CREATE_ANSWER_FAILED = exports.PEER_CONNECTION_CREATE_OFFER_FAILED = exports.GET_USER_MEDIA_FAILED = exports.ICE_CANDIDATE = exports.SDP = void 0;
5
+ exports.INCOMING_CALL = 'incomingCall';
6
+ exports.DECLINED_INCOMING_CALL = 'declinedIncomingCall';
7
+ exports.FAILED_INCOMING_CALL = 'failedIncomingCall';
8
+ exports.CONNECTING = 'connecting';
9
+ exports.CONNECTED = 'connected';
10
+ exports.DISCONNECTED = 'disconnected';
11
+ exports.NEW_RTC_SESSION = 'newRTCSession';
12
+ exports.REGISTERED = 'registered';
13
+ exports.UNREGISTERED = 'unregistered';
14
+ exports.REGISTRATION_FAILED = 'registrationFailed';
15
+ exports.NEW_MESSAGE = 'newMessage';
16
+ exports.SIP_EVENT = 'sipEvent';
17
+ exports.AVAILABLE_SECOND_REMOTE_STREAM_EVENT = 'availableSecondRemoteStream';
18
+ exports.NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT = 'notAvailableSecondRemoteStream';
19
+ exports.MUST_STOP_PRESENTATION_EVENT = 'mustStopPresentation';
20
+ exports.SHARE_STATE = 'shareState';
21
+ exports.ENTER_ROOM = 'enterRoom';
22
+ exports.PEER_CONNECTION_CONFIRMED = 'peerconnection:confirmed';
23
+ exports.PEER_CONNECTION_ONTRACK = 'peerconnection:ontrack';
24
+ exports.CHANNELS = 'channels';
25
+ exports.CHANNELS_NOTIFY = 'channels:notify';
26
+ exports.ENDED_FROM_SERVER = 'ended:fromserver';
27
+ exports.MAIN_CAM_CONTROL = 'main-cam-control';
28
+ exports.PARTICIPANT_ADDED_TO_LIST_MODERATORS = 'participant:added-to-list-moderators';
29
+ exports.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = 'participant:removed-from-list-moderators';
30
+ exports.PARTICIPANT_MOVE_REQUEST_TO_CONFERENCE = 'participant:move-request-to-conference';
31
+ exports.PARTICIPANT_MOVE_REQUEST_TO_STREAM = 'participant:move-request-to-stream';
32
+ exports.PARTICIPANT_CANCELLING_WORD_REQUEST = 'participant:canceling-word-request';
33
+ exports.WEBCAST_STARTED = 'webcast:started';
34
+ exports.WEBCAST_STOPPED = 'webcast:stopped';
35
+ exports.ACCOUNT_CHANGED = 'account:changed';
36
+ exports.ACCOUNT_DELETED = 'account:deleted';
37
+ exports.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = 'conference:participant-token-issued';
38
+ exports.ENDED = 'ended';
39
+ exports.SENDING = 'sending';
40
+ exports.REINVITE = 'reinvite';
41
+ exports.REPLACES = 'replaces';
42
+ exports.REFER = 'refer';
43
+ exports.PROGRESS = 'progress';
44
+ exports.ACCEPTED = 'accepted';
45
+ exports.CONFIRMED = 'confirmed';
46
+ exports.PEER_CONNECTION = 'peerconnection';
47
+ exports.FAILED = 'failed';
48
+ exports.MUTED = 'muted';
49
+ exports.UNMUTED = 'unmuted';
50
+ exports.NEW_DTMF = 'newDTMF';
51
+ exports.NEW_INFO = 'newInfo';
52
+ exports.HOLD = 'hold';
53
+ exports.UNHOLD = 'unhold';
54
+ exports.UPDATE = 'update';
55
+ exports.SDP = 'sdp';
56
+ exports.ICE_CANDIDATE = 'icecandidate';
57
+ exports.GET_USER_MEDIA_FAILED = 'getusermediafailed';
58
+ exports.PEER_CONNECTION_CREATE_OFFER_FAILED = 'peerconnection:createofferfailed';
59
+ exports.PEER_CONNECTION_CREATE_ANSWER_FAILED = 'peerconnection:createanswerfailed';
60
+ exports.PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED = 'peerconnection:setlocaldescriptionfailed';
61
+ exports.PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED = 'peerconnection:setremotedescriptionfailed';
62
+ exports.PRESENTATION_START = 'presentation:start';
63
+ exports.PRESENTATION_STARTED = 'presentation:started';
64
+ exports.PRESENTATION_END = 'presentation:end';
65
+ exports.PRESENTATION_ENDED = 'presentation:ended';
66
+ exports.PRESENTATION_FAILED = 'presentation:failed';
67
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;;AAAa,QAAA,aAAa,GAAG,cAAc,CAAC;AAC/B,QAAA,sBAAsB,GAAG,sBAAsB,CAAC;AAChD,QAAA,oBAAoB,GAAG,oBAAoB,CAAC;AAC5C,QAAA,UAAU,GAAG,YAAY,CAAC;AAC1B,QAAA,SAAS,GAAG,WAAW,CAAC;AACxB,QAAA,YAAY,GAAG,cAAc,CAAC;AAC9B,QAAA,eAAe,GAAG,eAAe,CAAC;AAClC,QAAA,UAAU,GAAG,YAAY,CAAC;AAC1B,QAAA,YAAY,GAAG,cAAc,CAAC;AAC9B,QAAA,mBAAmB,GAAG,oBAAoB,CAAC;AAC3C,QAAA,WAAW,GAAG,YAAY,CAAC;AAC3B,QAAA,SAAS,GAAG,UAAU,CAAC;AACvB,QAAA,oCAAoC,GAAG,6BAA6B,CAAC;AACrE,QAAA,wCAAwC,GAAG,gCAAgC,CAAC;AAC5E,QAAA,4BAA4B,GAAG,sBAAsB,CAAC;AACtD,QAAA,WAAW,GAAG,YAAY,CAAC;AAC3B,QAAA,UAAU,GAAG,WAAW,CAAC;AACzB,QAAA,yBAAyB,GAAG,0BAA0B,CAAC;AACvD,QAAA,uBAAuB,GAAG,wBAAwB,CAAC;AACnD,QAAA,QAAQ,GAAG,UAAU,CAAC;AACtB,QAAA,eAAe,GAAG,iBAAiB,CAAC;AACpC,QAAA,iBAAiB,GAAG,kBAAkB,CAAC;AACvC,QAAA,gBAAgB,GAAG,kBAAkB,CAAC;AACtC,QAAA,oCAAoC,GAAG,sCA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,CAAC;AAChC,QAAA,6CAA6C,GACxD,2CAA2C,CAAC;AACjC,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,oBAAoB,GAAG,sBAAsB,CAAC;AAC9C,QAAA,gBAAgB,GAAG,kBAAkB,CAAC;AACtC,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,mBAAmB,GAAG,qBAAqB,CAAC"}
@@ -1,7 +1,9 @@
1
+ export declare const UA_SYNTHETICS_EVENT_NAMES: readonly ["incomingCall", "declinedIncomingCall", "failedIncomingCall"];
1
2
  export declare const UA_JSSIP_EVENT_NAMES: readonly ["connecting", "connected", "disconnected", "newRTCSession", "registered", "unregistered", "registrationFailed", "newMessage", "sipEvent"];
2
- export declare const UA_EVENT_NAMES: readonly ["connecting", "connected", "disconnected", "newRTCSession", "registered", "unregistered", "registrationFailed", "newMessage", "sipEvent", "incomingCall", "declinedIncomingCall", "failedIncomingCall"];
3
+ export declare const SESSION_SYNTHETICS_EVENT_NAMES: readonly ["availableSecondRemoteStream", "notAvailableSecondRemoteStream", "mustStopPresentation", "shareState", "enterRoom", "peerconnection:confirmed", "peerconnection:ontrack", "channels", "channels:notify", "ended:fromserver", "main-cam-control", "participant:added-to-list-moderators", "participant:removed-from-list-moderators", "participant:move-request-to-conference", "participant:move-request-to-stream", "participant:canceling-word-request", "webcast:started", "webcast:stopped", "account:changed", "account:deleted", "conference:participant-token-issued"];
3
4
  export declare const SESSION_JSSIP_EVENT_NAMES: readonly ["ended", "connecting", "sending", "reinvite", "replaces", "refer", "progress", "accepted", "confirmed", "peerconnection", "failed", "muted", "unmuted", "newDTMF", "newInfo", "hold", "unhold", "update", "sdp", "icecandidate", "getusermediafailed", "peerconnection:createofferfailed", "peerconnection:createanswerfailed", "peerconnection:setlocaldescriptionfailed", "peerconnection:setremotedescriptionfailed", "presentation:start", "presentation:started", "presentation:end", "presentation:ended", "presentation:failed"];
4
- export declare const SESSION_EVENT_NAMES: readonly ["ended", "connecting", "sending", "reinvite", "replaces", "refer", "progress", "accepted", "confirmed", "peerconnection", "failed", "muted", "unmuted", "newDTMF", "newInfo", "hold", "unhold", "update", "sdp", "icecandidate", "getusermediafailed", "peerconnection:createofferfailed", "peerconnection:createanswerfailed", "peerconnection:setlocaldescriptionfailed", "peerconnection:setremotedescriptionfailed", "presentation:start", "presentation:started", "presentation:end", "presentation:ended", "presentation:failed", "availableSecondRemoteStream", "notAvailableSecondRemoteStream", "mustStopPresentation", "shareState", "enterRoom", "peerconnection:confirmed", "peerconnection:ontrack", "channels", "channels:notify", "ended:fromserver", "main-cam-control", "participant:added-to-list-moderators", "participant:removed-from-list-moderators", "participant:move-request-to-conference", "participant:move-request-to-stream", "participant:canceling-word-request", "webcast:started", "webcast:stopped", "account:changed", "account:deleted"];
5
+ export declare const UA_EVENT_NAMES: ("incomingCall" | "declinedIncomingCall" | "failedIncomingCall" | "connecting" | "connected" | "disconnected" | "newRTCSession" | "registered" | "unregistered" | "registrationFailed" | "newMessage" | "sipEvent")[];
6
+ export declare const SESSION_EVENT_NAMES: readonly ["ended", "connecting", "sending", "reinvite", "replaces", "refer", "progress", "accepted", "confirmed", "peerconnection", "failed", "muted", "unmuted", "newDTMF", "newInfo", "hold", "unhold", "update", "sdp", "icecandidate", "getusermediafailed", "peerconnection:createofferfailed", "peerconnection:createanswerfailed", "peerconnection:setlocaldescriptionfailed", "peerconnection:setremotedescriptionfailed", "presentation:start", "presentation:started", "presentation:end", "presentation:ended", "presentation:failed", "availableSecondRemoteStream", "notAvailableSecondRemoteStream", "mustStopPresentation", "shareState", "enterRoom", "peerconnection:confirmed", "peerconnection:ontrack", "channels", "channels:notify", "ended:fromserver", "main-cam-control", "participant:added-to-list-moderators", "participant:removed-from-list-moderators", "participant:move-request-to-conference", "participant:move-request-to-stream", "participant:canceling-word-request", "webcast:started", "webcast:stopped", "account:changed", "account:deleted", "conference:participant-token-issued"];
5
7
  export declare type TEventUA = typeof UA_EVENT_NAMES[number];
6
8
  export declare type TEventSession = typeof SESSION_EVENT_NAMES[number];
7
9
  //# sourceMappingURL=eventNames.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"eventNames.d.ts","sourceRoot":"","sources":["../src/eventNames.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,oBAAoB,qJAUvB,CAAC;AAEX,eAAO,MAAM,cAAc,mNAAmE,CAAC;AAyB/F,eAAO,MAAM,yBAAyB,mhBA+B5B,CAAC;AAEX,eAAO,MAAM,mBAAmB,0hCAGtB,CAAC;AAEX,oBAAY,QAAQ,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAErD,oBAAY,aAAa,GAAG,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"eventNames.d.ts","sourceRoot":"","sources":["../src/eventNames.ts"],"names":[],"mappings":"AAiEA,eAAO,MAAM,yBAAyB,yEAI5B,CAAC;AAEX,eAAO,MAAM,oBAAoB,qJAUvB,CAAC;AAEX,eAAO,MAAM,8BAA8B,yjBAsBjC,CAAC;AAEX,eAAO,MAAM,yBAAyB,mhBA+B5B,CAAC;AAEX,eAAO,MAAM,cAAc,uNAA0D,CAAC;AAEtF,eAAO,MAAM,mBAAmB,ikCAGtB,CAAC;AAEX,oBAAY,QAAQ,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAErD,oBAAY,aAAa,GAAG,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC"}
@@ -1,79 +1,81 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SESSION_EVENT_NAMES = exports.SESSION_JSSIP_EVENT_NAMES = exports.UA_EVENT_NAMES = exports.UA_JSSIP_EVENT_NAMES = void 0;
4
- const UA_SYNTHETICS_EVENT_NAMES = [
5
- 'incomingCall',
6
- 'declinedIncomingCall',
7
- 'failedIncomingCall',
3
+ exports.SESSION_EVENT_NAMES = exports.UA_EVENT_NAMES = exports.SESSION_JSSIP_EVENT_NAMES = exports.SESSION_SYNTHETICS_EVENT_NAMES = exports.UA_JSSIP_EVENT_NAMES = exports.UA_SYNTHETICS_EVENT_NAMES = void 0;
4
+ const constants_1 = require("./constants");
5
+ exports.UA_SYNTHETICS_EVENT_NAMES = [
6
+ constants_1.INCOMING_CALL,
7
+ constants_1.DECLINED_INCOMING_CALL,
8
+ constants_1.FAILED_INCOMING_CALL,
8
9
  ];
9
10
  exports.UA_JSSIP_EVENT_NAMES = [
10
- 'connecting',
11
- 'connected',
12
- 'disconnected',
13
- 'newRTCSession',
14
- 'registered',
15
- 'unregistered',
16
- 'registrationFailed',
17
- 'newMessage',
18
- 'sipEvent',
11
+ constants_1.CONNECTING,
12
+ constants_1.CONNECTED,
13
+ constants_1.DISCONNECTED,
14
+ constants_1.NEW_RTC_SESSION,
15
+ constants_1.REGISTERED,
16
+ constants_1.UNREGISTERED,
17
+ constants_1.REGISTRATION_FAILED,
18
+ constants_1.NEW_MESSAGE,
19
+ constants_1.SIP_EVENT,
19
20
  ];
20
- exports.UA_EVENT_NAMES = [...exports.UA_JSSIP_EVENT_NAMES, ...UA_SYNTHETICS_EVENT_NAMES];
21
- const SESSION_SYNTHETICS_EVENT_NAMES = [
22
- 'availableSecondRemoteStream',
23
- 'notAvailableSecondRemoteStream',
24
- 'mustStopPresentation',
25
- 'shareState',
26
- 'enterRoom',
27
- 'peerconnection:confirmed',
28
- 'peerconnection:ontrack',
29
- 'channels',
30
- 'channels:notify',
31
- 'ended:fromserver',
32
- 'main-cam-control',
33
- 'participant:added-to-list-moderators',
34
- 'participant:removed-from-list-moderators',
35
- 'participant:move-request-to-conference',
36
- 'participant:move-request-to-stream',
37
- 'participant:canceling-word-request',
38
- 'webcast:started',
39
- 'webcast:stopped',
40
- 'account:changed',
41
- 'account:deleted',
21
+ exports.SESSION_SYNTHETICS_EVENT_NAMES = [
22
+ constants_1.AVAILABLE_SECOND_REMOTE_STREAM_EVENT,
23
+ constants_1.NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT,
24
+ constants_1.MUST_STOP_PRESENTATION_EVENT,
25
+ constants_1.SHARE_STATE,
26
+ constants_1.ENTER_ROOM,
27
+ constants_1.PEER_CONNECTION_CONFIRMED,
28
+ constants_1.PEER_CONNECTION_ONTRACK,
29
+ constants_1.CHANNELS,
30
+ constants_1.CHANNELS_NOTIFY,
31
+ constants_1.ENDED_FROM_SERVER,
32
+ constants_1.MAIN_CAM_CONTROL,
33
+ constants_1.PARTICIPANT_ADDED_TO_LIST_MODERATORS,
34
+ constants_1.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS,
35
+ constants_1.PARTICIPANT_MOVE_REQUEST_TO_CONFERENCE,
36
+ constants_1.PARTICIPANT_MOVE_REQUEST_TO_STREAM,
37
+ constants_1.PARTICIPANT_CANCELLING_WORD_REQUEST,
38
+ constants_1.WEBCAST_STARTED,
39
+ constants_1.WEBCAST_STOPPED,
40
+ constants_1.ACCOUNT_CHANGED,
41
+ constants_1.ACCOUNT_DELETED,
42
+ constants_1.CONFERENCE_PARTICIPANT_TOKEN_ISSUED,
42
43
  ];
43
44
  exports.SESSION_JSSIP_EVENT_NAMES = [
44
- 'ended',
45
- 'connecting',
46
- 'sending',
47
- 'reinvite',
48
- 'replaces',
49
- 'refer',
50
- 'progress',
51
- 'accepted',
52
- 'confirmed',
53
- 'peerconnection',
54
- 'failed',
55
- 'muted',
56
- 'unmuted',
57
- 'newDTMF',
58
- 'newInfo',
59
- 'hold',
60
- 'unhold',
61
- 'update',
62
- 'sdp',
63
- 'icecandidate',
64
- 'getusermediafailed',
65
- 'peerconnection:createofferfailed',
66
- 'peerconnection:createanswerfailed',
67
- 'peerconnection:setlocaldescriptionfailed',
68
- 'peerconnection:setremotedescriptionfailed',
69
- 'presentation:start',
70
- 'presentation:started',
71
- 'presentation:end',
72
- 'presentation:ended',
73
- 'presentation:failed',
45
+ constants_1.ENDED,
46
+ constants_1.CONNECTING,
47
+ constants_1.SENDING,
48
+ constants_1.REINVITE,
49
+ constants_1.REPLACES,
50
+ constants_1.REFER,
51
+ constants_1.PROGRESS,
52
+ constants_1.ACCEPTED,
53
+ constants_1.CONFIRMED,
54
+ constants_1.PEER_CONNECTION,
55
+ constants_1.FAILED,
56
+ constants_1.MUTED,
57
+ constants_1.UNMUTED,
58
+ constants_1.NEW_DTMF,
59
+ constants_1.NEW_INFO,
60
+ constants_1.HOLD,
61
+ constants_1.UNHOLD,
62
+ constants_1.UPDATE,
63
+ constants_1.SDP,
64
+ constants_1.ICE_CANDIDATE,
65
+ constants_1.GET_USER_MEDIA_FAILED,
66
+ constants_1.PEER_CONNECTION_CREATE_OFFER_FAILED,
67
+ constants_1.PEER_CONNECTION_CREATE_ANSWER_FAILED,
68
+ constants_1.PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED,
69
+ constants_1.PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED,
70
+ constants_1.PRESENTATION_START,
71
+ constants_1.PRESENTATION_STARTED,
72
+ constants_1.PRESENTATION_END,
73
+ constants_1.PRESENTATION_ENDED,
74
+ constants_1.PRESENTATION_FAILED,
74
75
  ];
76
+ exports.UA_EVENT_NAMES = [...exports.UA_JSSIP_EVENT_NAMES, ...exports.UA_SYNTHETICS_EVENT_NAMES];
75
77
  exports.SESSION_EVENT_NAMES = [
76
78
  ...exports.SESSION_JSSIP_EVENT_NAMES,
77
- ...SESSION_SYNTHETICS_EVENT_NAMES,
79
+ ...exports.SESSION_SYNTHETICS_EVENT_NAMES,
78
80
  ];
79
81
  //# sourceMappingURL=eventNames.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"eventNames.js","sourceRoot":"","sources":["../src/eventNames.ts"],"names":[],"mappings":";;;AAAA,MAAM,yBAAyB,GAAG;IAChC,cAAc;IACd,sBAAsB;IACtB,oBAAoB;CACZ,CAAC;AAEE,QAAA,oBAAoB,GAAG;IAClC,YAAY;IACZ,WAAW;IACX,cAAc;IACd,eAAe;IACf,YAAY;IACZ,cAAc;IACd,oBAAoB;IACpB,YAAY;IACZ,UAAU;CACF,CAAC;AAEE,QAAA,cAAc,GAAG,CAAC,GAAG,4BAAoB,EAAE,GAAG,yBAAyB,CAAU,CAAC;AAE/F,MAAM,8BAA8B,GAAG;IACrC,6BAA6B;IAC7B,gCAAgC;IAChC,sBAAsB;IACtB,YAAY;IACZ,WAAW;IACX,0BAA0B;IAC1B,wBAAwB;IACxB,UAAU;IACV,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;IAClB,sCAAsC;IACtC,0CAA0C;IAC1C,wCAAwC;IACxC,oCAAoC;IACpC,oCAAoC;IACpC,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;CACT,CAAC;AAEE,QAAA,yBAAyB,GAAG;IACvC,OAAO;IACP,YAAY;IACZ,SAAS;IACT,UAAU;IACV,UAAU;IACV,OAAO;IACP,UAAU;IACV,UAAU;IACV,WAAW;IACX,gBAAgB;IAChB,QAAQ;IACR,OAAO;IACP,SAAS;IACT,SAAS;IACT,SAAS;IACT,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,KAAK;IACL,cAAc;IACd,oBAAoB;IACpB,kCAAkC;IAClC,mCAAmC;IACnC,0CAA0C;IAC1C,2CAA2C;IAC3C,oBAAoB;IACpB,sBAAsB;IACtB,kBAAkB;IAClB,oBAAoB;IACpB,qBAAqB;CACb,CAAC;AAEE,QAAA,mBAAmB,GAAG;IACjC,GAAG,iCAAyB;IAC5B,GAAG,8BAA8B;CACzB,CAAC"}
1
+ {"version":3,"file":"eventNames.js","sourceRoot":"","sources":["../src/eventNames.ts"],"names":[],"mappings":";;;AAAA,2CA+DqB;AAER,QAAA,yBAAyB,GAAG;IACvC,yBAAa;IACb,kCAAsB;IACtB,gCAAoB;CACZ,CAAC;AAEE,QAAA,oBAAoB,GAAG;IAClC,sBAAU;IACV,qBAAS;IACT,wBAAY;IACZ,2BAAe;IACf,sBAAU;IACV,wBAAY;IACZ,+BAAmB;IACnB,uBAAW;IACX,qBAAS;CACD,CAAC;AAEE,QAAA,8BAA8B,GAAG;IAC5C,gDAAoC;IACpC,oDAAwC;IACxC,wCAA4B;IAC5B,uBAAW;IACX,sBAAU;IACV,qCAAyB;IACzB,mCAAuB;IACvB,oBAAQ;IACR,2BAAe;IACf,6BAAiB;IACjB,4BAAgB;IAChB,gDAAoC;IACpC,oDAAwC;IACxC,kDAAsC;IACtC,8CAAkC;IAClC,+CAAmC;IACnC,2BAAe;IACf,2BAAe;IACf,2BAAe;IACf,2BAAe;IACf,+CAAmC;CAC3B,CAAC;AAEE,QAAA,yBAAyB,GAAG;IACvC,iBAAK;IACL,sBAAU;IACV,mBAAO;IACP,oBAAQ;IACR,oBAAQ;IACR,iBAAK;IACL,oBAAQ;IACR,oBAAQ;IACR,qBAAS;IACT,2BAAe;IACf,kBAAM;IACN,iBAAK;IACL,mBAAO;IACP,oBAAQ;IACR,oBAAQ;IACR,gBAAI;IACJ,kBAAM;IACN,kBAAM;IACN,eAAG;IACH,yBAAa;IACb,iCAAqB;IACrB,+CAAmC;IACnC,gDAAoC;IACpC,wDAA4C;IAC5C,yDAA6C;IAC7C,8BAAkB;IAClB,gCAAoB;IACpB,4BAAgB;IAChB,8BAAkB;IAClB,+BAAmB;CACX,CAAC;AAEE,QAAA,cAAc,GAAG,CAAC,GAAG,4BAAoB,EAAE,GAAG,iCAAyB,CAAC,CAAC;AAEzE,QAAA,mBAAmB,GAAG;IACjC,GAAG,iCAAyB;IAC5B,GAAG,sCAA8B;CACzB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
+ import getCodecFromSender from './utils/getCodecFromSender';
1
2
  import SipConnector, { hasCanceledCallError } from './SipConnector';
2
- import resolveVideoSendingBalancer from './videoSendingBalancer';
3
+ import resolveVideoSendingBalancer from './videoSendingBalancer';
3
4
  import * as causes from './causes';
4
5
  import * as eventNames from './eventNames';
5
- export { causes, eventNames, hasCanceledCallError, resolveVideoSendingBalancer };
6
+ export { causes, eventNames, hasCanceledCallError, resolveVideoSendingBalancer, getCodecFromSender, };
6
7
  export default SipConnector;
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,EAAE,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,2BAA2B,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,CAAC;AAEjF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,YAAY,EAAE,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,2BAA2B,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAE3C,OAAO,EACL,MAAM,EACN,UAAU,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,kBAAkB,GACnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
package/dist/index.es5.js CHANGED
@@ -1,4 +1,4 @@
1
- import e,{isCanceledError as t}from"@krivega/cancelable-promise/dist/CancelableRequest";import s from"events-constructor";import i from"stack-promises";
1
+ import e,{isCanceledError as t}from"@krivega/cancelable-promise/dist/CancelableRequest";import s from"events-constructor";import i from"stack-promises";const n=e=>e.getStats().then((e=>{const t=(s="codec",(e=>[...e.keys()].map((t=>e.get(t))))(e).find((e=>e.type===s)));var s;return null==t?void 0:t.mimeType}));
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -12,5 +12,6 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */function n(e,t,s,i){return new(s||(s=Promise))((function(n,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))}const o=e=>(t,s)=>void 0!==s&&t!==s||void 0===s&&t!==e,r=o(1),a=o(void 0),c=(e,t,s)=>{const i=e.getParameters();i.encodings&&0!==i.encodings.length||(i.encodings=[{}]);const[n]=i.encodings,o=n.scaleResolutionDownBy,c=((e,t)=>{const s=void 0!==e?Math.max(e,1):null;if(null!==s&&r(s,t))return s})(t.scaleResolutionDownBy,o);let h=!1;void 0!==c&&(i.encodings[0].scaleResolutionDownBy=c,h=!0);const d=n.maxBitrate,l=((e,t)=>{if(a(e,t))return e})(t.maxBitrate,d);return void 0!==l&&(i.encodings[0].maxBitrate=l,h=!0),h?(s&&s(i),e.setParameters(i)):Promise.resolve()},h=["connecting","connected","disconnected","newRTCSession","registered","unregistered","registrationFailed","newMessage","sipEvent"],d=[...h,"incomingCall","declinedIncomingCall","failedIncomingCall"],l=["ended","connecting","sending","reinvite","replaces","refer","progress","accepted","confirmed","peerconnection","failed","muted","unmuted","newDTMF","newInfo","hold","unhold","update","sdp","icecandidate","getusermediafailed","peerconnection:createofferfailed","peerconnection:createanswerfailed","peerconnection:setlocaldescriptionfailed","peerconnection:setremotedescriptionfailed","presentation:start","presentation:started","presentation:end","presentation:ended","presentation:failed"],g=[...l,"availableSecondRemoteStream","notAvailableSecondRemoteStream","mustStopPresentation","shareState","enterRoom","peerconnection:confirmed","peerconnection:ontrack","channels","channels:notify","ended:fromserver","main-cam-control","participant:added-to-list-moderators","participant:removed-from-list-moderators","participant:move-request-to-conference","participant:move-request-to-stream","participant:canceling-word-request","webcast:started","webcast:stopped","account:changed","account:deleted"];var u=Object.freeze({__proto__:null,UA_JSSIP_EVENT_NAMES:h,UA_EVENT_NAMES:d,SESSION_JSSIP_EVENT_NAMES:l,SESSION_EVENT_NAMES:g});const m="Terminated";var _=Object.freeze({__proto__:null,CONNECTION_ERROR:"Connection Error",REQUEST_TIMEOUT:"Request Timeout",SIP_FAILURE_CODE:"SIP Failure Code",INTERNAL_ERROR:"Internal Error",BUSY:"Busy",REJECTED:"Rejected",REDIRECTED:"Redirected",UNAVAILABLE:"Unavailable",NOT_FOUND:"Not Found",ADDRESS_INCOMPLETE:"Address Incomplete",INCOMPATIBLE_SDP:"Incompatible SDP",MISSING_SDP:"Missing SDP",AUTHENTICATION_ERROR:"Authentication Error",BYE:m,WEBRTC_ERROR:"WebRTC Error",CANCELED:"Canceled",NO_ANSWER:"No Answer",EXPIRES:"Expires",NO_ACK:"No ACK",DIALOG_ERROR:"Dialog Error",USER_DENIED_MEDIA_ACCESS:"User Denied Media Access",BAD_MEDIA_DESCRIPTION:"Bad Media Description",RTP_TIMEOUT:"RTP Timeout"});const S=e=>e.trim().replace(/ /g,"_"),v=(f=1e5,p=99999999,()=>Math.floor(Math.random()*(p-f))+f);var f,p;const E=e=>{const t=[...e.getAudioTracks(),...e.getVideoTracks()],s=new MediaStream(t);return s.getTracks=()=>[...s.getAudioTracks(),...s.getVideoTracks()],s};var C;!function(e){e.PAUSE_MAIN_CAM="PAUSEMAINCAM",e.RESUME_MAIN_CAM="RESUMEMAINCAM",e.MAX_MAIN_CAM_RESOLUTION="MAXMAINCAMRESOLUTION"}(C||(C={}));const R=(e=new Error)=>{const{originator:s,cause:i}=e;return t(e)||"Request Timeout"===i||"Rejected"===i||"local"===s&&("Canceled"===i||i===m)},b="SipConnector";class T{constructor({JsSIP:t}){this._isRegisterConfig=!1,this._connectionConfiguration={},this._remoteStreams={},this.getSipServerUrl=e=>e,this.isPendingPresentation=!1,this.connect=e=>(this._cancelRequests(),this._cancelableConnect.request(e)),this.createUa=e=>this._cancelableCreateUa.request(e),this.set=e=>this._cancelableSet.request(e),this.call=e=>this._cancelableCall.request(e),this.disconnect=()=>(this._cancelRequests(),this._disconnectWithoutCancelRequests()),this.answerToIncomingCall=e=>this._cancelableAnswer.request(e),this.sendDTMF=e=>this._cancelableSendDTMF.request(e),this.hangUp=()=>(this._cancelRequests(),this._hangUpWithoutCancelRequests()),this.restoreSession=()=>this._cancelableRestoreSession.request(),this.tryRegister=()=>this.isRegisterConfig?(this._uaEvents.trigger("connecting",void 0),this.unregister().finally((()=>this.register())).finally((()=>{}))):Promise.reject(new Error("Config is not registered")),this.declineToIncomingCall=({statusCode:e=487}={})=>new Promise(((t,s)=>{if(!this.isAvailableIncomingCall)return void s(new Error("no incomingSession"));const i=this.incomingSession,n=this.remoteCallerData;this._cancelableCall.cancelRequest(),this._cancelableAnswer.cancelRequest(),this.removeIncomingSession(),this._uaEvents.trigger("declinedIncomingCall",n),t(i.terminate({status_code:e}))})),this.busyIncomingCall=()=>this.declineToIncomingCall({statusCode:486}),this.removeIncomingSession=()=>{delete this.incomingSession},this.handleNewRTCSession=({originator:e,session:t})=>{if("remote"===e){this.incomingSession=t;const e=this.remoteCallerData;this.incomingSession.on("failed",(()=>{this.removeIncomingSession(),this._uaEvents.trigger("failedIncomingCall",e)})),this._uaEvents.trigger("incomingCall",e)}},this._connect=e=>this.createUa(e).then((()=>this._start())),this._createUa=({displayName:e="",user:t,password:s,register:i=!1,sipServerUrl:o,sipWebSocketServerURL:r,remoteAddress:a,extraHeaders:c=[],sdpSemantics:d="plan-b",sessionTimers:l=!1,registerExpires:g=300,connectionRecoveryMinInterval:u=2,connectionRecoveryMaxInterval:m=6})=>n(this,void 0,void 0,(function*(){if(!o)throw new Error("sipServerUrl is required");if(!r)throw new Error("sipWebSocketServerURL is required");if(i&&!t)throw new Error("user is required for authorized connection");if(i&&!s)throw new Error("password is required for authorized connection");let n;this._connectionConfiguration={sipServerUrl:o,displayName:e,register:i,user:t,password:s},this._init({sipServerUrl:o,sipWebSocketServerURL:r}),n=i&&t?t.trim():v();let _="Chrome";"unified-plan"===d&&(_="ChromeNew");const f={password:s,register:i,display_name:S(e),user_agent:_,sdp_semantics:d,sockets:[this.socket],uri:this.getSipServerUrl(n),session_timers:l,register_expires:g,connection_recovery_min_interval:u,connection_recovery_max_interval:m};this.ua&&(yield this._disconnectWithoutCancelRequests()),this._isRegisterConfig=!!f.register,this.ua=new this.JsSIP.UA(f),this._uaEvents.eachTriggers(((e,t)=>{const s=h.find((e=>e===t));s&&this.ua.on(s,e)}));const p=[...(e=>{const t=[];return e&&t.push(`X-Vinteo-Remote: ${e}`),t})(a),...c];return this.ua.registrator().setExtraHeaders(p),this.ua})),this._start=()=>new Promise(((e,t)=>{const s=()=>{n(),e(this.ua)},i=e=>{n(),t(e)},n=()=>{this.off("registered",s),this.off("registrationFailed",i),this.off("connected",s),this.off("disconnected",i)};(()=>{this.isRegisterConfig?(this.on("registered",s),this.on("registrationFailed",i)):this.on("connected",s),this.on("disconnected",i)})(),this.on("newRTCSession",this.handleNewRTCSession),this.ua.start()})),this._set=({displayName:e,password:t})=>new Promise(((s,i)=>{let n=!1,o=!1;void 0!==e&&e!==this._connectionConfiguration.displayName&&(n=this.ua.set("display_name",S(e)),this._connectionConfiguration.displayName=e),void 0!==t&&t!==this._connectionConfiguration.password&&(o=this.ua.set("password",t),this._connectionConfiguration.password=t);const r=n||o;o&&this.isRegisterConfig?this.register().then((()=>s(r))).catch(i):r?s(r):i(r)})),this._disconnectWithoutCancelRequests=()=>this._cancelableDisconnect.request(),this._disconnect=()=>n(this,void 0,void 0,(function*(){this.off("newRTCSession",this.handleNewRTCSession);const e=new Promise((e=>{this.once("disconnected",(()=>{delete this.ua,e()}))}));return this.ua?(yield this._hangUpWithoutCancelRequests(),this.ua?this.ua.stop():this._uaEvents.trigger("disconnected",void 0)):this._uaEvents.trigger("disconnected",void 0),e})),this._call=({number:e,mediaStream:t,extraHeaders:s=[],ontrack:i,iceServers:n})=>new Promise(((o,r)=>{this._connectionConfiguration.number=e,this._connectionConfiguration.answer=!1,this._handleCall({ontrack:i}).then(o).catch(r),this.session=this.ua.call(this.getSipServerUrl(e),{extraHeaders:s,mediaStream:E(t),eventHandlers:this._sessionEvents.triggers,pcConfig:{iceServers:n}})})),this._answer=({mediaStream:e,ontrack:t,extraHeaders:s=[],iceServers:i})=>new Promise(((n,o)=>{if(!this.isAvailableIncomingCall)return void o(new Error("no incomingSession"));this.session=this.incomingSession,this.removeIncomingSession(),this._sessionEvents.eachTriggers(((e,t)=>{const s=l.find((e=>e===t));s&&this.session.on(s,e)})),this._connectionConfiguration.answer=!0,this._connectionConfiguration.number=this.session.remote_identity.uri.user,this._handleCall({ontrack:t}).then(n).catch(o);const r=e?E(e):void 0;this.session.answer({extraHeaders:s,mediaStream:r,pcConfig:{iceServers:i}})})),this._handleCall=({ontrack:e})=>new Promise(((t,s)=>{const i=()=>{this.offSession("peerconnection",a),this.offSession("confirmed",c)},n=()=>{this.offSession("failed",o),this.offSession("ended",o)},o=e=>{const{originator:t}=e;"remote"===t&&this._sessionEvents.trigger("ended:fromserver",e),this.session&&!this._cancelableRestoreSession.requested&&this.restoreSession(),i(),n(),s(e)};let r;const a=({peerconnection:t})=>{r=t,r.ontrack=t=>{this._sessionEvents.trigger("peerconnection:ontrack",r),e&&e(t)}},c=()=>{r&&this._sessionEvents.trigger("peerconnection:confirmed",r),i(),t(r)};(()=>{this.onSession("peerconnection",a),this.onSession("confirmed",c)})(),(()=>{this.onSession("failed",o),this.onSession("ended",o)})()})),this._restoreSession=()=>n(this,void 0,void 0,(function*(){this._streamPresentationCurrent&&(yield this.stopPresentation()),delete this._connectionConfiguration.number,delete this.session,this._remoteStreams={}})),this._sendDTMF=e=>new Promise(((t,s)=>{this.session?(this.onceSession("newDTMF",(({originator:e})=>{"local"===e&&t()})),this.session.sendDTMF(e,{duration:120,interToneGap:600})):s()})),this._hangUpWithoutCancelRequests=()=>n(this,void 0,void 0,(function*(){if(this.ua&&this.session){const{session:e}=this;yield this.restoreSession(),e.isEnded()||e.terminate()}})),this._handleShareState=e=>{switch(e){case"YOUCANRECEIVECONTENT":this._sessionEvents.trigger("availableSecondRemoteStream",void 0);break;case"CONTENTEND":this._sessionEvents.trigger("notAvailableSecondRemoteStream",void 0);break;case"YOUMUSTSTOPSENDCONTENT":this._sessionEvents.trigger("mustStopPresentation",void 0)}},this._maybeTriggerChannels=e=>{const t=e.getHeader("X-WEBRTC-INPUT-CHANNELS"),s=e.getHeader("X-WEBRTC-OUTPUT-CHANNELS");if(t&&s){const e={inputChannels:t,outputChannels:s};this._sessionEvents.trigger("channels",e)}},this._handleNotify=e=>{if("channels"===e.cmd){const t=e;this._maybeTriggerChannelsNotify(t)}else if("WebcastStarted"===e.cmd){const t=e;this._maybeTriggerWebcastStartedNotify(t)}else if("WebcastStopped"===e.cmd){const t=e;this._maybeTriggerWebcastStoppedNotify(t)}else if("addedToListModerators"===e.cmd){const t=e;this._maybeTriggerAddedToListModeratorsNotify(t)}else if("removedFromListModerators"===e.cmd){const t=e;this._maybeTriggerRemovedFromListModeratorsNotify(t)}else if("WebcastParticipationAccepted"===e.cmd){const t=e;this._maybeTriggerParticipantMoveRequestToConference(t)}else if("WebcastParticipationRejected"===e.cmd){const t=e;this._maybeTriggerParticipantCancelingWordRequest(t)}else if("ParticipantMovedToWebcast"===e.cmd){const t=e;this._maybeTriggerParticipantMoveRequestToStream(t)}else"accountChanged"===e.cmd?this._maybeTriggerAccountChangedNotify():"accountDeleted"===e.cmd&&this._maybeTriggerAccountDeletedNotify()},this._maybeTriggerRemovedFromListModeratorsNotify=({conference:e})=>{const t={conference:e};this._sessionEvents.trigger("participant:removed-from-list-moderators",t)},this._maybeTriggerAddedToListModeratorsNotify=({conference:e})=>{const t={conference:e};this._sessionEvents.trigger("participant:added-to-list-moderators",t)},this._maybeTriggerWebcastStartedNotify=({body:{conference:e,type:t}})=>{const s={conference:e,type:t};this._sessionEvents.trigger("webcast:started",s)},this._maybeTriggerWebcastStoppedNotify=({body:{conference:e,type:t}})=>{const s={conference:e,type:t};this._sessionEvents.trigger("webcast:stopped",s)},this._maybeTriggerAccountChangedNotify=()=>{this._sessionEvents.trigger("account:changed",void 0)},this._maybeTriggerAccountDeletedNotify=()=>{this._sessionEvents.trigger("account:deleted",void 0)},this._maybeTriggerChannelsNotify=e=>{const t={inputChannels:e.input,outputChannels:e.output};this.session&&this._sessionEvents.trigger("channels:notify",t)},this._maybeTriggerParticipantMoveRequestToConference=({body:{conference:e}})=>{const t={conference:e};this._sessionEvents.trigger("participant:move-request-to-conference",t)},this._maybeTriggerParticipantCancelingWordRequest=({body:{conference:e}})=>{const t={conference:e};this._sessionEvents.trigger("participant:canceling-word-request",t)},this._maybeTriggerParticipantMoveRequestToStream=({body:{conference:e}})=>{const t={conference:e};this._sessionEvents.trigger("participant:move-request-to-stream",t)},this._triggerEnterRoom=e=>{const t=e.getHeader("x-webrtc-enter-room");this._sessionEvents.trigger("enterRoom",t)},this._triggerShareState=e=>{const t=e.getHeader("x-webrtc-share-state");this._sessionEvents.trigger("shareState",t)},this._triggerMainCamControl=e=>{const t=e.getHeader("X-WEBRTC-MAINCAM"),s=e.getHeader("X-WEBRTC-MAINCAM-RESOLUTION");this._sessionEvents.trigger("main-cam-control",{mainCam:t,resolutionMainCam:s})},this._handleNewInfo=e=>{const{originator:t}=e;if("remote"!==t)return;const s=e.request,i=s.getHeader("content-type");if(i)switch(i){case"application/vinteo.webrtc.roomname":this._triggerEnterRoom(s),this._maybeTriggerChannels(s);break;case"application/vinteo.webrtc.notify":this._maybeHandleNotify(s);break;case"application/vinteo.webrtc.sharedesktop":this._triggerShareState(s);break;case"application/vinteo.webrtc.maincam":this._triggerMainCamControl(s)}},this._handleSipEvent=({request:e})=>{this._maybeHandleNotify(e)},this._maybeHandleNotify=e=>{const t=e.getHeader("X-VINTEO-NOTIFY");if(t){const e=JSON.parse(t);this._handleNotify(e)}},this.JsSIP=t,this._sessionEvents=new s(g),this._uaEvents=new s(d),this._cancelableConnect=new e(this._connect,b,(()=>{this._cancelableCreateUa.cancelRequest(),this._cancelableDisconnect.cancelRequest()})),this._cancelableCreateUa=new e(this._createUa,b),this._cancelableDisconnect=new e(this._disconnect,b),this._cancelableSet=new e(this._set,b),this._cancelableCall=new e(this._call,b),this._cancelableAnswer=new e(this._answer,b),this._cancelableSendDTMF=new e(this._sendDTMF,b),this._cancelableRestoreSession=new e(this._restoreSession,b),this.onSession("shareState",this._handleShareState),this.onSession("newInfo",this._handleNewInfo),this.on("sipEvent",this._handleSipEvent)}register(){return new Promise(((e,t)=>{this.isRegisterConfig?(this.ua.on("registered",e),this.ua.on("registrationFailed",t),this.ua.register()):t(new Error("Config is not registered"))}))}unregister(){return new Promise(((e,t)=>{this.isRegistered?(this.ua.on("unregistered",e),this.ua.unregister()):t(new Error("ua is not registered"))}))}replaceMediaStream(e,t){return this.session.replaceMediaStream(e,t)}startPresentation(e,{isNeedReinvite:t=!0,isP2P:s=!1,maxBitrate:i}={}){this.isPendingPresentation=!0;const n=E(e);this._streamPresentationCurrent=n;let o=Promise.resolve();const r=s?["x-webrtc-share-state: YOUCANRECEIVECONTENT"]:["x-webrtc-share-state: LETMESTARTPRESENTATION"];return this.isEstablishedSession&&(o=this.session.sendInfo("application/vinteo.webrtc.sharedesktop",void 0,{extraHeaders:r}).then((()=>this.session.startPresentation(n,t))).then((()=>{const{connection:t}=this;if(!t||void 0===i)return;return((e,t,s)=>{const i=((e,t)=>e.find((e=>e.track&&t.getTracks().includes(e.track))))(e,t);return i?c(i,{maxBitrate:s}):Promise.resolve()})(t.getSenders(),e,i)})).then((()=>e)).catch((e=>{throw this._sessionEvents.trigger("presentation:failed",e),e}))),o.finally((()=>{this.isPendingPresentation=!1}))}stopPresentation({isP2P:e=!1}={}){this.isPendingPresentation=!0;const t=this._streamPresentationCurrent;let s=Promise.resolve();const i=e?["x-webrtc-share-state: CONTENTEND"]:["x-webrtc-share-state: STOPPRESENTATION"];return this.isEstablishedSession&&t&&(s=this.session.sendInfo("application/vinteo.webrtc.sharedesktop",void 0,{extraHeaders:i}).then((()=>this.session.stopPresentation(t))).catch((e=>{throw this._sessionEvents.trigger("presentation:failed",e),e}))),!this.isEstablishedSession&&t&&this._sessionEvents.trigger("presentation:ended",t),s.finally((()=>{delete this._streamPresentationCurrent,this.isPendingPresentation=!1}))}on(e,t){this._uaEvents.on(e,t)}once(e,t){this._uaEvents.once(e,t)}wait(e){return this._uaEvents.wait(e)}off(e,t){this._uaEvents.off(e,t)}onSession(e,t){this._sessionEvents.on(e,t)}onceSession(e,t){this._sessionEvents.once(e,t)}waitSession(e){return this._sessionEvents.wait(e)}offSession(e,t){this._sessionEvents.off(e,t)}isMutedVideo(){if(this.session)return this.session.isMuted().video}isMutedAudio(){if(this.session)return this.session.isMuted().audio}isConfigured(){return!!this.ua}getConnectionConfiguration(){return Object.assign({},this._connectionConfiguration)}getRemoteStreams(){if(!this.connection)return;const e=this.connection.getReceivers().map((({track:e})=>e));return(e=>e.some((e=>{const{kind:t}=e;return"video"===t})))(e)?this._generateStreams(e):this._generateAudioStreams(e)}get connection(){var e;return null===(e=null==this?void 0:this.session)||void 0===e?void 0:e.connection}get remoteCallerData(){var e,t,s,i,n,o;return{displayName:null===(t=null===(e=null==this?void 0:this.incomingSession)||void 0===e?void 0:e.remote_identity)||void 0===t?void 0:t.display_name,host:null===(i=null===(s=null==this?void 0:this.incomingSession)||void 0===s?void 0:s.remote_identity)||void 0===i?void 0:i.uri.host,incomingNumber:null===(o=null===(n=null==this?void 0:this.incomingSession)||void 0===n?void 0:n.remote_identity)||void 0===o?void 0:o.uri.user,session:null==this?void 0:this.incomingSession}}get requested(){return this._cancelableConnect.requested||this._cancelableCreateUa.requested||this._cancelableCall.requested||this._cancelableAnswer.requested}get isEstablishedSession(){return this.session&&this.session.isEstablished()}get isRegistered(){return!!this.ua&&this.ua.isRegistered()}get isRegisterConfig(){return!!this.ua&&this._isRegisterConfig}get isCallActive(){return!(!this.ua||!this.session)}get isAvailableIncomingCall(){return!!this.incomingSession}_init({sipServerUrl:e,sipWebSocketServerURL:t}){var s;this.getSipServerUrl=(s=e,e=>`sip:${e}@${s}`),this.socket=new this.JsSIP.WebSocketInterface(t)}_generateStream(e,t){const s=e.id,i=this._remoteStreams[s]||new MediaStream;return t&&i.addTrack(t),i.addTrack(e),this._remoteStreams[s]=i,i}_generateAudioStream(e){const t=e.id,s=this._remoteStreams[t]||new MediaStream;return s.addTrack(e),this._remoteStreams[t]=s,s}_generateStreams(e){const t=[];return e.forEach(((s,i)=>{if("audio"===s.kind)return;const n=s,o=e[i-1];let r;o&&"audio"===o.kind&&(r=o);const a=this._generateStream(n,r);t.push(a)}),[]),t}_generateAudioStreams(e){return e.map((e=>this._generateAudioStream(e)))}_cancelRequests(){this._cancelActionsRequests(),this._cancelCallRequests(),this._cancelConnectRequests()}_cancelConnectRequests(){this._cancelableConnect.cancelRequest()}_cancelCallRequests(){this._cancelableCall.cancelRequest(),this._cancelableAnswer.cancelRequest(),this._cancelableRestoreSession.cancelRequest()}_cancelActionsRequests(){this._cancelableAnswer.cancelRequest(),this._cancelableSendDTMF.cancelRequest()}waitChannels(){return this.waitSession("channels")}sendChannels({inputChannels:e,outputChannels:t}){const s=[`X-WEBRTC-INPUT-CHANNELS: ${e}`,`X-WEBRTC-OUTPUT-CHANNELS: ${t}`];this.session.sendInfo("application/vinteo.webrtc.channels",void 0,{extraHeaders:s})}}const w=e=>1e6*e,N=w(64),A=w(6144),y=i(),M=e=>{y.add(e),y().catch((e=>{console.debug("videoSendingBalancer: error",e)}))},I=(e,t,s,i)=>{M((()=>c(e,{scaleResolutionDownBy:t,maxBitrate:s},i)))},P=(e,{track:t,resolution:s},i)=>{const n=t.getSettings(),o=n.width,r=n.height,[a,c]=s.split("x"),h=o/+a,d=r/+c,l=Math.max(h,d,1),g=(u=+a)<=64?N:u<=128?w(128):u<=256?w(256):u<=384?w(320):u<=426?w(512):u<=640?w(1024):u<=848?w(1536):u<=1280?w(2048):u<=1920?w(4096):A;var u;I(e,l,g,i)},q=({mainCam:e,resolutionMainCam:t,sender:s,track:i},n)=>{switch(e){case C.PAUSE_MAIN_CAM:((e,t)=>{I(e,200,N,t)})(s,n);break;case C.RESUME_MAIN_CAM:((e,t)=>{I(e,1,A,t)})(s,n);break;case C.MAX_MAIN_CAM_RESOLUTION:P(s,{track:i,resolution:t},n)}},U=(e,t=!0,s)=>{let i,n;const o=t=>{const{connection:s}=e;if(!s)return;const o=(e=>e.find((e=>{var t;return"video"===(null===(t=null==e?void 0:e.track)||void 0===t?void 0:t.kind)})))(s.getSenders());o&&o.track&&void 0!==i&&void 0!==n&&q({mainCam:i,resolutionMainCam:n,sender:o,track:o.track},t)},r=e=>{i=e.mainCam,n=e.resolutionMainCam,o(s)},a=()=>{e.onSession("main-cam-control",r)};return!0===t&&a(),{balance:o,subscribe:a,unsubscribe:()=>{e.offSession("main-cam-control",r)}}};export{_ as causes,T as default,u as eventNames,R as hasCanceledCallError,U as resolveVideoSendingBalancer};
15
+ ***************************************************************************** */
16
+ function o(e,t,s,i){return new(s||(s=Promise))((function(n,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))}const r=e=>(t,s)=>void 0!==s&&t!==s||void 0===s&&t!==e,a=r(1),c=r(void 0),h=(e,t,s)=>{const i=e.getParameters();i.encodings&&0!==i.encodings.length||(i.encodings=[{}]);const[n]=i.encodings,o=n.scaleResolutionDownBy,r=((e,t)=>{const s=void 0!==e?Math.max(e,1):null;if(null!==s&&a(s,t))return s})(t.scaleResolutionDownBy,o);let h=!1;void 0!==r&&(i.encodings[0].scaleResolutionDownBy=r,h=!0);const d=n.maxBitrate,l=((e,t)=>{if(c(e,t))return e})(t.maxBitrate,d);return void 0!==l&&(i.encodings[0].maxBitrate=l,h=!0),h?(s&&s(i),e.setParameters(i)):Promise.resolve()},d=["incomingCall","declinedIncomingCall","failedIncomingCall"],l=["connecting","connected","disconnected","newRTCSession","registered","unregistered","registrationFailed","newMessage","sipEvent"],g=["availableSecondRemoteStream","notAvailableSecondRemoteStream","mustStopPresentation","shareState","enterRoom","peerconnection:confirmed","peerconnection:ontrack","channels","channels:notify","ended:fromserver","main-cam-control","participant:added-to-list-moderators","participant:removed-from-list-moderators","participant:move-request-to-conference","participant:move-request-to-stream","participant:canceling-word-request","webcast:started","webcast:stopped","account:changed","account:deleted","conference:participant-token-issued"],u=["ended","connecting","sending","reinvite","replaces","refer","progress","accepted","confirmed","peerconnection","failed","muted","unmuted","newDTMF","newInfo","hold","unhold","update","sdp","icecandidate","getusermediafailed","peerconnection:createofferfailed","peerconnection:createanswerfailed","peerconnection:setlocaldescriptionfailed","peerconnection:setremotedescriptionfailed","presentation:start","presentation:started","presentation:end","presentation:ended","presentation:failed"],m=[...l,...d],_=[...u,...g];var S=Object.freeze({__proto__:null,UA_SYNTHETICS_EVENT_NAMES:d,UA_JSSIP_EVENT_NAMES:l,SESSION_SYNTHETICS_EVENT_NAMES:g,SESSION_JSSIP_EVENT_NAMES:u,UA_EVENT_NAMES:m,SESSION_EVENT_NAMES:_});const f="Terminated";var v=Object.freeze({__proto__:null,CONNECTION_ERROR:"Connection Error",REQUEST_TIMEOUT:"Request Timeout",SIP_FAILURE_CODE:"SIP Failure Code",INTERNAL_ERROR:"Internal Error",BUSY:"Busy",REJECTED:"Rejected",REDIRECTED:"Redirected",UNAVAILABLE:"Unavailable",NOT_FOUND:"Not Found",ADDRESS_INCOMPLETE:"Address Incomplete",INCOMPATIBLE_SDP:"Incompatible SDP",MISSING_SDP:"Missing SDP",AUTHENTICATION_ERROR:"Authentication Error",BYE:f,WEBRTC_ERROR:"WebRTC Error",CANCELED:"Canceled",NO_ANSWER:"No Answer",EXPIRES:"Expires",NO_ACK:"No ACK",DIALOG_ERROR:"Dialog Error",USER_DENIED_MEDIA_ACCESS:"User Denied Media Access",BAD_MEDIA_DESCRIPTION:"Bad Media Description",RTP_TIMEOUT:"RTP Timeout"});const p=e=>e.trim().replace(/ /g,"_"),E=(C=1e5,T=99999999,()=>Math.floor(Math.random()*(T-C))+C);var C,T;const b=e=>{const t=[...e.getAudioTracks(),...e.getVideoTracks()],s=new MediaStream(t);return s.getTracks=()=>[...s.getAudioTracks(),...s.getVideoTracks()],s};var R;!function(e){e.PAUSE_MAIN_CAM="PAUSEMAINCAM",e.RESUME_MAIN_CAM="RESUMEMAINCAM",e.MAX_MAIN_CAM_RESOLUTION="MAXMAINCAMRESOLUTION"}(R||(R={}));const N=(e=new Error)=>{const{originator:s,cause:i}=e;return t(e)||"Request Timeout"===i||"Rejected"===i||"local"===s&&("Canceled"===i||i===f)},w="SipConnector";class y{constructor({JsSIP:t}){this._isRegisterConfig=!1,this._connectionConfiguration={},this._remoteStreams={},this.getSipServerUrl=e=>e,this.isPendingPresentation=!1,this.connect=e=>(this._cancelRequests(),this._cancelableConnect.request(e)),this.createUa=e=>this._cancelableCreateUa.request(e),this.set=e=>this._cancelableSet.request(e),this.call=e=>this._cancelableCall.request(e),this.disconnect=()=>(this._cancelRequests(),this._disconnectWithoutCancelRequests()),this.answerToIncomingCall=e=>this._cancelableAnswer.request(e),this.sendDTMF=e=>this._cancelableSendDTMF.request(e),this.hangUp=()=>(this._cancelRequests(),this._hangUpWithoutCancelRequests()),this.restoreSession=()=>this._cancelableRestoreSession.request(),this.tryRegister=()=>this.isRegisterConfig?(this._uaEvents.trigger("connecting",void 0),this.unregister().finally((()=>this.register())).finally((()=>{}))):Promise.reject(new Error("Config is not registered")),this.declineToIncomingCall=({statusCode:e=487}={})=>new Promise(((t,s)=>{if(!this.isAvailableIncomingCall)return void s(new Error("no incomingSession"));const i=this.incomingSession,n=this.remoteCallerData;this._cancelableCall.cancelRequest(),this._cancelableAnswer.cancelRequest(),this.removeIncomingSession(),this._uaEvents.trigger("declinedIncomingCall",n),t(i.terminate({status_code:e}))})),this.busyIncomingCall=()=>this.declineToIncomingCall({statusCode:486}),this.removeIncomingSession=()=>{delete this.incomingSession},this.handleNewRTCSession=({originator:e,session:t})=>{if("remote"===e){this.incomingSession=t;const e=this.remoteCallerData;this.incomingSession.on("failed",(()=>{this.removeIncomingSession(),this._uaEvents.trigger("failedIncomingCall",e)})),this._uaEvents.trigger("incomingCall",e)}},this._connect=e=>this.createUa(e).then((()=>this._start())),this._createUa=({displayName:e="",user:t,password:s,register:i=!1,sipServerUrl:n,sipWebSocketServerURL:r,remoteAddress:a,extraHeaders:c=[],sdpSemantics:h="plan-b",sessionTimers:d=!1,registerExpires:g=300,connectionRecoveryMinInterval:u=2,connectionRecoveryMaxInterval:m=6})=>o(this,void 0,void 0,(function*(){if(!n)throw new Error("sipServerUrl is required");if(!r)throw new Error("sipWebSocketServerURL is required");if(i&&!t)throw new Error("user is required for authorized connection");if(i&&!s)throw new Error("password is required for authorized connection");let o;this._connectionConfiguration={sipServerUrl:n,displayName:e,register:i,user:t,password:s},this._init({sipServerUrl:n,sipWebSocketServerURL:r}),o=i&&t?t.trim():E();let _="Chrome";"unified-plan"===h&&(_="ChromeNew");const S={password:s,register:i,display_name:p(e),user_agent:_,sdp_semantics:h,sockets:[this.socket],uri:this.getSipServerUrl(o),session_timers:d,register_expires:g,connection_recovery_min_interval:u,connection_recovery_max_interval:m};this.ua&&(yield this._disconnectWithoutCancelRequests()),this._isRegisterConfig=!!S.register,this.ua=new this.JsSIP.UA(S),this._uaEvents.eachTriggers(((e,t)=>{const s=l.find((e=>e===t));s&&this.ua.on(s,e)}));const f=(e=>{const t=[];return e&&t.push(`X-Vinteo-Remote: ${e}`),t})(a),v=[...f,...c];return this.ua.registrator().setExtraHeaders(v),this.ua})),this._start=()=>new Promise(((e,t)=>{const s=()=>{n(),e(this.ua)},i=e=>{n(),t(e)},n=()=>{this.off("registered",s),this.off("registrationFailed",i),this.off("connected",s),this.off("disconnected",i)};(()=>{this.isRegisterConfig?(this.on("registered",s),this.on("registrationFailed",i)):this.on("connected",s),this.on("disconnected",i)})(),this.on("newRTCSession",this.handleNewRTCSession),this.ua.start()})),this._set=({displayName:e,password:t})=>new Promise(((s,i)=>{let n=!1,o=!1;void 0!==e&&e!==this._connectionConfiguration.displayName&&(n=this.ua.set("display_name",p(e)),this._connectionConfiguration.displayName=e),void 0!==t&&t!==this._connectionConfiguration.password&&(o=this.ua.set("password",t),this._connectionConfiguration.password=t);const r=n||o;o&&this.isRegisterConfig?this.register().then((()=>s(r))).catch(i):r?s(r):i(r)})),this._disconnectWithoutCancelRequests=()=>this._cancelableDisconnect.request(),this._disconnect=()=>o(this,void 0,void 0,(function*(){this.off("newRTCSession",this.handleNewRTCSession);const e=new Promise((e=>{this.once("disconnected",(()=>{delete this.ua,e()}))}));return this.ua?(yield this._hangUpWithoutCancelRequests(),this.ua?this.ua.stop():this._uaEvents.trigger("disconnected",void 0)):this._uaEvents.trigger("disconnected",void 0),e})),this._call=({number:e,mediaStream:t,extraHeaders:s=[],ontrack:i,iceServers:n})=>new Promise(((o,r)=>{this._connectionConfiguration.number=e,this._connectionConfiguration.answer=!1,this._handleCall({ontrack:i}).then(o).catch(r),this.session=this.ua.call(this.getSipServerUrl(e),{extraHeaders:s,mediaStream:b(t),eventHandlers:this._sessionEvents.triggers,pcConfig:{iceServers:n}})})),this._answer=({mediaStream:e,ontrack:t,extraHeaders:s=[],iceServers:i})=>new Promise(((n,o)=>{if(!this.isAvailableIncomingCall)return void o(new Error("no incomingSession"));this.session=this.incomingSession,this.removeIncomingSession(),this._sessionEvents.eachTriggers(((e,t)=>{const s=u.find((e=>e===t));s&&this.session.on(s,e)})),this._connectionConfiguration.answer=!0,this._connectionConfiguration.number=this.session.remote_identity.uri.user,this._handleCall({ontrack:t}).then(n).catch(o);const r=e?b(e):void 0;this.session.answer({extraHeaders:s,mediaStream:r,pcConfig:{iceServers:i}})})),this._handleCall=({ontrack:e})=>new Promise(((t,s)=>{const i=()=>{this.offSession("peerconnection",a),this.offSession("confirmed",c)},n=()=>{this.offSession("failed",o),this.offSession("ended",o)},o=e=>{const{originator:t}=e;"remote"===t&&this._sessionEvents.trigger("ended:fromserver",e),this.session&&!this._cancelableRestoreSession.requested&&this.restoreSession(),i(),n(),s(e)};let r;const a=({peerconnection:t})=>{r=t,r.ontrack=t=>{this._sessionEvents.trigger("peerconnection:ontrack",r),e&&e(t)}},c=()=>{r&&this._sessionEvents.trigger("peerconnection:confirmed",r),i(),t(r)};(()=>{this.onSession("peerconnection",a),this.onSession("confirmed",c)})(),(()=>{this.onSession("failed",o),this.onSession("ended",o)})()})),this._restoreSession=()=>o(this,void 0,void 0,(function*(){this._streamPresentationCurrent&&(yield this.stopPresentation()),delete this._connectionConfiguration.number,delete this.session,this._remoteStreams={}})),this._sendDTMF=e=>new Promise(((t,s)=>{this.session?(this.onceSession("newDTMF",(({originator:e})=>{"local"===e&&t()})),this.session.sendDTMF(e,{duration:120,interToneGap:600})):s()})),this._hangUpWithoutCancelRequests=()=>o(this,void 0,void 0,(function*(){if(this.ua&&this.session){const{session:e}=this;yield this.restoreSession(),e.isEnded()||e.terminate()}})),this._handleShareState=e=>{switch(e){case"YOUCANRECEIVECONTENT":this._sessionEvents.trigger("availableSecondRemoteStream",void 0);break;case"CONTENTEND":this._sessionEvents.trigger("notAvailableSecondRemoteStream",void 0);break;case"YOUMUSTSTOPSENDCONTENT":this._sessionEvents.trigger("mustStopPresentation",void 0)}},this._maybeTriggerChannels=e=>{const t=e.getHeader("X-WEBRTC-INPUT-CHANNELS"),s=e.getHeader("X-WEBRTC-OUTPUT-CHANNELS");if(t&&s){const e={inputChannels:t,outputChannels:s};this._sessionEvents.trigger("channels",e)}},this._handleNotify=e=>{if("channels"===e.cmd){const t=e;this._maybeTriggerChannelsNotify(t)}else if("WebcastStarted"===e.cmd){const t=e;this._maybeTriggerWebcastStartedNotify(t)}else if("WebcastStopped"===e.cmd){const t=e;this._maybeTriggerWebcastStoppedNotify(t)}else if("addedToListModerators"===e.cmd){const t=e;this._maybeTriggerAddedToListModeratorsNotify(t)}else if("removedFromListModerators"===e.cmd){const t=e;this._maybeTriggerRemovedFromListModeratorsNotify(t)}else if("WebcastParticipationAccepted"===e.cmd){const t=e;this._maybeTriggerParticipantMoveRequestToConference(t)}else if("WebcastParticipationRejected"===e.cmd){const t=e;this._maybeTriggerParticipantCancelingWordRequest(t)}else if("ParticipantMovedToWebcast"===e.cmd){const t=e;this._maybeTriggerParticipantMoveRequestToStream(t)}else if("accountChanged"===e.cmd)this._maybeTriggerAccountChangedNotify();else if("accountDeleted"===e.cmd)this._maybeTriggerAccountDeletedNotify();else if("ConferenceParticipantTokenIssued"===e.cmd){const t=e;this._maybeTriggerConferenceParticipantTokenIssued(t)}},this._maybeTriggerRemovedFromListModeratorsNotify=({conference:e})=>{const t={conference:e};this._sessionEvents.trigger("participant:removed-from-list-moderators",t)},this._maybeTriggerAddedToListModeratorsNotify=({conference:e})=>{const t={conference:e};this._sessionEvents.trigger("participant:added-to-list-moderators",t)},this._maybeTriggerWebcastStartedNotify=({body:{conference:e,type:t}})=>{const s={conference:e,type:t};this._sessionEvents.trigger("webcast:started",s)},this._maybeTriggerWebcastStoppedNotify=({body:{conference:e,type:t}})=>{const s={conference:e,type:t};this._sessionEvents.trigger("webcast:stopped",s)},this._maybeTriggerAccountChangedNotify=()=>{this._sessionEvents.trigger("account:changed",void 0)},this._maybeTriggerAccountDeletedNotify=()=>{this._sessionEvents.trigger("account:deleted",void 0)},this._maybeTriggerConferenceParticipantTokenIssued=({body:{conference:e,participant:t,jwt:s}})=>{const i={conference:e,participant:t,jwt:s};this._sessionEvents.trigger("conference:participant-token-issued",i)},this._maybeTriggerChannelsNotify=e=>{const t={inputChannels:e.input,outputChannels:e.output};this.session&&this._sessionEvents.trigger("channels:notify",t)},this._maybeTriggerParticipantMoveRequestToConference=({body:{conference:e}})=>{const t={conference:e};this._sessionEvents.trigger("participant:move-request-to-conference",t)},this._maybeTriggerParticipantCancelingWordRequest=({body:{conference:e}})=>{const t={conference:e};this._sessionEvents.trigger("participant:canceling-word-request",t)},this._maybeTriggerParticipantMoveRequestToStream=({body:{conference:e}})=>{const t={conference:e};this._sessionEvents.trigger("participant:move-request-to-stream",t)},this._triggerEnterRoom=e=>{const t=e.getHeader("x-webrtc-enter-room");this._sessionEvents.trigger("enterRoom",t)},this._triggerShareState=e=>{const t=e.getHeader("x-webrtc-share-state");this._sessionEvents.trigger("shareState",t)},this._triggerMainCamControl=e=>{const t=e.getHeader("X-WEBRTC-MAINCAM"),s=e.getHeader("X-WEBRTC-MAINCAM-RESOLUTION");this._sessionEvents.trigger("main-cam-control",{mainCam:t,resolutionMainCam:s})},this._handleNewInfo=e=>{const{originator:t}=e;if("remote"!==t)return;const s=e.request,i=s.getHeader("content-type");if(i)switch(i){case"application/vinteo.webrtc.roomname":this._triggerEnterRoom(s),this._maybeTriggerChannels(s);break;case"application/vinteo.webrtc.notify":this._maybeHandleNotify(s);break;case"application/vinteo.webrtc.sharedesktop":this._triggerShareState(s);break;case"application/vinteo.webrtc.maincam":this._triggerMainCamControl(s)}},this._handleSipEvent=({request:e})=>{this._maybeHandleNotify(e)},this._maybeHandleNotify=e=>{const t=e.getHeader("X-VINTEO-NOTIFY");if(t){const e=JSON.parse(t);this._handleNotify(e)}},this.JsSIP=t,this._sessionEvents=new s(_),this._uaEvents=new s(m),this._cancelableConnect=new e(this._connect,w,(()=>{this._cancelableCreateUa.cancelRequest(),this._cancelableDisconnect.cancelRequest()})),this._cancelableCreateUa=new e(this._createUa,w),this._cancelableDisconnect=new e(this._disconnect,w),this._cancelableSet=new e(this._set,w),this._cancelableCall=new e(this._call,w),this._cancelableAnswer=new e(this._answer,w),this._cancelableSendDTMF=new e(this._sendDTMF,w),this._cancelableRestoreSession=new e(this._restoreSession,w),this.onSession("shareState",this._handleShareState),this.onSession("newInfo",this._handleNewInfo),this.on("sipEvent",this._handleSipEvent)}register(){return new Promise(((e,t)=>{this.isRegisterConfig?(this.ua.on("registered",e),this.ua.on("registrationFailed",t),this.ua.register()):t(new Error("Config is not registered"))}))}unregister(){return new Promise(((e,t)=>{this.isRegistered?(this.ua.on("unregistered",e),this.ua.unregister()):t(new Error("ua is not registered"))}))}replaceMediaStream(e,t){return this.session.replaceMediaStream(e,t)}startPresentation(e,{isNeedReinvite:t=!0,isP2P:s=!1,maxBitrate:i}={}){this.isPendingPresentation=!0;const n=b(e);this._streamPresentationCurrent=n;let o=Promise.resolve();const r=s?["x-webrtc-share-state: YOUCANRECEIVECONTENT"]:["x-webrtc-share-state: LETMESTARTPRESENTATION"];return this.isEstablishedSession&&(o=this.session.sendInfo("application/vinteo.webrtc.sharedesktop",void 0,{extraHeaders:r}).then((()=>this.session.startPresentation(n,t))).then((()=>{const{connection:t}=this;if(!t||void 0===i)return;return((e,t,s)=>{const i=((e,t)=>e.find((e=>e.track&&t.getTracks().includes(e.track))))(e,t);return i?h(i,{maxBitrate:s}):Promise.resolve()})(t.getSenders(),e,i)})).then((()=>e)).catch((e=>{throw this._sessionEvents.trigger("presentation:failed",e),e}))),o.finally((()=>{this.isPendingPresentation=!1}))}stopPresentation({isP2P:e=!1}={}){this.isPendingPresentation=!0;const t=this._streamPresentationCurrent;let s=Promise.resolve();const i=e?["x-webrtc-share-state: CONTENTEND"]:["x-webrtc-share-state: STOPPRESENTATION"];return this.isEstablishedSession&&t&&(s=this.session.sendInfo("application/vinteo.webrtc.sharedesktop",void 0,{extraHeaders:i}).then((()=>this.session.stopPresentation(t))).catch((e=>{throw this._sessionEvents.trigger("presentation:failed",e),e}))),!this.isEstablishedSession&&t&&this._sessionEvents.trigger("presentation:ended",t),s.finally((()=>{delete this._streamPresentationCurrent,this.isPendingPresentation=!1}))}on(e,t){this._uaEvents.on(e,t)}once(e,t){this._uaEvents.once(e,t)}wait(e){return this._uaEvents.wait(e)}off(e,t){this._uaEvents.off(e,t)}onSession(e,t){this._sessionEvents.on(e,t)}onceSession(e,t){this._sessionEvents.once(e,t)}waitSession(e){return this._sessionEvents.wait(e)}offSession(e,t){this._sessionEvents.off(e,t)}isMutedVideo(){if(this.session)return this.session.isMuted().video}isMutedAudio(){if(this.session)return this.session.isMuted().audio}isConfigured(){return!!this.ua}getConnectionConfiguration(){return Object.assign({},this._connectionConfiguration)}getRemoteStreams(){if(!this.connection)return;const e=this.connection.getReceivers().map((({track:e})=>e));return(e=>e.some((e=>{const{kind:t}=e;return"video"===t})))(e)?this._generateStreams(e):this._generateAudioStreams(e)}get connection(){var e;return null===(e=null==this?void 0:this.session)||void 0===e?void 0:e.connection}get remoteCallerData(){var e,t,s,i,n,o;return{displayName:null===(t=null===(e=null==this?void 0:this.incomingSession)||void 0===e?void 0:e.remote_identity)||void 0===t?void 0:t.display_name,host:null===(i=null===(s=null==this?void 0:this.incomingSession)||void 0===s?void 0:s.remote_identity)||void 0===i?void 0:i.uri.host,incomingNumber:null===(o=null===(n=null==this?void 0:this.incomingSession)||void 0===n?void 0:n.remote_identity)||void 0===o?void 0:o.uri.user,session:null==this?void 0:this.incomingSession}}get requested(){return this._cancelableConnect.requested||this._cancelableCreateUa.requested||this._cancelableCall.requested||this._cancelableAnswer.requested}get isEstablishedSession(){return this.session&&this.session.isEstablished()}get isRegistered(){return!!this.ua&&this.ua.isRegistered()}get isRegisterConfig(){return!!this.ua&&this._isRegisterConfig}get isCallActive(){return!(!this.ua||!this.session)}get isAvailableIncomingCall(){return!!this.incomingSession}_init({sipServerUrl:e,sipWebSocketServerURL:t}){var s;this.getSipServerUrl=(s=e,e=>`sip:${e}@${s}`),this.socket=new this.JsSIP.WebSocketInterface(t)}_generateStream(e,t){const s=e.id,i=this._remoteStreams[s]||new MediaStream;return t&&i.addTrack(t),i.addTrack(e),this._remoteStreams[s]=i,i}_generateAudioStream(e){const t=e.id,s=this._remoteStreams[t]||new MediaStream;return s.addTrack(e),this._remoteStreams[t]=s,s}_generateStreams(e){const t=[];return e.forEach(((s,i)=>{if("audio"===s.kind)return;const n=s,o=e[i-1];let r;o&&"audio"===o.kind&&(r=o);const a=this._generateStream(n,r);t.push(a)}),[]),t}_generateAudioStreams(e){return e.map((e=>this._generateAudioStream(e)))}_cancelRequests(){this._cancelActionsRequests(),this._cancelCallRequests(),this._cancelConnectRequests()}_cancelConnectRequests(){this._cancelableConnect.cancelRequest()}_cancelCallRequests(){this._cancelableCall.cancelRequest(),this._cancelableAnswer.cancelRequest(),this._cancelableRestoreSession.cancelRequest()}_cancelActionsRequests(){this._cancelableAnswer.cancelRequest(),this._cancelableSendDTMF.cancelRequest()}waitChannels(){return this.waitSession("channels")}sendChannels({inputChannels:e,outputChannels:t}){const s=[`X-WEBRTC-INPUT-CHANNELS: ${e}`,`X-WEBRTC-OUTPUT-CHANNELS: ${t}`];this.session.sendInfo("application/vinteo.webrtc.channels",void 0,{extraHeaders:s})}}const A=e=>1e6*e,I=A(64),M=A(6144),P=i(),q=e=>{P.add(e),P().catch((e=>{console.debug("videoSendingBalancer: error",e)}))},U=(e,t,s,i)=>{q((()=>h(e,{scaleResolutionDownBy:t,maxBitrate:s},i)))},k=(e,{track:t,resolution:s},i)=>{const n=t.getSettings(),o=n.width,r=n.height,[a,c]=s.split("x"),h=o/+a,d=r/+c,l=Math.max(h,d,1),g=(u=+a)<=64?I:u<=128?A(128):u<=256?A(256):u<=384?A(320):u<=426?A(512):u<=640?A(1024):u<=848?A(1536):u<=1280?A(2048):u<=1920?A(4096):M;var u;U(e,l,g,i)},O=({mainCam:e,resolutionMainCam:t,sender:s,track:i},n)=>{switch(e){case R.PAUSE_MAIN_CAM:((e,t)=>{U(e,200,I,t)})(s,n);break;case R.RESUME_MAIN_CAM:((e,t)=>{U(e,1,M,t)})(s,n);break;case R.MAX_MAIN_CAM_RESOLUTION:k(s,{track:i,resolution:t},n)}},D=(e,{autoSubscription:t=!0,ignoreForCodec:s,onSetParameters:i}={})=>{let r,a;const c=t=>o(void 0,void 0,void 0,(function*(){const{connection:i}=e;if(!i||void 0===r||void 0===a)return;const o=(e=>e.find((e=>{var t;return"video"===(null===(t=null==e?void 0:e.track)||void 0===t?void 0:t.kind)})))(i.getSenders());if(o&&o.track){if(s){const e=yield n(o);if(h=s,(c=e)&&h&&c.toLowerCase().includes(h.toLowerCase()))return}var c,h;O({mainCam:r,resolutionMainCam:a,sender:o,track:o.track},t)}})),h=e=>{r=e.mainCam,a=e.resolutionMainCam,c(i)},d=()=>{e.onSession("main-cam-control",h)};return!0===t&&d(),{balance:c,subscribe:d,unsubscribe:()=>{e.offSession("main-cam-control",h)}}};export{v as causes,y as default,S as eventNames,n as getCodecFromSender,N as hasCanceledCallError,D as resolveVideoSendingBalancer};
16
17
  //# sourceMappingURL=index.es5.js.map