@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,916 +1,432 @@
|
|
|
1
|
+
/* global RTCSessionDescriptionInit, navigator */
|
|
1
2
|
import EventEmitter from 'events';
|
|
2
3
|
import { SessionDescriptionHandler } from 'sip.js/lib/platform/web/session-description-handler/session-description-handler';
|
|
3
|
-
import '
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/* */
|
|
13
|
-
|
|
14
|
-
IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
15
|
-
|
|
16
|
-
// Use a function here to be able to mock it in tests
|
|
17
|
-
const realFetch = () => {
|
|
18
|
-
if (typeof document !== 'undefined' && window.fetch) {
|
|
19
|
-
// Browser
|
|
20
|
-
return window.fetch;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (isMobile()) {
|
|
24
|
-
// React native
|
|
25
|
-
return fetch;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// nodejs
|
|
29
|
-
// this package is disable for react-native in package.json because it requires nodejs modules
|
|
30
|
-
// Used to trick the optimizer to avoid requiring `node-fetch/lib/index` directly
|
|
31
|
-
// It causes to require it on browsers when delivered by a nodejs engine (cf: vitejs).
|
|
32
|
-
try {
|
|
33
|
-
// $FlowFixMe
|
|
34
|
-
return require(Math.random() >= 0 ? 'node-fetch/lib/index' : '');
|
|
35
|
-
} catch (e) {
|
|
36
|
-
return fetch;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/* global window */
|
|
41
|
-
|
|
42
|
-
const TRACE = 'trace';
|
|
43
|
-
const DEBUG = 'debug';
|
|
44
|
-
const INFO = 'info';
|
|
45
|
-
const LOG = 'log';
|
|
46
|
-
const WARN = 'warn';
|
|
47
|
-
const ERROR = 'error';
|
|
48
|
-
const CONSOLE_METHODS = [INFO, LOG, WARN, ERROR];
|
|
49
|
-
const LOG_LEVELS = [TRACE, DEBUG, INFO, LOG, WARN, ERROR];
|
|
50
|
-
const CATEGORY_PREFIX = 'logger-category=';
|
|
51
|
-
|
|
52
|
-
const MAX_REMOTE_RETRY = 100;
|
|
53
|
-
|
|
54
|
-
const addLevelsTo = (instance , withMethods = false) => {
|
|
55
|
-
instance.TRACE = TRACE;
|
|
56
|
-
instance.DEBUG = DEBUG;
|
|
57
|
-
instance.INFO = INFO;
|
|
58
|
-
instance.LOG = LOG;
|
|
59
|
-
instance.WARN = WARN;
|
|
60
|
-
instance.ERROR = ERROR;
|
|
61
|
-
|
|
62
|
-
if (withMethods) {
|
|
63
|
-
instance.trace = (...args) => instance.apply(null, [TRACE, ...args]);
|
|
64
|
-
instance.debug = (...args) => instance.apply(null, [DEBUG, ...args]);
|
|
65
|
-
instance.info = (...args) => instance.apply(null, [INFO, ...args]);
|
|
66
|
-
instance.log = (...args) => instance.apply(null, [LOG, ...args]);
|
|
67
|
-
instance.warn = (...args) => instance.apply(null, [WARN, ...args]);
|
|
68
|
-
instance.error = (...args) => instance.apply(null, [ERROR, ...args]);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return instance;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const safeStringify = (object ) => {
|
|
75
|
-
const result = '{"message": "Not parsable JSON"}';
|
|
76
|
-
try {
|
|
77
|
-
return JSON.stringify(object);
|
|
78
|
-
} catch (e) {
|
|
79
|
-
// Nothing to do
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return result;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
class IssueReporter {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
constructor() {
|
|
103
|
-
addLevelsTo(this);
|
|
104
|
-
|
|
105
|
-
this.oldConsoleMethods = null;
|
|
106
|
-
this.enabled = false;
|
|
107
|
-
this.remoteClientConfiguration = null;
|
|
108
|
-
this.buffer = [];
|
|
109
|
-
this.bufferTimeout = null;
|
|
110
|
-
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
111
|
-
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
112
|
-
this._callback = null;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
init() {
|
|
116
|
-
this._catchConsole();
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
setCallback(cb ) {
|
|
120
|
-
this._callback = cb;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
124
|
-
this.remoteClientConfiguration = configuration;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
enable() {
|
|
128
|
-
if (!this.oldConsoleMethods) {
|
|
129
|
-
this.init();
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
this.enabled = true;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
disable() {
|
|
136
|
-
this.enabled = false;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
loggerFor(category ) {
|
|
140
|
-
const logger = (level , ...args ) => {
|
|
141
|
-
this.log.apply(this, [level, this._makeCategory(category), ...args]);
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
return addLevelsTo(logger, true);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
removeSlashes(str ) {
|
|
148
|
-
return str.replace(/"/g, "'").replace(/\\/g, '');
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
log(level , ...args ) {
|
|
152
|
-
if (!this.enabled) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// Handle category label
|
|
157
|
-
let category = null;
|
|
158
|
-
let skipSendToRemote = false;
|
|
159
|
-
let extra = {};
|
|
160
|
-
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
161
|
-
category = args[0].split('=')[1];
|
|
162
|
-
// eslint-disable-next-line no-param-reassign
|
|
163
|
-
args.splice(0, 1);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// Handle extra data as object for the last argument
|
|
167
|
-
const lastArg = args[args.length - 1];
|
|
168
|
-
if (lastArg && ((typeof lastArg === 'object' && Object.keys(lastArg).length) || lastArg instanceof Error)) {
|
|
169
|
-
if (lastArg instanceof Error) {
|
|
170
|
-
extra = {
|
|
171
|
-
errorMessage: lastArg.message,
|
|
172
|
-
errorStack: lastArg.stack,
|
|
173
|
-
errorType: lastArg.constructor.name,
|
|
174
|
-
skipSendToRemote: lastArg.skipSendToRemote,
|
|
175
|
-
};
|
|
176
|
-
} else {
|
|
177
|
-
extra = lastArg;
|
|
178
|
-
}
|
|
179
|
-
// eslint-disable-next-line no-param-reassign
|
|
180
|
-
args.splice(1, 1);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (extra.skipSendToRemote) {
|
|
184
|
-
skipSendToRemote = true;
|
|
185
|
-
delete extra.skipSendToRemote;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
189
|
-
const message = args.join(', ');
|
|
190
|
-
let consoleMessage = message;
|
|
191
|
-
|
|
192
|
-
if (Object.keys(extra).length) {
|
|
193
|
-
const parsedExtra = safeStringify(extra);
|
|
194
|
-
consoleMessage = `${consoleMessage} (${parsedExtra})`;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if (category) {
|
|
198
|
-
consoleMessage = `[${category}] ${consoleMessage}`;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// Log the message in the console anyway (but don't console.error on mobile)
|
|
202
|
-
const consoleLevel = isMobile() && level === 'error' ? WARN : level;
|
|
203
|
-
|
|
204
|
-
// eslint-disable-next-line
|
|
205
|
-
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
206
|
-
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
207
|
-
|
|
208
|
-
if (this._callback) {
|
|
209
|
-
this._callback(level, consoleMessage);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
if (!skipSendToRemote) {
|
|
213
|
-
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
4
|
+
import IssueReporter from '../service/IssueReporter';
|
|
5
|
+
import { addIcesInAllBundles, fixSdp, parseCandidate } from '../utils/sdp';
|
|
6
|
+
const wazoLogger = IssueReporter ? IssueReporter.loggerFor('webrtc-sdh') : console;
|
|
7
|
+
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
8
|
+
export const wazoMediaStreamFactory = (constraints) => {
|
|
9
|
+
// @see sip.js/lib/platform/web/session-description-handler/media-stream-factory-default
|
|
10
|
+
if (!constraints.audio && !constraints.video) {
|
|
11
|
+
return Promise.resolve(new MediaStream());
|
|
214
12
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
logRequest(url , options , response , start ) {
|
|
218
|
-
if (!this.enabled) {
|
|
219
|
-
return;
|
|
13
|
+
if (navigator.mediaDevices === undefined) {
|
|
14
|
+
return Promise.reject(new Error('Media devices not available in insecure contexts.'));
|
|
220
15
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
let level = TRACE;
|
|
225
|
-
if (status >= 400 && status < 500) {
|
|
226
|
-
level = WARN;
|
|
227
|
-
} else if (status >= 500) {
|
|
228
|
-
level = ERROR;
|
|
16
|
+
// We have to make a `getUserMedia` on desktop but a `getDisplayMedia` in browsers when screensharing
|
|
17
|
+
if (constraints.screen && !constraints.desktop) {
|
|
18
|
+
return navigator.mediaDevices.getDisplayMedia.call(navigator.mediaDevices, constraints);
|
|
229
19
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
getReport() {
|
|
252
|
-
return this.getParsedLogs().join('\r\n');
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
_catchConsole() {
|
|
256
|
-
this.oldConsoleMethods = {};
|
|
257
|
-
CONSOLE_METHODS.forEach((methodName ) => {
|
|
258
|
-
// eslint-disable-next-line
|
|
259
|
-
this.oldConsoleMethods[methodName] = console[methodName];
|
|
260
|
-
window.console[methodName] = (...args) => {
|
|
261
|
-
// Store message
|
|
20
|
+
return navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices, constraints);
|
|
21
|
+
};
|
|
22
|
+
class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
23
|
+
gatheredCandidates;
|
|
24
|
+
eventEmitter;
|
|
25
|
+
isWeb;
|
|
26
|
+
session;
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/default-param-last
|
|
28
|
+
constructor(logger, mediaStreamFactory, sessionDescriptionHandlerConfiguration, isWeb, session) {
|
|
29
|
+
super(logger, mediaStreamFactory, sessionDescriptionHandlerConfiguration);
|
|
30
|
+
this.eventEmitter = new EventEmitter();
|
|
31
|
+
this.isWeb = isWeb;
|
|
32
|
+
this.session = session;
|
|
33
|
+
}
|
|
34
|
+
on(event, callback) {
|
|
35
|
+
this.eventEmitter.on(event, callback);
|
|
36
|
+
}
|
|
37
|
+
off(event, callback) {
|
|
38
|
+
this.eventEmitter.removeListener(event, callback);
|
|
39
|
+
}
|
|
40
|
+
setRemoteSessionDescription(sessionDescription) {
|
|
262
41
|
try {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
} catch (e) {
|
|
267
|
-
// Avoid circular structure issues
|
|
42
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
43
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
44
|
+
return result;
|
|
268
45
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
_sendToRemoteLogger(level , payload = {}) {
|
|
274
|
-
if (!this.remoteClientConfiguration) {
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
const { level: minLevel, bufferSize } = this.remoteClientConfiguration;
|
|
279
|
-
if (!minLevel || this._isLevelAbove(minLevel, level)) {
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
payload.level = level;
|
|
284
|
-
|
|
285
|
-
if (bufferSize > 0) {
|
|
286
|
-
return this._addToBuffer(payload);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
this._sendDebugToGrafana(payload);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
_parseLoggerBody(payload ) {
|
|
293
|
-
const { level } = payload;
|
|
294
|
-
const { maxMessageSize, extra } = this.remoteClientConfiguration || {};
|
|
295
|
-
|
|
296
|
-
delete payload.level;
|
|
297
|
-
|
|
298
|
-
if (maxMessageSize && typeof payload.message === 'string' && payload.message.length > maxMessageSize) {
|
|
299
|
-
payload.message = `${payload.message.substr(0, maxMessageSize)}...`;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
return safeStringify({
|
|
303
|
-
level,
|
|
304
|
-
...payload,
|
|
305
|
-
...extra,
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
_addToBuffer(payload ) {
|
|
310
|
-
// Reset buffer timer
|
|
311
|
-
if (this.bufferTimeout) {
|
|
312
|
-
clearTimeout(this.bufferTimeout);
|
|
313
|
-
this.bufferTimeout = null;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
this.buffer.push(payload);
|
|
317
|
-
|
|
318
|
-
// $FlowFixMe
|
|
319
|
-
const { bufferSize, bufferTimeout } = this.remoteClientConfiguration;
|
|
320
|
-
|
|
321
|
-
if (this.buffer.length > bufferSize) {
|
|
322
|
-
return this._processBuffer();
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
if (bufferTimeout > 0) {
|
|
326
|
-
this.bufferTimeout = setTimeout(this._boundProcessBuffer, bufferTimeout);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
_processBuffer() {
|
|
331
|
-
this._sendDebugToGrafana(this.buffer);
|
|
332
|
-
|
|
333
|
-
this.buffer = [];
|
|
334
|
-
if (this.bufferTimeout) {
|
|
335
|
-
clearTimeout(this.bufferTimeout);
|
|
336
|
-
this.bufferTimeout = null;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
_sendDebugToGrafana(payload , retry = 0) {
|
|
341
|
-
if (!this.remoteClientConfiguration || retry >= MAX_REMOTE_RETRY) {
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
const { tag, host, port } = this.remoteClientConfiguration;
|
|
346
|
-
const isArray = Array.isArray(payload);
|
|
347
|
-
const isSecure = +port === 443;
|
|
348
|
-
const url = `http${isSecure ? 's' : ''}://${host}${isSecure ? '' : `:${port}`}/${tag}`;
|
|
349
|
-
const body = isArray ? `[${payload.map(this._boundParseLoggerBody).join(',')}]` : this._parseLoggerBody(payload);
|
|
350
|
-
|
|
351
|
-
realFetch()(url, {
|
|
352
|
-
method: 'POST',
|
|
353
|
-
headers: {
|
|
354
|
-
Accept: 'application/json',
|
|
355
|
-
'Content-Type': 'application/json',
|
|
356
|
-
},
|
|
357
|
-
// $FlowFixMe
|
|
358
|
-
body,
|
|
359
|
-
}).catch((e ) => {
|
|
360
|
-
// $FlowFixMe
|
|
361
|
-
e.skipSendToRemote = true;
|
|
362
|
-
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
363
|
-
|
|
364
|
-
setTimeout(() => {
|
|
365
|
-
if (isArray) {
|
|
366
|
-
payload = payload.map(message => this._writeRetryCount(message, retry + 1));
|
|
367
|
-
} else if (payload && typeof payload === 'object') {
|
|
368
|
-
payload = this._writeRetryCount(payload, retry + 1);
|
|
46
|
+
catch (error) {
|
|
47
|
+
this.logger.error(`SessionDescriptionHandler.setRemoteSessionDescription: ${error}`);
|
|
48
|
+
throw error;
|
|
369
49
|
}
|
|
370
|
-
|
|
371
|
-
this._sendDebugToGrafana(payload, retry + 1);
|
|
372
|
-
}, 5000 + retry * 1000);
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
_writeRetryCount(message , count ) {
|
|
377
|
-
if (message && typeof message === 'object') {
|
|
378
|
-
// $FlowFixMe
|
|
379
|
-
message._retry = count;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
return message;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
_isLevelAbove(level1 , level2 ) {
|
|
386
|
-
const index1 = LOG_LEVELS.indexOf(level1);
|
|
387
|
-
const index2 = LOG_LEVELS.indexOf(level2);
|
|
388
|
-
if (index1 === -1 || index2 === -1) {
|
|
389
|
-
return false;
|
|
390
50
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
return `${CATEGORY_PREFIX}${category}`;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
var IssueReporter$1 = new IssueReporter();
|
|
401
|
-
|
|
402
|
-
/* */
|
|
403
|
-
|
|
404
|
-
const parseCandidate = (candidate ) => {
|
|
405
|
-
if (!candidate) {
|
|
406
|
-
return null;
|
|
407
|
-
}
|
|
408
|
-
const result = sdpParser.parse(candidate.indexOf('a=') === 0 ? candidate : `a=${candidate}`);
|
|
409
|
-
|
|
410
|
-
return result.candidates ? result.candidates[0] : null;
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
const getSrflxOrRelay = (candidates ) =>
|
|
414
|
-
candidates
|
|
415
|
-
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
416
|
-
|
|
417
|
-
const fixSdp = (sdp , candidates , forcePort = true) => {
|
|
418
|
-
const parsedSdp = sdpParser.parse(sdp);
|
|
419
|
-
const mainCandidate = getSrflxOrRelay(candidates)[0];
|
|
420
|
-
const ip = mainCandidate ? mainCandidate.ip : null;
|
|
421
|
-
|
|
422
|
-
if (ip) {
|
|
423
|
-
parsedSdp.origin.address = ip;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
parsedSdp.media = parsedSdp.media.map(media => {
|
|
427
|
-
const port = forcePort ? (mainCandidate ? mainCandidate.port : media.port) : media.port;
|
|
428
|
-
return {
|
|
429
|
-
...media,
|
|
430
|
-
port,
|
|
431
|
-
candidates: (media.candidates || []).concat(candidates),
|
|
432
|
-
direction: port < 10 ? 'inactive' : media.direction,
|
|
433
|
-
};
|
|
434
|
-
});
|
|
435
|
-
|
|
436
|
-
let fixed = sdpParser.write(parsedSdp);
|
|
437
|
-
|
|
438
|
-
if (ip) {
|
|
439
|
-
fixed = fixed.replace(/IN IP4 0.0.0.0/g, `IN IP4 ${ip}`);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
return fixed;
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
const addIcesInAllBundles = (sdp ) => {
|
|
446
|
-
const parsedSdp = sdpParser.parse(sdp);
|
|
447
|
-
|
|
448
|
-
const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
|
|
449
|
-
if (!mediaWithCandidate) {
|
|
450
|
-
return sdp;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
const { candidates } = mediaWithCandidate;
|
|
454
|
-
|
|
455
|
-
parsedSdp.media = parsedSdp.media.map(media => ({
|
|
456
|
-
...media,
|
|
457
|
-
candidates: media.candidates || candidates,
|
|
458
|
-
}));
|
|
459
|
-
|
|
460
|
-
return sdpParser.write(parsedSdp);
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
/* global RTCSessionDescriptionInit, navigator */
|
|
464
|
-
|
|
465
|
-
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
466
|
-
|
|
467
|
-
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
468
|
-
const wazoMediaStreamFactory = (constraints ) => {
|
|
469
|
-
// @see sip.js/lib/platform/web/session-description-handler/media-stream-factory-default
|
|
470
|
-
if (!constraints.audio && !constraints.video) {
|
|
471
|
-
return Promise.resolve(new MediaStream());
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
if (navigator.mediaDevices === undefined) {
|
|
475
|
-
return Promise.reject(new Error('Media devices not available in insecure contexts.'));
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
// We have to make a `getUserMedia` on desktop but a `getDisplayMedia` in browsers when screensharing
|
|
479
|
-
if (constraints.screen && !constraints.desktop) {
|
|
480
|
-
return navigator.mediaDevices.getDisplayMedia.call(navigator.mediaDevices, constraints);
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
return navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices, constraints);
|
|
484
|
-
};
|
|
485
|
-
|
|
486
|
-
class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
constructor(
|
|
490
|
-
logger ,
|
|
491
|
-
mediaStreamFactory ,
|
|
492
|
-
sessionDescriptionHandlerConfiguration ,
|
|
493
|
-
isWeb ,
|
|
494
|
-
session ,
|
|
495
|
-
) {
|
|
496
|
-
super(logger, mediaStreamFactory, sessionDescriptionHandlerConfiguration);
|
|
497
|
-
|
|
498
|
-
this.eventEmitter = new EventEmitter();
|
|
499
|
-
this.isWeb = isWeb;
|
|
500
|
-
this.session = session;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
on(event , callback ) {
|
|
504
|
-
this.eventEmitter.on(event, callback);
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
off(event , callback ) {
|
|
508
|
-
this.eventEmitter.removeListener(event, callback);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
// $FlowFixMe
|
|
512
|
-
setRemoteSessionDescription(sessionDescription ) {
|
|
513
|
-
try {
|
|
514
|
-
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
515
|
-
|
|
516
|
-
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
517
|
-
|
|
518
|
-
return result;
|
|
519
|
-
} catch (error) {
|
|
520
|
-
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
521
|
-
throw error;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
526
|
-
getDescription(options = {}, modifiers ) {
|
|
527
|
-
this.logger.debug('SessionDescriptionHandler.getDescription');
|
|
528
|
-
if (this._peerConnection === undefined) {
|
|
529
|
-
return Promise.reject(new Error('Peer connection closed.'));
|
|
530
|
-
}
|
|
531
|
-
// Callback on data channel creation
|
|
532
|
-
this.onDataChannel = options.onDataChannel;
|
|
533
|
-
|
|
534
|
-
// ICE will restart upon applying an offer created with the iceRestart option
|
|
535
|
-
const iceRestart = options.offerOptions ? options.offerOptions.iceRestart : false;
|
|
536
|
-
|
|
537
|
-
const isConference = options ? !!options.conference : false;
|
|
538
|
-
const audioOnly = options ? !!options.audioOnly : false;
|
|
539
|
-
|
|
540
|
-
// We should wait for ice when iceRestart (reinvite) or for the first invite
|
|
541
|
-
// We shouldn't wait for ice when holding or resuming the call
|
|
542
|
-
// We shouldn't wait for ice when receiving a reinvite (eg: pendingReinviteAck = true)
|
|
543
|
-
const shouldWaitForIce = !this.session.pendingReinviteAck && (iceRestart || ('constraints' in options));
|
|
544
|
-
|
|
545
|
-
// ICE gathering timeout may be set on a per call basis, otherwise the configured default is used
|
|
546
|
-
const iceTimeout = options.iceGatheringTimeout === undefined
|
|
547
|
-
? this.sessionDescriptionHandlerConfiguration.iceGatheringTimeout
|
|
548
|
-
: options.iceGatheringTimeout;
|
|
549
|
-
|
|
550
|
-
wazoLogger.trace('getting SDP description', { iceRestart, shouldWaitForIce, iceTimeout });
|
|
551
|
-
|
|
552
|
-
// Fetch ice ourselves for re-invite
|
|
553
|
-
this.gatheredCandidates = [];
|
|
554
|
-
if (!this.peerConnectionDelegate) {
|
|
555
|
-
this.peerConnectionDelegate = {};
|
|
556
|
-
}
|
|
557
|
-
this.peerConnectionDelegate.onicecandidate = event => {
|
|
558
|
-
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
559
|
-
if (event.candidate) {
|
|
560
|
-
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
561
|
-
|
|
562
|
-
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
563
|
-
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
564
|
-
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
565
|
-
ice: event.candidate.candidate,
|
|
566
|
-
});
|
|
567
|
-
this.iceGatheringComplete();
|
|
51
|
+
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
52
|
+
getDescription(options = {}, modifiers) {
|
|
53
|
+
this.logger.debug('SessionDescriptionHandler.getDescription');
|
|
54
|
+
if (this._peerConnection === undefined) {
|
|
55
|
+
return Promise.reject(new Error('Peer connection closed.'));
|
|
568
56
|
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
return {
|
|
593
|
-
type: description.type,
|
|
594
|
-
sdp: addIcesInAllBundles(sdp),
|
|
595
|
-
};
|
|
57
|
+
// Callback on data channel creation
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
this.onDataChannel = options.onDataChannel;
|
|
60
|
+
// ICE will restart upon applying an offer created with the iceRestart option
|
|
61
|
+
const iceRestart = options.offerOptions ? options.offerOptions.iceRestart : false;
|
|
62
|
+
const isConference = options ? !!options.conference : false;
|
|
63
|
+
const audioOnly = options ? !!options.audioOnly : false;
|
|
64
|
+
// We should wait for ice when iceRestart (reinvite) or for the first invite
|
|
65
|
+
// We shouldn't wait for ice when holding or resuming the call
|
|
66
|
+
// We shouldn't wait for ice when receiving a reinvite (eg: pendingReinviteAck = true)
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
const shouldWaitForIce = !this.session.pendingReinviteAck && (iceRestart || 'constraints' in options);
|
|
69
|
+
// ICE gathering timeout may be set on a per call basis, otherwise the configured default is used
|
|
70
|
+
const iceTimeout = options.iceGatheringTimeout === undefined ? this.sessionDescriptionHandlerConfiguration?.iceGatheringTimeout : options.iceGatheringTimeout;
|
|
71
|
+
wazoLogger.trace('getting SDP description', {
|
|
72
|
+
iceRestart,
|
|
73
|
+
shouldWaitForIce,
|
|
74
|
+
iceTimeout,
|
|
75
|
+
});
|
|
76
|
+
// Fetch ice ourselves for re-invite
|
|
77
|
+
this.gatheredCandidates = [];
|
|
78
|
+
if (!this.peerConnectionDelegate) {
|
|
79
|
+
this.peerConnectionDelegate = {};
|
|
596
80
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
.catch((error) => {
|
|
612
|
-
wazoLogger.error('error when creating media', error);
|
|
613
|
-
this.logger.error(`SessionDescriptionHandler.getDescription failed - ${error}`);
|
|
614
|
-
throw error;
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
// Overridden to avoid to use peerConnection.getReceivers and peerConnection.getSenders in react-native
|
|
619
|
-
sendDtmf(tones , options = {}) {
|
|
620
|
-
if (this.isWeb) {
|
|
621
|
-
return super.sendDtmf(tones, options);
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
this.logger.debug(`DTMF sent via INFO: ${tones.toString()}`);
|
|
625
|
-
|
|
626
|
-
const body = {
|
|
627
|
-
contentDisposition: 'render',
|
|
628
|
-
contentType: 'application/dtmf-relay',
|
|
629
|
-
content: `Signal=${tones}\r\nDuration=${options.duration || 1000}`,
|
|
630
|
-
};
|
|
631
|
-
const requestOptions = { body };
|
|
632
|
-
|
|
633
|
-
return this.session.info({ requestOptions });
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
// Overridden to avoid to use peerConnection.getReceivers and peerConnection.getSenders in react-native
|
|
637
|
-
close() {
|
|
638
|
-
wazoLogger.info('closing sdh');
|
|
639
|
-
|
|
640
|
-
if (this.isWeb) {
|
|
641
|
-
return super.close();
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
// react-native
|
|
645
|
-
this.logger.debug('SessionDescriptionHandler.close');
|
|
646
|
-
if (this._peerConnection === undefined) {
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
// Closing senders via getLocalStreams
|
|
651
|
-
this.peerConnection.getLocalStreams().forEach(stream => {
|
|
652
|
-
stream.getTracks().forEach((track) => {
|
|
653
|
-
track.stop();
|
|
654
|
-
});
|
|
655
|
-
});
|
|
656
|
-
|
|
657
|
-
// Closing receivers via getRemoteStreams
|
|
658
|
-
this.peerConnection.getRemoteStreams().forEach(stream => {
|
|
659
|
-
stream.getTracks().forEach(track => {
|
|
660
|
-
track.stop();
|
|
661
|
-
});
|
|
662
|
-
});
|
|
663
|
-
|
|
664
|
-
if (this._dataChannel) {
|
|
665
|
-
this._dataChannel.close();
|
|
666
|
-
}
|
|
667
|
-
this._peerConnection.close();
|
|
668
|
-
this._peerConnection = undefined;
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
// Overridden to send `inactive` in conference
|
|
672
|
-
updateDirection(options , isConference = false,
|
|
673
|
-
audioOnly = false) {
|
|
674
|
-
if (this._peerConnection === undefined) {
|
|
675
|
-
return Promise.reject(new Error('Peer connection closed.'));
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
// Waiting for `getTransceivers` API on mobile
|
|
679
|
-
if (!this.isWeb) {
|
|
680
|
-
return Promise.resolve();
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
switch (this._peerConnection.signalingState) {
|
|
684
|
-
case 'stable': {
|
|
685
|
-
// if we are stable, assume we are creating a local offer
|
|
686
|
-
this.logger.debug('SessionDescriptionHandler.updateDirection - setting offer direction');
|
|
687
|
-
// determine the direction to offer given the current direction and hold state
|
|
688
|
-
const directionToOffer = (currentDirection , transceiver /* RTCRtpTransceiver */) => {
|
|
689
|
-
if (isConference) {
|
|
690
|
-
if (audioOnly && transceiver.receiver.track && transceiver.receiver.track.kind === 'video') {
|
|
691
|
-
return 'sendonly';
|
|
81
|
+
this.peerConnectionDelegate.onicecandidate = event => {
|
|
82
|
+
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : {
|
|
83
|
+
done: true,
|
|
84
|
+
});
|
|
85
|
+
if (event.candidate) {
|
|
86
|
+
// @ts-ignore @REEVALUATE
|
|
87
|
+
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
88
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
89
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
90
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
91
|
+
ice: event.candidate.candidate,
|
|
92
|
+
});
|
|
93
|
+
this.iceGatheringComplete();
|
|
94
|
+
}
|
|
692
95
|
}
|
|
693
|
-
return options && options.hold ? 'sendonly' : 'sendrecv';
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
switch (currentDirection) {
|
|
697
|
-
case 'inactive':
|
|
698
|
-
return options && options.hold ? 'inactive' : (isConference && !audioOnly ? 'sendrecv' : 'recvonly');
|
|
699
|
-
case 'recvonly':
|
|
700
|
-
return options && options.hold ? 'inactive' : 'recvonly';
|
|
701
|
-
case 'sendonly':
|
|
702
|
-
return options && options.hold ? 'sendonly' : 'sendrecv';
|
|
703
|
-
case 'sendrecv':
|
|
704
|
-
return options && options.hold ? 'sendonly' : 'sendrecv';
|
|
705
|
-
case 'stopped':
|
|
706
|
-
return 'stopped';
|
|
707
|
-
default:
|
|
708
|
-
throw new Error('Should never happen');
|
|
709
|
-
}
|
|
710
96
|
};
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
97
|
+
return this.getLocalMediaStream(options).then(() => this.updateDirection(options, isConference, audioOnly)).then(() => this.createDataChannel(options)).then(() => {
|
|
98
|
+
if (isConference && options.constraints && !options.constraints.video && !('hold' in options) && !audioOnly) {
|
|
99
|
+
// Add a video an empty bundle to be able to replaceTrack when joining a conference without video
|
|
100
|
+
if (this.peerConnection?.addTransceiver) {
|
|
101
|
+
this.peerConnection.addTransceiver('video', {
|
|
102
|
+
streams: [this._localMediaStream],
|
|
103
|
+
direction: 'sendrecv',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
718
106
|
}
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
const description = this._peerConnection.remoteDescription;
|
|
733
|
-
if (!description) {
|
|
734
|
-
throw new Error('Failed to read remote offer');
|
|
735
|
-
}
|
|
736
|
-
const searchResult = /a=sendrecv\r\n|a=sendonly\r\n|a=recvonly\r\n|a=inactive\r\n/.exec(description.sdp);
|
|
737
|
-
if (searchResult) {
|
|
738
|
-
switch (searchResult[0]) {
|
|
739
|
-
case 'a=inactive\r\n':
|
|
740
|
-
return 'inactive';
|
|
741
|
-
case 'a=recvonly\r\n':
|
|
742
|
-
return 'recvonly';
|
|
743
|
-
case 'a=sendonly\r\n':
|
|
744
|
-
return 'sendonly';
|
|
745
|
-
case 'a=sendrecv\r\n':
|
|
746
|
-
return 'sendrecv';
|
|
747
|
-
default:
|
|
748
|
-
throw new Error('Should never happen');
|
|
107
|
+
})
|
|
108
|
+
.then(() => this.createLocalOfferOrAnswer(options))
|
|
109
|
+
.then((sessionDescription) => this.setLocalSessionDescription(sessionDescription))
|
|
110
|
+
.then(() => this.waitForIceGatheringComplete(iceRestart, iceTimeout))
|
|
111
|
+
.then(() => this.getLocalSessionDescription())
|
|
112
|
+
.then((description) => {
|
|
113
|
+
const { sdp, } = description;
|
|
114
|
+
// Check if we got ICEs
|
|
115
|
+
if (sdp.indexOf('a=candidate') !== -1) {
|
|
116
|
+
return {
|
|
117
|
+
type: description.type,
|
|
118
|
+
sdp: addIcesInAllBundles(sdp),
|
|
119
|
+
};
|
|
749
120
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
121
|
+
wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
|
|
122
|
+
// @TODO: find a better way to set sdp in answer.
|
|
123
|
+
// We can't call createAnswer again, so we have to put candidates manually with fixSdp
|
|
124
|
+
// In reinvite, createOffer doesn't update the SDP
|
|
125
|
+
return {
|
|
126
|
+
type: description.type,
|
|
127
|
+
// Fix sdp only when no candidates
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
sdp: fixSdp(sdp, this.gatheredCandidates, options && options.constraints ? options.constraints.video : false),
|
|
130
|
+
};
|
|
131
|
+
})
|
|
132
|
+
.then((sessionDescription) => this.applyModifiers(sessionDescription, modifiers))
|
|
133
|
+
.then((sessionDescription) => ({
|
|
134
|
+
body: sessionDescription.sdp,
|
|
135
|
+
contentType: 'application/sdp',
|
|
136
|
+
}))
|
|
137
|
+
.catch((error) => {
|
|
138
|
+
wazoLogger.error('error when creating media', error);
|
|
139
|
+
this.logger.error(`SessionDescriptionHandler.getDescription failed - ${error}`);
|
|
140
|
+
throw error;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
// Overridden to avoid to use peerConnection.getReceivers and peerConnection.getSenders in react-native
|
|
144
|
+
sendDtmf(tones, options = { duration: 0, interToneGap: 0 }) {
|
|
145
|
+
if (this.isWeb) {
|
|
146
|
+
return super.sendDtmf(tones, options);
|
|
147
|
+
}
|
|
148
|
+
this.logger.debug(`DTMF sent via INFO: ${tones.toString()}`);
|
|
149
|
+
const body = {
|
|
150
|
+
contentDisposition: 'render',
|
|
151
|
+
contentType: 'application/dtmf-relay',
|
|
152
|
+
content: `Signal=${tones}\r\nDuration=${options.duration || 1000}`,
|
|
153
|
+
};
|
|
154
|
+
const requestOptions = {
|
|
155
|
+
body,
|
|
156
|
+
};
|
|
157
|
+
// @ts-ignore @REEVALUATE: session.info is asynched
|
|
158
|
+
return this.session.info({
|
|
159
|
+
requestOptions,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
// Overridden to avoid to use peerConnection.getReceivers and peerConnection.getSenders in react-native
|
|
163
|
+
close() {
|
|
164
|
+
wazoLogger.info('closing sdh');
|
|
165
|
+
if (this.isWeb) {
|
|
166
|
+
return super.close();
|
|
167
|
+
}
|
|
168
|
+
// react-native
|
|
169
|
+
this.logger.debug('SessionDescriptionHandler.close');
|
|
170
|
+
if (this._peerConnection === undefined) {
|
|
773
171
|
return;
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
172
|
+
}
|
|
173
|
+
// Closing senders via getLocalStreams
|
|
174
|
+
// @ts-ignore
|
|
175
|
+
this.peerConnection?.getLocalStreams().forEach(stream => {
|
|
176
|
+
stream.getTracks().forEach((track) => {
|
|
177
|
+
track.stop();
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
// Closing receivers via getRemoteStreams
|
|
181
|
+
// @ts-ignore
|
|
182
|
+
this.peerConnection?.getRemoteStreams().forEach(stream => {
|
|
183
|
+
stream.getTracks().forEach((track) => {
|
|
184
|
+
track.stop();
|
|
185
|
+
});
|
|
788
186
|
});
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
case 'closed':
|
|
795
|
-
default:
|
|
796
|
-
return Promise.reject(new Error(`Invalid signaling state ${this._peerConnection.signalingState}`));
|
|
187
|
+
if (this._dataChannel) {
|
|
188
|
+
this._dataChannel.close();
|
|
189
|
+
}
|
|
190
|
+
this._peerConnection.close();
|
|
191
|
+
this._peerConnection = undefined;
|
|
797
192
|
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
193
|
+
// Overridden to send `inactive` in conference
|
|
194
|
+
updateDirection(options, isConference = false, audioOnly = false) {
|
|
195
|
+
if (this._peerConnection === undefined) {
|
|
196
|
+
return Promise.reject(new Error('Peer connection closed.'));
|
|
197
|
+
}
|
|
198
|
+
// Waiting for `getTransceivers` API on mobile
|
|
199
|
+
if (!this.isWeb) {
|
|
200
|
+
return Promise.resolve();
|
|
201
|
+
}
|
|
202
|
+
switch (this._peerConnection.signalingState) {
|
|
203
|
+
case 'stable':
|
|
204
|
+
{
|
|
205
|
+
// if we are stable, assume we are creating a local offer
|
|
206
|
+
this.logger.debug('SessionDescriptionHandler.updateDirection - setting offer direction');
|
|
207
|
+
// determine the direction to offer given the current direction and hold state
|
|
208
|
+
const directionToOffer = (currentDirection, transceiver) => {
|
|
209
|
+
if (isConference) {
|
|
210
|
+
if (audioOnly && transceiver.receiver.track && transceiver.receiver.track.kind === 'video') {
|
|
211
|
+
return 'sendonly';
|
|
212
|
+
}
|
|
213
|
+
return options && options.hold ? 'sendonly' : 'sendrecv';
|
|
214
|
+
}
|
|
215
|
+
switch (currentDirection) {
|
|
216
|
+
case 'inactive':
|
|
217
|
+
return options && options.hold ? 'inactive' : isConference && !audioOnly ? 'sendrecv' : 'recvonly';
|
|
218
|
+
case 'recvonly':
|
|
219
|
+
return options && options.hold ? 'inactive' : 'recvonly';
|
|
220
|
+
case 'sendonly':
|
|
221
|
+
return options && options.hold ? 'sendonly' : 'sendrecv';
|
|
222
|
+
case 'sendrecv':
|
|
223
|
+
return options && options.hold ? 'sendonly' : 'sendrecv';
|
|
224
|
+
case 'stopped':
|
|
225
|
+
return 'stopped';
|
|
226
|
+
default:
|
|
227
|
+
throw new Error('Should never happen');
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
// set the transceiver direction to the offer direction
|
|
231
|
+
this._peerConnection.getTransceivers().forEach(transceiver => {
|
|
232
|
+
if (transceiver.direction
|
|
233
|
+
/* guarding, but should always be true */
|
|
234
|
+
) {
|
|
235
|
+
const offerDirection = directionToOffer(transceiver.direction, transceiver);
|
|
236
|
+
if (transceiver.direction !== offerDirection) {
|
|
237
|
+
// @ts-ignore - @REEVALUATE
|
|
238
|
+
// eslint-disable-next-line no-param-reassign
|
|
239
|
+
transceiver.direction = offerDirection;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
break;
|
|
245
|
+
case 'have-remote-offer':
|
|
246
|
+
{
|
|
247
|
+
// if we have a remote offer, assume we are creating a local answer
|
|
248
|
+
this.logger.debug('SessionDescriptionHandler.updateDirection - setting answer direction');
|
|
249
|
+
// FIXME: This is not the correct way to determine the answer direction as it is only
|
|
250
|
+
// considering first match in the offered SDP and using that to determine the answer direction.
|
|
251
|
+
// While that may be fine for our current use cases, it is not a generally correct approach.
|
|
252
|
+
// determine the offered direction
|
|
253
|
+
const offeredDirection = (() => {
|
|
254
|
+
const description = this._peerConnection.remoteDescription;
|
|
255
|
+
if (!description) {
|
|
256
|
+
throw new Error('Failed to read remote offer');
|
|
257
|
+
}
|
|
258
|
+
const searchResult = /a=sendrecv\r\n|a=sendonly\r\n|a=recvonly\r\n|a=inactive\r\n/.exec(description.sdp);
|
|
259
|
+
if (searchResult) {
|
|
260
|
+
switch (searchResult[0]) {
|
|
261
|
+
case 'a=inactive\r\n':
|
|
262
|
+
return 'inactive';
|
|
263
|
+
case 'a=recvonly\r\n':
|
|
264
|
+
return 'recvonly';
|
|
265
|
+
case 'a=sendonly\r\n':
|
|
266
|
+
return 'sendonly';
|
|
267
|
+
case 'a=sendrecv\r\n':
|
|
268
|
+
return 'sendrecv';
|
|
269
|
+
default:
|
|
270
|
+
throw new Error('Should never happen');
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return 'sendrecv';
|
|
274
|
+
})();
|
|
275
|
+
// determine the answer direction based on the offered direction and our hold state
|
|
276
|
+
const answerDirection = (() => {
|
|
277
|
+
switch (offeredDirection) {
|
|
278
|
+
case 'inactive':
|
|
279
|
+
return 'inactive';
|
|
280
|
+
case 'recvonly':
|
|
281
|
+
return 'sendonly';
|
|
282
|
+
case 'sendonly':
|
|
283
|
+
return options && options.hold ? 'inactive' : 'recvonly';
|
|
284
|
+
case 'sendrecv':
|
|
285
|
+
return options && options.hold ? 'sendonly' : 'sendrecv';
|
|
286
|
+
default:
|
|
287
|
+
throw new Error('Should never happen');
|
|
288
|
+
}
|
|
289
|
+
})();
|
|
290
|
+
// set the transceiver direction to the answer direction
|
|
291
|
+
this._peerConnection.getTransceivers().forEach(transceiver => {
|
|
292
|
+
// @ts-ignore
|
|
293
|
+
if (transceiver.stopped) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if (transceiver.direction
|
|
297
|
+
/* guarding, but should always be true */
|
|
298
|
+
) {
|
|
299
|
+
const { receiver, } = transceiver;
|
|
300
|
+
if (isConference && audioOnly && receiver.track && receiver.track.kind === 'video') {
|
|
301
|
+
// eslint-disable-next-line no-param-reassign
|
|
302
|
+
transceiver.direction = 'inactive';
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
if (transceiver.direction !== 'stopped' && transceiver.direction !== answerDirection) {
|
|
306
|
+
// eslint-disable-next-line no-param-reassign
|
|
307
|
+
transceiver.direction = answerDirection;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
break;
|
|
313
|
+
case 'have-local-offer':
|
|
314
|
+
case 'have-local-pranswer':
|
|
315
|
+
case 'have-remote-pranswer':
|
|
316
|
+
case 'closed':
|
|
317
|
+
default:
|
|
318
|
+
return Promise.reject(new Error(`Invalid signaling state ${this._peerConnection.signalingState}`));
|
|
319
|
+
}
|
|
320
|
+
return Promise.resolve();
|
|
807
321
|
}
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
const updateTrack = (newTrack ) => {
|
|
815
|
-
const { kind } = newTrack;
|
|
816
|
-
if (kind !== 'audio' && kind !== 'video') {
|
|
817
|
-
throw new Error(`Unknown new track kind ${kind}.`);
|
|
818
|
-
}
|
|
819
|
-
const sender = pc.getSenders && pc.getSenders().find((otherSender) =>
|
|
820
|
-
otherSender.track && otherSender.track.kind === kind);
|
|
821
|
-
|
|
822
|
-
// Do not reuse sender video tracks in SFU
|
|
823
|
-
if (sender && (!sfu || newTrack.kind === 'audio')) {
|
|
824
|
-
if (sender.track) {
|
|
825
|
-
// eslint-disable-next-line no-param-reassign
|
|
826
|
-
newTrack.enabled = sender.track.enabled;
|
|
322
|
+
// Overridden to not reuse video track in SFU mode
|
|
323
|
+
setLocalMediaStream(stream) {
|
|
324
|
+
this.logger.debug('SessionDescriptionHandler.setLocalMediaStream');
|
|
325
|
+
if (!this._peerConnection) {
|
|
326
|
+
throw new Error('Peer connection undefined.');
|
|
827
327
|
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
328
|
+
const pc = this._peerConnection;
|
|
329
|
+
const { sfu, } = pc;
|
|
330
|
+
const localStream = this._localMediaStream;
|
|
331
|
+
const trackUpdates = [];
|
|
332
|
+
const updateTrack = (newTrack) => {
|
|
333
|
+
const { kind, } = newTrack;
|
|
334
|
+
if (kind !== 'audio' && kind !== 'video') {
|
|
335
|
+
throw new Error(`Unknown new track kind ${kind}.`);
|
|
336
|
+
}
|
|
337
|
+
const sender = pc.getSenders && pc.getSenders().find((otherSender) => otherSender.track && otherSender.track.kind === kind);
|
|
338
|
+
// Do not reuse sender video tracks in SFU
|
|
339
|
+
if (sender && (!sfu || newTrack.kind === 'audio')) {
|
|
340
|
+
if (sender.track) {
|
|
341
|
+
// eslint-disable-next-line no-param-reassign
|
|
342
|
+
newTrack.enabled = sender.track.enabled;
|
|
841
343
|
}
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
try {
|
|
861
|
-
if (pc.addTrack) {
|
|
862
|
-
pc.addTrack(newTrack, localStream);
|
|
863
|
-
} else {
|
|
864
|
-
pc.addStream(localStream);
|
|
865
|
-
}
|
|
866
|
-
} catch (error) {
|
|
867
|
-
this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${kind} track`);
|
|
868
|
-
throw error;
|
|
344
|
+
trackUpdates.push(new Promise(resolve => {
|
|
345
|
+
this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - replacing sender ${kind} track`);
|
|
346
|
+
resolve(null);
|
|
347
|
+
}).then(() => sender.replaceTrack(newTrack).then(() => {
|
|
348
|
+
const oldTrack = localStream.getTracks().find(localTrack => localTrack.kind === kind);
|
|
349
|
+
if (oldTrack) {
|
|
350
|
+
oldTrack.stop();
|
|
351
|
+
localStream.removeTrack(oldTrack);
|
|
352
|
+
// @ts-ignore
|
|
353
|
+
SessionDescriptionHandler.dispatchRemoveTrackEvent(localStream, oldTrack);
|
|
354
|
+
}
|
|
355
|
+
localStream.addTrack(newTrack);
|
|
356
|
+
// @ts-ignore
|
|
357
|
+
SessionDescriptionHandler.dispatchAddTrackEvent(localStream, newTrack);
|
|
358
|
+
}).catch((error) => {
|
|
359
|
+
this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to replace sender ${kind} track`);
|
|
360
|
+
throw error;
|
|
361
|
+
})));
|
|
869
362
|
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
363
|
+
else {
|
|
364
|
+
trackUpdates.push(new Promise(resolve => {
|
|
365
|
+
this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - adding sender ${kind} track`);
|
|
366
|
+
resolve(null);
|
|
367
|
+
}).then(() => {
|
|
368
|
+
// Review: could make streamless tracks a configurable option?
|
|
369
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addTrack#Usage_notes
|
|
370
|
+
try {
|
|
371
|
+
if (pc.addTrack) {
|
|
372
|
+
pc.addTrack(newTrack, localStream);
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
pc.addStream(localStream);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
catch (error) {
|
|
379
|
+
this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${kind} track`);
|
|
380
|
+
throw error;
|
|
381
|
+
}
|
|
382
|
+
localStream.addTrack(newTrack);
|
|
383
|
+
// @ts-ignore
|
|
384
|
+
SessionDescriptionHandler.dispatchAddTrackEvent(localStream, newTrack);
|
|
385
|
+
}));
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
// update peer connection audio tracks
|
|
389
|
+
const audioTracks = stream.getAudioTracks();
|
|
390
|
+
if (audioTracks.length) {
|
|
391
|
+
updateTrack(audioTracks[0]);
|
|
392
|
+
}
|
|
393
|
+
// update peer connection video tracks
|
|
394
|
+
const videoTracks = stream.getVideoTracks();
|
|
395
|
+
if (videoTracks.length) {
|
|
396
|
+
updateTrack(videoTracks[0]);
|
|
397
|
+
}
|
|
398
|
+
return trackUpdates.reduce((p, x) => p.then(() => x), Promise.resolve());
|
|
897
399
|
}
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
400
|
+
// Overridden to avoid replacing constraints with `localMediaStreamConstraints`
|
|
401
|
+
getLocalMediaStream(options) {
|
|
402
|
+
this.logger.debug('WazoSessionDescriptionHandler.getLocalMediaStream');
|
|
403
|
+
if (this._peerConnection === undefined) {
|
|
404
|
+
return Promise.reject(new Error('Peer connection closed.'));
|
|
405
|
+
}
|
|
406
|
+
let constraints = options.constraints ? { ...options.constraints,
|
|
407
|
+
} : {};
|
|
408
|
+
// if we already have a local media stream...
|
|
409
|
+
// @ts-ignore
|
|
410
|
+
if (this.localMediaStreamConstraints) {
|
|
411
|
+
// if constraints have not changed, do not get a new media stream
|
|
412
|
+
// @ts-ignore
|
|
413
|
+
if (JSON.stringify(this.localMediaStreamConstraints.audio) === JSON.stringify(constraints.audio) && JSON.stringify(this.localMediaStreamConstraints.video) === JSON.stringify(constraints.video)) {
|
|
414
|
+
return Promise.resolve();
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
else if (constraints.audio === undefined && constraints.video === undefined) {
|
|
418
|
+
// if no constraints have been specified, default to audio for initial media stream
|
|
419
|
+
constraints = {
|
|
420
|
+
audio: true,
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
// @ts-ignore
|
|
424
|
+
this.localMediaStreamConstraints = constraints;
|
|
425
|
+
// @ts-ignore
|
|
426
|
+
return this.mediaStreamFactory(constraints, this).then(mediaStream => {
|
|
427
|
+
this.setLocalMediaStream(mediaStream);
|
|
428
|
+
return mediaStream;
|
|
429
|
+
});
|
|
909
430
|
}
|
|
910
|
-
this.localMediaStreamConstraints = constraints;
|
|
911
|
-
return this.mediaStreamFactory(constraints, this).then((mediaStream) => this.setLocalMediaStream(mediaStream));
|
|
912
|
-
}
|
|
913
431
|
}
|
|
914
|
-
|
|
915
432
|
export default WazoSessionDescriptionHandler;
|
|
916
|
-
export { wazoMediaStreamFactory };
|