@wazo/sdk 0.38.21 → 0.39.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 -7932
- 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 -8729
- 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 -8679
- 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 -7847
- package/esm/checker/checks/webrtc.js +31 -7854
- 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 +1446 -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 -14987
- 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 +211 -14749
- package/esm/simple/Configuration.js +8 -14798
- package/esm/simple/Directory.js +6 -4964
- package/esm/simple/Phone.js +309 -14729
- package/esm/simple/Websocket.js +68 -1112
- package/esm/simple/index.js +125 -14794
- package/esm/simple/room/LocalParticipant.js +1 -14799
- package/esm/simple/room/Participant.js +274 -14762
- package/esm/simple/room/RemoteParticipant.js +6 -14798
- package/esm/simple/room/Room.js +648 -14738
- package/esm/simple/room/SipRoom.js +111 -14792
- package/esm/simple/room/Stream.js +40 -14794
- package/esm/simple/room/__tests__/Participant.test.js +68 -14874
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +10 -14807
- package/esm/simple/utils.js +9 -14801
- 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 +1973 -7678
- 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 -7943
- 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 -8741
- 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 -8689
- 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 -7855
- package/lib/checker/checks/webrtc.js +42 -7860
- 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 +1446 -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 -15012
- 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 +271 -14779
- package/lib/simple/Configuration.js +23 -14807
- package/lib/simple/Directory.js +18 -4966
- package/lib/simple/Phone.js +345 -14748
- package/lib/simple/Websocket.js +98 -1117
- package/lib/simple/index.js +151 -14802
- package/lib/simple/room/LocalParticipant.js +7 -14810
- package/lib/simple/room/Participant.js +269 -14780
- package/lib/simple/room/RemoteParticipant.js +11 -14808
- package/lib/simple/room/Room.js +655 -14763
- package/lib/simple/room/SipRoom.js +136 -14807
- package/lib/simple/room/Stream.js +43 -14804
- package/lib/simple/room/__tests__/Participant.test.js +79 -14881
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +14 -14816
- package/lib/simple/utils.js +22 -14810
- 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 +1999 -7698
- 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} +434 -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/global.d.ts +5 -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} +127 -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} +786 -459
- 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
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
import { SessionState } from 'sip.js/lib/api/session-state';
|
|
2
|
+
import { Inviter, Invitation } from 'sip.js/lib/api';
|
|
3
|
+
import { OutgoingInviteRequest } from 'sip.js/lib/core';
|
|
4
|
+
import type SipLine from '../domain/SipLine';
|
|
5
|
+
import type Session from '../domain/Session';
|
|
6
|
+
import type CallSession from '../domain/CallSession';
|
|
7
|
+
import AdHocAPIConference from '../domain/AdHocAPIConference';
|
|
8
|
+
import WebRTCPhone, * as PHONE_EVENTS from '../domain/Phone/WebRTCPhone';
|
|
9
|
+
import { MESSAGE_TYPE_CHAT, MESSAGE_TYPE_SIGNAL } from '../domain/Phone/WebRTCPhone';
|
|
10
|
+
import WazoWebRTCClient, { events as clientEvents, transportEvents } from '../web-rtc-client';
|
|
11
|
+
import IssueReporter from '../service/IssueReporter';
|
|
12
|
+
import Emitter, { IEmitter } from '../utils/Emitter';
|
|
13
|
+
import Wazo from './index';
|
|
14
|
+
import SFUNotAvailableError from '../domain/SFUNotAvailableError';
|
|
15
|
+
|
|
16
|
+
const logger = IssueReporter.loggerFor('simple-phone');
|
|
17
|
+
const sipLogger = IssueReporter.loggerFor('sip.js');
|
|
18
|
+
const protocolLogger = IssueReporter.loggerFor('sip');
|
|
19
|
+
const protocolDebugMessages = ['Received WebSocket text message:', 'Sending WebSocket message:'];
|
|
20
|
+
|
|
21
|
+
export interface IPhone extends IEmitter {
|
|
22
|
+
client: WazoWebRTCClient;
|
|
23
|
+
phone: WebRTCPhone | null | undefined;
|
|
24
|
+
session: Session;
|
|
25
|
+
sipLine: SipLine | null | undefined;
|
|
26
|
+
SessionState: Record<string, any>;
|
|
27
|
+
|
|
28
|
+
ON_USER_AGENT: string;
|
|
29
|
+
ON_REGISTERED: string;
|
|
30
|
+
ON_UNREGISTERED: string;
|
|
31
|
+
ON_PROGRESS: string;
|
|
32
|
+
ON_CALL_ACCEPTED: string;
|
|
33
|
+
ON_CALL_ANSWERED: string;
|
|
34
|
+
ON_CALL_INCOMING: string;
|
|
35
|
+
ON_CALL_OUTGOING: string;
|
|
36
|
+
ON_CALL_MUTED: string;
|
|
37
|
+
ON_CALL_UNMUTED: string;
|
|
38
|
+
ON_CALL_RESUMED: string;
|
|
39
|
+
ON_CALL_HELD: string;
|
|
40
|
+
ON_CALL_UNHELD: string;
|
|
41
|
+
ON_CAMERA_DISABLED: string;
|
|
42
|
+
ON_CAMERA_RESUMED: string;
|
|
43
|
+
ON_CALL_CANCELED: string;
|
|
44
|
+
ON_CALL_FAILED: string;
|
|
45
|
+
ON_CALL_REJECTED: string;
|
|
46
|
+
ON_CALL_ENDED: string;
|
|
47
|
+
ON_CALL_ENDING: string;
|
|
48
|
+
ON_MESSAGE: string;
|
|
49
|
+
ON_REINVITE: string;
|
|
50
|
+
ON_TRACK: string;
|
|
51
|
+
ON_AUDIO_STREAM: string;
|
|
52
|
+
ON_VIDEO_STREAM: string;
|
|
53
|
+
ON_REMOVE_STREAM: string;
|
|
54
|
+
ON_SHARE_SCREEN_STARTED: string;
|
|
55
|
+
ON_SHARE_SCREEN_ENDING: string;
|
|
56
|
+
ON_SHARE_SCREEN_ENDED: string;
|
|
57
|
+
ON_TERMINATE_SOUND: string;
|
|
58
|
+
ON_PLAY_RING_SOUND: string;
|
|
59
|
+
ON_PLAY_INBOUND_CALL_SIGNAL_SOUND: string;
|
|
60
|
+
ON_PLAY_HANGUP_SOUND: string;
|
|
61
|
+
ON_PLAY_PROGRESS_SOUND: string;
|
|
62
|
+
ON_VIDEO_INPUT_CHANGE: string;
|
|
63
|
+
ON_CALL_ERROR: string;
|
|
64
|
+
ON_MESSAGE_TRACK_UPDATED: string;
|
|
65
|
+
ON_NETWORK_STATS: string;
|
|
66
|
+
ON_CHAT: string;
|
|
67
|
+
ON_SIGNAL: string;
|
|
68
|
+
ON_DISCONNECTED: string;
|
|
69
|
+
ON_EARLY_MEDIA: string;
|
|
70
|
+
MESSAGE_TYPE_CHAT: string;
|
|
71
|
+
MESSAGE_TYPE_SIGNAL: string;
|
|
72
|
+
|
|
73
|
+
connect: (options: Record<string, any>, sipLine?: SipLine | null | undefined) => Promise<void>;
|
|
74
|
+
connectWithCredentials: (server: string, sipLine: SipLine, displayName: string, rawOptions: Record<string, any>) => void;
|
|
75
|
+
disconnect: () => Promise<void>;
|
|
76
|
+
call: (extension: string, withCamera: boolean, rawSipLine: SipLine | null | undefined, audioOnly: boolean, conference: boolean) => Promise<CallSession | null | undefined>;
|
|
77
|
+
hangup: (callSession: CallSession) => Promise<boolean> ;
|
|
78
|
+
startConference: (host: CallSession, otherCalls: CallSession[]) => Promise<AdHocAPIConference>;
|
|
79
|
+
mute: (callSession: CallSession, withApi?: boolean) => void;
|
|
80
|
+
unmute: (callSession: CallSession, withApi?: boolean) => void;
|
|
81
|
+
muteViaAPI: (callSession: CallSession) => void;
|
|
82
|
+
unmuteViaAPI: (callSession: CallSession) => void;
|
|
83
|
+
hold: (callSession: CallSession) => Promise<void | OutgoingInviteRequest> | null | undefined;
|
|
84
|
+
unhold: (callSession: CallSession) => Promise<MediaStream | void | null | undefined>;
|
|
85
|
+
resume: (callSession: CallSession) => Promise<MediaStream | null | void>;
|
|
86
|
+
reject: (callSession: CallSession) => Promise<void> | undefined;
|
|
87
|
+
transfer: (callSession: CallSession, target: string) => void;
|
|
88
|
+
atxfer: (callSession: CallSession) => Record<string, any> | null;
|
|
89
|
+
reinvite: (callSession: CallSession, constraints: (Record<string, any> | null), conference: boolean) => Promise<OutgoingInviteRequest | void | null>;
|
|
90
|
+
getStats: (callSession: CallSession) => Promise<RTCStatsReport | null | undefined>;
|
|
91
|
+
startNetworkMonitoring: (callSession: CallSession, interval: number) => void;
|
|
92
|
+
stopNetworkMonitoring: (callSession: CallSession) => void;
|
|
93
|
+
getSipSessionId: (sipSession: Invitation | Inviter) => string | null | undefined;
|
|
94
|
+
sendMessage: (body: string, sipSession?: Inviter | Invitation, contentType?: string) => void;
|
|
95
|
+
sendChat: (content: string, sipSession?: Inviter | Invitation) => void;
|
|
96
|
+
sendSignal: (content: any, sipSession?: Inviter | Invitation) => void ;
|
|
97
|
+
turnCameraOff: (callSession: CallSession) => void;
|
|
98
|
+
turnCameraOn: (callSession: CallSession) => void;
|
|
99
|
+
startScreenSharing: (constraints: Record<string, any>, callSession?: CallSession) => Promise<MediaStream | null>;
|
|
100
|
+
stopScreenSharing: (callSession?: CallSession, restoreLocalStream?: boolean) => Promise<OutgoingInviteRequest | void>;
|
|
101
|
+
sendDTMF: (tone: string, callSession: CallSession) => void;
|
|
102
|
+
getLocalStream: (callSession: CallSession) => MediaStream | null | undefined ;
|
|
103
|
+
hasLocalVideo: (callSession: CallSession) => boolean;
|
|
104
|
+
hasALocalVideoTrack: (callSession: CallSession) => boolean;
|
|
105
|
+
getLocalMediaStream: (callSession: CallSession) => MediaStream | null | undefined;
|
|
106
|
+
getLocalVideoStream: (callSession: CallSession) => MediaStream | null;
|
|
107
|
+
getRemoteStream: (callSession: CallSession) => MediaStream | null;
|
|
108
|
+
getRemoteVideoStream: (callSession: CallSession) => MediaStream | null ;
|
|
109
|
+
isVideoRemotelyHeld: (callSession: CallSession) => boolean;
|
|
110
|
+
getRemoteStreamForCall: (callSession: CallSession) => MediaStream | null;
|
|
111
|
+
getRemoteStreamsForCall: (callSession: CallSession) => MediaStream | null;
|
|
112
|
+
getRemoteVideoStreamForCall: (callSession: CallSession) => MediaStream | null;
|
|
113
|
+
getRemoteVideoStreamFromPc: (callSession: CallSession) => MediaStream | null;
|
|
114
|
+
hasVideo: (callSession: CallSession) => boolean;
|
|
115
|
+
hasAVideoTrack: (callSession: CallSession) => boolean;
|
|
116
|
+
getCurrentSipSession: () => Invitation | Inviter | null;
|
|
117
|
+
getPrimaryWebRtcLine: () => SipLine | null;
|
|
118
|
+
getOutputDevice: () => string | null ;
|
|
119
|
+
getPrimaryLine: () => SipLine | null;
|
|
120
|
+
getLineById: (lineId: string) => SipLine | null;
|
|
121
|
+
getSipLines: () => SipLine[];
|
|
122
|
+
hasSfu: () => boolean;
|
|
123
|
+
checkSfu: () => void;
|
|
124
|
+
_transferEvents: () => void;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
class Phone extends Emitter implements IPhone {
|
|
128
|
+
client: WazoWebRTCClient;
|
|
129
|
+
|
|
130
|
+
phone: WebRTCPhone | null | undefined;
|
|
131
|
+
|
|
132
|
+
session: Session;
|
|
133
|
+
|
|
134
|
+
sipLine: SipLine | null | undefined;
|
|
135
|
+
|
|
136
|
+
SessionState: Record<string, any>;
|
|
137
|
+
|
|
138
|
+
ON_USER_AGENT: string;
|
|
139
|
+
|
|
140
|
+
ON_REGISTERED: string;
|
|
141
|
+
|
|
142
|
+
ON_UNREGISTERED: string;
|
|
143
|
+
|
|
144
|
+
ON_PROGRESS: string;
|
|
145
|
+
|
|
146
|
+
ON_CALL_ACCEPTED: string;
|
|
147
|
+
|
|
148
|
+
ON_CALL_ANSWERED: string;
|
|
149
|
+
|
|
150
|
+
ON_CALL_INCOMING: string;
|
|
151
|
+
|
|
152
|
+
ON_CALL_OUTGOING: string;
|
|
153
|
+
|
|
154
|
+
ON_CALL_MUTED: string;
|
|
155
|
+
|
|
156
|
+
ON_CALL_UNMUTED: string;
|
|
157
|
+
|
|
158
|
+
ON_CALL_RESUMED: string;
|
|
159
|
+
|
|
160
|
+
ON_CALL_HELD: string;
|
|
161
|
+
|
|
162
|
+
ON_CALL_UNHELD: string;
|
|
163
|
+
|
|
164
|
+
ON_CAMERA_DISABLED: string;
|
|
165
|
+
|
|
166
|
+
ON_CAMERA_RESUMED: string;
|
|
167
|
+
|
|
168
|
+
ON_CALL_CANCELED: string;
|
|
169
|
+
|
|
170
|
+
ON_CALL_FAILED: string;
|
|
171
|
+
|
|
172
|
+
ON_CALL_REJECTED: string;
|
|
173
|
+
|
|
174
|
+
ON_CALL_ENDED: string;
|
|
175
|
+
|
|
176
|
+
ON_CALL_ENDING: string;
|
|
177
|
+
|
|
178
|
+
ON_MESSAGE: string;
|
|
179
|
+
|
|
180
|
+
ON_REINVITE: string;
|
|
181
|
+
|
|
182
|
+
ON_TRACK: string;
|
|
183
|
+
|
|
184
|
+
ON_AUDIO_STREAM: string;
|
|
185
|
+
|
|
186
|
+
ON_VIDEO_STREAM: string;
|
|
187
|
+
|
|
188
|
+
ON_REMOVE_STREAM: string;
|
|
189
|
+
|
|
190
|
+
ON_SHARE_SCREEN_STARTED: string;
|
|
191
|
+
|
|
192
|
+
ON_SHARE_SCREEN_ENDING: string;
|
|
193
|
+
|
|
194
|
+
ON_SHARE_SCREEN_ENDED: string;
|
|
195
|
+
|
|
196
|
+
ON_TERMINATE_SOUND: string;
|
|
197
|
+
|
|
198
|
+
ON_PLAY_RING_SOUND: string;
|
|
199
|
+
|
|
200
|
+
ON_PLAY_INBOUND_CALL_SIGNAL_SOUND: string;
|
|
201
|
+
|
|
202
|
+
ON_PLAY_HANGUP_SOUND: string;
|
|
203
|
+
|
|
204
|
+
ON_PLAY_PROGRESS_SOUND: string;
|
|
205
|
+
|
|
206
|
+
ON_VIDEO_INPUT_CHANGE: string;
|
|
207
|
+
|
|
208
|
+
ON_CALL_ERROR: string;
|
|
209
|
+
|
|
210
|
+
ON_MESSAGE_TRACK_UPDATED: string;
|
|
211
|
+
|
|
212
|
+
ON_NETWORK_STATS: string;
|
|
213
|
+
|
|
214
|
+
ON_CHAT: string;
|
|
215
|
+
|
|
216
|
+
ON_SIGNAL: string;
|
|
217
|
+
|
|
218
|
+
ON_DISCONNECTED: string;
|
|
219
|
+
|
|
220
|
+
ON_EARLY_MEDIA: string;
|
|
221
|
+
|
|
222
|
+
MESSAGE_TYPE_CHAT: string;
|
|
223
|
+
|
|
224
|
+
MESSAGE_TYPE_SIGNAL: string;
|
|
225
|
+
|
|
226
|
+
constructor() {
|
|
227
|
+
super();
|
|
228
|
+
// Sugar syntax for `Wazo.Phone.EVENT_NAME`
|
|
229
|
+
Object.keys(PHONE_EVENTS).forEach((key: string) => {
|
|
230
|
+
// @ts-ignore
|
|
231
|
+
this[key] = PHONE_EVENTS[key];
|
|
232
|
+
});
|
|
233
|
+
this.SessionState = SessionState;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
async connect(options: Record<string, any> = {}, sipLine: SipLine | null | undefined = null): Promise<void> {
|
|
237
|
+
if (this.phone) {
|
|
238
|
+
// Already connected
|
|
239
|
+
// let's update media constraints if they're being fed
|
|
240
|
+
if (options.media) {
|
|
241
|
+
this.phone.setMediaConstraints(options.media);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const server = Wazo.Auth.getHost();
|
|
248
|
+
const session = Wazo.Auth.getSession();
|
|
249
|
+
|
|
250
|
+
if (!server || !session) {
|
|
251
|
+
throw new Error('Please connect to the server using `Wazo.Auth.logIn` or `Wazo.Auth.authenticate` before using Room.connect().');
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
this.session = session;
|
|
255
|
+
this.sipLine = sipLine || this.getPrimaryWebRtcLine();
|
|
256
|
+
|
|
257
|
+
if (!this.sipLine) {
|
|
258
|
+
throw new Error('Sorry, no sip lines found for this user');
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
this.connectWithCredentials(server, this.sipLine, session.displayName(), options);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
connectWithCredentials(server: string, sipLine: SipLine, displayName: string, rawOptions: Record<string, any> = {}): void {
|
|
265
|
+
if (this.phone) {
|
|
266
|
+
// Already connected
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const [host, port = 443] = server.split(':');
|
|
271
|
+
const options = rawOptions;
|
|
272
|
+
options.media = options.media || {
|
|
273
|
+
audio: true,
|
|
274
|
+
video: false,
|
|
275
|
+
};
|
|
276
|
+
options.uaConfigOverrides = options.uaConfigOverrides || {};
|
|
277
|
+
|
|
278
|
+
if (IssueReporter.enabled) {
|
|
279
|
+
options.uaConfigOverrides.traceSip = true;
|
|
280
|
+
options.log = options.log || {};
|
|
281
|
+
options.log.builtinEnabled = false;
|
|
282
|
+
options.log.logLevel = 'debug';
|
|
283
|
+
|
|
284
|
+
options.log.connector = (level: any, className: string, label: any, content: string) => {
|
|
285
|
+
const protocolIndex = content && content.indexOf ? protocolDebugMessages.findIndex(prefix => content.indexOf(prefix) !== -1) : -1;
|
|
286
|
+
|
|
287
|
+
if (className === 'sip.Transport' && protocolIndex !== -1) {
|
|
288
|
+
const direction = protocolIndex === 0 ? 'receiving' : 'sending';
|
|
289
|
+
const message = content.replace(`${protocolDebugMessages[protocolIndex]}\n\n`, '').replace('\r\n', '\n');
|
|
290
|
+
protocolLogger.trace(message, {
|
|
291
|
+
className,
|
|
292
|
+
direction,
|
|
293
|
+
});
|
|
294
|
+
} else {
|
|
295
|
+
sipLogger.trace(content, {
|
|
296
|
+
className,
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
this.client = new WazoWebRTCClient({
|
|
303
|
+
host,
|
|
304
|
+
port: typeof port === 'string' ? parseInt(port, 10) : port,
|
|
305
|
+
displayName,
|
|
306
|
+
authorizationUser: sipLine.username,
|
|
307
|
+
password: sipLine.secret,
|
|
308
|
+
uri: `${sipLine.username}@${server}`,
|
|
309
|
+
...options,
|
|
310
|
+
}, null, options.uaConfigOverrides);
|
|
311
|
+
this.phone = new WebRTCPhone(this.client, options.audioDeviceOutput, true, options.audioDeviceRing);
|
|
312
|
+
|
|
313
|
+
this._transferEvents();
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
async disconnect(): Promise<void> {
|
|
317
|
+
if (this.phone) {
|
|
318
|
+
if (this.phone.hasAnActiveCall()) {
|
|
319
|
+
logger.info('hangup call on disconnect');
|
|
320
|
+
await this.phone.hangup(null);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
await this.phone.close();
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
this.phone = null;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// If audioOnly is set to true, all video stream will be deactivated, even remotes ones.
|
|
330
|
+
async call(extension: string, withCamera = false, rawSipLine: SipLine | null | undefined = null, audioOnly = false, conference = false): Promise<CallSession | null | undefined> {
|
|
331
|
+
if (!this.phone) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const sipLine = rawSipLine || this.getPrimaryWebRtcLine();
|
|
336
|
+
return this.phone.makeCall(extension, sipLine, withCamera, audioOnly, conference);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
async hangup(callSession: CallSession): Promise<boolean> {
|
|
340
|
+
logger.info('hangup via simple phone', {
|
|
341
|
+
callId: callSession.getId(),
|
|
342
|
+
});
|
|
343
|
+
return this.phone ? this.phone.hangup(callSession) : false;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
async accept(callSession: CallSession, cameraEnabled?: boolean): Promise<string | null> {
|
|
347
|
+
logger.info('accept via simple phone', {
|
|
348
|
+
callId: callSession.getId(),
|
|
349
|
+
cameraEnabled,
|
|
350
|
+
});
|
|
351
|
+
return this.phone ? this.phone.accept(callSession, cameraEnabled) : null;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
async startConference(host: CallSession, otherCalls: CallSession[]): Promise<AdHocAPIConference> {
|
|
355
|
+
const participants = [host, ...otherCalls].reduce((acc: Record<string, any>, participant: CallSession) => {
|
|
356
|
+
acc[participant.getTalkingToIds()[0]] = participant;
|
|
357
|
+
return acc;
|
|
358
|
+
}, {});
|
|
359
|
+
|
|
360
|
+
if (!this.phone) {
|
|
361
|
+
return Promise.reject();
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
const adHocConference = new AdHocAPIConference({
|
|
365
|
+
phone: this.phone,
|
|
366
|
+
host,
|
|
367
|
+
participants,
|
|
368
|
+
});
|
|
369
|
+
return adHocConference.start();
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
mute(callSession: CallSession, withApi = true): void {
|
|
373
|
+
if (withApi) {
|
|
374
|
+
this.muteViaAPI(callSession);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
this.phone?.mute(callSession);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
unmute(callSession: CallSession, withApi = true): void {
|
|
381
|
+
if (withApi) {
|
|
382
|
+
this.unmuteViaAPI(callSession);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
this.phone?.unmute(callSession);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
muteViaAPI(callSession: CallSession): void {
|
|
389
|
+
if (callSession && callSession.callId) {
|
|
390
|
+
Wazo.getApiClient().calld.mute(callSession.callId).catch(e => {
|
|
391
|
+
logger.error('Mute via API, error', e);
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
unmuteViaAPI(callSession: CallSession): void {
|
|
397
|
+
if (callSession && callSession.callId) {
|
|
398
|
+
Wazo.getApiClient().calld.unmute(callSession.callId).catch(e => {
|
|
399
|
+
logger.error('Unmute via API, error', e);
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
hold(callSession: CallSession): Promise<void | OutgoingInviteRequest> | null | undefined {
|
|
405
|
+
return this.phone?.hold(callSession, true);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
async unhold(callSession: CallSession): Promise<MediaStream | void | null | undefined> {
|
|
409
|
+
return this.phone?.unhold(callSession, true);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
async resume(callSession: CallSession): Promise<MediaStream | null | void> {
|
|
413
|
+
return this.phone?.resume(callSession) || null;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
reject(callSession: CallSession): Promise<void> | undefined {
|
|
417
|
+
return this.phone?.reject(callSession);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
transfer(callSession: CallSession, target: string): void {
|
|
421
|
+
this.phone?.transfer(callSession, target);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
atxfer(callSession: CallSession): Record<string, any> | null {
|
|
425
|
+
return this.phone?.atxfer(callSession) || null;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
async reinvite(callSession: CallSession, constraints: (Record<string, any> | null) = null, conference = false): Promise<OutgoingInviteRequest | void | null> {
|
|
429
|
+
return this.phone ? this.phone.sendReinvite(callSession, constraints, conference) : null;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
async getStats(callSession: CallSession): Promise<RTCStatsReport | null | undefined> {
|
|
433
|
+
return this.phone ? this.phone.getStats(callSession) : null;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
startNetworkMonitoring(callSession: CallSession, interval = 1000) {
|
|
437
|
+
return this.phone ? this.phone.startNetworkMonitoring(callSession, interval) : null;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
stopNetworkMonitoring(callSession: CallSession) {
|
|
441
|
+
return this.phone ? this.phone.stopNetworkMonitoring(callSession) : null;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
getSipSessionId(sipSession: Invitation | Inviter): string | null | undefined {
|
|
445
|
+
if (!sipSession || !this.phone) {
|
|
446
|
+
return null;
|
|
447
|
+
}
|
|
448
|
+
return this.phone.getSipSessionId(sipSession);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
sendMessage(body: string, sipSession?: Inviter | Invitation, contentType = 'text/plain'): void {
|
|
452
|
+
const toSipSession = sipSession || this.getCurrentSipSession();
|
|
453
|
+
|
|
454
|
+
if (!toSipSession || !this.phone) {
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
this.phone.sendMessage(toSipSession, body, contentType);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
sendChat(content: string, sipSession?: Inviter | Invitation): void {
|
|
462
|
+
this.sendMessage(JSON.stringify({
|
|
463
|
+
type: MESSAGE_TYPE_CHAT,
|
|
464
|
+
content,
|
|
465
|
+
}), sipSession, 'application/json');
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
sendSignal(content: any, sipSession?: Inviter | Invitation): void {
|
|
469
|
+
this.sendMessage(JSON.stringify({
|
|
470
|
+
type: MESSAGE_TYPE_SIGNAL,
|
|
471
|
+
content,
|
|
472
|
+
}), sipSession, 'application/json');
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
turnCameraOff(callSession: CallSession): void {
|
|
476
|
+
this.phone?.turnCameraOff(callSession);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
turnCameraOn(callSession: CallSession): void {
|
|
480
|
+
this.phone?.turnCameraOn(callSession);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
async startScreenSharing(constraints: Record<string, any>, callSession?: CallSession): Promise<MediaStream | null> {
|
|
484
|
+
return this.phone?.startScreenSharing(constraints, callSession) || null;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
stopScreenSharing(callSession?: CallSession, restoreLocalStream = true): Promise<OutgoingInviteRequest | void> {
|
|
488
|
+
return this.phone ? this.phone.stopScreenSharing(restoreLocalStream, callSession) : Promise.resolve();
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
sendDTMF(tone: string, callSession: CallSession): void {
|
|
492
|
+
this.phone?.sendKey(callSession, tone);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
getLocalStream(callSession: CallSession): MediaStream | null | undefined {
|
|
496
|
+
return this.phone?.getLocalStream(callSession);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
hasLocalVideo(callSession: CallSession): boolean {
|
|
500
|
+
return this.phone?.hasLocalVideo(callSession) || false;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
hasALocalVideoTrack(callSession: CallSession): boolean {
|
|
504
|
+
return this.phone?.hasALocalVideoTrack(callSession) || false;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// @Deprecated
|
|
508
|
+
getLocalMediaStream(callSession: CallSession): MediaStream | null | undefined {
|
|
509
|
+
logger.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
|
|
510
|
+
return this.phone?.getLocalStream(callSession);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
getLocalVideoStream(callSession: CallSession): MediaStream | null {
|
|
514
|
+
return this.phone?.getLocalVideoStream(callSession) || null;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
getRemoteStream(callSession: CallSession): MediaStream | null {
|
|
518
|
+
return this.phone?.getRemoteStream(callSession) || null;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
getRemoteVideoStream(callSession: CallSession): MediaStream | null {
|
|
522
|
+
return this.phone?.getRemoteVideoStream(callSession) || null;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
isVideoRemotelyHeld(callSession: CallSession): boolean {
|
|
526
|
+
return this.phone?.isVideoRemotelyHeld(callSession) || false;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// @Deprecated
|
|
530
|
+
getRemoteStreamForCall(callSession: CallSession): MediaStream | null {
|
|
531
|
+
logger.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
|
|
532
|
+
return this.getRemoteStream(callSession) || null;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// Returns remote streams directly from the peerConnection
|
|
536
|
+
// @Deprecated
|
|
537
|
+
getRemoteStreamsForCall(callSession: CallSession): MediaStream | null {
|
|
538
|
+
logger.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
|
|
539
|
+
return this.getLocalStream(callSession) || null;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
// @Deprecated
|
|
543
|
+
getRemoteVideoStreamForCall(callSession: CallSession): MediaStream | null {
|
|
544
|
+
logger.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
|
|
545
|
+
return this.getRemoteVideoStream(callSession);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
549
|
+
getRemoteVideoStreamFromPc(callSession: CallSession) : MediaStream | null {
|
|
550
|
+
return this.phone?.getRemoteVideoStreamFromPc(callSession) || null;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
hasVideo(callSession: CallSession): boolean {
|
|
554
|
+
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
hasAVideoTrack(callSession: CallSession): boolean {
|
|
558
|
+
return this.phone ? this.phone.hasAVideoTrack(callSession) : false;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
getCurrentSipSession(): Invitation | Inviter | null {
|
|
562
|
+
return this.phone?.currentSipSession || null;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
getPrimaryWebRtcLine(): SipLine | null {
|
|
566
|
+
const session = Wazo.Auth.getSession();
|
|
567
|
+
return session?.primaryWebRtcLine() || null;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
getOutputDevice(): string | null {
|
|
571
|
+
return this.phone?.audioOutputDeviceId || null;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
getPrimaryLine(): SipLine | null {
|
|
575
|
+
const session = Wazo.Auth.getSession();
|
|
576
|
+
return session?.primarySipLine() || null;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
getLineById(lineId: string): SipLine | null {
|
|
580
|
+
return this.getSipLines().find(line => line && line.id === lineId) || null;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
getSipLines(): SipLine[] {
|
|
584
|
+
const session = Wazo.Auth.getSession();
|
|
585
|
+
|
|
586
|
+
if (!session) {
|
|
587
|
+
return [];
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
return session.profile?.sipLines || [];
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
hasSfu(): boolean {
|
|
594
|
+
return this.sipLine?.hasVideoConference() || false;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
checkSfu(): void {
|
|
598
|
+
if (!this.hasSfu()) {
|
|
599
|
+
throw new SFUNotAvailableError();
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
_transferEvents() {
|
|
604
|
+
this.unbind();
|
|
605
|
+
[...clientEvents, ...transportEvents].forEach(event => {
|
|
606
|
+
this.client.on(event, (...args) => this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
607
|
+
});
|
|
608
|
+
Object.values(PHONE_EVENTS).forEach(event => {
|
|
609
|
+
if (typeof event !== 'string' || !this.phone) {
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
this.phone.on(event, (...args) => this.eventEmitter.emit.apply(this.eventEmitter, [event, ...args]));
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
if (!global.wazoTelephonyInstance) {
|
|
620
|
+
global.wazoTelephonyInstance = new Phone();
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
export default global.wazoTelephonyInstance;
|