@wazo/sdk 0.38.22 → 0.39.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -293
- package/dist/wazo-sdk.js +9 -25
- package/esm/__tests__/api-client.test.js +183 -5059
- package/esm/__tests__/web-rtc-client.test.js +177 -7930
- package/esm/api/agentd.js +23 -832
- package/esm/api/amid.js +9 -411
- package/esm/api/application.js +60 -829
- package/esm/api/auth.js +164 -1213
- package/esm/api/call-logd.js +24 -733
- package/esm/api/calld.js +114 -1469
- package/esm/api/chatd.js +35 -1312
- package/esm/api/confd.js +67 -1580
- package/esm/api/ctid-ng.js +92 -1343
- package/esm/api/dird.js +100 -1590
- package/esm/api/webhookd.js +7 -513
- package/esm/api-client.js +143 -4881
- package/esm/checker/Checker.js +45 -8727
- package/esm/checker/checks/aor.js +24 -4924
- package/esm/checker/checks/api.js +70 -4968
- package/esm/checker/checks/ice-ipv4.js +63 -117
- package/esm/checker/checks/index.js +8 -8677
- package/esm/checker/checks/symmetric-nat.js +54 -102
- package/esm/checker/checks/wazo-websocket.js +34 -999
- package/esm/checker/checks/webrtc-transport.js +28 -7845
- package/esm/checker/checks/webrtc.js +31 -7852
- package/esm/domain/AdHocAPIConference.js +86 -5115
- package/esm/domain/Agent.js +27 -61
- package/esm/domain/BadResponse.js +20 -43
- package/esm/domain/Call.js +120 -210
- package/esm/domain/CallLog.js +123 -305
- package/esm/domain/CallSession.js +251 -423
- package/esm/domain/ChatMessage.js +52 -105
- package/esm/domain/ChatRoom.js +28 -60
- package/esm/domain/Contact.js +430 -741
- package/esm/domain/Country.js +17 -19
- package/esm/domain/Device/DebugDevice.js +31 -47
- package/esm/domain/Device/Device.js +1 -1
- package/esm/domain/DirectorySource.js +1 -1
- package/esm/domain/ExternalApp.js +23 -56
- package/esm/domain/Features.js +57 -5009
- package/esm/domain/ForwardOption.js +35 -70
- package/esm/domain/IndirectTransfer.js +38 -97
- package/esm/domain/Line.js +37 -88
- package/esm/domain/Meeting.js +58 -113
- package/esm/domain/MeetingAuthorization.js +38 -68
- package/esm/domain/MeetingStatus.js +13 -28
- package/esm/domain/NotificationOptions.js +43 -77
- package/esm/domain/Phone/CTIPhone.js +245 -5743
- package/esm/domain/Phone/Phone.js +1 -2
- package/esm/domain/Phone/WebRTCPhone.js +1450 -2670
- package/esm/domain/Profile.js +120 -405
- package/esm/domain/Recording.js +27 -51
- package/esm/domain/Relocation.js +16 -40
- package/esm/domain/Room.js +90 -133
- package/esm/domain/SFUNotAvailableError.js +5 -8
- package/esm/domain/ServerError.js +8 -61
- package/esm/domain/Session.js +125 -251
- package/esm/domain/SipLine.js +78 -155
- package/esm/domain/Subscription.js +39 -83
- package/esm/domain/SwitchboardCall.js +51 -143
- package/esm/domain/Voicemail.js +57 -122
- package/esm/domain/__tests__/Agent.test.js +31 -101
- package/esm/domain/__tests__/Call.test.js +24 -232
- package/esm/domain/__tests__/CallLog.test.js +60 -386
- package/esm/domain/__tests__/CallSession.test.js +74 -502
- package/esm/domain/__tests__/Contact.test.js +220 -902
- package/esm/domain/__tests__/IndirectTransfer.test.js +63 -546
- package/esm/domain/__tests__/Line.test.js +48 -156
- package/esm/domain/__tests__/Meeting.test.js +73 -226
- package/esm/domain/__tests__/MeetingAuthorization.test.js +45 -105
- package/esm/domain/__tests__/Profile.test.js +135 -496
- package/esm/domain/__tests__/Room.test.js +227 -719
- package/esm/domain/__tests__/Session.test.js +357 -1025
- package/esm/domain/__tests__/SipLine.test.js +24 -179
- package/esm/domain/__tests__/Voicemail.test.js +82 -200
- package/esm/domain/types.js +1 -1
- package/esm/index.js +63 -14985
- package/esm/lib/WazoSessionDescriptionHandler.js +406 -890
- package/esm/pubkey.js +10 -0
- package/esm/service/CallApi.js +42 -5014
- package/esm/service/IssueReporter.js +278 -360
- package/esm/service/__tests__/IssueReporter.test.js +92 -494
- package/esm/service/getApiClient.js +53 -4972
- package/esm/simple/Auth.js +212 -14747
- package/esm/simple/Configuration.js +8 -14796
- package/esm/simple/Directory.js +6 -4964
- package/esm/simple/Phone.js +309 -14727
- package/esm/simple/Websocket.js +68 -1112
- package/esm/simple/index.js +125 -14792
- package/esm/simple/room/LocalParticipant.js +1 -14797
- package/esm/simple/room/Participant.js +274 -14760
- package/esm/simple/room/RemoteParticipant.js +6 -14796
- package/esm/simple/room/Room.js +648 -14736
- package/esm/simple/room/SipRoom.js +111 -14790
- package/esm/simple/room/Stream.js +40 -14792
- package/esm/simple/room/__tests__/Participant.test.js +68 -14872
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +10 -14805
- package/esm/simple/utils.js +9 -14799
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/types/__tests__/api-client.test.d.ts +2 -0
- package/esm/types/__tests__/api-client.test.d.ts.map +1 -0
- package/esm/types/__tests__/web-rtc-client.test.d.ts +2 -0
- package/esm/types/__tests__/web-rtc-client.test.d.ts.map +1 -0
- package/esm/types/api/agentd.d.ts +17 -0
- package/esm/types/api/agentd.d.ts.map +1 -0
- package/esm/types/api/amid.d.ts +8 -0
- package/esm/types/api/amid.d.ts.map +1 -0
- package/esm/types/api/application.d.ts +34 -0
- package/esm/types/api/application.d.ts.map +1 -0
- package/esm/types/api/auth.d.ts +64 -0
- package/esm/types/api/auth.d.ts.map +1 -0
- package/esm/types/api/call-logd.d.ts +12 -0
- package/esm/types/api/call-logd.d.ts.map +1 -0
- package/esm/types/api/calld.d.ts +51 -0
- package/esm/types/api/calld.d.ts.map +1 -0
- package/esm/types/api/chatd.d.ts +42 -0
- package/esm/types/api/chatd.d.ts.map +1 -0
- package/esm/types/api/confd.d.ts +39 -0
- package/esm/types/api/confd.d.ts.map +1 -0
- package/esm/types/api/ctid-ng.d.ts +36 -0
- package/esm/types/api/ctid-ng.d.ts.map +1 -0
- package/esm/types/api/dird.d.ts +38 -0
- package/esm/types/api/dird.d.ts.map +1 -0
- package/esm/types/api/webhookd.d.ts +24 -0
- package/esm/types/api/webhookd.d.ts.map +1 -0
- package/esm/types/api-client.d.ts +63 -0
- package/esm/types/api-client.d.ts.map +1 -0
- package/esm/types/checker/Checker.d.ts +13 -0
- package/esm/types/checker/Checker.d.ts.map +1 -0
- package/esm/types/checker/checks/aor.d.ts +6 -0
- package/esm/types/checker/checks/aor.d.ts.map +1 -0
- package/esm/types/checker/checks/api.d.ts +6 -0
- package/esm/types/checker/checks/api.d.ts.map +1 -0
- package/esm/types/checker/checks/ice-ipv4.d.ts +6 -0
- package/esm/types/checker/checks/ice-ipv4.d.ts.map +1 -0
- package/esm/types/checker/checks/index.d.ts +9 -0
- package/esm/types/checker/checks/index.d.ts.map +1 -0
- package/esm/types/checker/checks/symmetric-nat.d.ts +6 -0
- package/esm/types/checker/checks/symmetric-nat.d.ts.map +1 -0
- package/esm/types/checker/checks/wazo-websocket.d.ts +6 -0
- package/esm/types/checker/checks/wazo-websocket.d.ts.map +1 -0
- package/esm/types/checker/checks/webrtc-transport.d.ts +7 -0
- package/esm/types/checker/checks/webrtc-transport.d.ts.map +1 -0
- package/esm/types/checker/checks/webrtc.d.ts +6 -0
- package/esm/types/checker/checks/webrtc.d.ts.map +1 -0
- package/esm/types/domain/AdHocAPIConference.d.ts +54 -0
- package/esm/types/domain/AdHocAPIConference.d.ts.map +1 -0
- package/esm/types/domain/Agent.d.ts +31 -0
- package/esm/types/domain/Agent.d.ts.map +1 -0
- package/esm/types/domain/BadResponse.d.ts +11 -0
- package/esm/types/domain/BadResponse.d.ts.map +1 -0
- package/esm/types/domain/Call.d.ts +79 -0
- package/esm/types/domain/Call.d.ts.map +1 -0
- package/esm/types/domain/CallLog.d.ts +91 -0
- package/esm/types/domain/CallLog.d.ts.map +1 -0
- package/esm/types/domain/CallSession.d.ts +120 -0
- package/esm/types/domain/CallSession.d.ts.map +1 -0
- package/esm/types/domain/ChatMessage.d.ts +41 -0
- package/esm/types/domain/ChatMessage.d.ts.map +1 -0
- package/esm/types/domain/ChatRoom.d.ts +22 -0
- package/esm/types/domain/ChatRoom.d.ts.map +1 -0
- package/esm/types/domain/Contact.d.ts +316 -0
- package/esm/types/domain/Contact.d.ts.map +1 -0
- package/esm/types/domain/Country.d.ts +20 -0
- package/esm/types/domain/Country.d.ts.map +1 -0
- package/esm/types/domain/Device/DebugDevice.d.ts +14 -0
- package/esm/types/domain/Device/DebugDevice.d.ts.map +1 -0
- package/esm/types/domain/Device/Device.d.ts +13 -0
- package/esm/types/domain/Device/Device.d.ts.map +1 -0
- package/esm/types/domain/DirectorySource.d.ts +13 -0
- package/esm/types/domain/DirectorySource.d.ts.map +1 -0
- package/esm/types/domain/ExternalApp.d.ts +22 -0
- package/esm/types/domain/ExternalApp.d.ts.map +1 -0
- package/esm/types/domain/Features.d.ts +24 -0
- package/esm/types/domain/Features.d.ts.map +1 -0
- package/esm/types/domain/ForwardOption.d.ts +27 -0
- package/esm/types/domain/ForwardOption.d.ts.map +1 -0
- package/esm/types/domain/IndirectTransfer.d.ts +31 -0
- package/esm/types/domain/IndirectTransfer.d.ts.map +1 -0
- package/esm/types/domain/Line.d.ts +46 -0
- package/esm/types/domain/Line.d.ts.map +1 -0
- package/esm/types/domain/Meeting.d.ts +45 -0
- package/esm/types/domain/Meeting.d.ts.map +1 -0
- package/esm/types/domain/MeetingAuthorization.d.ts +26 -0
- package/esm/types/domain/MeetingAuthorization.d.ts.map +1 -0
- package/esm/types/domain/MeetingStatus.d.ts +10 -0
- package/esm/types/domain/MeetingStatus.d.ts.map +1 -0
- package/esm/types/domain/NotificationOptions.d.ts +22 -0
- package/esm/types/domain/NotificationOptions.d.ts.map +1 -0
- package/esm/types/domain/Phone/CTIPhone.d.ts +76 -0
- package/esm/types/domain/Phone/CTIPhone.d.ts.map +1 -0
- package/esm/types/domain/Phone/Phone.d.ts +71 -0
- package/esm/types/domain/Phone/Phone.d.ts.map +1 -0
- package/esm/types/domain/Phone/WebRTCPhone.d.ts +179 -0
- package/esm/types/domain/Phone/WebRTCPhone.d.ts.map +1 -0
- package/esm/types/domain/Profile.d.ts +151 -0
- package/esm/types/domain/Profile.d.ts.map +1 -0
- package/esm/types/domain/Recording.d.ts +26 -0
- package/esm/types/domain/Recording.d.ts.map +1 -0
- package/esm/types/domain/Relocation.d.ts +23 -0
- package/esm/types/domain/Relocation.d.ts.map +1 -0
- package/esm/types/domain/Room.d.ts +35 -0
- package/esm/types/domain/Room.d.ts.map +1 -0
- package/esm/types/domain/SFUNotAvailableError.d.ts +4 -0
- package/esm/types/domain/SFUNotAvailableError.d.ts.map +1 -0
- package/esm/types/domain/ServerError.d.ts +6 -0
- package/esm/types/domain/ServerError.d.ts.map +1 -0
- package/esm/types/domain/Session.d.ts +90 -0
- package/esm/types/domain/Session.d.ts.map +1 -0
- package/esm/types/domain/SipLine.d.ts +54 -0
- package/esm/types/domain/SipLine.d.ts.map +1 -0
- package/esm/types/domain/Subscription.d.ts +43 -0
- package/esm/types/domain/Subscription.d.ts.map +1 -0
- package/esm/types/domain/SwitchboardCall.d.ts +62 -0
- package/esm/types/domain/SwitchboardCall.d.ts.map +1 -0
- package/esm/types/domain/Voicemail.d.ts +50 -0
- package/esm/types/domain/Voicemail.d.ts.map +1 -0
- package/esm/types/domain/__tests__/Agent.test.d.ts +2 -0
- package/esm/types/domain/__tests__/Agent.test.d.ts.map +1 -0
- package/esm/types/domain/__tests__/Call.test.d.ts +2 -0
- package/esm/types/domain/__tests__/Call.test.d.ts.map +1 -0
- package/esm/types/domain/__tests__/CallLog.test.d.ts +2 -0
- package/esm/types/domain/__tests__/CallLog.test.d.ts.map +1 -0
- package/esm/types/domain/__tests__/CallSession.test.d.ts +2 -0
- package/esm/types/domain/__tests__/CallSession.test.d.ts.map +1 -0
- package/esm/types/domain/__tests__/Contact.test.d.ts +2 -0
- package/esm/types/domain/__tests__/Contact.test.d.ts.map +1 -0
- package/esm/types/domain/__tests__/IndirectTransfer.test.d.ts +2 -0
- package/esm/types/domain/__tests__/IndirectTransfer.test.d.ts.map +1 -0
- package/esm/types/domain/__tests__/Line.test.d.ts +2 -0
- package/esm/types/domain/__tests__/Line.test.d.ts.map +1 -0
- package/esm/types/domain/__tests__/Meeting.test.d.ts +2 -0
- package/esm/types/domain/__tests__/Meeting.test.d.ts.map +1 -0
- package/esm/types/domain/__tests__/MeetingAuthorization.test.d.ts +2 -0
- package/esm/types/domain/__tests__/MeetingAuthorization.test.d.ts.map +1 -0
- package/esm/types/domain/__tests__/Profile.test.d.ts +2 -0
- package/esm/types/domain/__tests__/Profile.test.d.ts.map +1 -0
- package/esm/types/domain/__tests__/Room.test.d.ts +2 -0
- package/esm/types/domain/__tests__/Room.test.d.ts.map +1 -0
- package/esm/types/domain/__tests__/Session.test.d.ts +2 -0
- package/esm/types/domain/__tests__/Session.test.d.ts.map +1 -0
- package/esm/types/domain/__tests__/SipLine.test.d.ts +2 -0
- package/esm/types/domain/__tests__/SipLine.test.d.ts.map +1 -0
- package/esm/types/domain/__tests__/Voicemail.test.d.ts +2 -0
- package/esm/types/domain/__tests__/Voicemail.test.d.ts.map +1 -0
- package/esm/types/domain/types.d.ts +217 -0
- package/esm/types/domain/types.d.ts.map +1 -0
- package/esm/types/index.d.ts +304 -0
- package/esm/types/index.d.ts.map +1 -0
- package/esm/types/lib/WazoSessionDescriptionHandler.d.ts +30 -0
- package/esm/types/lib/WazoSessionDescriptionHandler.d.ts.map +1 -0
- package/esm/types/pubkey.d.ts +3 -0
- package/esm/types/pubkey.d.ts.map +1 -0
- package/esm/types/service/CallApi.d.ts +28 -0
- package/esm/types/service/CallApi.d.ts.map +1 -0
- package/esm/types/service/IssueReporter.d.ts +40 -0
- package/esm/types/service/IssueReporter.d.ts.map +1 -0
- package/esm/types/service/__tests__/IssueReporter.test.d.ts +2 -0
- package/esm/types/service/__tests__/IssueReporter.test.d.ts.map +1 -0
- package/esm/types/service/getApiClient.d.ts +16 -0
- package/esm/types/service/getApiClient.d.ts.map +1 -0
- package/esm/types/simple/Auth.d.ts +51 -0
- package/esm/types/simple/Auth.d.ts.map +1 -0
- package/esm/types/simple/Configuration.d.ts +3 -0
- package/esm/types/simple/Configuration.d.ts.map +1 -0
- package/esm/types/simple/Directory.d.ts +3 -0
- package/esm/types/simple/Directory.d.ts.map +1 -0
- package/esm/types/simple/Phone.d.ts +115 -0
- package/esm/types/simple/Phone.d.ts.map +1 -0
- package/esm/types/simple/Websocket.d.ts +19 -0
- package/esm/types/simple/Websocket.d.ts.map +1 -0
- package/esm/types/simple/index.d.ts +147 -0
- package/esm/types/simple/index.d.ts.map +1 -0
- package/esm/types/simple/room/LocalParticipant.d.ts +5 -0
- package/esm/types/simple/room/LocalParticipant.d.ts.map +1 -0
- package/esm/types/simple/room/Participant.d.ts +76 -0
- package/esm/types/simple/room/Participant.d.ts.map +1 -0
- package/esm/types/simple/room/RemoteParticipant.d.ts +7 -0
- package/esm/types/simple/room/RemoteParticipant.d.ts.map +1 -0
- package/esm/types/simple/room/Room.d.ts +116 -0
- package/esm/types/simple/room/Room.d.ts.map +1 -0
- package/esm/types/simple/room/SipRoom.d.ts +14 -0
- package/esm/types/simple/room/SipRoom.d.ts.map +1 -0
- package/esm/types/simple/room/Stream.d.ts +13 -0
- package/esm/types/simple/room/Stream.d.ts.map +1 -0
- package/esm/types/simple/room/__tests__/Participant.test.d.ts +2 -0
- package/esm/types/simple/room/__tests__/Participant.test.d.ts.map +1 -0
- package/esm/types/simple/room/__tests__/RemoteParticipant.test.d.ts +2 -0
- package/esm/types/simple/room/__tests__/RemoteParticipant.test.d.ts.map +1 -0
- package/esm/types/simple/utils.d.ts +3 -0
- package/esm/types/simple/utils.d.ts.map +1 -0
- package/esm/types/types/WebSocketMessage.d.ts +285 -0
- package/esm/types/types/WebSocketMessage.d.ts.map +1 -0
- package/esm/types/utils/Emitter.d.ts +18 -0
- package/esm/types/utils/Emitter.d.ts.map +1 -0
- package/esm/types/utils/Heartbeat.d.ts +21 -0
- package/esm/types/utils/Heartbeat.d.ts.map +1 -0
- package/esm/types/utils/PhoneNumberUtil.d.ts +8 -0
- package/esm/types/utils/PhoneNumberUtil.d.ts.map +1 -0
- package/esm/types/utils/__tests__/Heartbeat.test.d.ts +2 -0
- package/esm/types/utils/__tests__/Heartbeat.test.d.ts.map +1 -0
- package/esm/types/utils/__tests__/PhoneNumberUtil.test.d.ts +2 -0
- package/esm/types/utils/__tests__/PhoneNumberUtil.test.d.ts.map +1 -0
- package/esm/types/utils/__tests__/api-requester.test.d.ts +2 -0
- package/esm/types/utils/__tests__/api-requester.test.d.ts.map +1 -0
- package/esm/types/utils/__tests__/array.test.d.ts +2 -0
- package/esm/types/utils/__tests__/array.test.d.ts.map +1 -0
- package/esm/types/utils/__tests__/compare-version.test.d.ts +2 -0
- package/esm/types/utils/__tests__/compare-version.test.d.ts.map +1 -0
- package/esm/types/utils/__tests__/object.test.d.ts +2 -0
- package/esm/types/utils/__tests__/object.test.d.ts.map +1 -0
- package/esm/types/utils/__tests__/sdp.test.d.ts +2 -0
- package/esm/types/utils/__tests__/sdp.test.d.ts.map +1 -0
- package/esm/types/utils/__tests__/string.test.d.ts +2 -0
- package/esm/types/utils/__tests__/string.test.d.ts.map +1 -0
- package/esm/types/utils/api-requester.d.ts +45 -0
- package/esm/types/utils/api-requester.d.ts.map +1 -0
- package/esm/types/utils/array.d.ts +2 -0
- package/esm/types/utils/array.d.ts.map +1 -0
- package/esm/types/utils/compare-version.d.ts +3 -0
- package/esm/types/utils/compare-version.d.ts.map +1 -0
- package/esm/types/utils/isMobile.d.ts +3 -0
- package/esm/types/utils/isMobile.d.ts.map +1 -0
- package/esm/types/utils/new-from.d.ts +3 -0
- package/esm/types/utils/new-from.d.ts.map +1 -0
- package/esm/types/utils/object.d.ts +2 -0
- package/esm/types/utils/object.d.ts.map +1 -0
- package/esm/types/utils/once.d.ts +2 -0
- package/esm/types/utils/once.d.ts.map +1 -0
- package/esm/types/utils/sdp.d.ts +13 -0
- package/esm/types/utils/sdp.d.ts.map +1 -0
- package/esm/types/utils/string.d.ts +2 -0
- package/esm/types/utils/string.d.ts.map +1 -0
- package/esm/types/utils/update-from.d.ts +3 -0
- package/esm/types/utils/update-from.d.ts.map +1 -0
- package/esm/types/utils/webrtc.d.ts +15 -0
- package/esm/types/utils/webrtc.d.ts.map +1 -0
- package/esm/types/web-rtc-client.d.ts +211 -0
- package/esm/types/web-rtc-client.d.ts.map +1 -0
- package/esm/types/websocket-client.d.ts +134 -0
- package/esm/types/websocket-client.d.ts.map +1 -0
- package/esm/utils/Emitter.js +17 -27
- package/esm/utils/Heartbeat.js +60 -83
- package/esm/utils/PhoneNumberUtil.js +48 -63
- package/esm/utils/__tests__/Heartbeat.test.js +59 -168
- package/esm/utils/__tests__/PhoneNumberUtil.test.js +55 -125
- package/esm/utils/__tests__/api-requester.test.js +127 -780
- package/esm/utils/__tests__/array.test.js +16 -19
- package/esm/utils/__tests__/compare-version.test.js +8 -26
- package/esm/utils/__tests__/object.test.js +73 -54
- package/esm/utils/__tests__/sdp.test.js +87 -216
- package/esm/utils/__tests__/string.test.js +21 -27
- package/esm/utils/api-requester.js +197 -675
- package/esm/utils/array.js +7 -11
- package/esm/utils/compare-version.js +12 -15
- package/esm/utils/isMobile.js +0 -2
- package/esm/utils/new-from.js +7 -12
- package/esm/utils/object.js +9 -23
- package/esm/utils/once.js +12 -13
- package/esm/utils/sdp.js +87 -131
- package/esm/utils/string.js +5 -9
- package/esm/utils/update-from.js +9 -16
- package/esm/utils/webrtc.js +35 -36
- package/esm/web-rtc-client.js +1974 -7676
- package/esm/websocket-client.js +352 -944
- package/lib/__tests__/api-client.test.js +199 -5067
- package/lib/__tests__/web-rtc-client.test.js +191 -7941
- package/lib/api/agentd.js +27 -837
- package/lib/api/amid.js +18 -415
- package/lib/api/application.js +64 -834
- package/lib/api/auth.js +166 -1222
- package/lib/api/call-logd.js +28 -738
- package/lib/api/calld.js +126 -1473
- package/lib/api/chatd.js +49 -1316
- package/lib/api/confd.js +79 -1584
- package/lib/api/ctid-ng.js +96 -1348
- package/lib/api/dird.js +105 -1596
- package/lib/api/webhookd.js +11 -518
- package/lib/api-client.js +138 -4884
- package/lib/checker/Checker.js +61 -8739
- package/lib/checker/checks/aor.js +37 -4929
- package/lib/checker/checks/api.js +81 -4971
- package/lib/checker/checks/ice-ipv4.js +66 -118
- package/lib/checker/checks/index.js +13 -8687
- package/lib/checker/checks/symmetric-nat.js +56 -104
- package/lib/checker/checks/wazo-websocket.js +58 -1006
- package/lib/checker/checks/webrtc-transport.js +41 -7853
- package/lib/checker/checks/webrtc.js +42 -7858
- package/lib/domain/AdHocAPIConference.js +80 -5116
- package/lib/domain/Agent.js +23 -64
- package/lib/domain/BadResponse.js +17 -44
- package/lib/domain/Call.js +108 -215
- package/lib/domain/CallLog.js +117 -311
- package/lib/domain/CallSession.js +221 -424
- package/lib/domain/ChatMessage.js +49 -110
- package/lib/domain/ChatRoom.js +28 -60
- package/lib/domain/Contact.js +404 -742
- package/lib/domain/Country.js +19 -21
- package/lib/domain/Device/DebugDevice.js +34 -49
- package/lib/domain/Device/Device.js +2 -2
- package/lib/domain/DirectorySource.js +2 -2
- package/lib/domain/ExternalApp.js +24 -56
- package/lib/domain/Features.js +68 -5018
- package/lib/domain/ForwardOption.js +36 -71
- package/lib/domain/IndirectTransfer.js +39 -98
- package/lib/domain/Line.js +35 -88
- package/lib/domain/Meeting.js +51 -118
- package/lib/domain/MeetingAuthorization.js +35 -75
- package/lib/domain/MeetingStatus.js +13 -29
- package/lib/domain/NotificationOptions.js +45 -77
- package/lib/domain/Phone/CTIPhone.js +283 -5755
- package/lib/domain/Phone/Phone.js +2 -5
- package/lib/domain/Phone/WebRTCPhone.js +1450 -2715
- package/lib/domain/Profile.js +127 -406
- package/lib/domain/Recording.js +28 -57
- package/lib/domain/Relocation.js +15 -43
- package/lib/domain/Room.js +73 -134
- package/lib/domain/SFUNotAvailableError.js +7 -9
- package/lib/domain/ServerError.js +14 -63
- package/lib/domain/Session.js +118 -251
- package/lib/domain/SipLine.js +70 -155
- package/lib/domain/Subscription.js +32 -86
- package/lib/domain/SwitchboardCall.js +45 -145
- package/lib/domain/Voicemail.js +56 -127
- package/lib/domain/__tests__/Agent.test.js +36 -103
- package/lib/domain/__tests__/Call.test.js +28 -237
- package/lib/domain/__tests__/CallLog.test.js +65 -392
- package/lib/domain/__tests__/CallSession.test.js +78 -503
- package/lib/domain/__tests__/Contact.test.js +224 -903
- package/lib/domain/__tests__/IndirectTransfer.test.js +75 -546
- package/lib/domain/__tests__/Line.test.js +52 -157
- package/lib/domain/__tests__/Meeting.test.js +78 -232
- package/lib/domain/__tests__/MeetingAuthorization.test.js +50 -107
- package/lib/domain/__tests__/Profile.test.js +161 -496
- package/lib/domain/__tests__/Room.test.js +239 -719
- package/lib/domain/__tests__/Session.test.js +350 -1024
- package/lib/domain/__tests__/SipLine.test.js +28 -180
- package/lib/domain/__tests__/Voicemail.test.js +86 -205
- package/lib/domain/types.js +2 -2
- package/lib/index.js +105 -15010
- package/lib/lib/WazoSessionDescriptionHandler.js +409 -898
- package/lib/pubkey.js +12 -0
- package/lib/service/CallApi.js +88 -5015
- package/lib/service/IssueReporter.js +264 -366
- package/lib/service/__tests__/IssueReporter.test.js +97 -500
- package/lib/service/getApiClient.js +70 -4990
- package/lib/simple/Auth.js +272 -14777
- package/lib/simple/Configuration.js +23 -14805
- package/lib/simple/Directory.js +18 -4966
- package/lib/simple/Phone.js +345 -14746
- package/lib/simple/Websocket.js +98 -1117
- package/lib/simple/index.js +151 -14800
- package/lib/simple/room/LocalParticipant.js +7 -14808
- package/lib/simple/room/Participant.js +269 -14778
- package/lib/simple/room/RemoteParticipant.js +11 -14806
- package/lib/simple/room/Room.js +655 -14761
- package/lib/simple/room/SipRoom.js +136 -14805
- package/lib/simple/room/Stream.js +43 -14802
- package/lib/simple/room/__tests__/Participant.test.js +79 -14879
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +14 -14814
- package/lib/simple/utils.js +22 -14808
- package/lib/types/WebSocketMessage.js +2 -4
- package/lib/types/__tests__/api-client.test.d.ts +2 -0
- package/lib/types/__tests__/api-client.test.d.ts.map +1 -0
- package/lib/types/__tests__/web-rtc-client.test.d.ts +2 -0
- package/lib/types/__tests__/web-rtc-client.test.d.ts.map +1 -0
- package/lib/types/api/agentd.d.ts +17 -0
- package/lib/types/api/agentd.d.ts.map +1 -0
- package/lib/types/api/amid.d.ts +8 -0
- package/lib/types/api/amid.d.ts.map +1 -0
- package/lib/types/api/application.d.ts +34 -0
- package/lib/types/api/application.d.ts.map +1 -0
- package/lib/types/api/auth.d.ts +64 -0
- package/lib/types/api/auth.d.ts.map +1 -0
- package/lib/types/api/call-logd.d.ts +12 -0
- package/lib/types/api/call-logd.d.ts.map +1 -0
- package/lib/types/api/calld.d.ts +51 -0
- package/lib/types/api/calld.d.ts.map +1 -0
- package/lib/types/api/chatd.d.ts +42 -0
- package/lib/types/api/chatd.d.ts.map +1 -0
- package/lib/types/api/confd.d.ts +39 -0
- package/lib/types/api/confd.d.ts.map +1 -0
- package/lib/types/api/ctid-ng.d.ts +36 -0
- package/lib/types/api/ctid-ng.d.ts.map +1 -0
- package/lib/types/api/dird.d.ts +38 -0
- package/lib/types/api/dird.d.ts.map +1 -0
- package/lib/types/api/webhookd.d.ts +24 -0
- package/lib/types/api/webhookd.d.ts.map +1 -0
- package/lib/types/api-client.d.ts +63 -0
- package/lib/types/api-client.d.ts.map +1 -0
- package/lib/types/checker/Checker.d.ts +13 -0
- package/lib/types/checker/Checker.d.ts.map +1 -0
- package/lib/types/checker/checks/aor.d.ts +6 -0
- package/lib/types/checker/checks/aor.d.ts.map +1 -0
- package/lib/types/checker/checks/api.d.ts +6 -0
- package/lib/types/checker/checks/api.d.ts.map +1 -0
- package/lib/types/checker/checks/ice-ipv4.d.ts +6 -0
- package/lib/types/checker/checks/ice-ipv4.d.ts.map +1 -0
- package/lib/types/checker/checks/index.d.ts +9 -0
- package/lib/types/checker/checks/index.d.ts.map +1 -0
- package/lib/types/checker/checks/symmetric-nat.d.ts +6 -0
- package/lib/types/checker/checks/symmetric-nat.d.ts.map +1 -0
- package/lib/types/checker/checks/wazo-websocket.d.ts +6 -0
- package/lib/types/checker/checks/wazo-websocket.d.ts.map +1 -0
- package/lib/types/checker/checks/webrtc-transport.d.ts +7 -0
- package/lib/types/checker/checks/webrtc-transport.d.ts.map +1 -0
- package/lib/types/checker/checks/webrtc.d.ts +6 -0
- package/lib/types/checker/checks/webrtc.d.ts.map +1 -0
- package/lib/types/domain/AdHocAPIConference.d.ts +54 -0
- package/lib/types/domain/AdHocAPIConference.d.ts.map +1 -0
- package/lib/types/domain/Agent.d.ts +31 -0
- package/lib/types/domain/Agent.d.ts.map +1 -0
- package/lib/types/domain/BadResponse.d.ts +11 -0
- package/lib/types/domain/BadResponse.d.ts.map +1 -0
- package/lib/types/domain/Call.d.ts +79 -0
- package/lib/types/domain/Call.d.ts.map +1 -0
- package/lib/types/domain/CallLog.d.ts +91 -0
- package/lib/types/domain/CallLog.d.ts.map +1 -0
- package/lib/types/domain/CallSession.d.ts +120 -0
- package/lib/types/domain/CallSession.d.ts.map +1 -0
- package/lib/types/domain/ChatMessage.d.ts +41 -0
- package/lib/types/domain/ChatMessage.d.ts.map +1 -0
- package/lib/types/domain/ChatRoom.d.ts +22 -0
- package/lib/types/domain/ChatRoom.d.ts.map +1 -0
- package/lib/types/domain/Contact.d.ts +316 -0
- package/lib/types/domain/Contact.d.ts.map +1 -0
- package/lib/types/domain/Country.d.ts +20 -0
- package/lib/types/domain/Country.d.ts.map +1 -0
- package/lib/types/domain/Device/DebugDevice.d.ts +14 -0
- package/lib/types/domain/Device/DebugDevice.d.ts.map +1 -0
- package/lib/types/domain/Device/Device.d.ts +13 -0
- package/lib/types/domain/Device/Device.d.ts.map +1 -0
- package/lib/types/domain/DirectorySource.d.ts +13 -0
- package/lib/types/domain/DirectorySource.d.ts.map +1 -0
- package/lib/types/domain/ExternalApp.d.ts +22 -0
- package/lib/types/domain/ExternalApp.d.ts.map +1 -0
- package/lib/types/domain/Features.d.ts +24 -0
- package/lib/types/domain/Features.d.ts.map +1 -0
- package/lib/types/domain/ForwardOption.d.ts +27 -0
- package/lib/types/domain/ForwardOption.d.ts.map +1 -0
- package/lib/types/domain/IndirectTransfer.d.ts +31 -0
- package/lib/types/domain/IndirectTransfer.d.ts.map +1 -0
- package/lib/types/domain/Line.d.ts +46 -0
- package/lib/types/domain/Line.d.ts.map +1 -0
- package/lib/types/domain/Meeting.d.ts +45 -0
- package/lib/types/domain/Meeting.d.ts.map +1 -0
- package/lib/types/domain/MeetingAuthorization.d.ts +26 -0
- package/lib/types/domain/MeetingAuthorization.d.ts.map +1 -0
- package/lib/types/domain/MeetingStatus.d.ts +10 -0
- package/lib/types/domain/MeetingStatus.d.ts.map +1 -0
- package/lib/types/domain/NotificationOptions.d.ts +22 -0
- package/lib/types/domain/NotificationOptions.d.ts.map +1 -0
- package/lib/types/domain/Phone/CTIPhone.d.ts +76 -0
- package/lib/types/domain/Phone/CTIPhone.d.ts.map +1 -0
- package/lib/types/domain/Phone/Phone.d.ts +71 -0
- package/lib/types/domain/Phone/Phone.d.ts.map +1 -0
- package/lib/types/domain/Phone/WebRTCPhone.d.ts +179 -0
- package/lib/types/domain/Phone/WebRTCPhone.d.ts.map +1 -0
- package/lib/types/domain/Profile.d.ts +151 -0
- package/lib/types/domain/Profile.d.ts.map +1 -0
- package/lib/types/domain/Recording.d.ts +26 -0
- package/lib/types/domain/Recording.d.ts.map +1 -0
- package/lib/types/domain/Relocation.d.ts +23 -0
- package/lib/types/domain/Relocation.d.ts.map +1 -0
- package/lib/types/domain/Room.d.ts +35 -0
- package/lib/types/domain/Room.d.ts.map +1 -0
- package/lib/types/domain/SFUNotAvailableError.d.ts +4 -0
- package/lib/types/domain/SFUNotAvailableError.d.ts.map +1 -0
- package/lib/types/domain/ServerError.d.ts +6 -0
- package/lib/types/domain/ServerError.d.ts.map +1 -0
- package/lib/types/domain/Session.d.ts +90 -0
- package/lib/types/domain/Session.d.ts.map +1 -0
- package/lib/types/domain/SipLine.d.ts +54 -0
- package/lib/types/domain/SipLine.d.ts.map +1 -0
- package/lib/types/domain/Subscription.d.ts +43 -0
- package/lib/types/domain/Subscription.d.ts.map +1 -0
- package/lib/types/domain/SwitchboardCall.d.ts +62 -0
- package/lib/types/domain/SwitchboardCall.d.ts.map +1 -0
- package/lib/types/domain/Voicemail.d.ts +50 -0
- package/lib/types/domain/Voicemail.d.ts.map +1 -0
- package/lib/types/domain/__tests__/Agent.test.d.ts +2 -0
- package/lib/types/domain/__tests__/Agent.test.d.ts.map +1 -0
- package/lib/types/domain/__tests__/Call.test.d.ts +2 -0
- package/lib/types/domain/__tests__/Call.test.d.ts.map +1 -0
- package/lib/types/domain/__tests__/CallLog.test.d.ts +2 -0
- package/lib/types/domain/__tests__/CallLog.test.d.ts.map +1 -0
- package/lib/types/domain/__tests__/CallSession.test.d.ts +2 -0
- package/lib/types/domain/__tests__/CallSession.test.d.ts.map +1 -0
- package/lib/types/domain/__tests__/Contact.test.d.ts +2 -0
- package/lib/types/domain/__tests__/Contact.test.d.ts.map +1 -0
- package/lib/types/domain/__tests__/IndirectTransfer.test.d.ts +2 -0
- package/lib/types/domain/__tests__/IndirectTransfer.test.d.ts.map +1 -0
- package/lib/types/domain/__tests__/Line.test.d.ts +2 -0
- package/lib/types/domain/__tests__/Line.test.d.ts.map +1 -0
- package/lib/types/domain/__tests__/Meeting.test.d.ts +2 -0
- package/lib/types/domain/__tests__/Meeting.test.d.ts.map +1 -0
- package/lib/types/domain/__tests__/MeetingAuthorization.test.d.ts +2 -0
- package/lib/types/domain/__tests__/MeetingAuthorization.test.d.ts.map +1 -0
- package/lib/types/domain/__tests__/Profile.test.d.ts +2 -0
- package/lib/types/domain/__tests__/Profile.test.d.ts.map +1 -0
- package/lib/types/domain/__tests__/Room.test.d.ts +2 -0
- package/lib/types/domain/__tests__/Room.test.d.ts.map +1 -0
- package/lib/types/domain/__tests__/Session.test.d.ts +2 -0
- package/lib/types/domain/__tests__/Session.test.d.ts.map +1 -0
- package/lib/types/domain/__tests__/SipLine.test.d.ts +2 -0
- package/lib/types/domain/__tests__/SipLine.test.d.ts.map +1 -0
- package/lib/types/domain/__tests__/Voicemail.test.d.ts +2 -0
- package/lib/types/domain/__tests__/Voicemail.test.d.ts.map +1 -0
- package/lib/types/domain/types.d.ts +217 -0
- package/lib/types/domain/types.d.ts.map +1 -0
- package/lib/types/index.d.ts +304 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/lib/WazoSessionDescriptionHandler.d.ts +30 -0
- package/lib/types/lib/WazoSessionDescriptionHandler.d.ts.map +1 -0
- package/lib/types/pubkey.d.ts +3 -0
- package/lib/types/pubkey.d.ts.map +1 -0
- package/lib/types/service/CallApi.d.ts +28 -0
- package/lib/types/service/CallApi.d.ts.map +1 -0
- package/lib/types/service/IssueReporter.d.ts +40 -0
- package/lib/types/service/IssueReporter.d.ts.map +1 -0
- package/lib/types/service/__tests__/IssueReporter.test.d.ts +2 -0
- package/lib/types/service/__tests__/IssueReporter.test.d.ts.map +1 -0
- package/lib/types/service/getApiClient.d.ts +16 -0
- package/lib/types/service/getApiClient.d.ts.map +1 -0
- package/lib/types/simple/Auth.d.ts +51 -0
- package/lib/types/simple/Auth.d.ts.map +1 -0
- package/lib/types/simple/Configuration.d.ts +3 -0
- package/lib/types/simple/Configuration.d.ts.map +1 -0
- package/lib/types/simple/Directory.d.ts +3 -0
- package/lib/types/simple/Directory.d.ts.map +1 -0
- package/lib/types/simple/Phone.d.ts +115 -0
- package/lib/types/simple/Phone.d.ts.map +1 -0
- package/lib/types/simple/Websocket.d.ts +19 -0
- package/lib/types/simple/Websocket.d.ts.map +1 -0
- package/lib/types/simple/index.d.ts +147 -0
- package/lib/types/simple/index.d.ts.map +1 -0
- package/lib/types/simple/room/LocalParticipant.d.ts +5 -0
- package/lib/types/simple/room/LocalParticipant.d.ts.map +1 -0
- package/lib/types/simple/room/Participant.d.ts +76 -0
- package/lib/types/simple/room/Participant.d.ts.map +1 -0
- package/lib/types/simple/room/RemoteParticipant.d.ts +7 -0
- package/lib/types/simple/room/RemoteParticipant.d.ts.map +1 -0
- package/lib/types/simple/room/Room.d.ts +116 -0
- package/lib/types/simple/room/Room.d.ts.map +1 -0
- package/lib/types/simple/room/SipRoom.d.ts +14 -0
- package/lib/types/simple/room/SipRoom.d.ts.map +1 -0
- package/lib/types/simple/room/Stream.d.ts +13 -0
- package/lib/types/simple/room/Stream.d.ts.map +1 -0
- package/lib/types/simple/room/__tests__/Participant.test.d.ts +2 -0
- package/lib/types/simple/room/__tests__/Participant.test.d.ts.map +1 -0
- package/lib/types/simple/room/__tests__/RemoteParticipant.test.d.ts +2 -0
- package/lib/types/simple/room/__tests__/RemoteParticipant.test.d.ts.map +1 -0
- package/lib/types/simple/utils.d.ts +3 -0
- package/lib/types/simple/utils.d.ts.map +1 -0
- package/lib/types/types/WebSocketMessage.d.ts +285 -0
- package/lib/types/types/WebSocketMessage.d.ts.map +1 -0
- package/lib/types/utils/Emitter.d.ts +18 -0
- package/lib/types/utils/Emitter.d.ts.map +1 -0
- package/lib/types/utils/Heartbeat.d.ts +21 -0
- package/lib/types/utils/Heartbeat.d.ts.map +1 -0
- package/lib/types/utils/PhoneNumberUtil.d.ts +8 -0
- package/lib/types/utils/PhoneNumberUtil.d.ts.map +1 -0
- package/lib/types/utils/__tests__/Heartbeat.test.d.ts +2 -0
- package/lib/types/utils/__tests__/Heartbeat.test.d.ts.map +1 -0
- package/lib/types/utils/__tests__/PhoneNumberUtil.test.d.ts +2 -0
- package/lib/types/utils/__tests__/PhoneNumberUtil.test.d.ts.map +1 -0
- package/lib/types/utils/__tests__/api-requester.test.d.ts +2 -0
- package/lib/types/utils/__tests__/api-requester.test.d.ts.map +1 -0
- package/lib/types/utils/__tests__/array.test.d.ts +2 -0
- package/lib/types/utils/__tests__/array.test.d.ts.map +1 -0
- package/lib/types/utils/__tests__/compare-version.test.d.ts +2 -0
- package/lib/types/utils/__tests__/compare-version.test.d.ts.map +1 -0
- package/lib/types/utils/__tests__/object.test.d.ts +2 -0
- package/lib/types/utils/__tests__/object.test.d.ts.map +1 -0
- package/lib/types/utils/__tests__/sdp.test.d.ts +2 -0
- package/lib/types/utils/__tests__/sdp.test.d.ts.map +1 -0
- package/lib/types/utils/__tests__/string.test.d.ts +2 -0
- package/lib/types/utils/__tests__/string.test.d.ts.map +1 -0
- package/lib/types/utils/api-requester.d.ts +45 -0
- package/lib/types/utils/api-requester.d.ts.map +1 -0
- package/lib/types/utils/array.d.ts +2 -0
- package/lib/types/utils/array.d.ts.map +1 -0
- package/lib/types/utils/compare-version.d.ts +3 -0
- package/lib/types/utils/compare-version.d.ts.map +1 -0
- package/lib/types/utils/isMobile.d.ts +3 -0
- package/lib/types/utils/isMobile.d.ts.map +1 -0
- package/lib/types/utils/new-from.d.ts +3 -0
- package/lib/types/utils/new-from.d.ts.map +1 -0
- package/lib/types/utils/object.d.ts +2 -0
- package/lib/types/utils/object.d.ts.map +1 -0
- package/lib/types/utils/once.d.ts +2 -0
- package/lib/types/utils/once.d.ts.map +1 -0
- package/lib/types/utils/sdp.d.ts +13 -0
- package/lib/types/utils/sdp.d.ts.map +1 -0
- package/lib/types/utils/string.d.ts +2 -0
- package/lib/types/utils/string.d.ts.map +1 -0
- package/lib/types/utils/update-from.d.ts +3 -0
- package/lib/types/utils/update-from.d.ts.map +1 -0
- package/lib/types/utils/webrtc.d.ts +15 -0
- package/lib/types/utils/webrtc.d.ts.map +1 -0
- package/lib/types/web-rtc-client.d.ts +211 -0
- package/lib/types/web-rtc-client.d.ts.map +1 -0
- package/lib/types/websocket-client.d.ts +134 -0
- package/lib/types/websocket-client.d.ts.map +1 -0
- package/lib/utils/Emitter.js +22 -33
- package/lib/utils/Heartbeat.js +54 -86
- package/lib/utils/PhoneNumberUtil.js +60 -77
- package/lib/utils/__tests__/Heartbeat.test.js +73 -170
- package/lib/utils/__tests__/PhoneNumberUtil.test.js +57 -131
- package/lib/utils/__tests__/api-requester.test.js +139 -784
- package/lib/utils/__tests__/array.test.js +18 -21
- package/lib/utils/__tests__/compare-version.test.js +12 -27
- package/lib/utils/__tests__/object.test.js +75 -56
- package/lib/utils/__tests__/sdp.test.js +99 -220
- package/lib/utils/__tests__/string.test.js +23 -29
- package/lib/utils/api-requester.js +191 -685
- package/lib/utils/array.js +10 -14
- package/lib/utils/compare-version.js +15 -18
- package/lib/utils/isMobile.js +3 -5
- package/lib/utils/new-from.js +9 -14
- package/lib/utils/object.js +12 -26
- package/lib/utils/once.js +15 -15
- package/lib/utils/sdp.js +97 -150
- package/lib/utils/string.js +8 -12
- package/lib/utils/update-from.js +11 -18
- package/lib/utils/webrtc.js +38 -39
- package/lib/web-rtc-client.js +2001 -7695
- package/lib/websocket-client.js +357 -1021
- package/package.json +40 -34
- package/src/__tests__/{api-client.test.js → api-client.test.ts} +71 -29
- package/src/__tests__/{web-rtc-client.test.js → web-rtc-client.test.ts} +95 -35
- package/src/api/agentd.ts +37 -0
- package/src/api/amid.ts +16 -0
- package/src/api/application.ts +96 -0
- package/src/api/auth.ts +259 -0
- package/src/api/call-logd.ts +38 -0
- package/src/api/calld.ts +183 -0
- package/src/api/chatd.ts +83 -0
- package/src/api/confd.ts +110 -0
- package/src/api/ctid-ng.ts +152 -0
- package/src/api/dird.ts +146 -0
- package/src/api/webhookd.ts +30 -0
- package/src/{api-client.js → api-client.ts} +99 -65
- package/src/checker/{Checker.js → Checker.ts} +27 -20
- package/src/checker/checks/{aor.js → aor.ts} +10 -6
- package/src/checker/checks/{api.js → api.ts} +18 -17
- package/src/checker/checks/{ice-ipv4.js → ice-ipv4.ts} +23 -26
- package/src/checker/checks/{index.js → index.ts} +1 -9
- package/src/checker/checks/{symmetric-nat.js → symmetric-nat.ts} +14 -15
- package/src/checker/checks/{wazo-websocket.js → wazo-websocket.ts} +7 -5
- package/src/checker/checks/{webrtc-transport.js → webrtc-transport.ts} +3 -2
- package/src/checker/checks/{webrtc.js → webrtc.ts} +3 -4
- package/src/domain/{AdHocAPIConference.js → AdHocAPIConference.ts} +38 -54
- package/src/domain/{Agent.js → Agent.ts} +11 -7
- package/src/domain/BadResponse.ts +29 -0
- package/src/domain/{Call.js → Call.ts} +62 -46
- package/src/domain/{CallLog.js → CallLog.ts} +61 -63
- package/src/domain/{CallSession.js → CallSession.ts} +55 -52
- package/src/domain/{ChatMessage.js → ChatMessage.ts} +32 -21
- package/src/domain/{ChatRoom.js → ChatRoom.ts} +15 -11
- package/src/domain/{Contact.js → Contact.ts} +373 -261
- package/src/domain/{Country.js → Country.ts} +0 -0
- package/src/domain/Device/{DebugDevice.js → DebugDevice.ts} +3 -5
- package/src/domain/Device/{Device.js → Device.ts} +0 -11
- package/src/domain/DirectorySource.ts +13 -0
- package/src/domain/{ExternalApp.js → ExternalApp.ts} +14 -13
- package/src/domain/{Features.js → Features.ts} +43 -17
- package/src/domain/{ForwardOption.js → ForwardOption.ts} +16 -16
- package/src/domain/{IndirectTransfer.js → IndirectTransfer.ts} +21 -19
- package/src/domain/{Line.js → Line.ts} +39 -26
- package/src/domain/{Meeting.js → Meeting.ts} +36 -29
- package/src/domain/{MeetingAuthorization.js → MeetingAuthorization.ts} +13 -12
- package/src/domain/{MeetingStatus.js → MeetingStatus.ts} +2 -6
- package/src/domain/{NotificationOptions.js → NotificationOptions.ts} +14 -13
- package/src/domain/Phone/{CTIPhone.js → CTIPhone.ts} +90 -60
- package/src/domain/Phone/{Phone.js → Phone.ts} +27 -72
- package/src/domain/Phone/{WebRTCPhone.js → WebRTCPhone.ts} +441 -413
- package/src/domain/{Profile.js → Profile.ts} +117 -100
- package/src/domain/{Recording.js → Recording.ts} +25 -16
- package/src/domain/{Relocation.js → Relocation.ts} +15 -14
- package/src/domain/{Room.js → Room.ts} +58 -27
- package/src/domain/{SFUNotAvailableError.js → SFUNotAvailableError.ts} +2 -2
- package/src/domain/ServerError.ts +12 -0
- package/src/domain/{Session.js → Session.ts} +89 -67
- package/src/domain/{SipLine.js → SipLine.ts} +52 -45
- package/src/domain/{Subscription.js → Subscription.ts} +22 -13
- package/src/domain/{SwitchboardCall.js → SwitchboardCall.ts} +48 -43
- package/src/domain/{Voicemail.js → Voicemail.ts} +38 -34
- package/src/domain/__tests__/{Agent.test.js → Agent.test.ts} +11 -19
- package/src/domain/__tests__/{Call.test.js → Call.test.ts} +12 -9
- package/src/domain/__tests__/CallLog.test.ts +65 -0
- package/src/domain/__tests__/{CallSession.test.js → CallSession.test.ts} +15 -19
- package/src/domain/__tests__/Contact.test.ts +238 -0
- package/src/domain/__tests__/{IndirectTransfer.test.js → IndirectTransfer.test.ts} +38 -31
- package/src/domain/__tests__/Line.test.ts +53 -0
- package/src/domain/__tests__/{Meeting.test.js → Meeting.test.ts} +12 -38
- package/src/domain/__tests__/{MeetingAuthorization.test.js → MeetingAuthorization.test.ts} +13 -21
- package/src/domain/__tests__/Profile.test.ts +139 -0
- package/src/domain/__tests__/{Room.test.js → Room.test.ts} +114 -76
- package/src/domain/__tests__/{Session.test.js → Session.test.ts} +137 -162
- package/src/domain/__tests__/{SipLine.test.js → SipLine.test.ts} +7 -3
- package/src/domain/__tests__/{Voicemail.test.js → Voicemail.test.ts} +26 -20
- package/src/domain/types.ts +227 -0
- package/src/{index.js → index.ts} +4 -28
- package/src/lib/WazoSessionDescriptionHandler.ts +534 -0
- package/{config.js → src/pubkey.ts} +3 -3
- package/src/service/{CallApi.js → CallApi.ts} +14 -18
- package/src/service/{IssueReporter.js → IssueReporter.ts} +105 -56
- package/src/service/__tests__/{IssueReporter.test.js → IssueReporter.test.ts} +27 -23
- package/src/service/getApiClient.ts +94 -0
- package/src/simple/{Auth.js → Auth.ts} +129 -100
- package/src/simple/{Configuration.js → Configuration.ts} +2 -3
- package/src/simple/{Directory.js → Directory.ts} +2 -3
- package/src/simple/Phone.ts +623 -0
- package/src/simple/Websocket.ts +119 -0
- package/src/simple/{index.js → index.ts} +51 -21
- package/src/simple/room/{LocalParticipant.js → LocalParticipant.ts} +1 -3
- package/src/simple/room/{Participant.js → Participant.ts} +108 -46
- package/src/simple/room/{RemoteParticipant.js → RemoteParticipant.ts} +5 -4
- package/src/simple/room/{Room.js → Room.ts} +266 -183
- package/src/simple/room/{SipRoom.js → SipRoom.ts} +46 -29
- package/src/simple/room/{Stream.js → Stream.ts} +8 -6
- package/src/simple/room/__tests__/{Participant.test.js → Participant.test.ts} +9 -15
- package/src/simple/room/__tests__/{RemoteParticipant.test.js → RemoteParticipant.test.ts} +5 -1
- package/src/simple/utils.ts +12 -0
- package/src/types/WebSocketMessage.ts +335 -0
- package/src/types/global.d.ts +26 -0
- package/src/utils/Emitter.ts +34 -0
- package/src/utils/{Heartbeat.js → Heartbeat.ts} +17 -11
- package/src/utils/{PhoneNumberUtil.js → PhoneNumberUtil.ts} +12 -18
- package/src/utils/__tests__/{Heartbeat.test.js → Heartbeat.test.ts} +0 -15
- package/src/utils/__tests__/{PhoneNumberUtil.test.js → PhoneNumberUtil.test.ts} +6 -4
- package/src/utils/__tests__/{api-requester.test.js → api-requester.test.ts} +75 -24
- package/src/utils/__tests__/{array.test.js → array.test.ts} +10 -2
- package/src/utils/__tests__/{compare-version.test.js → compare-version.test.ts} +0 -0
- package/src/utils/__tests__/object.test.ts +77 -0
- package/src/utils/__tests__/{sdp.test.js → sdp.test.ts} +15 -37
- package/src/utils/__tests__/{string.test.js → string.test.ts} +4 -2
- package/src/utils/{api-requester.js → api-requester.ts} +104 -83
- package/src/utils/{array.js → array.ts} +2 -2
- package/src/utils/{compare-version.js → compare-version.ts} +3 -2
- package/src/utils/{isMobile.js → isMobile.ts} +1 -1
- package/src/utils/{new-from.js → new-from.ts} +3 -6
- package/src/utils/{object.js → object.ts} +3 -6
- package/src/utils/{once.js → once.ts} +5 -5
- package/src/utils/sdp.ts +119 -0
- package/src/utils/{string.js → string.ts} +2 -3
- package/src/utils/update-from.ts +11 -0
- package/src/utils/{webrtc.js → webrtc.ts} +21 -3
- package/src/{web-rtc-client.js → web-rtc-client.ts} +793 -463
- package/src/{websocket-client.js → websocket-client.ts} +146 -144
- package/esm/simple/Softphone.js +0 -394
- package/lib/simple/Softphone.js +0 -396
- package/src/api/agentd.js +0 -74
- package/src/api/amid.js +0 -13
- package/src/api/application.js +0 -137
- package/src/api/auth.js +0 -279
- package/src/api/call-logd.js +0 -20
- package/src/api/calld.js +0 -214
- package/src/api/chatd.js +0 -80
- package/src/api/confd.js +0 -127
- package/src/api/ctid-ng.js +0 -153
- package/src/api/dird.js +0 -159
- package/src/api/webhookd.js +0 -31
- package/src/domain/BadResponse.js +0 -42
- package/src/domain/DirectorySource.js +0 -16
- package/src/domain/ServerError.js +0 -18
- package/src/domain/__tests__/CallLog.test.js +0 -75
- package/src/domain/__tests__/Contact.test.js +0 -170
- package/src/domain/__tests__/Line.test.js +0 -73
- package/src/domain/__tests__/Profile.test.js +0 -104
- package/src/domain/types.js +0 -248
- package/src/lib/WazoSessionDescriptionHandler.js +0 -467
- package/src/service/getApiClient.js +0 -122
- package/src/simple/Phone.js +0 -425
- package/src/simple/Softphone.js +0 -392
- package/src/simple/Websocket.js +0 -86
- package/src/simple/utils.js +0 -17
- package/src/types/WebSocketMessage.js +0 -232
- package/src/utils/Emitter.js +0 -26
- package/src/utils/__tests__/object.test.js +0 -35
- package/src/utils/sdp.js +0 -140
- package/src/utils/update-from.js +0 -15
|
@@ -1,59 +1,91 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import type { Message } from 'sip.js/lib/api/message';
|
|
3
2
|
import sdpParser from 'sdp-transform';
|
|
4
|
-
|
|
3
|
+
import { Invitation, Inviter } from 'sip.js';
|
|
5
4
|
import type CallSession from '../../domain/CallSession';
|
|
6
5
|
import getApiClient from '../../service/getApiClient';
|
|
7
6
|
import Emitter from '../../utils/Emitter';
|
|
8
7
|
import Wazo from '../index';
|
|
9
|
-
import Participant from './Participant';
|
|
8
|
+
import Participant, { RawParticipant } from './Participant';
|
|
10
9
|
import RemoteParticipant from './RemoteParticipant';
|
|
11
10
|
import IssueReporter from '../../service/IssueReporter';
|
|
12
11
|
import LocalParticipant from './LocalParticipant';
|
|
13
12
|
|
|
14
13
|
export const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
15
14
|
export const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
16
|
-
|
|
17
15
|
const logger = IssueReporter.loggerFor('sdk-room');
|
|
18
16
|
|
|
19
17
|
class Room extends Emitter {
|
|
20
|
-
callSession:
|
|
18
|
+
callSession: CallSession | null | undefined;
|
|
19
|
+
|
|
21
20
|
name: string;
|
|
21
|
+
|
|
22
22
|
extension: string;
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
|
|
24
|
+
sourceId: number | null | undefined;
|
|
25
|
+
|
|
26
|
+
meetingUuid: string | null | undefined;
|
|
27
|
+
|
|
25
28
|
participants: Participant[];
|
|
26
|
-
|
|
29
|
+
|
|
30
|
+
callId: string | null | undefined;
|
|
31
|
+
|
|
27
32
|
connected: boolean;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
|
|
34
|
+
localParticipant: Participant | null | undefined;
|
|
35
|
+
|
|
36
|
+
_callIdStreamIdMap: Record<string, any>;
|
|
37
|
+
|
|
38
|
+
_unassociatedVideoStreams: Record<string, any>;
|
|
39
|
+
|
|
40
|
+
_unassociatedParticipants: Record<string, any>;
|
|
41
|
+
|
|
42
|
+
_boundOnParticipantJoined: (...args: Array<any>) => any;
|
|
43
|
+
|
|
44
|
+
_boundOnParticipantLeft: (...args: Array<any>) => any;
|
|
45
|
+
|
|
46
|
+
_boundOnMessage: (...args: Array<any>) => any;
|
|
47
|
+
|
|
48
|
+
_boundOnChat: (...args: Array<any>) => any;
|
|
49
|
+
|
|
50
|
+
_boundOnSignal: (...args: Array<any>) => any;
|
|
51
|
+
|
|
52
|
+
_boundSaveLocalVideoStream: (...args: Array<any>) => any;
|
|
53
|
+
|
|
54
|
+
_boundOnReinvite: (...args: Array<any>) => any;
|
|
55
|
+
|
|
56
|
+
audioStream: any | null | undefined;
|
|
57
|
+
|
|
58
|
+
extra: Record<string, any>;
|
|
59
|
+
|
|
41
60
|
// video tag representing the room audio stream
|
|
42
61
|
roomAudioElement: any;
|
|
43
62
|
|
|
44
63
|
CONFERENCE_USER_PARTICIPANT_JOINED: string;
|
|
64
|
+
|
|
45
65
|
CONFERENCE_USER_PARTICIPANT_LEFT: string;
|
|
66
|
+
|
|
46
67
|
MEETING_USER_PARTICIPANT_JOINED: string;
|
|
68
|
+
|
|
47
69
|
MEETING_USER_PARTICIPANT_LEFT: string;
|
|
70
|
+
|
|
48
71
|
ON_SHARE_SCREEN_ENDED: string;
|
|
72
|
+
|
|
49
73
|
ON_MESSAGE: string;
|
|
74
|
+
|
|
50
75
|
ON_CHAT: string;
|
|
76
|
+
|
|
51
77
|
ON_SIGNAL: string;
|
|
78
|
+
|
|
52
79
|
ON_AUDIO_STREAM: string;
|
|
80
|
+
|
|
53
81
|
ON_VIDEO_STREAM: string;
|
|
82
|
+
|
|
54
83
|
ON_REMOVE_STREAM: string;
|
|
84
|
+
|
|
55
85
|
ON_DISCONNECTED: string;
|
|
86
|
+
|
|
56
87
|
ON_JOINED: string;
|
|
88
|
+
|
|
57
89
|
ON_VIDEO_INPUT_CHANGE: string;
|
|
58
90
|
|
|
59
91
|
/**
|
|
@@ -65,17 +97,14 @@ class Room extends Emitter {
|
|
|
65
97
|
* @param meetingUuid string
|
|
66
98
|
* @param extra Object
|
|
67
99
|
*/
|
|
68
|
-
constructor(
|
|
69
|
-
callSession: CallSession,
|
|
70
|
-
extension: string,
|
|
71
|
-
sourceId: ?number,
|
|
72
|
-
callId: ?string,
|
|
73
|
-
meetingUuid: ?string,
|
|
74
|
-
extra: Object = {},
|
|
75
|
-
) {
|
|
100
|
+
constructor(callSession: CallSession, extension: string, sourceId: number | null | undefined, callId: string | null | undefined, meetingUuid: string | null | undefined, extra: Record<string, any> = {}) {
|
|
76
101
|
super();
|
|
77
|
-
logger.info('room initialized', {
|
|
78
|
-
|
|
102
|
+
logger.info('room initialized', {
|
|
103
|
+
callId,
|
|
104
|
+
extension,
|
|
105
|
+
sourceId,
|
|
106
|
+
meetingUuid,
|
|
107
|
+
});
|
|
79
108
|
// Represents the room callSession
|
|
80
109
|
this.callSession = callSession;
|
|
81
110
|
this.extension = extension;
|
|
@@ -91,12 +120,10 @@ class Room extends Emitter {
|
|
|
91
120
|
this._unassociatedVideoStreams = {};
|
|
92
121
|
// Participant not yet associated to a stream, [participant.callId = label in setDescription]: Participant
|
|
93
122
|
this._unassociatedParticipants = {};
|
|
94
|
-
|
|
95
123
|
// The shared audio stream of the room
|
|
96
124
|
this.audioStream = null;
|
|
97
125
|
// Extra values passed to local participant
|
|
98
126
|
this.extra = extra;
|
|
99
|
-
|
|
100
127
|
// Sugar syntax for `room.EVENT_NAME`
|
|
101
128
|
this.CONFERENCE_USER_PARTICIPANT_JOINED = Wazo.Websocket.CONFERENCE_USER_PARTICIPANT_JOINED;
|
|
102
129
|
this.CONFERENCE_USER_PARTICIPANT_LEFT = Wazo.Websocket.CONFERENCE_USER_PARTICIPANT_LEFT;
|
|
@@ -106,14 +133,12 @@ class Room extends Emitter {
|
|
|
106
133
|
this.ON_MESSAGE = Wazo.Phone.ON_MESSAGE;
|
|
107
134
|
this.ON_CHAT = Wazo.Phone.ON_CHAT;
|
|
108
135
|
this.ON_SIGNAL = Wazo.Phone.ON_SIGNAL;
|
|
109
|
-
|
|
110
136
|
this.ON_AUDIO_STREAM = Wazo.Phone.ON_AUDIO_STREAM;
|
|
111
137
|
this.ON_VIDEO_STREAM = Wazo.Phone.ON_VIDEO_STREAM;
|
|
112
138
|
this.ON_REMOVE_STREAM = Wazo.Phone.ON_REMOVE_STREAM;
|
|
113
139
|
this.ON_VIDEO_INPUT_CHANGE = Wazo.Phone.ON_VIDEO_INPUT_CHANGE;
|
|
114
140
|
this.ON_DISCONNECTED = 'room/ON_DISCONNECTED';
|
|
115
141
|
this.ON_JOINED = 'room/ON_JOINED';
|
|
116
|
-
|
|
117
142
|
this._boundOnParticipantJoined = this._onParticipantJoined.bind(this);
|
|
118
143
|
this._boundOnParticipantLeft = this._onParticipantLeft.bind(this);
|
|
119
144
|
this._boundOnMessage = this._onMessage.bind(this);
|
|
@@ -121,7 +146,6 @@ class Room extends Emitter {
|
|
|
121
146
|
this._boundOnSignal = this._onSignal.bind(this);
|
|
122
147
|
this._boundSaveLocalVideoStream = this._saveLocalVideoStream.bind(this);
|
|
123
148
|
this._boundOnReinvite = this._onReinvite.bind(this);
|
|
124
|
-
|
|
125
149
|
this.unbind();
|
|
126
150
|
|
|
127
151
|
this._bindEvents();
|
|
@@ -139,12 +163,24 @@ class Room extends Emitter {
|
|
|
139
163
|
* @param meeting ?Meeting
|
|
140
164
|
* @returns {Promise<Room>}
|
|
141
165
|
*/
|
|
142
|
-
static async connect({
|
|
143
|
-
|
|
166
|
+
static async connect({
|
|
167
|
+
extension,
|
|
168
|
+
constraints,
|
|
169
|
+
audioOnly = false,
|
|
170
|
+
extra,
|
|
171
|
+
room,
|
|
172
|
+
meeting,
|
|
173
|
+
}: Record<string, any>) {
|
|
174
|
+
logger.info('connecting to room', {
|
|
175
|
+
extension,
|
|
176
|
+
audioOnly,
|
|
177
|
+
room: !!room,
|
|
178
|
+
});
|
|
144
179
|
|
|
145
180
|
if (!room) {
|
|
146
|
-
await Wazo.Phone.connect({
|
|
147
|
-
|
|
181
|
+
await Wazo.Phone.connect({
|
|
182
|
+
media: constraints,
|
|
183
|
+
});
|
|
148
184
|
const withCamera = constraints && !!constraints.video;
|
|
149
185
|
|
|
150
186
|
if (withCamera) {
|
|
@@ -152,17 +188,20 @@ class Room extends Emitter {
|
|
|
152
188
|
}
|
|
153
189
|
|
|
154
190
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
155
|
-
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({
|
|
156
|
-
|
|
191
|
+
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({
|
|
192
|
+
data,
|
|
193
|
+
}) => {
|
|
194
|
+
logger.info('room call received via WS', {
|
|
195
|
+
callId: data.call_id,
|
|
196
|
+
});
|
|
197
|
+
|
|
157
198
|
if (room) {
|
|
158
199
|
room.setCallId(data.call_id);
|
|
159
200
|
}
|
|
160
201
|
});
|
|
161
|
-
|
|
162
202
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
163
203
|
// eslint-disable-next-line no-param-reassign
|
|
164
|
-
room = new Room(callSession, extension, null, null, extra);
|
|
165
|
-
|
|
204
|
+
room = new Room(callSession as CallSession, extension, null, null, extra);
|
|
166
205
|
// Wait for the call to be accepted
|
|
167
206
|
await new Promise((resolve, reject) => {
|
|
168
207
|
Wazo.Phone.once(Wazo.Phone.ON_CALL_ACCEPTED, resolve);
|
|
@@ -180,8 +219,7 @@ class Room extends Emitter {
|
|
|
180
219
|
// Retrieve conference sources
|
|
181
220
|
const contacts = await getApiClient().dird.fetchConferenceContacts(sources.items[0]);
|
|
182
221
|
// Retrieve conference
|
|
183
|
-
const conference = contacts
|
|
184
|
-
|
|
222
|
+
const conference = contacts?.find(contact => contact.numbers?.find(number => number.number === extension));
|
|
185
223
|
logger.info('connected to room', {
|
|
186
224
|
sourceId: conference ? conference.sourceId : null,
|
|
187
225
|
name: conference ? conference.name : null,
|
|
@@ -196,7 +234,6 @@ class Room extends Emitter {
|
|
|
196
234
|
uuid: meeting.uuid,
|
|
197
235
|
name: meeting.name,
|
|
198
236
|
});
|
|
199
|
-
|
|
200
237
|
room.setMeetingUuid(meeting.uuid);
|
|
201
238
|
room.setName(meeting.name);
|
|
202
239
|
}
|
|
@@ -206,24 +243,21 @@ class Room extends Emitter {
|
|
|
206
243
|
|
|
207
244
|
static disconnect() {
|
|
208
245
|
logger.info('static disconnection to room');
|
|
209
|
-
|
|
210
246
|
Wazo.Phone.disconnect();
|
|
211
247
|
}
|
|
212
248
|
|
|
213
249
|
async disconnect() {
|
|
214
250
|
logger.info('disconnection to room called');
|
|
215
|
-
|
|
216
|
-
await Wazo.Phone.hangup(this.callSession);
|
|
251
|
+
await Wazo.Phone.hangup(this.callSession as CallSession);
|
|
217
252
|
this.callSession = null;
|
|
218
253
|
this.eventEmitter.emit(this.ON_DISCONNECTED, this);
|
|
219
254
|
this.connected = false;
|
|
220
255
|
this.unbind();
|
|
221
|
-
|
|
222
256
|
Wazo.Phone.off(this.ON_MESSAGE, this._boundOnMessage);
|
|
223
257
|
Wazo.Phone.off(this.ON_CHAT, this._boundOnChat);
|
|
224
258
|
Wazo.Phone.off(this.ON_SIGNAL, this._boundOnSignal);
|
|
225
259
|
Wazo.Phone.off(this.ON_VIDEO_INPUT_CHANGE, this._boundSaveLocalVideoStream);
|
|
226
|
-
Wazo.Phone.phone
|
|
260
|
+
Wazo.Phone.phone?.off(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
227
261
|
Wazo.Websocket.off(this.CONFERENCE_USER_PARTICIPANT_JOINED, this._boundOnParticipantJoined);
|
|
228
262
|
Wazo.Websocket.off(this.CONFERENCE_USER_PARTICIPANT_LEFT, this._boundOnParticipantLeft);
|
|
229
263
|
Wazo.Websocket.off(this.MEETING_USER_PARTICIPANT_JOINED, this._boundOnParticipantJoined);
|
|
@@ -231,19 +265,23 @@ class Room extends Emitter {
|
|
|
231
265
|
}
|
|
232
266
|
|
|
233
267
|
setSourceId(sourceId: number) {
|
|
234
|
-
logger.info('set room source id', {
|
|
235
|
-
|
|
268
|
+
logger.info('set room source id', {
|
|
269
|
+
sourceId,
|
|
270
|
+
});
|
|
236
271
|
this.sourceId = sourceId;
|
|
237
272
|
}
|
|
238
273
|
|
|
239
274
|
setMeetingUuid(meetingUuid: string) {
|
|
240
|
-
logger.info('set meeting uuid', {
|
|
241
|
-
|
|
275
|
+
logger.info('set meeting uuid', {
|
|
276
|
+
meetingUuid,
|
|
277
|
+
});
|
|
242
278
|
this.meetingUuid = meetingUuid;
|
|
243
279
|
}
|
|
244
280
|
|
|
245
281
|
setCallId(callId: string) {
|
|
246
|
-
logger.info('set room call id', {
|
|
282
|
+
logger.info('set room call id', {
|
|
283
|
+
callId,
|
|
284
|
+
});
|
|
247
285
|
|
|
248
286
|
if (callId) {
|
|
249
287
|
this.callId = callId;
|
|
@@ -251,8 +289,9 @@ class Room extends Emitter {
|
|
|
251
289
|
}
|
|
252
290
|
|
|
253
291
|
setName(name: string) {
|
|
254
|
-
logger.info('set room name', {
|
|
255
|
-
|
|
292
|
+
logger.info('set room name', {
|
|
293
|
+
name,
|
|
294
|
+
});
|
|
256
295
|
this.name = name;
|
|
257
296
|
}
|
|
258
297
|
|
|
@@ -269,10 +308,12 @@ class Room extends Emitter {
|
|
|
269
308
|
return Wazo.Phone.sendSignal(content);
|
|
270
309
|
}
|
|
271
310
|
|
|
272
|
-
async startScreenSharing(constraints:
|
|
273
|
-
logger.info('start room screen sharing', {
|
|
311
|
+
async startScreenSharing(constraints: Record<string, any>) {
|
|
312
|
+
logger.info('start room screen sharing', {
|
|
313
|
+
constraints,
|
|
314
|
+
});
|
|
315
|
+
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession as CallSession);
|
|
274
316
|
|
|
275
|
-
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
276
317
|
if (!screensharingStream) {
|
|
277
318
|
console.warn('screensharing stream is null (likely due to user cancellation)');
|
|
278
319
|
return null;
|
|
@@ -283,22 +324,20 @@ class Room extends Emitter {
|
|
|
283
324
|
return screensharingStream;
|
|
284
325
|
}
|
|
285
326
|
|
|
286
|
-
async stopScreenSharing(restoreLocalStream
|
|
327
|
+
async stopScreenSharing(restoreLocalStream = true) {
|
|
287
328
|
logger.info('stop room screen sharing');
|
|
288
|
-
|
|
289
|
-
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
329
|
+
await Wazo.Phone.stopScreenSharing(this.callSession as CallSession, restoreLocalStream);
|
|
290
330
|
|
|
291
331
|
if (this.localParticipant) {
|
|
292
332
|
this._updateLocalParticipantStream();
|
|
293
|
-
|
|
333
|
+
|
|
294
334
|
this.localParticipant.onStopScreensharing();
|
|
295
335
|
}
|
|
296
336
|
}
|
|
297
337
|
|
|
298
338
|
turnCameraOff() {
|
|
299
339
|
logger.info('turn room camera off');
|
|
300
|
-
|
|
301
|
-
Wazo.Phone.turnCameraOff(this.callSession);
|
|
340
|
+
Wazo.Phone.turnCameraOff(this.callSession as CallSession);
|
|
302
341
|
|
|
303
342
|
if (this.localParticipant) {
|
|
304
343
|
this.localParticipant.onVideoMuted();
|
|
@@ -307,8 +346,7 @@ class Room extends Emitter {
|
|
|
307
346
|
|
|
308
347
|
turnCameraOn() {
|
|
309
348
|
logger.info('turn room camera on');
|
|
310
|
-
|
|
311
|
-
Wazo.Phone.turnCameraOn(this.callSession);
|
|
349
|
+
Wazo.Phone.turnCameraOn(this.callSession as CallSession);
|
|
312
350
|
|
|
313
351
|
if (this.localParticipant) {
|
|
314
352
|
this.localParticipant.onVideoUnMuted();
|
|
@@ -317,17 +355,13 @@ class Room extends Emitter {
|
|
|
317
355
|
|
|
318
356
|
mute() {
|
|
319
357
|
logger.info('mute room');
|
|
320
|
-
|
|
321
|
-
Wazo.Phone.mute(this.callSession);
|
|
322
|
-
|
|
358
|
+
Wazo.Phone.mute(this.callSession as CallSession);
|
|
323
359
|
this.sendMuteStatus();
|
|
324
360
|
}
|
|
325
361
|
|
|
326
362
|
unmute() {
|
|
327
363
|
logger.info('unmute room');
|
|
328
|
-
|
|
329
|
-
Wazo.Phone.unmute(this.callSession);
|
|
330
|
-
|
|
364
|
+
Wazo.Phone.unmute(this.callSession as CallSession);
|
|
331
365
|
this.sendUnMuteStatus();
|
|
332
366
|
}
|
|
333
367
|
|
|
@@ -345,8 +379,7 @@ class Room extends Emitter {
|
|
|
345
379
|
|
|
346
380
|
hold() {
|
|
347
381
|
logger.info('hold room');
|
|
348
|
-
|
|
349
|
-
Wazo.Phone.hold(this.callSession, true);
|
|
382
|
+
Wazo.Phone.hold(this.callSession as CallSession);
|
|
350
383
|
|
|
351
384
|
if (this.localParticipant) {
|
|
352
385
|
this.localParticipant.onHold();
|
|
@@ -355,26 +388,23 @@ class Room extends Emitter {
|
|
|
355
388
|
|
|
356
389
|
async resume() {
|
|
357
390
|
logger.info('resume room');
|
|
358
|
-
|
|
359
|
-
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
391
|
+
const newStream = await Wazo.Phone.resume(this.callSession as CallSession);
|
|
360
392
|
|
|
361
393
|
if (this.localParticipant) {
|
|
362
394
|
// Update local participant stream (useful when resuming a shreenshared conference)
|
|
363
395
|
this._updateLocalParticipantStream();
|
|
364
396
|
|
|
365
|
-
// $FlowFixMe
|
|
366
397
|
this.localParticipant.onResume();
|
|
367
398
|
|
|
368
|
-
// $FlowFixMe
|
|
369
399
|
if (!newStream && this.localParticipant.screensharing) {
|
|
370
|
-
// $FlowFixMe
|
|
371
400
|
this.localParticipant.onStopScreensharing();
|
|
372
401
|
}
|
|
373
402
|
}
|
|
374
403
|
}
|
|
375
404
|
|
|
376
405
|
_updateLocalParticipantStream() {
|
|
377
|
-
const localStream = Wazo.Phone.getLocalStream(this.callSession);
|
|
406
|
+
const localStream = Wazo.Phone.getLocalStream(this.callSession as CallSession);
|
|
407
|
+
|
|
378
408
|
if (this.localParticipant && localStream) {
|
|
379
409
|
const localWazoStream = new Wazo.Stream(localStream);
|
|
380
410
|
this.localParticipant.resetStreams([localWazoStream]);
|
|
@@ -382,27 +412,29 @@ class Room extends Emitter {
|
|
|
382
412
|
}
|
|
383
413
|
|
|
384
414
|
sendDTMF(tone: string) {
|
|
385
|
-
logger.info('send room DTMF', {
|
|
386
|
-
|
|
387
|
-
|
|
415
|
+
logger.info('send room DTMF', {
|
|
416
|
+
tone,
|
|
417
|
+
});
|
|
418
|
+
Wazo.Phone.sendDTMF(tone, this.callSession as CallSession);
|
|
388
419
|
}
|
|
389
420
|
|
|
390
|
-
async sendReinvite(newConstraints:
|
|
391
|
-
logger.info('send room reinvite', {
|
|
421
|
+
async sendReinvite(newConstraints: Record<string, any> | null = null) {
|
|
422
|
+
logger.info('send room reinvite', {
|
|
423
|
+
callId: this.callSession ? this.callSession.getId() : null,
|
|
424
|
+
newConstraints,
|
|
425
|
+
});
|
|
392
426
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
393
|
-
|
|
394
427
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
395
428
|
if (Wazo.Phone.phone && Wazo.Phone.phone.currentScreenShare) {
|
|
396
429
|
this._onScreenSharing();
|
|
397
430
|
}
|
|
398
431
|
});
|
|
399
|
-
|
|
400
|
-
const response = await Wazo.Phone.phone.sendReinvite(this.callSession, newConstraints, true);
|
|
432
|
+
const response = await Wazo.Phone.phone?.sendReinvite(this.callSession, newConstraints, true);
|
|
401
433
|
|
|
402
434
|
if (this.localParticipant && newConstraints && newConstraints.video) {
|
|
403
|
-
const localVideoStream = Wazo.Phone.phone
|
|
435
|
+
const localVideoStream = Wazo.Phone.phone?.getLocalVideoStream(this.callSession as CallSession);
|
|
436
|
+
|
|
404
437
|
if (localVideoStream) {
|
|
405
|
-
// $FlowFixMe
|
|
406
438
|
this._associateStreamTo(localVideoStream, this.localParticipant);
|
|
407
439
|
}
|
|
408
440
|
} else if (this.localParticipant && wasScreensharing && newConstraints && !newConstraints.video) {
|
|
@@ -414,53 +446,57 @@ class Room extends Emitter {
|
|
|
414
446
|
}
|
|
415
447
|
|
|
416
448
|
hasALocalVideoTrack() {
|
|
417
|
-
return Wazo.Phone.hasALocalVideoTrack(this.callSession);
|
|
449
|
+
return Wazo.Phone.hasALocalVideoTrack(this.callSession as CallSession);
|
|
418
450
|
}
|
|
419
451
|
|
|
420
452
|
getLocalStream() {
|
|
421
|
-
return Wazo.Phone.getLocalStream(this.callSession);
|
|
453
|
+
return Wazo.Phone.getLocalStream(this.callSession as CallSession);
|
|
422
454
|
}
|
|
423
455
|
|
|
424
456
|
getRemoteStream() {
|
|
425
|
-
return Wazo.Phone.getRemoteStream(this.callSession);
|
|
457
|
+
return Wazo.Phone.getRemoteStream(this.callSession as CallSession);
|
|
426
458
|
}
|
|
427
459
|
|
|
428
460
|
getRemoteVideoStream() {
|
|
429
|
-
return Wazo.Phone.getRemoteVideoStream(this.callSession);
|
|
461
|
+
return Wazo.Phone.getRemoteVideoStream(this.callSession as CallSession);
|
|
430
462
|
}
|
|
431
463
|
|
|
432
464
|
_bindEvents() {
|
|
433
465
|
if (!Wazo.Phone.phone || !Wazo.Phone.phone.currentSipSession) {
|
|
434
466
|
return;
|
|
435
467
|
}
|
|
468
|
+
|
|
436
469
|
// Retrieve mapping
|
|
437
|
-
|
|
470
|
+
// @ts-ignore
|
|
471
|
+
Wazo.Phone.phone.currentSipSession.sessionDescriptionHandler.on('setDescription', ({
|
|
472
|
+
type,
|
|
473
|
+
sdp: rawSdp,
|
|
474
|
+
}: any) => {
|
|
438
475
|
if (type !== 'offer') {
|
|
439
476
|
return;
|
|
440
477
|
}
|
|
441
478
|
|
|
442
479
|
this._mapMsid(rawSdp);
|
|
443
480
|
});
|
|
444
|
-
|
|
445
481
|
// Listen to REINVITE to ba able to map msid after upgrading to video in a audio only conference
|
|
446
482
|
// This allow to map msid with the non parsed (eg without the `stripVideo` modifier) SDP
|
|
447
483
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
448
|
-
|
|
449
484
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
450
485
|
logger.info('on room audio stream');
|
|
451
|
-
|
|
452
486
|
this.audioStream = stream;
|
|
487
|
+
|
|
453
488
|
if (!this.roomAudioElement) {
|
|
454
|
-
const sessionId = Wazo.Phone.phone
|
|
455
|
-
this.roomAudioElement = Wazo.Phone.phone
|
|
489
|
+
const sessionId = Wazo.Phone.phone?.getSipSessionId(Wazo.Phone.phone?.currentSipSession as Inviter | Invitation);
|
|
490
|
+
this.roomAudioElement = Wazo.Phone.phone?.createAudioElementFor(sessionId as string);
|
|
456
491
|
this.roomAudioElement.srcObject = stream;
|
|
457
492
|
} else {
|
|
458
493
|
this.roomAudioElement.srcObject = stream;
|
|
459
494
|
}
|
|
460
495
|
});
|
|
461
|
-
|
|
462
496
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
463
|
-
logger.info('on room video stream', {
|
|
497
|
+
logger.info('on room video stream', {
|
|
498
|
+
streamId,
|
|
499
|
+
});
|
|
464
500
|
|
|
465
501
|
this._mapMsid(sipSession.body.body);
|
|
466
502
|
|
|
@@ -468,17 +504,17 @@ class Room extends Emitter {
|
|
|
468
504
|
this._unassociatedVideoStreams[streamId] = stream;
|
|
469
505
|
|
|
470
506
|
const callId = this._getCallIdFromTrackId(streamId);
|
|
507
|
+
|
|
471
508
|
const participant = callId ? this._getParticipantFromCallId(callId) : null;
|
|
509
|
+
|
|
472
510
|
if (participant) {
|
|
473
511
|
this.__associateStreams(participant);
|
|
474
512
|
}
|
|
475
513
|
});
|
|
476
|
-
|
|
477
514
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
478
515
|
logger.info('on room remove stream');
|
|
516
|
+
const participant = this.participants.find(someParticipant => someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
479
517
|
|
|
480
|
-
const participant = this.participants.find(someParticipant =>
|
|
481
|
-
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
482
518
|
if (!participant) {
|
|
483
519
|
return;
|
|
484
520
|
}
|
|
@@ -497,6 +533,7 @@ class Room extends Emitter {
|
|
|
497
533
|
|
|
498
534
|
_onReinvite(session: any, inviteRequest: any) {
|
|
499
535
|
const body = inviteRequest.body || inviteRequest.message.body;
|
|
536
|
+
|
|
500
537
|
if (body) {
|
|
501
538
|
this._mapMsid(body);
|
|
502
539
|
|
|
@@ -507,19 +544,29 @@ class Room extends Emitter {
|
|
|
507
544
|
}
|
|
508
545
|
}
|
|
509
546
|
|
|
510
|
-
_mapMsid(rawSdp:
|
|
547
|
+
_mapMsid(rawSdp: string) {
|
|
511
548
|
const sdp = sdpParser.parse(rawSdp);
|
|
512
|
-
const labelMsidArray = sdp.media.filter(media => !!media.label).map(({
|
|
549
|
+
const labelMsidArray = sdp.media.filter((media: any) => !!media.label).map(({
|
|
550
|
+
label,
|
|
551
|
+
msid,
|
|
552
|
+
}: any) => ({
|
|
513
553
|
label: String(label),
|
|
514
554
|
streamId: msid.split(' ')[0],
|
|
515
555
|
trackId: msid.split(' ')[1],
|
|
516
556
|
}));
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
557
|
+
labelMsidArray.forEach(({
|
|
558
|
+
label,
|
|
559
|
+
streamId,
|
|
560
|
+
trackId,
|
|
561
|
+
}) => {
|
|
562
|
+
this._callIdStreamIdMap[String(label)] = {
|
|
563
|
+
streamId,
|
|
564
|
+
trackId,
|
|
565
|
+
};
|
|
521
566
|
const callId = String(label);
|
|
567
|
+
|
|
522
568
|
const participant = this._unassociatedParticipants[callId] || this._getParticipantFromCallId(callId);
|
|
569
|
+
|
|
523
570
|
if (participant) {
|
|
524
571
|
this.__associateStreams(participant);
|
|
525
572
|
}
|
|
@@ -529,41 +576,47 @@ class Room extends Emitter {
|
|
|
529
576
|
_transferEvents() {
|
|
530
577
|
Wazo.Websocket.on(this.CONFERENCE_USER_PARTICIPANT_JOINED, this._boundOnParticipantJoined);
|
|
531
578
|
Wazo.Websocket.on(this.CONFERENCE_USER_PARTICIPANT_LEFT, this._boundOnParticipantLeft);
|
|
532
|
-
|
|
533
579
|
Wazo.Websocket.on(this.MEETING_USER_PARTICIPANT_JOINED, this._boundOnParticipantJoined);
|
|
534
580
|
Wazo.Websocket.on(this.MEETING_USER_PARTICIPANT_LEFT, this._boundOnParticipantLeft);
|
|
535
|
-
|
|
536
581
|
// Phone events
|
|
537
582
|
Wazo.Phone.on(this.ON_MESSAGE, this._boundOnMessage);
|
|
538
583
|
Wazo.Phone.on(this.ON_CHAT, this._boundOnChat);
|
|
539
584
|
Wazo.Phone.on(this.ON_SIGNAL, this._boundOnSignal);
|
|
540
585
|
Wazo.Phone.on(this.ON_VIDEO_INPUT_CHANGE, this._boundSaveLocalVideoStream);
|
|
541
|
-
|
|
542
|
-
[this.ON_AUDIO_STREAM, this.ON_VIDEO_STREAM, this.ON_REMOVE_STREAM].forEach(event =>
|
|
543
|
-
Wazo.Phone.on(event, (...args) => this.eventEmitter.emit.apply(this.eventEmitter, [event, ...args])));
|
|
586
|
+
[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])));
|
|
544
587
|
}
|
|
545
588
|
|
|
546
|
-
_onMessage(message: Message):
|
|
589
|
+
_onMessage(message: Message): Record<string, any> | null | undefined {
|
|
590
|
+
// @ts-ignore
|
|
547
591
|
if (message.method !== 'MESSAGE') {
|
|
548
592
|
return null;
|
|
549
593
|
}
|
|
550
|
-
|
|
594
|
+
|
|
595
|
+
let body: any;
|
|
596
|
+
|
|
551
597
|
try {
|
|
598
|
+
// @ts-ignore
|
|
552
599
|
body = JSON.parse(message.body);
|
|
553
|
-
} catch (e) {
|
|
600
|
+
} catch (e: any) {
|
|
554
601
|
return null;
|
|
555
602
|
}
|
|
556
603
|
|
|
557
604
|
switch (body.type) {
|
|
558
|
-
case 'ConfbridgeTalking':
|
|
605
|
+
case 'ConfbridgeTalking':
|
|
606
|
+
{
|
|
559
607
|
// Update participant
|
|
560
608
|
const channel = body.channels[0];
|
|
561
|
-
const {
|
|
609
|
+
const {
|
|
610
|
+
id: callId,
|
|
611
|
+
talking_status: talkingStatus,
|
|
612
|
+
} = channel;
|
|
562
613
|
const isTalking = talkingStatus === 'on';
|
|
563
614
|
const participantIdx = this.participants.findIndex(participant => participant.callId === callId);
|
|
615
|
+
|
|
564
616
|
if (participantIdx === -1) {
|
|
565
617
|
return;
|
|
566
618
|
}
|
|
619
|
+
|
|
567
620
|
this.participants[participantIdx].onTalking(isTalking);
|
|
568
621
|
break;
|
|
569
622
|
}
|
|
@@ -572,33 +625,44 @@ class Room extends Emitter {
|
|
|
572
625
|
}
|
|
573
626
|
|
|
574
627
|
this.eventEmitter.emit(this.ON_MESSAGE, body);
|
|
575
|
-
|
|
576
628
|
return body;
|
|
577
629
|
}
|
|
578
630
|
|
|
579
|
-
_onChat(content:
|
|
631
|
+
_onChat(content: Record<string, any>) {
|
|
580
632
|
this.eventEmitter.emit(this.ON_CHAT, content);
|
|
581
633
|
}
|
|
582
634
|
|
|
583
|
-
_onSignal(content:
|
|
584
|
-
const {
|
|
635
|
+
_onSignal(content: Record<string, any>) {
|
|
636
|
+
const {
|
|
637
|
+
type,
|
|
638
|
+
} = content;
|
|
585
639
|
|
|
586
640
|
switch (type) {
|
|
587
641
|
// we're receiving a external update
|
|
588
|
-
case SIGNAL_TYPE_PARTICIPANT_UPDATE:
|
|
589
|
-
|
|
590
|
-
const
|
|
642
|
+
case SIGNAL_TYPE_PARTICIPANT_UPDATE:
|
|
643
|
+
{
|
|
644
|
+
const {
|
|
645
|
+
status,
|
|
646
|
+
} = content;
|
|
647
|
+
|
|
648
|
+
const participant: Participant | null | undefined = this._getParticipantFromCallId(status.callId);
|
|
591
649
|
|
|
592
650
|
if (participant) {
|
|
593
651
|
// we're receiving, so no need to broadcast
|
|
594
652
|
participant.updateStatus(status, false);
|
|
595
653
|
}
|
|
654
|
+
|
|
596
655
|
break;
|
|
597
656
|
}
|
|
598
657
|
|
|
599
658
|
// this is a request to broadcast our current status
|
|
600
|
-
case SIGNAL_TYPE_PARTICIPANT_REQUEST:
|
|
601
|
-
|
|
659
|
+
case SIGNAL_TYPE_PARTICIPANT_REQUEST:
|
|
660
|
+
{
|
|
661
|
+
const {
|
|
662
|
+
callId,
|
|
663
|
+
origin,
|
|
664
|
+
} = content;
|
|
665
|
+
|
|
602
666
|
// callId is null, someone's requesting everyone's state;
|
|
603
667
|
// or callId is set and matches ours;
|
|
604
668
|
if (this.localParticipant && (!callId || callId === this.localParticipant.callId)) {
|
|
@@ -606,18 +670,27 @@ class Room extends Emitter {
|
|
|
606
670
|
}
|
|
607
671
|
|
|
608
672
|
// might as well update the requester's status
|
|
609
|
-
const requester:
|
|
673
|
+
const requester: Participant | null | undefined = this._getParticipantFromCallId(origin.callId);
|
|
674
|
+
|
|
610
675
|
if (requester) {
|
|
611
676
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
612
|
-
logger.info('trigger room requester status', {
|
|
677
|
+
logger.info('trigger room requester status', {
|
|
678
|
+
origin,
|
|
679
|
+
});
|
|
613
680
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
614
681
|
}
|
|
682
|
+
|
|
615
683
|
break;
|
|
616
684
|
}
|
|
617
685
|
|
|
618
|
-
case Wazo.Phone.ON_MESSAGE_TRACK_UPDATED:
|
|
619
|
-
|
|
686
|
+
case Wazo.Phone.ON_MESSAGE_TRACK_UPDATED:
|
|
687
|
+
{
|
|
688
|
+
const {
|
|
689
|
+
callId,
|
|
690
|
+
update,
|
|
691
|
+
} = content;
|
|
620
692
|
const participantIdx = this.participants.findIndex(p => p.callId === callId);
|
|
693
|
+
|
|
621
694
|
if (participantIdx !== -1) {
|
|
622
695
|
this.participants[participantIdx] = this._onParticipantTrackUpdate(this.participants[participantIdx], update);
|
|
623
696
|
}
|
|
@@ -625,7 +698,8 @@ class Room extends Emitter {
|
|
|
625
698
|
break;
|
|
626
699
|
}
|
|
627
700
|
|
|
628
|
-
default:
|
|
701
|
+
default:
|
|
702
|
+
{
|
|
629
703
|
console.warn('uncaught signal', content);
|
|
630
704
|
}
|
|
631
705
|
}
|
|
@@ -633,61 +707,65 @@ class Room extends Emitter {
|
|
|
633
707
|
this.eventEmitter.emit(Wazo.Phone.ON_SIGNAL, content);
|
|
634
708
|
}
|
|
635
709
|
|
|
636
|
-
async _onParticipantJoined(payload:
|
|
710
|
+
async _onParticipantJoined(payload: Record<string, any>) {
|
|
637
711
|
const participant = payload.data;
|
|
638
712
|
const session = Wazo.Auth.getSession();
|
|
639
|
-
let participants = [];
|
|
713
|
+
let participants: Participant[] = [];
|
|
640
714
|
|
|
641
715
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
642
|
-
if (participant.user_uuid === session
|
|
716
|
+
if (participant.user_uuid === session?.uuid) {
|
|
643
717
|
logger.info('room current user joined');
|
|
644
|
-
|
|
645
718
|
// Retrieve participants via an API calls
|
|
646
719
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
647
720
|
let response;
|
|
721
|
+
|
|
648
722
|
try {
|
|
649
723
|
if (this.meetingUuid) {
|
|
650
|
-
logger.info('fetching meeting participants', {
|
|
724
|
+
logger.info('fetching meeting participants', {
|
|
725
|
+
meetingUuid: this.meetingUuid,
|
|
726
|
+
});
|
|
651
727
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
652
728
|
} else {
|
|
653
|
-
logger.info('fetching conference participants', {
|
|
729
|
+
logger.info('fetching conference participants', {
|
|
730
|
+
conferenceId,
|
|
731
|
+
});
|
|
654
732
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
655
733
|
}
|
|
656
|
-
} catch (e) {
|
|
734
|
+
} catch (e: any) {
|
|
657
735
|
logger.error('room participants fetching, error', e);
|
|
658
736
|
}
|
|
737
|
+
|
|
659
738
|
if (response) {
|
|
660
|
-
logger.info('conference participants fetched', {
|
|
661
|
-
|
|
739
|
+
logger.info('conference participants fetched', {
|
|
740
|
+
nb: response.items.length,
|
|
741
|
+
});
|
|
742
|
+
participants = response.items.map((item: RawParticipant) => {
|
|
662
743
|
const isMe = item.call_id === this.callId;
|
|
663
|
-
|
|
664
|
-
return isMe && item.call_id
|
|
665
|
-
? new Wazo.LocalParticipant(this, item, this.extra)
|
|
666
|
-
: new Wazo.RemoteParticipant(this, item);
|
|
744
|
+
return isMe && item.call_id ? new Wazo.LocalParticipant(this, item, this.extra) : new Wazo.RemoteParticipant(this, item);
|
|
667
745
|
});
|
|
668
|
-
|
|
669
746
|
this.participants = participants;
|
|
747
|
+
const localParticipant = participants.find((someParticipant: any) => someParticipant instanceof Wazo.LocalParticipant);
|
|
670
748
|
|
|
671
|
-
const localParticipant = participants.find(someParticipant => someParticipant instanceof Wazo.LocalParticipant);
|
|
672
749
|
if (!this.localParticipant && localParticipant) {
|
|
673
750
|
this._onLocalParticipantJoined(localParticipant);
|
|
674
751
|
}
|
|
675
752
|
|
|
676
|
-
participants.forEach(someParticipant => this._isParticipantJoining(someParticipant));
|
|
753
|
+
participants.forEach((someParticipant: Participant) => this._isParticipantJoining(someParticipant));
|
|
677
754
|
this.eventEmitter.emit(this.ON_JOINED, localParticipant, participants);
|
|
678
755
|
}
|
|
679
756
|
|
|
680
757
|
return this.participants;
|
|
681
758
|
}
|
|
682
759
|
|
|
683
|
-
const remoteParticipant:
|
|
684
|
-
|
|
685
|
-
:
|
|
686
|
-
|
|
687
|
-
|
|
760
|
+
const remoteParticipant: RemoteParticipant | null | undefined = !this.participants.some(p => p.callId === participant.call_id) ? new Wazo.RemoteParticipant(this, participant) : null;
|
|
761
|
+
logger.info('other room user joined', {
|
|
762
|
+
callId: participant.call_id,
|
|
763
|
+
remoteParticipant: !!remoteParticipant,
|
|
764
|
+
});
|
|
688
765
|
|
|
689
766
|
if (remoteParticipant) {
|
|
690
767
|
this.participants.push(remoteParticipant);
|
|
768
|
+
|
|
691
769
|
this._isParticipantJoining(remoteParticipant);
|
|
692
770
|
}
|
|
693
771
|
|
|
@@ -698,12 +776,12 @@ class Room extends Emitter {
|
|
|
698
776
|
this.localParticipant = localParticipant;
|
|
699
777
|
|
|
700
778
|
const localVideoStream = this._getLocalVideoStream();
|
|
779
|
+
|
|
701
780
|
if (localVideoStream) {
|
|
702
781
|
this._saveLocalVideoStream(localVideoStream);
|
|
703
782
|
}
|
|
704
783
|
|
|
705
784
|
this.connected = true;
|
|
706
|
-
|
|
707
785
|
localParticipant.broadcastStatus(null, true);
|
|
708
786
|
|
|
709
787
|
// we're in the room, now let's request everyone's status
|
|
@@ -717,6 +795,7 @@ class Room extends Emitter {
|
|
|
717
795
|
|
|
718
796
|
_isParticipantJoining(participant: Participant) {
|
|
719
797
|
this.__associateStreams(participant);
|
|
798
|
+
|
|
720
799
|
// @VALIDATE: no need to publicize ourselves, no?
|
|
721
800
|
if (participant instanceof RemoteParticipant) {
|
|
722
801
|
this.eventEmitter.emit(this.CONFERENCE_USER_PARTICIPANT_JOINED, participant);
|
|
@@ -724,7 +803,9 @@ class Room extends Emitter {
|
|
|
724
803
|
}
|
|
725
804
|
|
|
726
805
|
_saveLocalVideoStream(stream: MediaStream) {
|
|
727
|
-
const {
|
|
806
|
+
const {
|
|
807
|
+
localParticipant,
|
|
808
|
+
} = this;
|
|
728
809
|
|
|
729
810
|
if (!localParticipant) {
|
|
730
811
|
return;
|
|
@@ -740,33 +821,32 @@ class Room extends Emitter {
|
|
|
740
821
|
return videoStream;
|
|
741
822
|
}
|
|
742
823
|
|
|
743
|
-
_onParticipantLeft(payload:
|
|
744
|
-
const leftParticipant = this.participants.find(participant =>
|
|
745
|
-
participant && participant.callId === payload.data.call_id);
|
|
824
|
+
_onParticipantLeft(payload: Record<string, any>) {
|
|
825
|
+
const leftParticipant = this.participants.find(participant => participant && participant.callId === payload.data.call_id);
|
|
746
826
|
|
|
747
827
|
// Trigger Participant.ON_DISCONNECT event
|
|
748
828
|
if (leftParticipant) {
|
|
749
829
|
leftParticipant.onDisconnect();
|
|
750
830
|
}
|
|
751
831
|
|
|
752
|
-
this.participants = this.participants.filter(participant =>
|
|
753
|
-
participant && participant.callId !== payload.data.call_id);
|
|
832
|
+
this.participants = this.participants.filter(participant => participant && participant.callId !== payload.data.call_id);
|
|
754
833
|
this.eventEmitter.emit(this.CONFERENCE_USER_PARTICIPANT_LEFT, leftParticipant);
|
|
755
834
|
}
|
|
756
835
|
|
|
757
836
|
_onParticipantTrackUpdate(oldParticipant: Participant, update: string): Participant {
|
|
758
837
|
const newParticipant = oldParticipant;
|
|
759
|
-
|
|
760
|
-
|
|
838
|
+
const {
|
|
839
|
+
trackId,
|
|
840
|
+
streamId,
|
|
841
|
+
} = this._callIdStreamIdMap[newParticipant.callId] || {};
|
|
842
|
+
// @ts-ignore
|
|
761
843
|
const pc = Wazo.Phone.phone.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
762
844
|
// Can't use `getReceivers` here because on FF we make the mapping based on the streamId
|
|
763
|
-
const stream = pc.getRemoteStreams().find(someStream =>
|
|
764
|
-
someStream.id === streamId || someStream.getTracks().some(track => track.id === trackId));
|
|
845
|
+
const stream = pc.getRemoteStreams().find((someStream: any) => someStream.id === streamId || someStream.getTracks().some((track: any) => track.id === trackId));
|
|
765
846
|
|
|
766
847
|
if (update === 'downgrade') {
|
|
767
848
|
newParticipant.resetStreams([]);
|
|
768
849
|
newParticipant.onStreamUnSubscribed(stream);
|
|
769
|
-
|
|
770
850
|
return newParticipant;
|
|
771
851
|
}
|
|
772
852
|
|
|
@@ -780,18 +860,23 @@ class Room extends Emitter {
|
|
|
780
860
|
|
|
781
861
|
// Associate audio/video streams to the participant and triggers events on it
|
|
782
862
|
__associateStreams(participant: Participant) {
|
|
783
|
-
const {
|
|
863
|
+
const {
|
|
864
|
+
trackId,
|
|
865
|
+
} = this._callIdStreamIdMap[participant.callId] || {};
|
|
866
|
+
|
|
784
867
|
if (!trackId) {
|
|
785
868
|
this._unassociatedParticipants[participant.callId] = participant;
|
|
786
|
-
|
|
787
869
|
return;
|
|
788
870
|
}
|
|
871
|
+
|
|
789
872
|
if (!trackId || !participant || !this.localParticipant || participant.callId === this.localParticipant.callId) {
|
|
790
873
|
return;
|
|
791
874
|
}
|
|
792
875
|
|
|
793
876
|
const streamId = this._getStreamIdFrTrackId(trackId);
|
|
794
|
-
|
|
877
|
+
|
|
878
|
+
const key: any = this._getUnassociatedMapIdFromTrackIdOrStreamId(trackId, streamId);
|
|
879
|
+
|
|
795
880
|
const stream = this._unassociatedVideoStreams[key];
|
|
796
881
|
|
|
797
882
|
if (stream) {
|
|
@@ -803,7 +888,7 @@ class Room extends Emitter {
|
|
|
803
888
|
}
|
|
804
889
|
}
|
|
805
890
|
|
|
806
|
-
_getUnassociatedMapIdFromTrackIdOrStreamId(trackId: string, streamId:
|
|
891
|
+
_getUnassociatedMapIdFromTrackIdOrStreamId(trackId: string, streamId: string | null | undefined) {
|
|
807
892
|
// Find by trackId
|
|
808
893
|
if (trackId in this._unassociatedVideoStreams) {
|
|
809
894
|
return trackId;
|
|
@@ -815,14 +900,12 @@ class Room extends Emitter {
|
|
|
815
900
|
}
|
|
816
901
|
|
|
817
902
|
// Find in all the streams by streamId (used on FF where we can't map by trackId)
|
|
818
|
-
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream:
|
|
819
|
-
stream && stream.id === streamId);
|
|
903
|
+
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream: Record<string, any>) => stream && stream.id === streamId);
|
|
820
904
|
return idx === -1 ? null : Object.keys(this._unassociatedVideoStreams)[idx];
|
|
821
905
|
}
|
|
822
906
|
|
|
823
907
|
_getStreamIdFrTrackId(trackId: string) {
|
|
824
|
-
const mapping:
|
|
825
|
-
|
|
908
|
+
const mapping: Record<string, any> = Object.values(this._callIdStreamIdMap).find((map: Record<string, any>) => map.trackId === trackId);
|
|
826
909
|
return mapping ? mapping.streamId : null;
|
|
827
910
|
}
|
|
828
911
|
|
|
@@ -830,7 +913,6 @@ class Room extends Emitter {
|
|
|
830
913
|
const stream = new Wazo.Stream(rawStream, participant);
|
|
831
914
|
participant.streams.push(stream);
|
|
832
915
|
participant.videoStreams.push(stream);
|
|
833
|
-
|
|
834
916
|
participant.onStreamSubscribed(stream);
|
|
835
917
|
}
|
|
836
918
|
|
|
@@ -843,8 +925,9 @@ class Room extends Emitter {
|
|
|
843
925
|
}
|
|
844
926
|
|
|
845
927
|
_getLocalVideoStream() {
|
|
846
|
-
return Wazo.Phone.getLocalVideoStream(this.callSession);
|
|
928
|
+
return Wazo.Phone.getLocalVideoStream(this.callSession as CallSession);
|
|
847
929
|
}
|
|
930
|
+
|
|
848
931
|
}
|
|
849
932
|
|
|
850
933
|
export default Room;
|