@wazo/sdk 0.43.15 → 0.44.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.
- package/dist/index.js +10630 -0
- package/dist/index.mjs +10541 -0
- package/{lib → dist}/types/domain/Contact.d.ts +3 -1
- package/dist/types/domain/Contact.d.ts.map +1 -0
- package/{lib → dist}/types/index.d.ts +13 -13
- package/dist/types/index.d.ts.map +1 -0
- package/dist/wazo-sdk.js +69378 -43
- package/dist/wazo-sdk.js.LICENSE.txt +684 -0
- package/package.json +11 -22
- package/esm/__tests__/api-client.test.js +0 -281
- package/esm/__tests__/web-rtc-client.test.js +0 -192
- package/esm/api/agentd.js +0 -23
- package/esm/api/amid.js +0 -17
- package/esm/api/application.js +0 -63
- package/esm/api/auth.js +0 -198
- package/esm/api/call-logd.js +0 -24
- package/esm/api/calld.js +0 -120
- package/esm/api/chatd.js +0 -50
- package/esm/api/confd.js +0 -77
- package/esm/api/ctid-ng.js +0 -96
- package/esm/api/dird.js +0 -110
- package/esm/api/webhookd.js +0 -7
- package/esm/api-client.js +0 -41
- package/esm/base-api-client.js +0 -125
- package/esm/checker/Checker.js +0 -54
- package/esm/checker/checks/aor.js +0 -28
- package/esm/checker/checks/api.js +0 -76
- package/esm/checker/checks/ice-ipv4.js +0 -69
- package/esm/checker/checks/index.js +0 -8
- package/esm/checker/checks/symmetric-nat.js +0 -59
- package/esm/checker/checks/wazo-websocket.js +0 -38
- package/esm/checker/checks/webrtc-transport.js +0 -35
- package/esm/checker/checks/webrtc.js +0 -40
- package/esm/constants.js +0 -11
- package/esm/domain/AdHocAPIConference.js +0 -102
- package/esm/domain/Agent.js +0 -30
- package/esm/domain/BadResponse.js +0 -21
- package/esm/domain/Call.js +0 -123
- package/esm/domain/CallLog.js +0 -157
- package/esm/domain/CallSession.js +0 -253
- package/esm/domain/CallerID.js +0 -24
- package/esm/domain/ChatMessage.js +0 -55
- package/esm/domain/ChatRoom.js +0 -30
- package/esm/domain/Contact.js +0 -464
- package/esm/domain/Country.js +0 -19
- package/esm/domain/Device/DebugDevice.js +0 -32
- package/esm/domain/Device/Device.js +0 -1
- package/esm/domain/DirectorySource.js +0 -1
- package/esm/domain/ExternalApp.js +0 -24
- package/esm/domain/Features.js +0 -77
- package/esm/domain/ForwardOption.js +0 -37
- package/esm/domain/Incall.js +0 -28
- package/esm/domain/IndirectTransfer.js +0 -40
- package/esm/domain/Line.js +0 -39
- package/esm/domain/Meeting.js +0 -61
- package/esm/domain/MeetingAuthorization.js +0 -46
- package/esm/domain/MeetingStatus.js +0 -14
- package/esm/domain/NotificationOptions.js +0 -45
- package/esm/domain/Phone/CTIPhone.js +0 -288
- package/esm/domain/Phone/Phone.js +0 -1
- package/esm/domain/Phone/WebRTCPhone.js +0 -1482
- package/esm/domain/Profile.js +0 -128
- package/esm/domain/Recording.js +0 -30
- package/esm/domain/Relocation.js +0 -20
- package/esm/domain/Room.js +0 -97
- package/esm/domain/SFUNotAvailableError.js +0 -6
- package/esm/domain/ServerError.js +0 -9
- package/esm/domain/Session.js +0 -174
- package/esm/domain/SipLine.js +0 -82
- package/esm/domain/Subscription.js +0 -42
- package/esm/domain/SwitchboardCall.js +0 -56
- package/esm/domain/Voicemail.js +0 -76
- package/esm/domain/__tests__/Agent.test.js +0 -37
- package/esm/domain/__tests__/Call.test.js +0 -25
- package/esm/domain/__tests__/CallLog.test.js +0 -181
- package/esm/domain/__tests__/CallSession.test.js +0 -78
- package/esm/domain/__tests__/Contact.test.js +0 -393
- package/esm/domain/__tests__/IndirectTransfer.test.js +0 -67
- package/esm/domain/__tests__/Line.test.js +0 -52
- package/esm/domain/__tests__/Meeting.test.js +0 -77
- package/esm/domain/__tests__/MeetingAuthorization.test.js +0 -49
- package/esm/domain/__tests__/Profile.test.js +0 -169
- package/esm/domain/__tests__/Room.test.js +0 -206
- package/esm/domain/__tests__/Session.test.js +0 -382
- package/esm/domain/__tests__/SipLine.test.js +0 -27
- package/esm/domain/__tests__/Voicemail.test.js +0 -90
- package/esm/domain/types.js +0 -2
- package/esm/index.js +0 -51
- package/esm/lib/WazoSessionDescriptionHandler.js +0 -429
- package/esm/pubkey.js +0 -10
- package/esm/service/CallApi.js +0 -61
- package/esm/service/IssueReporter.js +0 -331
- package/esm/service/__tests__/IssueReporter.test.js +0 -112
- package/esm/service/__tests__/getApiclient.test.js +0 -37
- package/esm/service/getApiClient.js +0 -94
- package/esm/simple/Auth.js +0 -384
- package/esm/simple/Configuration.js +0 -13
- package/esm/simple/Directory.js +0 -11
- package/esm/simple/Phone.js +0 -389
- package/esm/simple/Websocket.js +0 -81
- package/esm/simple/__tests__/Auth.test.js +0 -144
- package/esm/simple/index.js +0 -137
- package/esm/simple/room/LocalParticipant.js +0 -4
- package/esm/simple/room/Participant.js +0 -315
- package/esm/simple/room/RemoteParticipant.js +0 -10
- package/esm/simple/room/Room.js +0 -714
- package/esm/simple/room/SipRoom.js +0 -121
- package/esm/simple/room/Stream.js +0 -47
- package/esm/simple/room/__tests__/Participant.test.js +0 -71
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +0 -12
- package/esm/simple/utils.js +0 -10
- package/esm/types/WebSocketMessage.js +0 -1
- package/esm/types/domain/Contact.d.ts +0 -332
- package/esm/types/domain/Contact.d.ts.map +0 -1
- package/esm/types/index.d.ts +0 -59
- package/esm/types/index.d.ts.map +0 -1
- package/esm/utils/Emitter.js +0 -19
- package/esm/utils/Heartbeat.js +0 -73
- package/esm/utils/PhoneNumberUtil.js +0 -67
- package/esm/utils/__tests__/Heartbeat.test.js +0 -65
- package/esm/utils/__tests__/PhoneNumberUtil.test.js +0 -70
- package/esm/utils/__tests__/api-requester.test.js +0 -166
- package/esm/utils/__tests__/array.test.js +0 -18
- package/esm/utils/__tests__/compare-version.test.js +0 -10
- package/esm/utils/__tests__/object.test.js +0 -76
- package/esm/utils/__tests__/sdp.test.js +0 -172
- package/esm/utils/__tests__/string.test.js +0 -49
- package/esm/utils/api-requester.js +0 -213
- package/esm/utils/array.js +0 -9
- package/esm/utils/compare-version.js +0 -17
- package/esm/utils/isMobile.js +0 -3
- package/esm/utils/new-from.js +0 -7
- package/esm/utils/object.js +0 -10
- package/esm/utils/once.js +0 -15
- package/esm/utils/sdp.js +0 -104
- package/esm/utils/string.js +0 -12
- package/esm/utils/update-from.js +0 -10
- package/esm/utils/webrtc.js +0 -37
- package/esm/web-rtc-client.js +0 -2200
- package/esm/websocket-client.js +0 -385
- package/index.js +0 -1
- package/lib/__tests__/api-client.test.js +0 -295
- package/lib/__tests__/web-rtc-client.test.js +0 -210
- package/lib/api/agentd.js +0 -28
- package/lib/api/amid.js +0 -28
- package/lib/api/application.js +0 -68
- package/lib/api/auth.js +0 -210
- package/lib/api/call-logd.js +0 -29
- package/lib/api/calld.js +0 -134
- package/lib/api/chatd.js +0 -68
- package/lib/api/confd.js +0 -91
- package/lib/api/ctid-ng.js +0 -101
- package/lib/api/dird.js +0 -124
- package/lib/api/webhookd.js +0 -12
- package/lib/api-client.js +0 -37
- package/lib/base-api-client.js +0 -133
- package/lib/checker/Checker.js +0 -68
- package/lib/checker/checks/aor.js +0 -42
- package/lib/checker/checks/api.js +0 -90
- package/lib/checker/checks/ice-ipv4.js +0 -73
- package/lib/checker/checks/index.js +0 -13
- package/lib/checker/checks/symmetric-nat.js +0 -61
- package/lib/checker/checks/wazo-websocket.js +0 -63
- package/lib/checker/checks/webrtc-transport.js +0 -49
- package/lib/checker/checks/webrtc.js +0 -54
- package/lib/constants.js +0 -14
- package/lib/domain/AdHocAPIConference.js +0 -101
- package/lib/domain/Agent.js +0 -25
- package/lib/domain/BadResponse.js +0 -19
- package/lib/domain/Call.js +0 -112
- package/lib/domain/CallLog.js +0 -151
- package/lib/domain/CallSession.js +0 -224
- package/lib/domain/CallerID.js +0 -27
- package/lib/domain/ChatMessage.js +0 -53
- package/lib/domain/ChatRoom.js +0 -32
- package/lib/domain/Contact.js +0 -439
- package/lib/domain/Country.js +0 -21
- package/lib/domain/Device/DebugDevice.js +0 -35
- package/lib/domain/Device/Device.js +0 -2
- package/lib/domain/DirectorySource.js +0 -2
- package/lib/domain/ExternalApp.js +0 -27
- package/lib/domain/Features.js +0 -87
- package/lib/domain/ForwardOption.js +0 -41
- package/lib/domain/Incall.js +0 -32
- package/lib/domain/IndirectTransfer.js +0 -42
- package/lib/domain/Line.js +0 -39
- package/lib/domain/Meeting.js +0 -55
- package/lib/domain/MeetingAuthorization.js +0 -45
- package/lib/domain/MeetingStatus.js +0 -15
- package/lib/domain/NotificationOptions.js +0 -49
- package/lib/domain/Phone/CTIPhone.js +0 -324
- package/lib/domain/Phone/Phone.js +0 -2
- package/lib/domain/Phone/WebRTCPhone.js +0 -1492
- package/lib/domain/Profile.js +0 -138
- package/lib/domain/Recording.js +0 -31
- package/lib/domain/Relocation.js +0 -18
- package/lib/domain/Room.js +0 -81
- package/lib/domain/SFUNotAvailableError.js +0 -9
- package/lib/domain/ServerError.js +0 -15
- package/lib/domain/Session.js +0 -166
- package/lib/domain/SipLine.js +0 -76
- package/lib/domain/Subscription.js +0 -34
- package/lib/domain/SwitchboardCall.js +0 -50
- package/lib/domain/Voicemail.js +0 -77
- package/lib/domain/__tests__/Agent.test.js +0 -42
- package/lib/domain/__tests__/Call.test.js +0 -30
- package/lib/domain/__tests__/CallLog.test.js +0 -166
- package/lib/domain/__tests__/CallSession.test.js +0 -83
- package/lib/domain/__tests__/Contact.test.js +0 -371
- package/lib/domain/__tests__/IndirectTransfer.test.js +0 -81
- package/lib/domain/__tests__/Line.test.js +0 -57
- package/lib/domain/__tests__/Meeting.test.js +0 -82
- package/lib/domain/__tests__/MeetingAuthorization.test.js +0 -54
- package/lib/domain/__tests__/Profile.test.js +0 -197
- package/lib/domain/__tests__/Room.test.js +0 -220
- package/lib/domain/__tests__/Session.test.js +0 -378
- package/lib/domain/__tests__/SipLine.test.js +0 -32
- package/lib/domain/__tests__/Voicemail.test.js +0 -95
- package/lib/domain/types.js +0 -38
- package/lib/index.js +0 -127
- package/lib/lib/WazoSessionDescriptionHandler.js +0 -434
- package/lib/pubkey.js +0 -12
- package/lib/service/CallApi.js +0 -112
- package/lib/service/IssueReporter.js +0 -317
- package/lib/service/__tests__/IssueReporter.test.js +0 -117
- package/lib/service/__tests__/getApiclient.test.js +0 -42
- package/lib/service/getApiClient.js +0 -114
- package/lib/simple/Auth.js +0 -433
- package/lib/simple/Configuration.js +0 -31
- package/lib/simple/Directory.js +0 -29
- package/lib/simple/Phone.js +0 -418
- package/lib/simple/Websocket.js +0 -116
- package/lib/simple/__tests__/Auth.test.js +0 -181
- package/lib/simple/index.js +0 -165
- package/lib/simple/room/LocalParticipant.js +0 -9
- package/lib/simple/room/Participant.js +0 -302
- package/lib/simple/room/RemoteParticipant.js +0 -15
- package/lib/simple/room/Room.js +0 -711
- package/lib/simple/room/SipRoom.js +0 -141
- package/lib/simple/room/Stream.js +0 -50
- package/lib/simple/room/__tests__/Participant.test.js +0 -85
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +0 -17
- package/lib/simple/utils.js +0 -27
- package/lib/types/WebSocketMessage.js +0 -2
- package/lib/types/__tests__/api-client.test.d.ts +0 -2
- package/lib/types/__tests__/api-client.test.d.ts.map +0 -1
- package/lib/types/__tests__/web-rtc-client.test.d.ts +0 -2
- package/lib/types/__tests__/web-rtc-client.test.d.ts.map +0 -1
- package/lib/types/api/agentd.d.ts +0 -17
- package/lib/types/api/agentd.d.ts.map +0 -1
- package/lib/types/api/amid.d.ts +0 -8
- package/lib/types/api/amid.d.ts.map +0 -1
- package/lib/types/api/application.d.ts +0 -34
- package/lib/types/api/application.d.ts.map +0 -1
- package/lib/types/api/auth.d.ts +0 -69
- package/lib/types/api/auth.d.ts.map +0 -1
- package/lib/types/api/call-logd.d.ts +0 -12
- package/lib/types/api/call-logd.d.ts.map +0 -1
- package/lib/types/api/calld.d.ts +0 -52
- package/lib/types/api/calld.d.ts.map +0 -1
- package/lib/types/api/chatd.d.ts +0 -29
- package/lib/types/api/chatd.d.ts.map +0 -1
- package/lib/types/api/confd.d.ts +0 -46
- package/lib/types/api/confd.d.ts.map +0 -1
- package/lib/types/api/ctid-ng.d.ts +0 -36
- package/lib/types/api/ctid-ng.d.ts.map +0 -1
- package/lib/types/api/dird.d.ts +0 -33
- package/lib/types/api/dird.d.ts.map +0 -1
- package/lib/types/api/webhookd.d.ts +0 -24
- package/lib/types/api/webhookd.d.ts.map +0 -1
- package/lib/types/api-client.d.ts +0 -26
- package/lib/types/api-client.d.ts.map +0 -1
- package/lib/types/base-api-client.d.ts +0 -43
- package/lib/types/base-api-client.d.ts.map +0 -1
- package/lib/types/checker/Checker.d.ts +0 -13
- package/lib/types/checker/Checker.d.ts.map +0 -1
- package/lib/types/checker/checks/aor.d.ts +0 -6
- package/lib/types/checker/checks/aor.d.ts.map +0 -1
- package/lib/types/checker/checks/api.d.ts +0 -6
- package/lib/types/checker/checks/api.d.ts.map +0 -1
- package/lib/types/checker/checks/ice-ipv4.d.ts +0 -6
- package/lib/types/checker/checks/ice-ipv4.d.ts.map +0 -1
- package/lib/types/checker/checks/index.d.ts +0 -9
- package/lib/types/checker/checks/index.d.ts.map +0 -1
- package/lib/types/checker/checks/symmetric-nat.d.ts +0 -6
- package/lib/types/checker/checks/symmetric-nat.d.ts.map +0 -1
- package/lib/types/checker/checks/wazo-websocket.d.ts +0 -6
- package/lib/types/checker/checks/wazo-websocket.d.ts.map +0 -1
- package/lib/types/checker/checks/webrtc-transport.d.ts +0 -7
- package/lib/types/checker/checks/webrtc-transport.d.ts.map +0 -1
- package/lib/types/checker/checks/webrtc.d.ts +0 -6
- package/lib/types/checker/checks/webrtc.d.ts.map +0 -1
- package/lib/types/constants.d.ts +0 -12
- package/lib/types/constants.d.ts.map +0 -1
- package/lib/types/domain/AdHocAPIConference.d.ts +0 -54
- package/lib/types/domain/AdHocAPIConference.d.ts.map +0 -1
- package/lib/types/domain/Agent.d.ts +0 -31
- package/lib/types/domain/Agent.d.ts.map +0 -1
- package/lib/types/domain/BadResponse.d.ts +0 -11
- package/lib/types/domain/BadResponse.d.ts.map +0 -1
- package/lib/types/domain/Call.d.ts +0 -79
- package/lib/types/domain/Call.d.ts.map +0 -1
- package/lib/types/domain/CallLog.d.ts +0 -88
- package/lib/types/domain/CallLog.d.ts.map +0 -1
- package/lib/types/domain/CallSession.d.ts +0 -119
- package/lib/types/domain/CallSession.d.ts.map +0 -1
- package/lib/types/domain/CallerID.d.ts +0 -22
- package/lib/types/domain/CallerID.d.ts.map +0 -1
- package/lib/types/domain/ChatMessage.d.ts +0 -41
- package/lib/types/domain/ChatMessage.d.ts.map +0 -1
- package/lib/types/domain/ChatRoom.d.ts +0 -22
- package/lib/types/domain/ChatRoom.d.ts.map +0 -1
- package/lib/types/domain/Contact.d.ts.map +0 -1
- package/lib/types/domain/Country.d.ts +0 -21
- package/lib/types/domain/Country.d.ts.map +0 -1
- package/lib/types/domain/Device/DebugDevice.d.ts +0 -14
- package/lib/types/domain/Device/DebugDevice.d.ts.map +0 -1
- package/lib/types/domain/Device/Device.d.ts +0 -13
- package/lib/types/domain/Device/Device.d.ts.map +0 -1
- package/lib/types/domain/DirectorySource.d.ts +0 -13
- package/lib/types/domain/DirectorySource.d.ts.map +0 -1
- package/lib/types/domain/ExternalApp.d.ts +0 -22
- package/lib/types/domain/ExternalApp.d.ts.map +0 -1
- package/lib/types/domain/Features.d.ts +0 -26
- package/lib/types/domain/Features.d.ts.map +0 -1
- package/lib/types/domain/ForwardOption.d.ts +0 -28
- package/lib/types/domain/ForwardOption.d.ts.map +0 -1
- package/lib/types/domain/Incall.d.ts +0 -21
- package/lib/types/domain/Incall.d.ts.map +0 -1
- package/lib/types/domain/IndirectTransfer.d.ts +0 -31
- package/lib/types/domain/IndirectTransfer.d.ts.map +0 -1
- package/lib/types/domain/Line.d.ts +0 -35
- package/lib/types/domain/Line.d.ts.map +0 -1
- package/lib/types/domain/Meeting.d.ts +0 -45
- package/lib/types/domain/Meeting.d.ts.map +0 -1
- package/lib/types/domain/MeetingAuthorization.d.ts +0 -32
- package/lib/types/domain/MeetingAuthorization.d.ts.map +0 -1
- package/lib/types/domain/MeetingStatus.d.ts +0 -10
- package/lib/types/domain/MeetingStatus.d.ts.map +0 -1
- package/lib/types/domain/NotificationOptions.d.ts +0 -22
- package/lib/types/domain/NotificationOptions.d.ts.map +0 -1
- package/lib/types/domain/Phone/CTIPhone.d.ts +0 -79
- package/lib/types/domain/Phone/CTIPhone.d.ts.map +0 -1
- package/lib/types/domain/Phone/Phone.d.ts +0 -83
- package/lib/types/domain/Phone/Phone.d.ts.map +0 -1
- package/lib/types/domain/Phone/WebRTCPhone.d.ts +0 -183
- package/lib/types/domain/Phone/WebRTCPhone.d.ts.map +0 -1
- package/lib/types/domain/Profile.d.ts +0 -155
- package/lib/types/domain/Profile.d.ts.map +0 -1
- package/lib/types/domain/Recording.d.ts +0 -26
- package/lib/types/domain/Recording.d.ts.map +0 -1
- package/lib/types/domain/Relocation.d.ts +0 -23
- package/lib/types/domain/Relocation.d.ts.map +0 -1
- package/lib/types/domain/Room.d.ts +0 -33
- package/lib/types/domain/Room.d.ts.map +0 -1
- package/lib/types/domain/SFUNotAvailableError.d.ts +0 -4
- package/lib/types/domain/SFUNotAvailableError.d.ts.map +0 -1
- package/lib/types/domain/ServerError.d.ts +0 -6
- package/lib/types/domain/ServerError.d.ts.map +0 -1
- package/lib/types/domain/Session.d.ts +0 -100
- package/lib/types/domain/Session.d.ts.map +0 -1
- package/lib/types/domain/SipLine.d.ts +0 -54
- package/lib/types/domain/SipLine.d.ts.map +0 -1
- package/lib/types/domain/Subscription.d.ts +0 -43
- package/lib/types/domain/Subscription.d.ts.map +0 -1
- package/lib/types/domain/SwitchboardCall.d.ts +0 -62
- package/lib/types/domain/SwitchboardCall.d.ts.map +0 -1
- package/lib/types/domain/Voicemail.d.ts +0 -58
- package/lib/types/domain/Voicemail.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Agent.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Agent.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Call.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Call.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/CallLog.test.d.ts +0 -2
- package/lib/types/domain/__tests__/CallLog.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/CallSession.test.d.ts +0 -2
- package/lib/types/domain/__tests__/CallSession.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Contact.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Contact.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/IndirectTransfer.test.d.ts +0 -2
- package/lib/types/domain/__tests__/IndirectTransfer.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Line.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Line.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Meeting.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Meeting.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/MeetingAuthorization.test.d.ts +0 -2
- package/lib/types/domain/__tests__/MeetingAuthorization.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Profile.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Profile.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Room.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Room.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Session.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Session.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/SipLine.test.d.ts +0 -2
- package/lib/types/domain/__tests__/SipLine.test.d.ts.map +0 -1
- package/lib/types/domain/__tests__/Voicemail.test.d.ts +0 -2
- package/lib/types/domain/__tests__/Voicemail.test.d.ts.map +0 -1
- package/lib/types/domain/types.d.ts +0 -378
- package/lib/types/domain/types.d.ts.map +0 -1
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/lib/WazoSessionDescriptionHandler.d.ts +0 -31
- package/lib/types/lib/WazoSessionDescriptionHandler.d.ts.map +0 -1
- package/lib/types/pubkey.d.ts +0 -3
- package/lib/types/pubkey.d.ts.map +0 -1
- package/lib/types/service/CallApi.d.ts +0 -28
- package/lib/types/service/CallApi.d.ts.map +0 -1
- package/lib/types/service/IssueReporter.d.ts +0 -42
- package/lib/types/service/IssueReporter.d.ts.map +0 -1
- package/lib/types/service/__tests__/IssueReporter.test.d.ts +0 -2
- package/lib/types/service/__tests__/IssueReporter.test.d.ts.map +0 -1
- package/lib/types/service/__tests__/getApiclient.test.d.ts +0 -2
- package/lib/types/service/__tests__/getApiclient.test.d.ts.map +0 -1
- package/lib/types/service/getApiClient.d.ts +0 -21
- package/lib/types/service/getApiClient.d.ts.map +0 -1
- package/lib/types/simple/Auth.d.ts +0 -75
- package/lib/types/simple/Auth.d.ts.map +0 -1
- package/lib/types/simple/Configuration.d.ts +0 -7
- package/lib/types/simple/Configuration.d.ts.map +0 -1
- package/lib/types/simple/Directory.d.ts +0 -7
- package/lib/types/simple/Directory.d.ts.map +0 -1
- package/lib/types/simple/Phone.d.ts +0 -119
- package/lib/types/simple/Phone.d.ts.map +0 -1
- package/lib/types/simple/Websocket.d.ts +0 -21
- package/lib/types/simple/Websocket.d.ts.map +0 -1
- package/lib/types/simple/__tests__/Auth.test.d.ts +0 -2
- package/lib/types/simple/__tests__/Auth.test.d.ts.map +0 -1
- package/lib/types/simple/index.d.ts +0 -153
- package/lib/types/simple/index.d.ts.map +0 -1
- package/lib/types/simple/room/LocalParticipant.d.ts +0 -5
- package/lib/types/simple/room/LocalParticipant.d.ts.map +0 -1
- package/lib/types/simple/room/Participant.d.ts +0 -77
- package/lib/types/simple/room/Participant.d.ts.map +0 -1
- package/lib/types/simple/room/RemoteParticipant.d.ts +0 -7
- package/lib/types/simple/room/RemoteParticipant.d.ts.map +0 -1
- package/lib/types/simple/room/Room.d.ts +0 -127
- package/lib/types/simple/room/Room.d.ts.map +0 -1
- package/lib/types/simple/room/SipRoom.d.ts +0 -14
- package/lib/types/simple/room/SipRoom.d.ts.map +0 -1
- package/lib/types/simple/room/Stream.d.ts +0 -13
- package/lib/types/simple/room/Stream.d.ts.map +0 -1
- package/lib/types/simple/room/__tests__/Participant.test.d.ts +0 -2
- package/lib/types/simple/room/__tests__/Participant.test.d.ts.map +0 -1
- package/lib/types/simple/room/__tests__/RemoteParticipant.test.d.ts +0 -2
- package/lib/types/simple/room/__tests__/RemoteParticipant.test.d.ts.map +0 -1
- package/lib/types/simple/utils.d.ts +0 -3
- package/lib/types/simple/utils.d.ts.map +0 -1
- package/lib/types/types/WebSocketMessage.d.ts +0 -285
- package/lib/types/types/WebSocketMessage.d.ts.map +0 -1
- package/lib/types/utils/Emitter.d.ts +0 -18
- package/lib/types/utils/Emitter.d.ts.map +0 -1
- package/lib/types/utils/Heartbeat.d.ts +0 -22
- package/lib/types/utils/Heartbeat.d.ts.map +0 -1
- package/lib/types/utils/PhoneNumberUtil.d.ts +0 -7
- package/lib/types/utils/PhoneNumberUtil.d.ts.map +0 -1
- package/lib/types/utils/__tests__/Heartbeat.test.d.ts +0 -2
- package/lib/types/utils/__tests__/Heartbeat.test.d.ts.map +0 -1
- package/lib/types/utils/__tests__/PhoneNumberUtil.test.d.ts +0 -2
- package/lib/types/utils/__tests__/PhoneNumberUtil.test.d.ts.map +0 -1
- package/lib/types/utils/__tests__/api-requester.test.d.ts +0 -2
- package/lib/types/utils/__tests__/api-requester.test.d.ts.map +0 -1
- package/lib/types/utils/__tests__/array.test.d.ts +0 -2
- package/lib/types/utils/__tests__/array.test.d.ts.map +0 -1
- package/lib/types/utils/__tests__/compare-version.test.d.ts +0 -2
- package/lib/types/utils/__tests__/compare-version.test.d.ts.map +0 -1
- package/lib/types/utils/__tests__/object.test.d.ts +0 -2
- package/lib/types/utils/__tests__/object.test.d.ts.map +0 -1
- package/lib/types/utils/__tests__/sdp.test.d.ts +0 -2
- package/lib/types/utils/__tests__/sdp.test.d.ts.map +0 -1
- package/lib/types/utils/__tests__/string.test.d.ts +0 -2
- package/lib/types/utils/__tests__/string.test.d.ts.map +0 -1
- package/lib/types/utils/api-requester.d.ts +0 -48
- package/lib/types/utils/api-requester.d.ts.map +0 -1
- package/lib/types/utils/array.d.ts +0 -2
- package/lib/types/utils/array.d.ts.map +0 -1
- package/lib/types/utils/compare-version.d.ts +0 -3
- package/lib/types/utils/compare-version.d.ts.map +0 -1
- package/lib/types/utils/isMobile.d.ts +0 -3
- package/lib/types/utils/isMobile.d.ts.map +0 -1
- package/lib/types/utils/new-from.d.ts +0 -3
- package/lib/types/utils/new-from.d.ts.map +0 -1
- package/lib/types/utils/object.d.ts +0 -2
- package/lib/types/utils/object.d.ts.map +0 -1
- package/lib/types/utils/once.d.ts +0 -2
- package/lib/types/utils/once.d.ts.map +0 -1
- package/lib/types/utils/sdp.d.ts +0 -28
- package/lib/types/utils/sdp.d.ts.map +0 -1
- package/lib/types/utils/string.d.ts +0 -3
- package/lib/types/utils/string.d.ts.map +0 -1
- package/lib/types/utils/update-from.d.ts +0 -3
- package/lib/types/utils/update-from.d.ts.map +0 -1
- package/lib/types/utils/webrtc.d.ts +0 -15
- package/lib/types/utils/webrtc.d.ts.map +0 -1
- package/lib/types/web-rtc-client.d.ts +0 -198
- package/lib/types/web-rtc-client.d.ts.map +0 -1
- package/lib/types/websocket-client.d.ts +0 -138
- package/lib/types/websocket-client.d.ts.map +0 -1
- package/lib/utils/Emitter.js +0 -24
- package/lib/utils/Heartbeat.js +0 -66
- package/lib/utils/PhoneNumberUtil.js +0 -73
- package/lib/utils/__tests__/Heartbeat.test.js +0 -79
- package/lib/utils/__tests__/PhoneNumberUtil.test.js +0 -72
- package/lib/utils/__tests__/api-requester.test.js +0 -180
- package/lib/utils/__tests__/array.test.js +0 -20
- package/lib/utils/__tests__/compare-version.test.js +0 -15
- package/lib/utils/__tests__/object.test.js +0 -78
- package/lib/utils/__tests__/sdp.test.js +0 -188
- package/lib/utils/__tests__/string.test.js +0 -51
- package/lib/utils/api-requester.js +0 -200
- package/lib/utils/array.js +0 -13
- package/lib/utils/compare-version.js +0 -19
- package/lib/utils/isMobile.js +0 -5
- package/lib/utils/new-from.js +0 -9
- package/lib/utils/object.js +0 -14
- package/lib/utils/once.js +0 -18
- package/lib/utils/sdp.js +0 -115
- package/lib/utils/string.js +0 -17
- package/lib/utils/update-from.js +0 -12
- package/lib/utils/webrtc.js +0 -41
- package/lib/web-rtc-client.js +0 -2239
- package/lib/websocket-client.js +0 -390
- package/src/__tests__/api-client.test.ts +0 -315
- package/src/__tests__/web-rtc-client.test.ts +0 -198
- package/src/api/agentd.ts +0 -37
- package/src/api/amid.ts +0 -25
- package/src/api/application.ts +0 -96
- package/src/api/auth.ts +0 -305
- package/src/api/call-logd.ts +0 -38
- package/src/api/calld.ts +0 -185
- package/src/api/chatd.ts +0 -87
- package/src/api/confd.ts +0 -119
- package/src/api/ctid-ng.ts +0 -152
- package/src/api/dird.ts +0 -143
- package/src/api/webhookd.ts +0 -30
- package/src/api-client.ts +0 -65
- package/src/base-api-client.ts +0 -184
- package/src/checker/Checker.ts +0 -73
- package/src/checker/checks/aor.ts +0 -34
- package/src/checker/checks/api.ts +0 -78
- package/src/checker/checks/ice-ipv4.ts +0 -80
- package/src/checker/checks/index.ts +0 -9
- package/src/checker/checks/symmetric-nat.ts +0 -69
- package/src/checker/checks/wazo-websocket.ts +0 -41
- package/src/checker/checks/webrtc-transport.ts +0 -42
- package/src/checker/checks/webrtc.ts +0 -48
- package/src/constants.ts +0 -11
- package/src/domain/AdHocAPIConference.ts +0 -166
- package/src/domain/Agent.ts +0 -68
- package/src/domain/BadResponse.ts +0 -29
- package/src/domain/Call.ts +0 -217
- package/src/domain/CallLog.ts +0 -265
- package/src/domain/CallSession.ts +0 -401
- package/src/domain/CallerID.ts +0 -49
- package/src/domain/ChatMessage.ts +0 -107
- package/src/domain/ChatRoom.ts +0 -55
- package/src/domain/Contact.ts +0 -851
- package/src/domain/Country.ts +0 -19
- package/src/domain/Device/DebugDevice.ts +0 -44
- package/src/domain/Device/Device.ts +0 -12
- package/src/domain/DirectorySource.ts +0 -13
- package/src/domain/ExternalApp.ts +0 -46
- package/src/domain/Features.ts +0 -105
- package/src/domain/ForwardOption.ts +0 -65
- package/src/domain/Incall.ts +0 -50
- package/src/domain/IndirectTransfer.ts +0 -73
- package/src/domain/Line.ts +0 -79
- package/src/domain/Meeting.ts +0 -113
- package/src/domain/MeetingAuthorization.ts +0 -81
- package/src/domain/MeetingStatus.ts +0 -23
- package/src/domain/NotificationOptions.ts +0 -68
- package/src/domain/Phone/CTIPhone.ts +0 -381
- package/src/domain/Phone/Phone.ts +0 -81
- package/src/domain/Phone/WebRTCPhone.ts +0 -1830
- package/src/domain/Profile.ts +0 -289
- package/src/domain/Recording.ts +0 -60
- package/src/domain/Relocation.ts +0 -45
- package/src/domain/Room.ts +0 -141
- package/src/domain/SFUNotAvailableError.ts +0 -7
- package/src/domain/ServerError.ts +0 -12
- package/src/domain/Session.ts +0 -297
- package/src/domain/SipLine.ts +0 -154
- package/src/domain/Subscription.ts +0 -95
- package/src/domain/SwitchboardCall.ts +0 -127
- package/src/domain/Voicemail.ts +0 -138
- package/src/domain/__tests__/Agent.test.ts +0 -38
- package/src/domain/__tests__/Call.test.ts +0 -26
- package/src/domain/__tests__/CallLog.test.ts +0 -203
- package/src/domain/__tests__/CallSession.test.ts +0 -80
- package/src/domain/__tests__/Contact.test.ts +0 -407
- package/src/domain/__tests__/IndirectTransfer.test.ts +0 -68
- package/src/domain/__tests__/Line.test.ts +0 -53
- package/src/domain/__tests__/Meeting.test.ts +0 -93
- package/src/domain/__tests__/MeetingAuthorization.test.ts +0 -50
- package/src/domain/__tests__/Profile.test.ts +0 -170
- package/src/domain/__tests__/Room.test.ts +0 -207
- package/src/domain/__tests__/Session.test.ts +0 -385
- package/src/domain/__tests__/SipLine.test.ts +0 -30
- package/src/domain/__tests__/Voicemail.test.ts +0 -91
- package/src/domain/types.ts +0 -331
- package/src/index.ts +0 -60
- package/src/lib/WazoSessionDescriptionHandler.ts +0 -532
- package/src/pubkey.ts +0 -11
- package/src/service/CallApi.ts +0 -86
- package/src/service/IssueReporter.ts +0 -434
- package/src/service/__tests__/IssueReporter.test.ts +0 -127
- package/src/service/__tests__/getApiclient.test.ts +0 -46
- package/src/service/getApiClient.ts +0 -113
- package/src/simple/Auth.ts +0 -496
- package/src/simple/Configuration.ts +0 -18
- package/src/simple/Directory.ts +0 -16
- package/src/simple/Phone.ts +0 -531
- package/src/simple/Websocket.ts +0 -107
- package/src/simple/__tests__/Auth.test.ts +0 -168
- package/src/simple/index.ts +0 -153
- package/src/simple/room/LocalParticipant.ts +0 -5
- package/src/simple/room/Participant.ts +0 -409
- package/src/simple/room/RemoteParticipant.ts +0 -15
- package/src/simple/room/Room.ts +0 -942
- package/src/simple/room/SipRoom.ts +0 -164
- package/src/simple/room/Stream.ts +0 -64
- package/src/simple/room/__tests__/Participant.test.ts +0 -73
- package/src/simple/room/__tests__/RemoteParticipant.test.ts +0 -15
- package/src/simple/utils.ts +0 -12
- package/src/types/WebSocketMessage.ts +0 -335
- package/src/types/global.d.ts +0 -33
- package/src/types/wazo.d.ts +0 -1
- package/src/utils/Emitter.ts +0 -34
- package/src/utils/Heartbeat.ts +0 -102
- package/src/utils/PhoneNumberUtil.ts +0 -81
- package/src/utils/__tests__/Heartbeat.test.ts +0 -66
- package/src/utils/__tests__/PhoneNumberUtil.test.ts +0 -79
- package/src/utils/__tests__/api-requester.test.ts +0 -180
- package/src/utils/__tests__/array.test.ts +0 -19
- package/src/utils/__tests__/compare-version.test.ts +0 -11
- package/src/utils/__tests__/object.test.ts +0 -77
- package/src/utils/__tests__/sdp.test.ts +0 -173
- package/src/utils/__tests__/string.test.ts +0 -55
- package/src/utils/api-requester.ts +0 -294
- package/src/utils/array.ts +0 -11
- package/src/utils/compare-version.ts +0 -21
- package/src/utils/isMobile.ts +0 -4
- package/src/utils/new-from.ts +0 -7
- package/src/utils/object.ts +0 -12
- package/src/utils/once.ts +0 -14
- package/src/utils/sdp.ts +0 -140
- package/src/utils/string.ts +0 -15
- package/src/utils/update-from.ts +0 -11
- package/src/utils/webrtc.ts +0 -56
- package/src/web-rtc-client.ts +0 -2687
- package/src/websocket-client.ts +0 -475
- /package/{esm → dist}/types/__tests__/api-client.test.d.ts +0 -0
- /package/{esm → dist}/types/__tests__/api-client.test.d.ts.map +0 -0
- /package/{esm → dist}/types/__tests__/web-rtc-client.test.d.ts +0 -0
- /package/{esm → dist}/types/__tests__/web-rtc-client.test.d.ts.map +0 -0
- /package/{esm → dist}/types/api/agentd.d.ts +0 -0
- /package/{esm → dist}/types/api/agentd.d.ts.map +0 -0
- /package/{esm → dist}/types/api/amid.d.ts +0 -0
- /package/{esm → dist}/types/api/amid.d.ts.map +0 -0
- /package/{esm → dist}/types/api/application.d.ts +0 -0
- /package/{esm → dist}/types/api/application.d.ts.map +0 -0
- /package/{esm → dist}/types/api/auth.d.ts +0 -0
- /package/{esm → dist}/types/api/auth.d.ts.map +0 -0
- /package/{esm → dist}/types/api/call-logd.d.ts +0 -0
- /package/{esm → dist}/types/api/call-logd.d.ts.map +0 -0
- /package/{esm → dist}/types/api/calld.d.ts +0 -0
- /package/{esm → dist}/types/api/calld.d.ts.map +0 -0
- /package/{esm → dist}/types/api/chatd.d.ts +0 -0
- /package/{esm → dist}/types/api/chatd.d.ts.map +0 -0
- /package/{esm → dist}/types/api/confd.d.ts +0 -0
- /package/{esm → dist}/types/api/confd.d.ts.map +0 -0
- /package/{esm → dist}/types/api/ctid-ng.d.ts +0 -0
- /package/{esm → dist}/types/api/ctid-ng.d.ts.map +0 -0
- /package/{esm → dist}/types/api/dird.d.ts +0 -0
- /package/{esm → dist}/types/api/dird.d.ts.map +0 -0
- /package/{esm → dist}/types/api/webhookd.d.ts +0 -0
- /package/{esm → dist}/types/api/webhookd.d.ts.map +0 -0
- /package/{esm → dist}/types/api-client.d.ts +0 -0
- /package/{esm → dist}/types/api-client.d.ts.map +0 -0
- /package/{esm → dist}/types/base-api-client.d.ts +0 -0
- /package/{esm → dist}/types/base-api-client.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/Checker.d.ts +0 -0
- /package/{esm → dist}/types/checker/Checker.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/aor.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/aor.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/api.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/api.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/ice-ipv4.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/ice-ipv4.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/index.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/index.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/symmetric-nat.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/symmetric-nat.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/wazo-websocket.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/wazo-websocket.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/webrtc-transport.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/webrtc-transport.d.ts.map +0 -0
- /package/{esm → dist}/types/checker/checks/webrtc.d.ts +0 -0
- /package/{esm → dist}/types/checker/checks/webrtc.d.ts.map +0 -0
- /package/{esm → dist}/types/constants.d.ts +0 -0
- /package/{esm → dist}/types/constants.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/AdHocAPIConference.d.ts +0 -0
- /package/{esm → dist}/types/domain/AdHocAPIConference.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Agent.d.ts +0 -0
- /package/{esm → dist}/types/domain/Agent.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/BadResponse.d.ts +0 -0
- /package/{esm → dist}/types/domain/BadResponse.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Call.d.ts +0 -0
- /package/{esm → dist}/types/domain/Call.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/CallLog.d.ts +0 -0
- /package/{esm → dist}/types/domain/CallLog.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/CallSession.d.ts +0 -0
- /package/{esm → dist}/types/domain/CallSession.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/CallerID.d.ts +0 -0
- /package/{esm → dist}/types/domain/CallerID.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/ChatMessage.d.ts +0 -0
- /package/{esm → dist}/types/domain/ChatMessage.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/ChatRoom.d.ts +0 -0
- /package/{esm → dist}/types/domain/ChatRoom.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Country.d.ts +0 -0
- /package/{esm → dist}/types/domain/Country.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Device/DebugDevice.d.ts +0 -0
- /package/{esm → dist}/types/domain/Device/DebugDevice.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Device/Device.d.ts +0 -0
- /package/{esm → dist}/types/domain/Device/Device.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/DirectorySource.d.ts +0 -0
- /package/{esm → dist}/types/domain/DirectorySource.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/ExternalApp.d.ts +0 -0
- /package/{esm → dist}/types/domain/ExternalApp.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Features.d.ts +0 -0
- /package/{esm → dist}/types/domain/Features.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/ForwardOption.d.ts +0 -0
- /package/{esm → dist}/types/domain/ForwardOption.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Incall.d.ts +0 -0
- /package/{esm → dist}/types/domain/Incall.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/IndirectTransfer.d.ts +0 -0
- /package/{esm → dist}/types/domain/IndirectTransfer.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Line.d.ts +0 -0
- /package/{esm → dist}/types/domain/Line.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Meeting.d.ts +0 -0
- /package/{esm → dist}/types/domain/Meeting.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/MeetingAuthorization.d.ts +0 -0
- /package/{esm → dist}/types/domain/MeetingAuthorization.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/MeetingStatus.d.ts +0 -0
- /package/{esm → dist}/types/domain/MeetingStatus.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/NotificationOptions.d.ts +0 -0
- /package/{esm → dist}/types/domain/NotificationOptions.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Phone/CTIPhone.d.ts +0 -0
- /package/{esm → dist}/types/domain/Phone/CTIPhone.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Phone/Phone.d.ts +0 -0
- /package/{esm → dist}/types/domain/Phone/Phone.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Phone/WebRTCPhone.d.ts +0 -0
- /package/{esm → dist}/types/domain/Phone/WebRTCPhone.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Profile.d.ts +0 -0
- /package/{esm → dist}/types/domain/Profile.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Recording.d.ts +0 -0
- /package/{esm → dist}/types/domain/Recording.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Relocation.d.ts +0 -0
- /package/{esm → dist}/types/domain/Relocation.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Room.d.ts +0 -0
- /package/{esm → dist}/types/domain/Room.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/SFUNotAvailableError.d.ts +0 -0
- /package/{esm → dist}/types/domain/SFUNotAvailableError.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/ServerError.d.ts +0 -0
- /package/{esm → dist}/types/domain/ServerError.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Session.d.ts +0 -0
- /package/{esm → dist}/types/domain/Session.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/SipLine.d.ts +0 -0
- /package/{esm → dist}/types/domain/SipLine.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Subscription.d.ts +0 -0
- /package/{esm → dist}/types/domain/Subscription.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/SwitchboardCall.d.ts +0 -0
- /package/{esm → dist}/types/domain/SwitchboardCall.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/Voicemail.d.ts +0 -0
- /package/{esm → dist}/types/domain/Voicemail.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Agent.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Agent.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Call.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Call.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/CallLog.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/CallLog.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/CallSession.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/CallSession.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Contact.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Contact.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/IndirectTransfer.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/IndirectTransfer.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Line.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Line.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Meeting.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Meeting.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/MeetingAuthorization.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/MeetingAuthorization.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Profile.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Profile.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Room.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Room.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Session.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Session.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/SipLine.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/SipLine.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/__tests__/Voicemail.test.d.ts +0 -0
- /package/{esm → dist}/types/domain/__tests__/Voicemail.test.d.ts.map +0 -0
- /package/{esm → dist}/types/domain/types.d.ts +0 -0
- /package/{esm → dist}/types/domain/types.d.ts.map +0 -0
- /package/{esm → dist}/types/lib/WazoSessionDescriptionHandler.d.ts +0 -0
- /package/{esm → dist}/types/lib/WazoSessionDescriptionHandler.d.ts.map +0 -0
- /package/{esm → dist}/types/pubkey.d.ts +0 -0
- /package/{esm → dist}/types/pubkey.d.ts.map +0 -0
- /package/{esm → dist}/types/service/CallApi.d.ts +0 -0
- /package/{esm → dist}/types/service/CallApi.d.ts.map +0 -0
- /package/{esm → dist}/types/service/IssueReporter.d.ts +0 -0
- /package/{esm → dist}/types/service/IssueReporter.d.ts.map +0 -0
- /package/{esm → dist}/types/service/__tests__/IssueReporter.test.d.ts +0 -0
- /package/{esm → dist}/types/service/__tests__/IssueReporter.test.d.ts.map +0 -0
- /package/{esm → dist}/types/service/__tests__/getApiclient.test.d.ts +0 -0
- /package/{esm → dist}/types/service/__tests__/getApiclient.test.d.ts.map +0 -0
- /package/{esm → dist}/types/service/getApiClient.d.ts +0 -0
- /package/{esm → dist}/types/service/getApiClient.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/Auth.d.ts +0 -0
- /package/{esm → dist}/types/simple/Auth.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/Configuration.d.ts +0 -0
- /package/{esm → dist}/types/simple/Configuration.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/Directory.d.ts +0 -0
- /package/{esm → dist}/types/simple/Directory.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/Phone.d.ts +0 -0
- /package/{esm → dist}/types/simple/Phone.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/Websocket.d.ts +0 -0
- /package/{esm → dist}/types/simple/Websocket.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/__tests__/Auth.test.d.ts +0 -0
- /package/{esm → dist}/types/simple/__tests__/Auth.test.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/index.d.ts +0 -0
- /package/{esm → dist}/types/simple/index.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/LocalParticipant.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/LocalParticipant.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/Participant.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/Participant.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/RemoteParticipant.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/RemoteParticipant.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/Room.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/Room.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/SipRoom.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/SipRoom.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/Stream.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/Stream.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/__tests__/Participant.test.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/__tests__/Participant.test.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/room/__tests__/RemoteParticipant.test.d.ts +0 -0
- /package/{esm → dist}/types/simple/room/__tests__/RemoteParticipant.test.d.ts.map +0 -0
- /package/{esm → dist}/types/simple/utils.d.ts +0 -0
- /package/{esm → dist}/types/simple/utils.d.ts.map +0 -0
- /package/{esm → dist}/types/types/WebSocketMessage.d.ts +0 -0
- /package/{esm → dist}/types/types/WebSocketMessage.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/Emitter.d.ts +0 -0
- /package/{esm → dist}/types/utils/Emitter.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/Heartbeat.d.ts +0 -0
- /package/{esm → dist}/types/utils/Heartbeat.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/PhoneNumberUtil.d.ts +0 -0
- /package/{esm → dist}/types/utils/PhoneNumberUtil.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/Heartbeat.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/Heartbeat.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/PhoneNumberUtil.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/PhoneNumberUtil.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/api-requester.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/api-requester.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/array.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/array.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/compare-version.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/compare-version.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/object.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/object.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/sdp.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/sdp.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/__tests__/string.test.d.ts +0 -0
- /package/{esm → dist}/types/utils/__tests__/string.test.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/api-requester.d.ts +0 -0
- /package/{esm → dist}/types/utils/api-requester.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/array.d.ts +0 -0
- /package/{esm → dist}/types/utils/array.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/compare-version.d.ts +0 -0
- /package/{esm → dist}/types/utils/compare-version.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/isMobile.d.ts +0 -0
- /package/{esm → dist}/types/utils/isMobile.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/new-from.d.ts +0 -0
- /package/{esm → dist}/types/utils/new-from.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/object.d.ts +0 -0
- /package/{esm → dist}/types/utils/object.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/once.d.ts +0 -0
- /package/{esm → dist}/types/utils/once.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/sdp.d.ts +0 -0
- /package/{esm → dist}/types/utils/sdp.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/string.d.ts +0 -0
- /package/{esm → dist}/types/utils/string.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/update-from.d.ts +0 -0
- /package/{esm → dist}/types/utils/update-from.d.ts.map +0 -0
- /package/{esm → dist}/types/utils/webrtc.d.ts +0 -0
- /package/{esm → dist}/types/utils/webrtc.d.ts.map +0 -0
- /package/{esm → dist}/types/web-rtc-client.d.ts +0 -0
- /package/{esm → dist}/types/web-rtc-client.d.ts.map +0 -0
- /package/{esm → dist}/types/websocket-client.d.ts +0 -0
- /package/{esm → dist}/types/websocket-client.d.ts.map +0 -0
package/esm/simple/room/Room.js
DELETED
|
@@ -1,714 +0,0 @@
|
|
|
1
|
-
import sdpParser from 'sdp-transform';
|
|
2
|
-
import getApiClient from '../../service/getApiClient';
|
|
3
|
-
import Emitter from '../../utils/Emitter';
|
|
4
|
-
import Wazo from '../index';
|
|
5
|
-
import RemoteParticipant from './RemoteParticipant';
|
|
6
|
-
import IssueReporter from '../../service/IssueReporter';
|
|
7
|
-
export const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
8
|
-
export const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
9
|
-
const logger = IssueReporter.loggerFor('sdk-room');
|
|
10
|
-
class Room extends Emitter {
|
|
11
|
-
callSession;
|
|
12
|
-
name;
|
|
13
|
-
extension;
|
|
14
|
-
sourceId;
|
|
15
|
-
meetingUuid;
|
|
16
|
-
participants;
|
|
17
|
-
callId;
|
|
18
|
-
connected;
|
|
19
|
-
localParticipant;
|
|
20
|
-
_callIdStreamIdMap;
|
|
21
|
-
_unassociatedVideoStreams;
|
|
22
|
-
_unassociatedParticipants;
|
|
23
|
-
_boundOnParticipantJoined;
|
|
24
|
-
_boundOnParticipantLeft;
|
|
25
|
-
_boundOnMessage;
|
|
26
|
-
_boundOnChat;
|
|
27
|
-
_boundOnSignal;
|
|
28
|
-
_boundSaveLocalVideoStream;
|
|
29
|
-
_boundOnReinvite;
|
|
30
|
-
audioStream;
|
|
31
|
-
extra;
|
|
32
|
-
// video tag representing the room audio stream
|
|
33
|
-
roomAudioElement;
|
|
34
|
-
CONFERENCE_USER_PARTICIPANT_JOINED;
|
|
35
|
-
CONFERENCE_USER_PARTICIPANT_LEFT;
|
|
36
|
-
MEETING_USER_PARTICIPANT_JOINED;
|
|
37
|
-
MEETING_USER_PARTICIPANT_LEFT;
|
|
38
|
-
ON_SHARE_SCREEN_ENDED;
|
|
39
|
-
ON_MESSAGE;
|
|
40
|
-
ON_CHAT;
|
|
41
|
-
ON_SIGNAL;
|
|
42
|
-
ON_AUDIO_STREAM;
|
|
43
|
-
ON_VIDEO_STREAM;
|
|
44
|
-
ON_REMOVE_STREAM;
|
|
45
|
-
ON_DISCONNECTED;
|
|
46
|
-
ON_JOINED;
|
|
47
|
-
ON_VIDEO_INPUT_CHANGE;
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* @param callSession CallSession
|
|
51
|
-
* @param extension string
|
|
52
|
-
* @param sourceId number
|
|
53
|
-
* @param callId string
|
|
54
|
-
* @param meetingUuid string
|
|
55
|
-
* @param extra Object
|
|
56
|
-
*/
|
|
57
|
-
constructor(callSession, extension, sourceId, callId, meetingUuid, extra = {}) {
|
|
58
|
-
super();
|
|
59
|
-
logger.info('room initialized', {
|
|
60
|
-
callId,
|
|
61
|
-
extension,
|
|
62
|
-
sourceId,
|
|
63
|
-
meetingUuid,
|
|
64
|
-
});
|
|
65
|
-
// Represents the room callSession
|
|
66
|
-
this.callSession = callSession;
|
|
67
|
-
this.extension = extension;
|
|
68
|
-
this.sourceId = sourceId;
|
|
69
|
-
this.meetingUuid = meetingUuid;
|
|
70
|
-
this.callId = callId;
|
|
71
|
-
this.participants = [];
|
|
72
|
-
this.connected = false;
|
|
73
|
-
this.localParticipant = null;
|
|
74
|
-
// [callId]: streamId
|
|
75
|
-
this._callIdStreamIdMap = {};
|
|
76
|
-
// Stream not yet associated to a participant, [streamId]: stream
|
|
77
|
-
this._unassociatedVideoStreams = {};
|
|
78
|
-
// Participant not yet associated to a stream, [participant.callId = label in setDescription]: Participant
|
|
79
|
-
this._unassociatedParticipants = {};
|
|
80
|
-
// The shared audio stream of the room
|
|
81
|
-
this.audioStream = null;
|
|
82
|
-
// Extra values passed to local participant
|
|
83
|
-
this.extra = extra;
|
|
84
|
-
// Sugar syntax for `room.EVENT_NAME`
|
|
85
|
-
this.CONFERENCE_USER_PARTICIPANT_JOINED = Wazo.Websocket.CONFERENCE_USER_PARTICIPANT_JOINED;
|
|
86
|
-
this.CONFERENCE_USER_PARTICIPANT_LEFT = Wazo.Websocket.CONFERENCE_USER_PARTICIPANT_LEFT;
|
|
87
|
-
this.MEETING_USER_PARTICIPANT_JOINED = Wazo.Websocket.MEETING_USER_PARTICIPANT_JOINED;
|
|
88
|
-
this.MEETING_USER_PARTICIPANT_LEFT = Wazo.Websocket.MEETING_USER_PARTICIPANT_LEFT;
|
|
89
|
-
this.ON_SHARE_SCREEN_ENDED = Wazo.Phone.ON_SHARE_SCREEN_ENDED;
|
|
90
|
-
this.ON_MESSAGE = Wazo.Phone.ON_MESSAGE;
|
|
91
|
-
this.ON_CHAT = Wazo.Phone.ON_CHAT;
|
|
92
|
-
this.ON_SIGNAL = Wazo.Phone.ON_SIGNAL;
|
|
93
|
-
this.ON_AUDIO_STREAM = Wazo.Phone.ON_AUDIO_STREAM;
|
|
94
|
-
this.ON_VIDEO_STREAM = Wazo.Phone.ON_VIDEO_STREAM;
|
|
95
|
-
this.ON_REMOVE_STREAM = Wazo.Phone.ON_REMOVE_STREAM;
|
|
96
|
-
this.ON_VIDEO_INPUT_CHANGE = Wazo.Phone.ON_VIDEO_INPUT_CHANGE;
|
|
97
|
-
this.ON_DISCONNECTED = 'room/ON_DISCONNECTED';
|
|
98
|
-
this.ON_JOINED = 'room/ON_JOINED';
|
|
99
|
-
this._boundOnParticipantJoined = this._onParticipantJoined.bind(this);
|
|
100
|
-
this._boundOnParticipantLeft = this._onParticipantLeft.bind(this);
|
|
101
|
-
this._boundOnMessage = this._onMessage.bind(this);
|
|
102
|
-
this._boundOnChat = this._onChat.bind(this);
|
|
103
|
-
this._boundOnSignal = this._onSignal.bind(this);
|
|
104
|
-
this._boundSaveLocalVideoStream = this._saveLocalVideoStream.bind(this);
|
|
105
|
-
this._boundOnReinvite = this._onReinvite.bind(this);
|
|
106
|
-
this.unbind();
|
|
107
|
-
this._bindEvents();
|
|
108
|
-
this._transferEvents();
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
*
|
|
112
|
-
* @param extension string
|
|
113
|
-
* @param constraints string
|
|
114
|
-
* @param audioOnly boolean
|
|
115
|
-
* @param extra Object
|
|
116
|
-
* @param room ?Room
|
|
117
|
-
* @param meeting ?Meeting
|
|
118
|
-
* @returns {Promise<Room>}
|
|
119
|
-
*/
|
|
120
|
-
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting, }) {
|
|
121
|
-
logger.info('connecting to room', {
|
|
122
|
-
extension,
|
|
123
|
-
audioOnly,
|
|
124
|
-
room: !!room,
|
|
125
|
-
});
|
|
126
|
-
if (!room) {
|
|
127
|
-
await Wazo.Phone.connect({
|
|
128
|
-
// @ts-ignore: Property 'audio' is missing
|
|
129
|
-
media: constraints,
|
|
130
|
-
});
|
|
131
|
-
const withCamera = constraints && !!constraints.video;
|
|
132
|
-
if (withCamera) {
|
|
133
|
-
Wazo.Phone.checkSfu();
|
|
134
|
-
}
|
|
135
|
-
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
136
|
-
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data, }) => {
|
|
137
|
-
logger.info('room call received via WS', {
|
|
138
|
-
callId: data.call_id,
|
|
139
|
-
});
|
|
140
|
-
if (room) {
|
|
141
|
-
room.setCallId(data.call_id);
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
145
|
-
// @ts-fix: heads up: added an extra `null` here
|
|
146
|
-
// eslint-disable-next-line no-param-reassign
|
|
147
|
-
room = new Room(callSession, extension, null, null, null, extra);
|
|
148
|
-
// Wait for the call to be accepted
|
|
149
|
-
await new Promise((resolve, reject) => {
|
|
150
|
-
Wazo.Phone.once(Wazo.Phone.ON_CALL_ACCEPTED, resolve);
|
|
151
|
-
Wazo.Phone.once(Wazo.Phone.ON_CALL_FAILED, reject);
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
if (room && room.callSession && room.callSession.call) {
|
|
155
|
-
room.setCallId(room.callSession.call.id);
|
|
156
|
-
}
|
|
157
|
-
if (!meeting) {
|
|
158
|
-
// Fetch conference source
|
|
159
|
-
const sources = await getApiClient().dird.fetchConferenceSource('default');
|
|
160
|
-
// Retrieve conference sources
|
|
161
|
-
const contacts = await getApiClient().dird.fetchConferenceContacts(sources.items[0]);
|
|
162
|
-
// Retrieve conference
|
|
163
|
-
const conference = contacts?.find(contact => contact.numbers?.find(number => String(number.number) === String(extension)));
|
|
164
|
-
logger.info('connected to room', {
|
|
165
|
-
sourceId: conference ? conference.sourceId : null,
|
|
166
|
-
name: conference ? conference.name : null,
|
|
167
|
-
});
|
|
168
|
-
if (conference) {
|
|
169
|
-
room.setSourceId(parseInt(`${conference.sourceId}`, 10));
|
|
170
|
-
room.setName(`${conference.name}`);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
else if (meeting) {
|
|
174
|
-
logger.info('Already connected to meeting', {
|
|
175
|
-
uuid: meeting.uuid,
|
|
176
|
-
name: meeting.name,
|
|
177
|
-
});
|
|
178
|
-
room.setMeetingUuid(meeting.uuid);
|
|
179
|
-
room.setName(meeting.name);
|
|
180
|
-
}
|
|
181
|
-
return room;
|
|
182
|
-
}
|
|
183
|
-
static disconnect() {
|
|
184
|
-
logger.info('static disconnection to room');
|
|
185
|
-
Wazo.Phone.disconnect();
|
|
186
|
-
}
|
|
187
|
-
async disconnect() {
|
|
188
|
-
logger.info('disconnection to room called');
|
|
189
|
-
await Wazo.Phone.hangup(this.callSession);
|
|
190
|
-
this.callSession = undefined;
|
|
191
|
-
this.eventEmitter.emit(this.ON_DISCONNECTED, this);
|
|
192
|
-
this.connected = false;
|
|
193
|
-
this.unbind();
|
|
194
|
-
Wazo.Phone.off(this.ON_MESSAGE, this._boundOnMessage);
|
|
195
|
-
Wazo.Phone.off(this.ON_CHAT, this._boundOnChat);
|
|
196
|
-
Wazo.Phone.off(this.ON_SIGNAL, this._boundOnSignal);
|
|
197
|
-
Wazo.Phone.off(this.ON_VIDEO_INPUT_CHANGE, this._boundSaveLocalVideoStream);
|
|
198
|
-
Wazo.Phone.phone?.off(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
199
|
-
Wazo.Websocket.off(this.CONFERENCE_USER_PARTICIPANT_JOINED, this._boundOnParticipantJoined);
|
|
200
|
-
Wazo.Websocket.off(this.CONFERENCE_USER_PARTICIPANT_LEFT, this._boundOnParticipantLeft);
|
|
201
|
-
Wazo.Websocket.off(this.MEETING_USER_PARTICIPANT_JOINED, this._boundOnParticipantJoined);
|
|
202
|
-
Wazo.Websocket.off(this.MEETING_USER_PARTICIPANT_LEFT, this._boundOnParticipantLeft);
|
|
203
|
-
}
|
|
204
|
-
setSourceId(sourceId) {
|
|
205
|
-
logger.info('set room source id', {
|
|
206
|
-
sourceId,
|
|
207
|
-
});
|
|
208
|
-
this.sourceId = sourceId;
|
|
209
|
-
}
|
|
210
|
-
setMeetingUuid(meetingUuid) {
|
|
211
|
-
logger.info('set meeting uuid', {
|
|
212
|
-
meetingUuid,
|
|
213
|
-
});
|
|
214
|
-
this.meetingUuid = meetingUuid;
|
|
215
|
-
}
|
|
216
|
-
setCallId(callId) {
|
|
217
|
-
logger.info('set room call id', {
|
|
218
|
-
callId,
|
|
219
|
-
});
|
|
220
|
-
if (callId) {
|
|
221
|
-
this.callId = callId;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
setName(name) {
|
|
225
|
-
logger.info('set room name', {
|
|
226
|
-
name,
|
|
227
|
-
});
|
|
228
|
-
this.name = name;
|
|
229
|
-
}
|
|
230
|
-
// @TODO: change sipSession to callSession
|
|
231
|
-
sendMessage(body, sipSession = null) {
|
|
232
|
-
return Wazo.Phone.sendMessage(body, sipSession);
|
|
233
|
-
}
|
|
234
|
-
sendChat(content) {
|
|
235
|
-
return Wazo.Phone.sendChat(content);
|
|
236
|
-
}
|
|
237
|
-
sendSignal(content) {
|
|
238
|
-
return Wazo.Phone.sendSignal(content);
|
|
239
|
-
}
|
|
240
|
-
async startScreenSharing(constraints) {
|
|
241
|
-
logger.info('start room screen sharing', {
|
|
242
|
-
constraints,
|
|
243
|
-
});
|
|
244
|
-
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
245
|
-
if (!screensharingStream) {
|
|
246
|
-
console.warn('screensharing stream is null (likely due to user cancellation)');
|
|
247
|
-
return null;
|
|
248
|
-
}
|
|
249
|
-
this._onScreenSharing();
|
|
250
|
-
return screensharingStream;
|
|
251
|
-
}
|
|
252
|
-
async stopScreenSharing(restoreLocalStream = true) {
|
|
253
|
-
logger.info('stop room screen sharing');
|
|
254
|
-
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
255
|
-
if (this.localParticipant) {
|
|
256
|
-
this._updateLocalParticipantStream();
|
|
257
|
-
this.localParticipant.onStopScreensharing();
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
turnCameraOff() {
|
|
261
|
-
logger.info('turn room camera off');
|
|
262
|
-
Wazo.Phone.turnCameraOff(this.callSession);
|
|
263
|
-
if (this.localParticipant) {
|
|
264
|
-
this.localParticipant.onVideoMuted();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
turnCameraOn() {
|
|
268
|
-
logger.info('turn room camera on');
|
|
269
|
-
Wazo.Phone.turnCameraOn(this.callSession);
|
|
270
|
-
if (this.localParticipant) {
|
|
271
|
-
this.localParticipant.onVideoUnMuted();
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
mute() {
|
|
275
|
-
logger.info('mute room');
|
|
276
|
-
Wazo.Phone.mute(this.callSession);
|
|
277
|
-
this.sendMuteStatus();
|
|
278
|
-
}
|
|
279
|
-
unmute() {
|
|
280
|
-
logger.info('unmute room');
|
|
281
|
-
Wazo.Phone.unmute(this.callSession);
|
|
282
|
-
this.sendUnMuteStatus();
|
|
283
|
-
}
|
|
284
|
-
sendMuteStatus() {
|
|
285
|
-
if (this.localParticipant) {
|
|
286
|
-
this.localParticipant.onAudioMuted();
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
sendUnMuteStatus() {
|
|
290
|
-
if (this.localParticipant) {
|
|
291
|
-
this.localParticipant.onAudioUnMuted();
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
hold() {
|
|
295
|
-
logger.info('hold room');
|
|
296
|
-
Wazo.Phone.hold(this.callSession);
|
|
297
|
-
if (this.localParticipant) {
|
|
298
|
-
this.localParticipant.onHold();
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
async resume() {
|
|
302
|
-
logger.info('resume room');
|
|
303
|
-
const newStream = await Wazo.Phone.resume(this.callSession);
|
|
304
|
-
if (this.localParticipant) {
|
|
305
|
-
// Update local participant stream (useful when resuming a shreenshared conference)
|
|
306
|
-
this._updateLocalParticipantStream();
|
|
307
|
-
this.localParticipant.onResume();
|
|
308
|
-
if (!newStream && this.localParticipant.screensharing) {
|
|
309
|
-
this.localParticipant.onStopScreensharing();
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
_updateLocalParticipantStream() {
|
|
314
|
-
const localStream = Wazo.Phone.getLocalStream(this.callSession);
|
|
315
|
-
if (this.localParticipant && localStream) {
|
|
316
|
-
const localWazoStream = new Wazo.Stream(localStream);
|
|
317
|
-
this.localParticipant.resetStreams([localWazoStream]);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
sendDTMF(tone) {
|
|
321
|
-
logger.info('send room DTMF', {
|
|
322
|
-
tone,
|
|
323
|
-
});
|
|
324
|
-
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
325
|
-
}
|
|
326
|
-
async sendReinvite(newConstraints = null) {
|
|
327
|
-
logger.info('send room reinvite', {
|
|
328
|
-
callId: this.callSession ? this.callSession.getId() : null,
|
|
329
|
-
newConstraints,
|
|
330
|
-
});
|
|
331
|
-
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
332
|
-
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
333
|
-
if (Wazo.Phone.phone && Wazo.Phone.phone.currentScreenShare) {
|
|
334
|
-
this._onScreenSharing();
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
const response = await Wazo.Phone.phone?.sendReinvite(this.callSession, newConstraints, true);
|
|
338
|
-
if (this.localParticipant && newConstraints && newConstraints.video) {
|
|
339
|
-
const localVideoStream = Wazo.Phone.phone?.getLocalVideoStream(this.callSession);
|
|
340
|
-
if (localVideoStream) {
|
|
341
|
-
this._associateStreamTo(localVideoStream, this.localParticipant);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
else if (this.localParticipant && wasScreensharing && newConstraints && !newConstraints.video) {
|
|
345
|
-
// Downgrade from screenshare to audio
|
|
346
|
-
this.localParticipant.onStopScreensharing();
|
|
347
|
-
}
|
|
348
|
-
return response;
|
|
349
|
-
}
|
|
350
|
-
hasALocalVideoTrack() {
|
|
351
|
-
return Wazo.Phone.hasALocalVideoTrack(this.callSession);
|
|
352
|
-
}
|
|
353
|
-
getLocalStream() {
|
|
354
|
-
return Wazo.Phone.getLocalStream(this.callSession);
|
|
355
|
-
}
|
|
356
|
-
getRemoteStream() {
|
|
357
|
-
return Wazo.Phone.getRemoteStream(this.callSession);
|
|
358
|
-
}
|
|
359
|
-
getRemoteVideoStream() {
|
|
360
|
-
return Wazo.Phone.getRemoteVideoStream(this.callSession);
|
|
361
|
-
}
|
|
362
|
-
_bindEvents() {
|
|
363
|
-
if (!Wazo.Phone.phone || !Wazo.Phone.phone.currentSipSession) {
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
// Retrieve mapping
|
|
367
|
-
Wazo.Phone.phone.currentSipSession.sessionDescriptionHandler?.on('setDescription', ({ type, sdp: rawSdp, }) => {
|
|
368
|
-
if (type !== 'offer') {
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
this._mapMsid(rawSdp);
|
|
372
|
-
});
|
|
373
|
-
// Listen to REINVITE to ba able to map msid after upgrading to video in a audio only conference
|
|
374
|
-
// This allow to map msid with the non parsed (eg without the `stripVideo` modifier) SDP
|
|
375
|
-
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
376
|
-
this.on(this.ON_AUDIO_STREAM, async (stream) => {
|
|
377
|
-
logger.info('on room audio stream');
|
|
378
|
-
this.audioStream = stream;
|
|
379
|
-
if (!this.roomAudioElement) {
|
|
380
|
-
const sessionId = Wazo.Phone.phone?.getSipSessionId(Wazo.Phone.phone?.currentSipSession);
|
|
381
|
-
this.roomAudioElement = await Wazo.Phone.phone?.createAudioElementFor(sessionId);
|
|
382
|
-
this.roomAudioElement.srcObject = stream;
|
|
383
|
-
}
|
|
384
|
-
else {
|
|
385
|
-
this.roomAudioElement.srcObject = stream;
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
389
|
-
logger.info('on room video stream', {
|
|
390
|
-
streamId,
|
|
391
|
-
});
|
|
392
|
-
this._mapMsid(sipSession.body.body);
|
|
393
|
-
// ON_VIDEO_STREAM is called before PARTICIPANT_JOINED, so we have to keep stream in `_unassociatedVideoStreams`.
|
|
394
|
-
this._unassociatedVideoStreams[streamId] = stream;
|
|
395
|
-
const callId = this._getCallIdFromTrackId(streamId);
|
|
396
|
-
const participant = callId ? this._getParticipantFromCallId(callId) : null;
|
|
397
|
-
if (participant) {
|
|
398
|
-
this.__associateStreams(participant);
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
|
-
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
402
|
-
logger.info('on room remove stream');
|
|
403
|
-
const participant = this.participants.find(someParticipant => someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
404
|
-
if (!participant) {
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
participant.videoStreams = participant.videoStreams.filter(someStream => someStream.id !== stream.id);
|
|
408
|
-
participant.streams = participant.streams.filter(someStream => someStream.id !== stream.id);
|
|
409
|
-
participant.onStreamUnSubscribed(stream);
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
_onScreenSharing() {
|
|
413
|
-
if (this.localParticipant) {
|
|
414
|
-
this.localParticipant.onScreensharing();
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
_onReinvite(session, inviteRequest) {
|
|
418
|
-
const body = inviteRequest.body || inviteRequest.message.body;
|
|
419
|
-
if (body) {
|
|
420
|
-
this._mapMsid(body);
|
|
421
|
-
// Re-associate video streams
|
|
422
|
-
this.participants.forEach(participant => {
|
|
423
|
-
this.__associateStreams(participant);
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
_mapMsid(rawSdp) {
|
|
428
|
-
const sdp = sdpParser.parse(rawSdp);
|
|
429
|
-
// @ts-ignore: Property 'label' does not exist
|
|
430
|
-
const labelMsidArray = sdp.media.filter((media) => !!media.label).map(({ label, msid }) => ({
|
|
431
|
-
label: String(label),
|
|
432
|
-
streamId: msid?.split(' ')[0],
|
|
433
|
-
trackId: msid?.split(' ')[1],
|
|
434
|
-
}));
|
|
435
|
-
labelMsidArray.forEach(({ label, streamId, trackId, }) => {
|
|
436
|
-
this._callIdStreamIdMap[String(label)] = {
|
|
437
|
-
streamId,
|
|
438
|
-
trackId,
|
|
439
|
-
};
|
|
440
|
-
const callId = String(label);
|
|
441
|
-
const participant = this._unassociatedParticipants[callId] || this._getParticipantFromCallId(callId);
|
|
442
|
-
if (participant) {
|
|
443
|
-
this.__associateStreams(participant);
|
|
444
|
-
}
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
_transferEvents() {
|
|
448
|
-
Wazo.Websocket.on(this.CONFERENCE_USER_PARTICIPANT_JOINED, this._boundOnParticipantJoined);
|
|
449
|
-
Wazo.Websocket.on(this.CONFERENCE_USER_PARTICIPANT_LEFT, this._boundOnParticipantLeft);
|
|
450
|
-
Wazo.Websocket.on(this.MEETING_USER_PARTICIPANT_JOINED, this._boundOnParticipantJoined);
|
|
451
|
-
Wazo.Websocket.on(this.MEETING_USER_PARTICIPANT_LEFT, this._boundOnParticipantLeft);
|
|
452
|
-
// Phone events
|
|
453
|
-
Wazo.Phone.on(this.ON_MESSAGE, this._boundOnMessage);
|
|
454
|
-
Wazo.Phone.on(this.ON_CHAT, this._boundOnChat);
|
|
455
|
-
Wazo.Phone.on(this.ON_SIGNAL, this._boundOnSignal);
|
|
456
|
-
Wazo.Phone.on(this.ON_VIDEO_INPUT_CHANGE, this._boundSaveLocalVideoStream);
|
|
457
|
-
[this.ON_AUDIO_STREAM, this.ON_VIDEO_STREAM, this.ON_REMOVE_STREAM].forEach(event => Wazo.Phone.on(event, (...args) => this.eventEmitter.emit.apply(this.eventEmitter, [event, ...args])));
|
|
458
|
-
}
|
|
459
|
-
_onMessage(message) {
|
|
460
|
-
if (message.method !== 'MESSAGE') {
|
|
461
|
-
return null;
|
|
462
|
-
}
|
|
463
|
-
let body;
|
|
464
|
-
try {
|
|
465
|
-
body = JSON.parse(message.body);
|
|
466
|
-
}
|
|
467
|
-
catch (e) {
|
|
468
|
-
return null;
|
|
469
|
-
}
|
|
470
|
-
switch (body.type) {
|
|
471
|
-
case 'ConfbridgeTalking':
|
|
472
|
-
{
|
|
473
|
-
// Update participant
|
|
474
|
-
const channel = body.channels[0];
|
|
475
|
-
const { id: callId, talking_status: talkingStatus, } = channel;
|
|
476
|
-
const isTalking = talkingStatus === 'on';
|
|
477
|
-
const participantIdx = this.participants.findIndex(participant => participant.callId === callId);
|
|
478
|
-
if (participantIdx === -1) {
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
this.participants[participantIdx].onTalking(isTalking);
|
|
482
|
-
break;
|
|
483
|
-
}
|
|
484
|
-
default:
|
|
485
|
-
}
|
|
486
|
-
this.eventEmitter.emit(this.ON_MESSAGE, body);
|
|
487
|
-
return body;
|
|
488
|
-
}
|
|
489
|
-
_onChat(content) {
|
|
490
|
-
this.eventEmitter.emit(this.ON_CHAT, content);
|
|
491
|
-
}
|
|
492
|
-
_onSignal(content) {
|
|
493
|
-
const { type, } = content;
|
|
494
|
-
switch (type) {
|
|
495
|
-
// we're receiving a external update
|
|
496
|
-
case SIGNAL_TYPE_PARTICIPANT_UPDATE:
|
|
497
|
-
{
|
|
498
|
-
const { status, } = content;
|
|
499
|
-
const participant = this._getParticipantFromCallId(status.callId);
|
|
500
|
-
if (participant) {
|
|
501
|
-
// we're receiving, so no need to broadcast
|
|
502
|
-
participant.updateStatus(status, false);
|
|
503
|
-
}
|
|
504
|
-
break;
|
|
505
|
-
}
|
|
506
|
-
// this is a request to broadcast our current status
|
|
507
|
-
case SIGNAL_TYPE_PARTICIPANT_REQUEST:
|
|
508
|
-
{
|
|
509
|
-
const { callId, origin, } = content;
|
|
510
|
-
// callId is null, someone's requesting everyone's state;
|
|
511
|
-
// or callId is set and matches ours;
|
|
512
|
-
if (this.localParticipant && (!callId || callId === this.localParticipant.callId)) {
|
|
513
|
-
this.localParticipant.broadcastStatus(null, true);
|
|
514
|
-
}
|
|
515
|
-
// might as well update the requester's status
|
|
516
|
-
const requester = this._getParticipantFromCallId(origin.callId);
|
|
517
|
-
if (requester) {
|
|
518
|
-
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
519
|
-
logger.info('trigger room requester status', {
|
|
520
|
-
origin,
|
|
521
|
-
});
|
|
522
|
-
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
523
|
-
}
|
|
524
|
-
break;
|
|
525
|
-
}
|
|
526
|
-
case Wazo.Phone.ON_MESSAGE_TRACK_UPDATED:
|
|
527
|
-
{
|
|
528
|
-
const { callId, update, } = content;
|
|
529
|
-
const participantIdx = this.participants.findIndex(p => p.callId === callId);
|
|
530
|
-
if (participantIdx !== -1) {
|
|
531
|
-
this.participants[participantIdx] = this._onParticipantTrackUpdate(this.participants[participantIdx], update);
|
|
532
|
-
}
|
|
533
|
-
break;
|
|
534
|
-
}
|
|
535
|
-
default:
|
|
536
|
-
{
|
|
537
|
-
console.warn('uncaught signal', content);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
this.eventEmitter.emit(Wazo.Phone.ON_SIGNAL, content);
|
|
541
|
-
}
|
|
542
|
-
async _onParticipantJoined(payload) {
|
|
543
|
-
const participant = payload.data;
|
|
544
|
-
const session = Wazo.Auth.getSession();
|
|
545
|
-
let participants = [];
|
|
546
|
-
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
547
|
-
if (participant.user_uuid === session?.uuid) {
|
|
548
|
-
logger.info('room current user joined');
|
|
549
|
-
// Retrieve participants via an API calls
|
|
550
|
-
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
551
|
-
let response;
|
|
552
|
-
try {
|
|
553
|
-
if (this.meetingUuid) {
|
|
554
|
-
logger.info('fetching meeting participants', {
|
|
555
|
-
meetingUuid: this.meetingUuid,
|
|
556
|
-
});
|
|
557
|
-
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
558
|
-
}
|
|
559
|
-
else {
|
|
560
|
-
logger.info('fetching conference participants', {
|
|
561
|
-
conferenceId,
|
|
562
|
-
});
|
|
563
|
-
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
catch (e) {
|
|
567
|
-
logger.error('room participants fetching, error', e);
|
|
568
|
-
}
|
|
569
|
-
if (response) {
|
|
570
|
-
logger.info('conference participants fetched', {
|
|
571
|
-
nb: response.items.length,
|
|
572
|
-
});
|
|
573
|
-
participants = response.items.map((item) => {
|
|
574
|
-
const isMe = item.call_id === this.callId;
|
|
575
|
-
return isMe && item.call_id ? new Wazo.LocalParticipant(this, item, this.extra) : new Wazo.RemoteParticipant(this, item);
|
|
576
|
-
});
|
|
577
|
-
this.participants = participants;
|
|
578
|
-
const localParticipant = participants.find((someParticipant) => someParticipant instanceof Wazo.LocalParticipant);
|
|
579
|
-
if (!this.localParticipant && localParticipant) {
|
|
580
|
-
this._onLocalParticipantJoined(localParticipant);
|
|
581
|
-
}
|
|
582
|
-
participants.forEach((someParticipant) => this._isParticipantJoining(someParticipant));
|
|
583
|
-
this.eventEmitter.emit(this.ON_JOINED, localParticipant, participants);
|
|
584
|
-
}
|
|
585
|
-
return this.participants;
|
|
586
|
-
}
|
|
587
|
-
const remoteParticipant = !this.participants.some(p => p.callId === participant.call_id) ? new Wazo.RemoteParticipant(this, participant) : null;
|
|
588
|
-
logger.info('other room user joined', {
|
|
589
|
-
callId: participant.call_id,
|
|
590
|
-
remoteParticipant: !!remoteParticipant,
|
|
591
|
-
});
|
|
592
|
-
if (remoteParticipant) {
|
|
593
|
-
this.participants.push(remoteParticipant);
|
|
594
|
-
this._isParticipantJoining(remoteParticipant);
|
|
595
|
-
}
|
|
596
|
-
return remoteParticipant;
|
|
597
|
-
}
|
|
598
|
-
_onLocalParticipantJoined(localParticipant) {
|
|
599
|
-
this.localParticipant = localParticipant;
|
|
600
|
-
const localVideoStream = this._getLocalVideoStream();
|
|
601
|
-
if (localVideoStream) {
|
|
602
|
-
this._saveLocalVideoStream(localVideoStream);
|
|
603
|
-
}
|
|
604
|
-
this.connected = true;
|
|
605
|
-
localParticipant.broadcastStatus(null, true);
|
|
606
|
-
// we're in the room, now let's request everyone's status
|
|
607
|
-
if (this.localParticipant) {
|
|
608
|
-
this.sendSignal({
|
|
609
|
-
type: SIGNAL_TYPE_PARTICIPANT_REQUEST,
|
|
610
|
-
origin: this.localParticipant.getStatus(),
|
|
611
|
-
});
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
_isParticipantJoining(participant) {
|
|
615
|
-
this.__associateStreams(participant);
|
|
616
|
-
// @VALIDATE: no need to publicize ourselves, no?
|
|
617
|
-
if (participant instanceof RemoteParticipant) {
|
|
618
|
-
this.eventEmitter.emit(this.CONFERENCE_USER_PARTICIPANT_JOINED, participant);
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
_saveLocalVideoStream(stream) {
|
|
622
|
-
const { localParticipant, } = this;
|
|
623
|
-
if (!localParticipant) {
|
|
624
|
-
return;
|
|
625
|
-
}
|
|
626
|
-
const videoStream = new Wazo.Stream(stream, localParticipant);
|
|
627
|
-
if (videoStream) {
|
|
628
|
-
localParticipant.resetStreams([videoStream]);
|
|
629
|
-
localParticipant.onStreamSubscribed(videoStream);
|
|
630
|
-
}
|
|
631
|
-
return videoStream;
|
|
632
|
-
}
|
|
633
|
-
_onParticipantLeft(payload) {
|
|
634
|
-
const leftParticipant = this.participants.find(participant => participant && participant.callId === payload.data.call_id);
|
|
635
|
-
// Trigger Participant.ON_DISCONNECT event
|
|
636
|
-
if (leftParticipant) {
|
|
637
|
-
leftParticipant.onDisconnect();
|
|
638
|
-
}
|
|
639
|
-
this.participants = this.participants.filter(participant => participant && participant.callId !== payload.data.call_id);
|
|
640
|
-
this.eventEmitter.emit(this.CONFERENCE_USER_PARTICIPANT_LEFT, leftParticipant);
|
|
641
|
-
}
|
|
642
|
-
_onParticipantTrackUpdate(oldParticipant, update) {
|
|
643
|
-
const newParticipant = oldParticipant;
|
|
644
|
-
const { trackId, streamId, } = this._callIdStreamIdMap[newParticipant.callId] || {};
|
|
645
|
-
const pc = Wazo.Phone.phone?.currentSipSession?.sessionDescriptionHandler?.peerConnection;
|
|
646
|
-
// Can't use `getReceivers` here because on FF we make the mapping based on the streamId
|
|
647
|
-
const stream = pc.getRemoteStreams().find(someStream => someStream.id === streamId || someStream.getTracks().some(track => track.id === trackId));
|
|
648
|
-
if (update === 'downgrade') {
|
|
649
|
-
newParticipant.resetStreams([]);
|
|
650
|
-
newParticipant.onStreamUnSubscribed(stream);
|
|
651
|
-
return newParticipant;
|
|
652
|
-
}
|
|
653
|
-
// Upgrade
|
|
654
|
-
if (stream) {
|
|
655
|
-
this._associateStreamTo(stream, newParticipant);
|
|
656
|
-
}
|
|
657
|
-
return newParticipant;
|
|
658
|
-
}
|
|
659
|
-
// Associate audio/video streams to the participant and triggers events on it
|
|
660
|
-
__associateStreams(participant) {
|
|
661
|
-
const { trackId, } = this._callIdStreamIdMap[participant.callId] || {};
|
|
662
|
-
if (!trackId) {
|
|
663
|
-
this._unassociatedParticipants[participant.callId] = participant;
|
|
664
|
-
return;
|
|
665
|
-
}
|
|
666
|
-
if (!trackId || !participant || !this.localParticipant || participant.callId === this.localParticipant.callId) {
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
const streamId = this._getStreamIdFrTrackId(trackId);
|
|
670
|
-
const key = this._getUnassociatedMapIdFromTrackIdOrStreamId(trackId, streamId);
|
|
671
|
-
const stream = key ? this._unassociatedVideoStreams[key] : null;
|
|
672
|
-
if (stream) {
|
|
673
|
-
// Try to associate stream
|
|
674
|
-
this._associateStreamTo(stream, participant);
|
|
675
|
-
if (key) {
|
|
676
|
-
delete this._unassociatedVideoStreams[key];
|
|
677
|
-
}
|
|
678
|
-
delete this._unassociatedParticipants[participant.callId];
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
_getUnassociatedMapIdFromTrackIdOrStreamId(trackId, streamId) {
|
|
682
|
-
// Find by trackId
|
|
683
|
-
if (trackId in this._unassociatedVideoStreams) {
|
|
684
|
-
return trackId;
|
|
685
|
-
}
|
|
686
|
-
// Find by streamId
|
|
687
|
-
if (streamId && streamId in this._unassociatedVideoStreams) {
|
|
688
|
-
return streamId;
|
|
689
|
-
}
|
|
690
|
-
// Find in all the streams by streamId (used on FF where we can't map by trackId)
|
|
691
|
-
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream) => stream && stream.id === streamId);
|
|
692
|
-
return idx === -1 ? null : Object.keys(this._unassociatedVideoStreams)[idx];
|
|
693
|
-
}
|
|
694
|
-
_getStreamIdFrTrackId(trackId) {
|
|
695
|
-
const mapping = Object.values(this._callIdStreamIdMap).find((map) => map.trackId === trackId);
|
|
696
|
-
return mapping ? mapping.streamId : null;
|
|
697
|
-
}
|
|
698
|
-
_associateStreamTo(rawStream, participant) {
|
|
699
|
-
const stream = new Wazo.Stream(rawStream, participant);
|
|
700
|
-
participant.streams.push(stream);
|
|
701
|
-
participant.videoStreams.push(stream);
|
|
702
|
-
participant.onStreamSubscribed(stream);
|
|
703
|
-
}
|
|
704
|
-
_getCallIdFromTrackId(trackId) {
|
|
705
|
-
return Object.keys(this._callIdStreamIdMap).find(key => this._callIdStreamIdMap[key].trackId === trackId);
|
|
706
|
-
}
|
|
707
|
-
_getParticipantFromCallId(callId) {
|
|
708
|
-
return this.participants.find(participant => participant.callId === callId);
|
|
709
|
-
}
|
|
710
|
-
_getLocalVideoStream() {
|
|
711
|
-
return Wazo.Phone.getLocalVideoStream(this.callSession);
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
export default Room;
|