@wazo/sdk 0.38.22 → 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 -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 +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 -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 +211 -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 +1973 -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 +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 -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 +271 -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 +1999 -7696
- 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 -457
- 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,96 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
import ApiRequester from '../utils/api-requester';
|
|
3
|
+
import type { ListNodesResponse, ListCallNodesResponse } from '../domain/types';
|
|
4
|
+
|
|
5
|
+
export interface ApplicationD {
|
|
6
|
+
bridgeCall: (applicationUuid: string, callId: number, context: string, exten: string, autoanswer: string, displayed_caller_id_number: string | null | undefined) => Promise<boolean>;
|
|
7
|
+
answerCall: (applicationUuid: string, callId: number) => Promise<boolean>;
|
|
8
|
+
calls: (applicationUuid: string) => Promise<boolean>;
|
|
9
|
+
hangupCall: (applicationUuid: string, callId: number) => Promise<boolean>;
|
|
10
|
+
startPlaybackCall: (applicationUuid: string, callId: number, language: string, uri: string) => Promise<boolean>;
|
|
11
|
+
stopPlaybackCall: (applicationUuid: string, playbackUuid: string) => Promise<boolean>;
|
|
12
|
+
startProgressCall: (applicationUuid: string, callId: number) => Promise<boolean>;
|
|
13
|
+
stopProgressCall: (applicationUuid: string, callId: number) => Promise<boolean>;
|
|
14
|
+
startMohCall: (applicationUuid: string, callId: number, mohUuid: string) => Promise<boolean>;
|
|
15
|
+
stopMohCall: (applicationUuid: string, callId: number) => Promise<boolean>;
|
|
16
|
+
startHoldCall: (applicationUuid: string, callId: number) => Promise<boolean>;
|
|
17
|
+
stopHoldCall: (applicationUuid: string, callId: number) => Promise<boolean>;
|
|
18
|
+
startMuteCall: (applicationUuid: string, callId: number) => Promise<boolean>;
|
|
19
|
+
stopMuteCall: (applicationUuid: string, callId: number) => Promise<boolean>;
|
|
20
|
+
sendDTMFCall: (applicationUuid: string, callId: number, digits: number) => Promise<boolean>;
|
|
21
|
+
addCallNodes: (applicationUuid: string, nodeUuid: string, callId: string) => Promise<boolean>;
|
|
22
|
+
createNewNodeWithCall: (applicationUuid: string, calls: Array<Record<string, any>>) => Promise<boolean>;
|
|
23
|
+
addNewCallNodes: (applicationUuid: string, nodeUuid: string, context: string, exten: string, autoanswer: string) => Promise<boolean>;
|
|
24
|
+
listCallsNodes: (applicationUuid: string, nodeUuid: string) => Promise<ListCallNodesResponse>;
|
|
25
|
+
listNodes: (applicationUuid: string) => Promise<ListNodesResponse>;
|
|
26
|
+
removeNode: (applicationUuid: string, nodeUuid: string) => Promise<boolean>;
|
|
27
|
+
removeCallNodes: (applicationUuid: string, nodeUuid: string, callId: string) => Promise<boolean>;
|
|
28
|
+
listSnoop: (applicationUuid: string) => Promise<ListNodesResponse>;
|
|
29
|
+
removeSnoop: (applicationUuid: string, snoopUuid: string) => Promise<boolean>;
|
|
30
|
+
viewSnoop: (applicationUuid: string, snoopUuid: string) => Promise<ListNodesResponse>;
|
|
31
|
+
createSnoop: (applicationUuid: string, callId: number, snoopingCallId: number, whisperMode: string) => Promise<boolean>;
|
|
32
|
+
updateSnoop: (applicationUuid: string, snoopUuid: string, whisperMode: string) => Promise<boolean>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default ((client: ApiRequester, baseUrl: string): ApplicationD => ({
|
|
36
|
+
bridgeCall(applicationUuid: string, callId: number, context: string, exten: string, autoanswer: string, displayed_caller_id_number: string | null | undefined) {
|
|
37
|
+
const url = `${baseUrl}/${applicationUuid}/nodes`;
|
|
38
|
+
const body = {
|
|
39
|
+
calls: [{
|
|
40
|
+
id: callId,
|
|
41
|
+
}],
|
|
42
|
+
};
|
|
43
|
+
return client.post(url, body, null, (res: Record<string, any>) => res.json().then((response: Record<string, any>) => response.uuid)).then((nodeUuid: string) => client.post(`${url}/${nodeUuid}/calls`, {
|
|
44
|
+
context,
|
|
45
|
+
exten,
|
|
46
|
+
autoanswer,
|
|
47
|
+
displayed_caller_id_number,
|
|
48
|
+
}).then((data: any) => ({
|
|
49
|
+
nodeUuid,
|
|
50
|
+
data,
|
|
51
|
+
})));
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
answerCall: (applicationUuid: string, callId: number) => client.put(`${baseUrl}/${applicationUuid}/calls/${callId}/answer`, {}, null, ApiRequester.successResponseParser),
|
|
55
|
+
calls: (applicationUuid: string) => client.get(`${baseUrl}/${applicationUuid}/calls`),
|
|
56
|
+
hangupCall: (applicationUuid: string, callId: number) => client.delete(`${baseUrl}/${applicationUuid}/calls/${callId}`),
|
|
57
|
+
startPlaybackCall: (applicationUuid: string, callId: number, language: string, uri: string) => client.post(`${baseUrl}/${applicationUuid}/calls/${callId}/playbacks`, {
|
|
58
|
+
language,
|
|
59
|
+
uri,
|
|
60
|
+
}),
|
|
61
|
+
stopPlaybackCall: (applicationUuid: string, playbackUuid: string) => client.delete(`${baseUrl}/${applicationUuid}/playbacks/${playbackUuid}`),
|
|
62
|
+
startProgressCall: (applicationUuid: string, callId: number) => client.put(`${baseUrl}/${applicationUuid}/calls/${callId}/progress/start`, {}, null, ApiRequester.successResponseParser),
|
|
63
|
+
stopProgressCall: (applicationUuid: string, callId: number) => client.put(`${baseUrl}/${applicationUuid}/calls/${callId}/progress/stop`, {}, null, ApiRequester.successResponseParser),
|
|
64
|
+
startMohCall: (applicationUuid: string, callId: number, mohUuid: string) => client.put(`${baseUrl}/${applicationUuid}/calls/${callId}/moh/${mohUuid}/start`, {}, null, ApiRequester.successResponseParser),
|
|
65
|
+
stopMohCall: (applicationUuid: string, callId: number) => client.put(`${baseUrl}/${applicationUuid}/calls/${callId}/moh/stop`, {}, null, ApiRequester.successResponseParser),
|
|
66
|
+
startHoldCall: (applicationUuid: string, callId: number) => client.put(`${baseUrl}/${applicationUuid}/calls/${callId}/hold/start`, {}, null, ApiRequester.successResponseParser),
|
|
67
|
+
stopHoldCall: (applicationUuid: string, callId: number) => client.put(`${baseUrl}/${applicationUuid}/calls/${callId}/hold/stop`, {}, null, ApiRequester.successResponseParser),
|
|
68
|
+
startMuteCall: (applicationUuid: string, callId: number) => client.put(`${baseUrl}/${applicationUuid}/calls/${callId}/mute/start`, {}, null, ApiRequester.successResponseParser),
|
|
69
|
+
stopMuteCall: (applicationUuid: string, callId: number) => client.put(`${baseUrl}/${applicationUuid}/calls/${callId}/mute/stop`, {}, null, ApiRequester.successResponseParser),
|
|
70
|
+
sendDTMFCall: (applicationUuid: string, callId: number, digits: number) => client.put(`${baseUrl}/${applicationUuid}/calls/${callId}/dtmf`, {
|
|
71
|
+
digits,
|
|
72
|
+
}, null, ApiRequester.successResponseParser),
|
|
73
|
+
addCallNodes: (applicationUuid: string, nodeUuid: string, callId: string): Promise<boolean> => client.put(`${baseUrl}/${applicationUuid}/nodes/${nodeUuid}/calls/${callId}`, {}, null, ApiRequester.successResponseParser),
|
|
74
|
+
createNewNodeWithCall: (applicationUuid: string, calls: Array<Record<string, any>>) => client.post(`${baseUrl}/${applicationUuid}/nodes`, {
|
|
75
|
+
calls,
|
|
76
|
+
}),
|
|
77
|
+
addNewCallNodes: (applicationUuid: string, nodeUuid: string, context: string, exten: string, autoanswer: string) => client.post(`${baseUrl}/${applicationUuid}/nodes/${nodeUuid}/calls`, {
|
|
78
|
+
context,
|
|
79
|
+
exten,
|
|
80
|
+
autoanswer,
|
|
81
|
+
}),
|
|
82
|
+
listCallsNodes: (applicationUuid: string, nodeUuid: string): Promise<ListCallNodesResponse> => client.get(`${baseUrl}/${applicationUuid}/nodes/${nodeUuid}`),
|
|
83
|
+
listNodes: (applicationUuid: string): Promise<ListNodesResponse> => client.get(`${baseUrl}/${applicationUuid}/nodes`),
|
|
84
|
+
removeNode: (applicationUuid: string, nodeUuid: string) => client.delete(`${baseUrl}/${applicationUuid}/nodes/${nodeUuid}`),
|
|
85
|
+
removeCallNodes: (applicationUuid: string, nodeUuid: string, callId: string) => client.delete(`${baseUrl}/${applicationUuid}/nodes/${nodeUuid}/calls/${callId}`),
|
|
86
|
+
listSnoop: (applicationUuid: string): Promise<ListNodesResponse> => client.get(`${baseUrl}/${applicationUuid}/snoops`),
|
|
87
|
+
removeSnoop: (applicationUuid: string, snoopUuid: string) => client.delete(`${baseUrl}/${applicationUuid}/snoops/${snoopUuid}`),
|
|
88
|
+
viewSnoop: (applicationUuid: string, snoopUuid: string): Promise<ListNodesResponse> => client.get(`${baseUrl}/${applicationUuid}/snoops/${snoopUuid}`),
|
|
89
|
+
createSnoop: (applicationUuid: string, callId: number, snoopingCallId: number, whisperMode: string) => client.post(`${baseUrl}/${applicationUuid}/calls/${callId}/snoops`, {
|
|
90
|
+
snooping_call_id: snoopingCallId,
|
|
91
|
+
whisper_mode: whisperMode,
|
|
92
|
+
}),
|
|
93
|
+
updateSnoop: (applicationUuid: string, snoopUuid: string, whisperMode: string) => client.put(`${baseUrl}/${applicationUuid}/snoops/${snoopUuid}`, {
|
|
94
|
+
whisper_mode: whisperMode,
|
|
95
|
+
}, null, ApiRequester.successResponseParser),
|
|
96
|
+
}));
|
package/src/api/auth.ts
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import ApiRequester from '../utils/api-requester';
|
|
2
|
+
import type { User, Tenant, Token, UUID, LogoutResponse, ListTenantsResponse, RequestError, ListUsersResponse, ListGroupsResponse, ListPoliciesResponse, GetTenantResponse, GetUserResponse } from '../domain/types';
|
|
3
|
+
import Session, { Response } from '../domain/Session';
|
|
4
|
+
|
|
5
|
+
export const DEFAULT_BACKEND_USER = 'wazo_user';
|
|
6
|
+
export const BACKEND_LDAP_USER = 'ldap_user';
|
|
7
|
+
export const DETAULT_EXPIRATION = 3600;
|
|
8
|
+
|
|
9
|
+
type LoginParams = {
|
|
10
|
+
username: string;
|
|
11
|
+
password: string;
|
|
12
|
+
backend: string;
|
|
13
|
+
expiration: number;
|
|
14
|
+
mobile?: boolean;
|
|
15
|
+
tenantId?: string;
|
|
16
|
+
domainName?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type SendResetPasswordArgs = {
|
|
20
|
+
username: string,
|
|
21
|
+
email: string,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export interface AuthD {
|
|
25
|
+
checkToken: (token: Token) => Promise<boolean>;
|
|
26
|
+
authenticate: (token: Token) => Promise<Session | null | undefined>;
|
|
27
|
+
logIn(params: LoginParams): Promise<Session | null | undefined> ;
|
|
28
|
+
logOut: (token: Token) => Promise<LogoutResponse>;
|
|
29
|
+
refreshToken: (refreshToken: string, backend: string, expiration: number, isMobile?: boolean, tenantId?: string, domainName?: string) => Promise<Session | null | undefined>;
|
|
30
|
+
deleteRefreshToken: (clientId: string) => Promise<boolean>;
|
|
31
|
+
updatePassword: (userUuid: UUID, oldPassword: string, newPassword: string) => Promise<boolean>;
|
|
32
|
+
sendDeviceToken: (userUuid: UUID, deviceToken: string, apnsVoipToken: string | null | undefined, apnsNotificationToken: string | null | undefined) => Promise<void>;
|
|
33
|
+
getPushNotificationSenderId: (userUuid: UUID) => Promise<string>;
|
|
34
|
+
sendResetPasswordEmail: (params: SendResetPasswordArgs) => Promise<boolean>;
|
|
35
|
+
resetPassword: (userUuid: string, password: string) => Promise<boolean>;
|
|
36
|
+
removeDeviceToken: (userUuid: UUID) => Promise<void>;
|
|
37
|
+
createUser: (username: string, password: string, firstname: string, lastname: string) => Promise<User | RequestError>;
|
|
38
|
+
addUserEmail: (userUuid: UUID, email: string, main?: boolean) => Promise<void>;
|
|
39
|
+
addUserPolicy: (userUuid: UUID, policyUuid: UUID) => Promise<void>;
|
|
40
|
+
getRestrictionPolicies: (scopes: string[]) => Promise<any>;
|
|
41
|
+
deleteUserPolicy: (userUuid: UUID, policyUuid: UUID) => Promise<any>;
|
|
42
|
+
addUserGroup: (userUuid: UUID, groupUuid: UUID) => Promise<any>;
|
|
43
|
+
listUsersGroup: (groupUuid: UUID) => Promise<any>;
|
|
44
|
+
deleteUserGroup: (userUuid: UUID, groupUuid: UUID) => Promise<void>;
|
|
45
|
+
getUser: (userUuid: UUID) => Promise<GetUserResponse>;
|
|
46
|
+
getUserSession: (userUuid: UUID) => Promise<any>; // @TODO
|
|
47
|
+
deleteUserSession: (userUuid: UUID, sessionUuids: UUID) => Promise<void>;
|
|
48
|
+
listUsers: () => Promise<ListUsersResponse>;
|
|
49
|
+
deleteUser: (userUuid: UUID) => Promise<boolean | RequestError>;
|
|
50
|
+
listTenants: () => Promise<ListTenantsResponse>;
|
|
51
|
+
getTenant: (tenantUuid: UUID) => Promise<GetTenantResponse>;
|
|
52
|
+
createTenant: (name: string) => Promise<Tenant | RequestError>;
|
|
53
|
+
updateTenant: (uuid: UUID, name: string, contact: string, phone: string, address: Array<Record<string, any>>) => Promise<Tenant | RequestError>;
|
|
54
|
+
deleteTenant: (uuid: UUID) => Promise<boolean | RequestError>;
|
|
55
|
+
createGroup: (name: string) => Promise<void>;
|
|
56
|
+
listGroups: () => Promise<ListGroupsResponse>;
|
|
57
|
+
deleteGroup: (uuid: UUID) => Promise<boolean | RequestError>;
|
|
58
|
+
createPolicy: (name: string, description: string, aclTemplates: Array<Record<string, any>>) => Promise<void>;
|
|
59
|
+
listPolicies: () => Promise<ListPoliciesResponse>;
|
|
60
|
+
deletePolicy: (policyUuid: UUID) => Promise<boolean | RequestError>;
|
|
61
|
+
getProviders: (userUuid: UUID) => Promise<any>; // @TODO
|
|
62
|
+
getProviderToken: (userUuid: UUID, provider: string) => Promise<string>; // @TODO; validate
|
|
63
|
+
getProviderAuthUrl: (userUuid: UUID, provider: string) => Promise<string>;
|
|
64
|
+
deleteProviderToken: (userUuid: UUID, provider: string) => Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default ((client: ApiRequester, baseUrl: string): AuthD => ({
|
|
68
|
+
checkToken: (token: Token): Promise<boolean> => client.head(`${baseUrl}/token/${token}`, null, {}),
|
|
69
|
+
authenticate: (token: Token): Promise<Session | null | undefined> => client.get(`${baseUrl}/token/${token}`, null, {}).then((response: Response) => Session.parse(response)),
|
|
70
|
+
|
|
71
|
+
logIn(params: {
|
|
72
|
+
username: string;
|
|
73
|
+
password: string;
|
|
74
|
+
backend: string;
|
|
75
|
+
expiration: number;
|
|
76
|
+
mobile?: boolean;
|
|
77
|
+
tenantId?: string;
|
|
78
|
+
domainName?: string;
|
|
79
|
+
}): Promise<Session | null | undefined> {
|
|
80
|
+
const body: Record<string, any> = {
|
|
81
|
+
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
82
|
+
expiration: params.expiration || DETAULT_EXPIRATION,
|
|
83
|
+
};
|
|
84
|
+
const headers: Record<string, any> = {
|
|
85
|
+
Authorization: `Basic ${ApiRequester.base64Encode(`${params.username}:${params.password}`)}`,
|
|
86
|
+
'Content-Type': 'application/json',
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
if (client.clientId) {
|
|
90
|
+
body.access_type = 'offline';
|
|
91
|
+
body.client_id = client.clientId;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (params.mobile) {
|
|
95
|
+
headers['Wazo-Session-Type'] = 'mobile';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (params.tenantId) {
|
|
99
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
100
|
+
body.tenant_id = params.tenantId;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (params.domainName) {
|
|
104
|
+
body.domain_name = params.domainName;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return client.post(`${baseUrl}/token`, body, headers).then((response: Response) => Session.parse(response));
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
logOut: (token: Token): Promise<LogoutResponse> => client.delete(`${baseUrl}/token/${token}`, null, {}, ApiRequester.successResponseParser),
|
|
111
|
+
refreshToken: (refreshToken: string, backend: string, expiration: number, isMobile?: boolean, tenantId?: string, domainName?: string): Promise<Session | null | undefined> => {
|
|
112
|
+
const body: Record<string, any> = {
|
|
113
|
+
backend: backend || DEFAULT_BACKEND_USER,
|
|
114
|
+
expiration: expiration || DETAULT_EXPIRATION,
|
|
115
|
+
refresh_token: refreshToken,
|
|
116
|
+
client_id: client.clientId,
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
if (tenantId) {
|
|
120
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
121
|
+
body.tenant_id = tenantId;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (domainName) {
|
|
125
|
+
body.domain_name = domainName;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const headers: Record<string, any> = {
|
|
129
|
+
'Content-Type': 'application/json',
|
|
130
|
+
...(isMobile ? {
|
|
131
|
+
'Wazo-Session-Type': 'mobile',
|
|
132
|
+
} : {}),
|
|
133
|
+
};
|
|
134
|
+
return client.post(`${baseUrl}/token`, body, headers, ApiRequester.defaultParser, false).then(Session.parse);
|
|
135
|
+
},
|
|
136
|
+
deleteRefreshToken: (clientId: string): Promise<boolean> => client.delete(`${baseUrl}/users/me/tokens/${clientId}`, null, null, ApiRequester.successResponseParser),
|
|
137
|
+
updatePassword: (userUuid: UUID, oldPassword: string, newPassword: string): Promise<boolean> => {
|
|
138
|
+
const body = {
|
|
139
|
+
new_password: newPassword,
|
|
140
|
+
old_password: oldPassword,
|
|
141
|
+
};
|
|
142
|
+
return client.put(`${baseUrl}/users/${userUuid}/password`, body, null, ApiRequester.successResponseParser);
|
|
143
|
+
},
|
|
144
|
+
sendDeviceToken: (userUuid: UUID, deviceToken: string, apnsVoipToken: string | null | undefined, apnsNotificationToken: string | null | undefined) => {
|
|
145
|
+
const body: Record<string, any> = {
|
|
146
|
+
token: deviceToken,
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
if (apnsVoipToken) {
|
|
150
|
+
// Should be called `voip_token`, but we can't changed it to be retro-compatible
|
|
151
|
+
body.apns_token = apnsVoipToken;
|
|
152
|
+
body.apns_voip_token = apnsVoipToken;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (apnsNotificationToken) {
|
|
156
|
+
body.apns_notification_token = apnsNotificationToken;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return client.post(`${baseUrl}/users/${userUuid}/external/mobile`, body);
|
|
160
|
+
},
|
|
161
|
+
getPushNotificationSenderId: (userUuid: UUID) => client.get(`${baseUrl}/users/${userUuid}/external/mobile/sender_id`, null).then((response: Record<string, any>) => response.sender_id),
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* `username` or `email` should be set.
|
|
165
|
+
*/
|
|
166
|
+
sendResetPasswordEmail: ({
|
|
167
|
+
username,
|
|
168
|
+
email,
|
|
169
|
+
}: {
|
|
170
|
+
username: string | null | undefined;
|
|
171
|
+
email: string | null | undefined;
|
|
172
|
+
}) => {
|
|
173
|
+
const body: any = {};
|
|
174
|
+
|
|
175
|
+
if (username) {
|
|
176
|
+
body.username = username;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (email) {
|
|
180
|
+
body.email = email;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return client.get(`${baseUrl}/users/password/reset`, body, {}, ApiRequester.successResponseParser);
|
|
184
|
+
},
|
|
185
|
+
resetPassword: (userUuid: string, password: string) => {
|
|
186
|
+
const body = {
|
|
187
|
+
password,
|
|
188
|
+
};
|
|
189
|
+
return client.post(`${baseUrl}/users/password/reset?user_uuid=${userUuid}`, body, null, ApiRequester.successResponseParser);
|
|
190
|
+
},
|
|
191
|
+
removeDeviceToken: (userUuid: UUID) => client.delete(`${baseUrl}/users/${userUuid}/external/mobile`),
|
|
192
|
+
createUser: (username: string, password: string, firstname: string, lastname: string): Promise<User | RequestError> => {
|
|
193
|
+
const body = {
|
|
194
|
+
username,
|
|
195
|
+
password,
|
|
196
|
+
firstname,
|
|
197
|
+
lastname,
|
|
198
|
+
};
|
|
199
|
+
return client.post(`${baseUrl}/users`, body);
|
|
200
|
+
},
|
|
201
|
+
addUserEmail: (userUuid: UUID, email: string, main?: boolean) => {
|
|
202
|
+
const body = {
|
|
203
|
+
emails: [{
|
|
204
|
+
address: email,
|
|
205
|
+
main,
|
|
206
|
+
}],
|
|
207
|
+
};
|
|
208
|
+
return client.put(`${baseUrl}/users/${userUuid}/emails`, body);
|
|
209
|
+
},
|
|
210
|
+
addUserPolicy: (userUuid: UUID, policyUuid: UUID) => client.put(`${baseUrl}/users/${userUuid}/policies/${policyUuid}`),
|
|
211
|
+
getRestrictionPolicies: (scopes: string[]) => client.post(`${baseUrl}/token/${client.token}/scopes/check`, {
|
|
212
|
+
scopes,
|
|
213
|
+
}),
|
|
214
|
+
deleteUserPolicy: (userUuid: UUID, policyUuid: UUID) => client.delete(`${baseUrl}/users/${userUuid}/policies/${policyUuid}`),
|
|
215
|
+
addUserGroup: (userUuid: UUID, groupUuid: UUID) => client.put(`${baseUrl}/groups/${groupUuid}/users/${userUuid}`),
|
|
216
|
+
listUsersGroup: (groupUuid: UUID) => client.get(`${baseUrl}/groups/${groupUuid}/users`),
|
|
217
|
+
deleteUserGroup: (userUuid: UUID, groupUuid: UUID) => client.delete(`${baseUrl}/groups/${groupUuid}/users/${userUuid}`),
|
|
218
|
+
getUser: (userUuid: UUID): Promise<GetUserResponse> => client.get(`${baseUrl}/users/${userUuid}`),
|
|
219
|
+
getUserSession: (userUuid: UUID) => client.get(`${baseUrl}/users/${userUuid}/sessions`),
|
|
220
|
+
deleteUserSession: (userUuid: UUID, sessionUuids: UUID) => client.delete(`${baseUrl}/users/${userUuid}/sessions/${sessionUuids}`),
|
|
221
|
+
listUsers: (): Promise<ListUsersResponse> => client.get(`${baseUrl}/users`),
|
|
222
|
+
deleteUser: (userUuid: UUID): Promise<boolean | RequestError> => client.delete(`${baseUrl}/users/${userUuid}`),
|
|
223
|
+
listTenants: (): Promise<ListTenantsResponse> => client.get(`${baseUrl}/tenants`),
|
|
224
|
+
getTenant: (tenantUuid: UUID): Promise<GetTenantResponse> => client.get(`${baseUrl}/tenants/${tenantUuid}`),
|
|
225
|
+
createTenant: (name: string): Promise<Tenant | RequestError> => client.post(`${baseUrl}/tenants`, {
|
|
226
|
+
name,
|
|
227
|
+
}),
|
|
228
|
+
updateTenant: (uuid: UUID, name: string, contact: string, phone: string, address: Array<Record<string, any>>): Promise<Tenant | RequestError> => {
|
|
229
|
+
const body = {
|
|
230
|
+
name,
|
|
231
|
+
contact,
|
|
232
|
+
phone,
|
|
233
|
+
address,
|
|
234
|
+
};
|
|
235
|
+
return client.put(`${baseUrl}/tenants/${uuid}`, body);
|
|
236
|
+
},
|
|
237
|
+
deleteTenant: (uuid: UUID): Promise<boolean | RequestError> => client.delete(`${baseUrl}/tenants/${uuid}`),
|
|
238
|
+
createGroup: (name: string) => client.post(`${baseUrl}/groups`, {
|
|
239
|
+
name,
|
|
240
|
+
}),
|
|
241
|
+
listGroups: (): Promise<ListGroupsResponse> => client.get(`${baseUrl}/groups`),
|
|
242
|
+
deleteGroup: (uuid: UUID): Promise<boolean | RequestError> => client.delete(`${baseUrl}/groups/${uuid}`),
|
|
243
|
+
createPolicy: (name: string, description: string, aclTemplates: Array<Record<string, any>>) => {
|
|
244
|
+
const body = {
|
|
245
|
+
name,
|
|
246
|
+
description,
|
|
247
|
+
acl_templates: aclTemplates,
|
|
248
|
+
// deprecated
|
|
249
|
+
acl: aclTemplates,
|
|
250
|
+
};
|
|
251
|
+
return client.post(`${baseUrl}/policies`, body);
|
|
252
|
+
},
|
|
253
|
+
listPolicies: (): Promise<ListPoliciesResponse> => client.get(`${baseUrl}/policies`),
|
|
254
|
+
deletePolicy: (policyUuid: UUID): Promise<boolean | RequestError> => client.delete(`${baseUrl}/policies/${policyUuid}`),
|
|
255
|
+
getProviders: (userUuid: UUID) => client.get(`${baseUrl}/users/${userUuid}/external`),
|
|
256
|
+
getProviderToken: (userUuid: UUID, provider: string) => client.get(`${baseUrl}/users/${userUuid}/external/${provider}`),
|
|
257
|
+
getProviderAuthUrl: (userUuid: UUID, provider: string) => client.post(`${baseUrl}/users/${userUuid}/external/${provider}`, {}),
|
|
258
|
+
deleteProviderToken: (userUuid: UUID, provider: string) => client.delete(`${baseUrl}/users/${userUuid}/external/${provider}`),
|
|
259
|
+
}));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import ApiRequester from '../utils/api-requester';
|
|
2
|
+
import CallLog from '../domain/CallLog';
|
|
3
|
+
|
|
4
|
+
export interface CallLogD {
|
|
5
|
+
search: (search: string, limit: number) => Promise<Array<CallLog>>;
|
|
6
|
+
searchBy: (field: string, value: string, limit: number) => Promise<Array<CallLog>>;
|
|
7
|
+
listCallLogs: (offset?: number, limit?: number) => Promise<Array<CallLog>>;
|
|
8
|
+
listDistinctCallLogs: (offset: number, limit: number, distinct?: string) => Promise<Array<CallLog>>;
|
|
9
|
+
listCallLogsFromDate: (from: Date, number: string) => Promise<Array<CallLog>>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default ((client: ApiRequester, baseUrl: string): CallLogD => ({
|
|
13
|
+
search: (search: string, limit = 5): Promise<Array<CallLog>> => client.get(`${baseUrl}/users/me/cdr`, {
|
|
14
|
+
search,
|
|
15
|
+
limit,
|
|
16
|
+
}).then(CallLog.parseMany),
|
|
17
|
+
|
|
18
|
+
searchBy: (field: string, value: string, limit = 5): Promise<Array<CallLog>> => client.get(`${baseUrl}/users/me/cdr`, {
|
|
19
|
+
[field]: value,
|
|
20
|
+
limit,
|
|
21
|
+
}).then(CallLog.parseMany),
|
|
22
|
+
|
|
23
|
+
listCallLogs: (offset?: number, limit = 5): Promise<Array<CallLog>> => client.get(`${baseUrl}/users/me/cdr`, {
|
|
24
|
+
offset,
|
|
25
|
+
limit,
|
|
26
|
+
}).then(CallLog.parseMany),
|
|
27
|
+
|
|
28
|
+
listDistinctCallLogs: (offset: number, limit = 5, distinct = undefined): Promise<Array<CallLog>> => client.get(`${baseUrl}/users/me/cdr`, {
|
|
29
|
+
offset,
|
|
30
|
+
limit,
|
|
31
|
+
distinct,
|
|
32
|
+
}).then(CallLog.parseMany),
|
|
33
|
+
|
|
34
|
+
listCallLogsFromDate: (from: Date, number: string): Promise<Array<CallLog>> => client.get(`${baseUrl}/users/me/cdr`, {
|
|
35
|
+
from: from.toISOString(),
|
|
36
|
+
number,
|
|
37
|
+
}).then(CallLog.parseMany),
|
|
38
|
+
}));
|
package/src/api/calld.ts
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
import ApiRequester from '../utils/api-requester';
|
|
3
|
+
import type { UUID, RequestError } from '../domain/types';
|
|
4
|
+
import Relocation, { RelocationResponse } from '../domain/Relocation';
|
|
5
|
+
import ChatMessage, { ChatMessageListResponse } from '../domain/ChatMessage';
|
|
6
|
+
import Voicemail from '../domain/Voicemail';
|
|
7
|
+
import Call, { CallResponse } from '../domain/Call';
|
|
8
|
+
import IndirectTransfer from '../domain/IndirectTransfer';
|
|
9
|
+
import MeetingStatus from '../domain/MeetingStatus';
|
|
10
|
+
|
|
11
|
+
type CallQuery = {
|
|
12
|
+
from_mobile: boolean;
|
|
13
|
+
extension: string;
|
|
14
|
+
line_id?: number;
|
|
15
|
+
all_lines?: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export interface CallD {
|
|
19
|
+
updatePresence: (presence: string) => Promise<boolean>;
|
|
20
|
+
listMessages: (participantUuid: UUID | null | undefined, limit?: number) => Promise<Array<ChatMessage>>;
|
|
21
|
+
sendMessage: (alias: string, msg: string, toUserId: string) => Promise<boolean>;
|
|
22
|
+
makeCall: (extension: string, fromMobile: boolean, lineId: number | null | undefined, allLines: boolean | null | undefined) => Promise<CallResponse>;
|
|
23
|
+
cancelCall: (callId: string) => Promise<boolean>;
|
|
24
|
+
listCalls: () => Promise<Array<Call>>;
|
|
25
|
+
relocateCall: (callId: string, destination: string, lineId: number | null | undefined, contact?: string | null | undefined) => Promise<Relocation>;
|
|
26
|
+
listVoicemails: () => Promise<RequestError | Array<Voicemail>>;
|
|
27
|
+
deleteVoicemail: (voicemailId: number) => Promise<boolean>;
|
|
28
|
+
getVoicemailUrl: (voicemail: Voicemail) => string;
|
|
29
|
+
fetchSwitchboardHeldCalls: (switchboardUuid: UUID) => Promise<any>; // @TODO: replace `any`
|
|
30
|
+
holdSwitchboardCall: (switchboardUuid: UUID, callId: string) => Promise<boolean>;
|
|
31
|
+
answerSwitchboardHeldCall: (switchboardUuid: UUID, callId: string, lineId: string | null | undefined) => Promise<void>;
|
|
32
|
+
fetchSwitchboardQueuedCalls: (switchboardUuid: UUID) => Promise<any>; // @TODO: replace `any`
|
|
33
|
+
answerSwitchboardQueuedCall: (switchboardUuid: UUID, callId: string, lineId: string | null | undefined) => Promise<any>; // @TODO: replace `any`
|
|
34
|
+
sendFax: (extension: string, fax: string, callerId: string | null | undefined) => Promise<void>;
|
|
35
|
+
getConferenceParticipantsAsUser: (conferenceId: string) => Promise<Record<string, any>>; // @TODO: replace `any`
|
|
36
|
+
getMeetingParticipantsAsUser: (meetingUuid: string) => Promise<Record<string, any>>; // @TODO: replace `any`
|
|
37
|
+
banMeetingParticipant: (meetingUuid: string, participantUuid: string) => Promise<boolean>;
|
|
38
|
+
listTrunks: () => Promise<any>;
|
|
39
|
+
mute: (callId: string) => Promise<boolean>;
|
|
40
|
+
unmute: (callId: string) => Promise<boolean>;
|
|
41
|
+
hold: (callId: string) => Promise<boolean>;
|
|
42
|
+
resume: (callId: string) => Promise<boolean>;
|
|
43
|
+
// eslint-disable-next-line camelcase
|
|
44
|
+
transferCall: (initiator_call: string, exten: string, flow: string) => Promise<IndirectTransfer>;
|
|
45
|
+
confirmCallTransfer: (transferId: string) => Promise<boolean>;
|
|
46
|
+
cancelCallTransfer: (transferId: string) => Promise<boolean>;
|
|
47
|
+
sendDTMF: (callId: string, digits: string) => Promise<boolean>;
|
|
48
|
+
// @deprecated: check for engine version >= 20.12 instead
|
|
49
|
+
isAhHocConferenceAPIEnabled: () => Promise<boolean>;
|
|
50
|
+
createAdHocConference: (hostCallId: string, participantCallIds: string[]) => Promise<any>; // @TODO: replace `any`
|
|
51
|
+
addAdHocConferenceParticipant: (conferenceId: string, callId: string) => Promise<boolean>;
|
|
52
|
+
removeAdHocConferenceParticipant: (conferenceId: string, participantCallId: string) => Promise<boolean>;
|
|
53
|
+
deleteAdHocConference: (conferenceId: string) => Promise<boolean>;
|
|
54
|
+
startRecording: (callId: string) => Promise<boolean>;
|
|
55
|
+
stopRecording: (callId: string) => Promise<boolean>;
|
|
56
|
+
pauseRecording: (callId: string) => Promise<boolean>;
|
|
57
|
+
resumeRecording: (callId: string) => Promise<boolean>;
|
|
58
|
+
guestGetMeetingStatus: (meetingUuid: string) => Promise<MeetingStatus>
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default ((client: ApiRequester, baseUrl: string): CallD => ({
|
|
62
|
+
updatePresence: (presence: string): Promise<boolean> => client.put(`${baseUrl}/users/me/presences`, {
|
|
63
|
+
presence,
|
|
64
|
+
}, null, ApiRequester.successResponseParser),
|
|
65
|
+
listMessages: (participantUuid: UUID | null | undefined, limit?: number): Promise<Array<ChatMessage>> => {
|
|
66
|
+
const query: Record<string, any> = {};
|
|
67
|
+
|
|
68
|
+
if (participantUuid) {
|
|
69
|
+
query.participant_user_uuid = participantUuid;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (limit) {
|
|
73
|
+
query.limit = limit;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return client.get(`${baseUrl}/users/me/chats`, query).then((response: ChatMessageListResponse) => ChatMessage.parseMany(response));
|
|
77
|
+
},
|
|
78
|
+
sendMessage: (alias: string, msg: string, toUserId: string) => {
|
|
79
|
+
const body = {
|
|
80
|
+
alias,
|
|
81
|
+
msg,
|
|
82
|
+
to: toUserId,
|
|
83
|
+
};
|
|
84
|
+
return client.post(`${baseUrl}/users/me/chats`, body, null, ApiRequester.successResponseParser);
|
|
85
|
+
},
|
|
86
|
+
makeCall: (extension: string, fromMobile: boolean, lineId: number | null | undefined, allLines: boolean | null | undefined = false): Promise<CallResponse> => {
|
|
87
|
+
const query: CallQuery = {
|
|
88
|
+
from_mobile: fromMobile,
|
|
89
|
+
extension,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
if (lineId) {
|
|
93
|
+
query.line_id = lineId;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (allLines) {
|
|
97
|
+
query.all_lines = true;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return client.post(`${baseUrl}/users/me/calls`, query);
|
|
101
|
+
},
|
|
102
|
+
cancelCall: (callId: string): Promise<boolean> => client.delete(`${baseUrl}/users/me/calls/${callId}`, null),
|
|
103
|
+
listCalls: (): Promise<Array<Call>> => client.get(`${baseUrl}/users/me/calls`, null).then((response: any) => Call.parseMany(response.items)),
|
|
104
|
+
|
|
105
|
+
relocateCall(callId: string, destination: string, lineId: number | null | undefined, contact?: string | null | undefined): Promise<Relocation> {
|
|
106
|
+
const body: Record<string, any> = {
|
|
107
|
+
completions: ['answer'],
|
|
108
|
+
destination,
|
|
109
|
+
initiator_call: callId,
|
|
110
|
+
auto_answer: true,
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
if (lineId || contact) {
|
|
114
|
+
body.location = {};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (lineId) {
|
|
118
|
+
body.location.line_id = lineId;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (contact) {
|
|
122
|
+
body.location.contact = contact;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return client.post(`${baseUrl}/users/me/relocates`, body).then((response: RelocationResponse) => Relocation.parse(response));
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
listVoicemails: (): Promise<RequestError | Array<Voicemail>> => client.get(`${baseUrl}/users/me/voicemails`).then((response: any) => Voicemail.parseMany(response)),
|
|
129
|
+
deleteVoicemail: (voicemailId: number): Promise<boolean> => client.delete(`${baseUrl}/users/me/voicemails/messages/${voicemailId}`),
|
|
130
|
+
getVoicemailUrl: (voicemail: Voicemail): string => {
|
|
131
|
+
const body = {
|
|
132
|
+
token: client.token,
|
|
133
|
+
};
|
|
134
|
+
return client.computeUrl('get', `${baseUrl}/users/me/voicemails/messages/${voicemail.id}/recording`, body);
|
|
135
|
+
},
|
|
136
|
+
fetchSwitchboardHeldCalls: (switchboardUuid: UUID) => client.get(`${baseUrl}/switchboards/${switchboardUuid}/calls/held`),
|
|
137
|
+
holdSwitchboardCall: (switchboardUuid: UUID, callId: string) => client.put(`${baseUrl}/switchboards/${switchboardUuid}/calls/held/${callId}`, null, null, ApiRequester.successResponseParser),
|
|
138
|
+
answerSwitchboardHeldCall: (switchboardUuid: UUID, callId: string, lineId: string | null | undefined = null) => client.put(`${baseUrl}/switchboards/${switchboardUuid}/calls/held/${callId}/answer${lineId ? `?line_id=${lineId}` : ''}`),
|
|
139
|
+
fetchSwitchboardQueuedCalls: (switchboardUuid: UUID) => client.get(`${baseUrl}/switchboards/${switchboardUuid}/calls/queued`),
|
|
140
|
+
answerSwitchboardQueuedCall: (switchboardUuid: UUID, callId: string, lineId: string | null | undefined = null) => client.put(`${baseUrl}/switchboards/${switchboardUuid}/calls/queued/${callId}/answer${lineId ? `?line_id=${lineId}` : ''}`),
|
|
141
|
+
sendFax: (extension: string, fax: string, callerId: string | null | undefined = null) => {
|
|
142
|
+
const headers = {
|
|
143
|
+
'Content-type': 'application/pdf',
|
|
144
|
+
'X-Auth-Token': client.token,
|
|
145
|
+
};
|
|
146
|
+
const params = ApiRequester.getQueryString({
|
|
147
|
+
extension,
|
|
148
|
+
caller_id: callerId,
|
|
149
|
+
});
|
|
150
|
+
return client.post(`${baseUrl}/users/me/faxes?${params}`, fax, headers);
|
|
151
|
+
},
|
|
152
|
+
getConferenceParticipantsAsUser: async (conferenceId: string): Promise<Record<string, any>> => client.get(`${baseUrl}/users/me/conferences/${conferenceId}/participants`),
|
|
153
|
+
getMeetingParticipantsAsUser: async (meetingUuid: string): Promise<Record<string, any>> => client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
|
|
154
|
+
banMeetingParticipant: (meetingUuid: string, participantUuid: string) => client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}/participants/${participantUuid}`, null, null, ApiRequester.successResponseParser),
|
|
155
|
+
listTrunks: () => client.get(`${baseUrl}/trunks`),
|
|
156
|
+
mute: (callId: string) => client.put(`${baseUrl}/users/me/calls/${callId}/mute/start`, null, null, ApiRequester.successResponseParser),
|
|
157
|
+
unmute: (callId: string) => client.put(`${baseUrl}/users/me/calls/${callId}/mute/stop`, null, null, ApiRequester.successResponseParser),
|
|
158
|
+
hold: (callId: string) => client.put(`${baseUrl}/users/me/calls/${callId}/hold/start`, null, null, ApiRequester.successResponseParser),
|
|
159
|
+
resume: (callId: string) => client.put(`${baseUrl}/users/me/calls/${callId}/hold/stop`, null, null, ApiRequester.successResponseParser),
|
|
160
|
+
// eslint-disable-next-line camelcase
|
|
161
|
+
transferCall: (initiator_call: string, exten: string, flow: string) => client.post(`${baseUrl}/users/me/transfers`, {
|
|
162
|
+
initiator_call,
|
|
163
|
+
exten,
|
|
164
|
+
flow,
|
|
165
|
+
}).then(IndirectTransfer.parseFromApi),
|
|
166
|
+
confirmCallTransfer: (transferId: string): Promise<boolean> => client.put(`${baseUrl}/users/me/transfers/${transferId}/complete`, null, null, ApiRequester.successResponseParser),
|
|
167
|
+
cancelCallTransfer: (transferId: string): Promise<boolean> => client.delete(`${baseUrl}/users/me/transfers/${transferId}`, null, null, ApiRequester.successResponseParser),
|
|
168
|
+
sendDTMF: (callId: string, digits: string) => client.put(`${baseUrl}/users/me/calls/${callId}/dtmf?digits=${encodeURIComponent(digits)}`, null, null, ApiRequester.successResponseParser),
|
|
169
|
+
// @deprecated: check for engine version >= 20.12 instead
|
|
170
|
+
isAhHocConferenceAPIEnabled: () => client.head(`${baseUrl}/users/me/conferences/adhoc`, null, null, ApiRequester.successResponseParser),
|
|
171
|
+
createAdHocConference: (hostCallId: string, participantCallIds: string[]) => client.post(`${baseUrl}/users/me/conferences/adhoc`, {
|
|
172
|
+
host_call_id: hostCallId,
|
|
173
|
+
participant_call_ids: participantCallIds,
|
|
174
|
+
}),
|
|
175
|
+
addAdHocConferenceParticipant: (conferenceId: string, callId: string) => client.put(`${baseUrl}/users/me/conferences/adhoc/${conferenceId}/participants/${callId}`, null, null, ApiRequester.successResponseParser),
|
|
176
|
+
removeAdHocConferenceParticipant: (conferenceId: string, participantCallId: string) => client.delete(`${baseUrl}/users/me/conferences/adhoc/${conferenceId}/participants/${participantCallId}`, null, null, ApiRequester.successResponseParser),
|
|
177
|
+
deleteAdHocConference: (conferenceId: string) => client.delete(`${baseUrl}/users/me/conferences/adhoc/${conferenceId}`, null, null, ApiRequester.successResponseParser),
|
|
178
|
+
startRecording: (callId: string) => client.put(`${baseUrl}/users/me/calls/${callId}/record/start`, null, null, ApiRequester.successResponseParser),
|
|
179
|
+
stopRecording: (callId: string) => client.put(`${baseUrl}/users/me/calls/${callId}/record/stop`, null, null, ApiRequester.successResponseParser),
|
|
180
|
+
pauseRecording: (callId: string) => client.put(`${baseUrl}/users/me/calls/${callId}/record/pause`, null, null, ApiRequester.successResponseParser),
|
|
181
|
+
resumeRecording: (callId: string) => client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null, ApiRequester.successResponseParser),
|
|
182
|
+
guestGetMeetingStatus: (meetingUuid: string): Promise<MeetingStatus> => client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
183
|
+
}));
|