rcs-js 2.0.21 → 2.0.23-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Client.d.ts +6 -0
- package/dist/cjs/Client.js +32 -22
- package/dist/cjs/api/errors/BadGatewayError.d.ts +6 -0
- package/dist/cjs/api/errors/BadGatewayError.js +50 -0
- package/dist/cjs/api/errors/ConflictError.d.ts +6 -0
- package/dist/cjs/api/errors/ConflictError.js +50 -0
- package/dist/cjs/api/errors/GoneError.d.ts +6 -0
- package/dist/cjs/api/errors/GoneError.js +50 -0
- package/dist/cjs/api/errors/ServiceUnavailableError.d.ts +6 -0
- package/dist/cjs/api/errors/ServiceUnavailableError.js +50 -0
- package/dist/cjs/api/errors/TooEarlyError.d.ts +6 -0
- package/dist/cjs/api/errors/TooEarlyError.js +50 -0
- package/dist/cjs/api/errors/UnprocessableEntityError.d.ts +6 -0
- package/dist/cjs/api/errors/UnprocessableEntityError.js +50 -0
- package/dist/cjs/api/errors/index.d.ts +6 -0
- package/dist/cjs/api/errors/index.js +6 -0
- package/dist/cjs/api/resources/calls/client/Client.d.ts +181 -0
- package/dist/cjs/api/resources/calls/client/Client.js +788 -0
- package/dist/cjs/api/resources/calls/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/calls/client/index.js +17 -0
- package/dist/cjs/api/resources/calls/client/requests/CallsDownloadRecordingRequest.d.ts +8 -0
- package/dist/cjs/api/resources/calls/client/requests/CallsDownloadRecordingRequest.js +3 -0
- package/dist/cjs/api/resources/calls/client/requests/CallsListEventsRequest.d.ts +10 -0
- package/dist/cjs/api/resources/calls/client/requests/CallsListEventsRequest.js +3 -0
- package/dist/cjs/api/resources/calls/client/requests/CallsListRequest.d.ts +17 -0
- package/dist/cjs/api/resources/calls/client/requests/CallsListRequest.js +3 -0
- package/dist/cjs/api/resources/calls/client/requests/CreateCallParams.d.ts +17 -0
- package/dist/cjs/api/resources/calls/client/requests/CreateCallParams.js +3 -0
- package/dist/cjs/api/resources/calls/client/requests/CreateStreamTokenParams.d.ts +12 -0
- package/dist/cjs/api/resources/calls/client/requests/CreateStreamTokenParams.js +3 -0
- package/dist/cjs/api/resources/calls/client/requests/UpdateCallParams.d.ts +12 -0
- package/dist/cjs/api/resources/calls/client/requests/UpdateCallParams.js +3 -0
- package/dist/cjs/api/resources/calls/client/requests/index.d.ts +6 -0
- package/dist/cjs/api/resources/calls/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/calls/index.d.ts +1 -0
- package/dist/cjs/api/resources/calls/index.js +17 -0
- package/dist/cjs/api/resources/forms/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/forms/client/Client.js +1 -1
- package/dist/cjs/api/resources/index.d.ts +3 -0
- package/dist/cjs/api/resources/index.js +4 -1
- package/dist/cjs/api/resources/network/client/Client.d.ts +21 -0
- package/dist/cjs/api/resources/network/client/Client.js +30 -0
- package/dist/cjs/api/resources/network/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/network/client/index.js +2 -0
- package/dist/cjs/api/resources/network/index.d.ts +2 -0
- package/dist/cjs/api/resources/network/index.js +18 -0
- package/dist/cjs/api/resources/network/resources/index.d.ts +8 -0
- package/dist/cjs/api/resources/network/resources/index.js +47 -0
- package/dist/cjs/api/resources/network/resources/requests/client/Client.d.ts +61 -0
- package/dist/cjs/api/resources/network/resources/requests/client/Client.js +223 -0
- package/dist/cjs/api/resources/network/resources/requests/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/network/resources/requests/client/index.js +17 -0
- package/dist/cjs/api/resources/network/resources/requests/client/requests/ListNetworkRequestsParams.d.ts +21 -0
- package/dist/cjs/api/resources/network/resources/requests/client/requests/ListNetworkRequestsParams.js +3 -0
- package/dist/cjs/api/resources/network/resources/requests/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/network/resources/requests/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/network/resources/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/network/resources/requests/index.js +17 -0
- package/dist/cjs/api/resources/network/resources/silentAuth/client/Client.d.ts +71 -0
- package/dist/cjs/api/resources/network/resources/silentAuth/client/Client.js +234 -0
- package/dist/cjs/api/resources/network/resources/silentAuth/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/network/resources/silentAuth/client/index.js +17 -0
- package/dist/cjs/api/resources/network/resources/silentAuth/client/requests/SilentAuthCheckRequest.d.ts +10 -0
- package/dist/cjs/api/resources/network/resources/silentAuth/client/requests/SilentAuthCheckRequest.js +3 -0
- package/dist/cjs/api/resources/network/resources/silentAuth/client/requests/SilentAuthRequest.d.ts +34 -0
- package/dist/cjs/api/resources/network/resources/silentAuth/client/requests/SilentAuthRequest.js +3 -0
- package/dist/cjs/api/resources/network/resources/silentAuth/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/network/resources/silentAuth/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/network/resources/silentAuth/index.d.ts +1 -0
- package/dist/cjs/api/resources/network/resources/silentAuth/index.js +17 -0
- package/dist/cjs/api/resources/network/resources/simSwap/client/Client.d.ts +37 -0
- package/dist/cjs/api/resources/network/resources/simSwap/client/Client.js +143 -0
- package/dist/cjs/api/resources/network/resources/simSwap/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/network/resources/simSwap/client/index.js +17 -0
- package/dist/cjs/api/resources/network/resources/simSwap/client/requests/SimSwapRequest.d.ts +13 -0
- package/dist/cjs/api/resources/network/resources/simSwap/client/requests/SimSwapRequest.js +3 -0
- package/dist/cjs/api/resources/network/resources/simSwap/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/network/resources/simSwap/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/network/resources/simSwap/index.d.ts +1 -0
- package/dist/cjs/api/resources/network/resources/simSwap/index.js +17 -0
- package/dist/cjs/api/resources/network/resources/subscriberMatch/client/Client.d.ts +47 -0
- package/dist/cjs/api/resources/network/resources/subscriberMatch/client/Client.js +153 -0
- package/dist/cjs/api/resources/network/resources/subscriberMatch/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/network/resources/subscriberMatch/client/index.js +17 -0
- package/dist/cjs/api/resources/network/resources/subscriberMatch/client/requests/SubscriberMatchRequest.d.ts +22 -0
- package/dist/cjs/api/resources/network/resources/subscriberMatch/client/requests/SubscriberMatchRequest.js +3 -0
- package/dist/cjs/api/resources/network/resources/subscriberMatch/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/network/resources/subscriberMatch/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/network/resources/subscriberMatch/index.d.ts +1 -0
- package/dist/cjs/api/resources/network/resources/subscriberMatch/index.js +17 -0
- package/dist/cjs/api/resources/voiceStreams/index.d.ts +1 -0
- package/dist/cjs/api/resources/voiceStreams/index.js +17 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceClientFrame.d.ts +10 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceClientFrame.js +3 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceClientMedia.d.ts +10 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceClientMedia.js +3 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceClientMediaFrame.d.ts +11 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceClientMediaFrame.js +10 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceCommandAckFrame.d.ts +22 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceCommandAckFrame.js +14 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceCommandAction.d.ts +15 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceCommandAction.js +18 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceCommandFrame.d.ts +15 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceCommandFrame.js +10 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceConnectedFrame.d.ts +11 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceConnectedFrame.js +10 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceEventFrame.d.ts +15 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceEventFrame.js +10 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceMediaTrack.d.ts +5 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceMediaTrack.js +8 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceServerFrame.d.ts +16 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceServerFrame.js +3 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceServerMedia.d.ts +10 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceServerMedia.js +3 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceServerMediaFrame.d.ts +13 -0
- package/dist/cjs/api/resources/voiceStreams/types/VoiceServerMediaFrame.js +10 -0
- package/dist/cjs/api/resources/voiceStreams/types/index.d.ts +12 -0
- package/dist/cjs/api/resources/voiceStreams/types/index.js +28 -0
- package/dist/cjs/api/types/AgentSummary.d.ts +2 -2
- package/dist/cjs/api/types/Call.d.ts +16 -0
- package/dist/cjs/api/types/Call.js +3 -0
- package/dist/cjs/api/types/CallDirection.d.ts +11 -0
- package/dist/cjs/api/types/CallDirection.js +14 -0
- package/dist/cjs/api/types/CallEvent.d.ts +15 -0
- package/dist/cjs/api/types/CallEvent.js +3 -0
- package/dist/cjs/api/types/CallEventSource.d.ts +8 -0
- package/dist/cjs/api/types/CallEventSource.js +11 -0
- package/dist/cjs/api/types/CallMetadata.d.ts +4 -0
- package/dist/cjs/api/types/CallMetadata.js +3 -0
- package/dist/cjs/api/types/CallState.d.ts +25 -0
- package/dist/cjs/api/types/CallState.js +28 -0
- package/dist/cjs/api/types/CallStatusEvent.d.ts +41 -0
- package/dist/cjs/api/types/CallStatusEvent.js +3 -0
- package/dist/cjs/api/types/CallStreamToken.d.ts +7 -0
- package/dist/cjs/api/types/CallStreamToken.js +3 -0
- package/dist/cjs/api/types/CreatedCall.d.ts +18 -0
- package/dist/cjs/api/types/CreatedCall.js +3 -0
- package/dist/cjs/api/types/E164PhoneNumber.d.ts +4 -0
- package/dist/cjs/api/types/E164PhoneNumber.js +3 -0
- package/dist/cjs/api/types/HostedSilentAuthResponse.d.ts +8 -0
- package/dist/cjs/api/types/HostedSilentAuthResponse.js +3 -0
- package/dist/cjs/api/types/JsonSilentAuthResponse.d.ts +8 -0
- package/dist/cjs/api/types/JsonSilentAuthResponse.js +3 -0
- package/dist/cjs/api/types/ListCallEventsResponse.d.ts +5 -0
- package/dist/cjs/api/types/ListCallEventsResponse.js +3 -0
- package/dist/cjs/api/types/ListCallsResponse.d.ts +5 -0
- package/dist/cjs/api/types/ListCallsResponse.js +3 -0
- package/dist/cjs/api/types/ListNetworkRequestsResponse.d.ts +8 -0
- package/dist/cjs/api/types/ListNetworkRequestsResponse.js +3 -0
- package/dist/cjs/api/types/NetworkInsightStatus.d.ts +8 -0
- package/dist/cjs/api/types/NetworkInsightStatus.js +11 -0
- package/dist/cjs/api/types/NetworkRequestId.d.ts +4 -0
- package/dist/cjs/api/types/NetworkRequestId.js +3 -0
- package/dist/cjs/api/types/NetworkRequestResult.d.ts +5 -0
- package/dist/cjs/api/types/NetworkRequestResult.js +3 -0
- package/dist/cjs/api/types/NetworkRequestStatus.d.ts +9 -0
- package/dist/cjs/api/types/NetworkRequestStatus.js +12 -0
- package/dist/cjs/api/types/NetworkRequestSummary.d.ts +19 -0
- package/dist/cjs/api/types/NetworkRequestSummary.js +3 -0
- package/dist/cjs/api/types/NetworkRequestType.d.ts +7 -0
- package/dist/cjs/api/types/NetworkRequestType.js +10 -0
- package/dist/cjs/api/types/RecordingDownload.d.ts +5 -0
- package/dist/cjs/api/types/RecordingDownload.js +3 -0
- package/dist/cjs/api/types/RecordingState.d.ts +15 -0
- package/dist/cjs/api/types/RecordingState.js +18 -0
- package/dist/cjs/api/types/SilentAuthCheckResponse.d.ts +14 -0
- package/dist/cjs/api/types/SilentAuthCheckResponse.js +12 -0
- package/dist/cjs/api/types/SilentAuthResponse.d.ts +10 -0
- package/dist/cjs/api/types/SilentAuthResponse.js +3 -0
- package/dist/cjs/api/types/SimSwapResponse.d.ts +9 -0
- package/dist/cjs/api/types/SimSwapResponse.js +3 -0
- package/dist/cjs/api/types/SubscriberMatchAttributes.d.ts +27 -0
- package/dist/cjs/api/types/SubscriberMatchAttributes.js +3 -0
- package/dist/cjs/api/types/SubscriberMatchResponse.d.ts +46 -0
- package/dist/cjs/api/types/SubscriberMatchResponse.js +3 -0
- package/dist/cjs/api/types/SubscriberMatchResult.d.ts +12 -0
- package/dist/cjs/api/types/SubscriberMatchResult.js +15 -0
- package/dist/cjs/api/types/WebhookEventEnum.d.ts +1 -0
- package/dist/cjs/api/types/WebhookEventEnum.js +1 -0
- package/dist/cjs/api/types/index.d.ts +29 -0
- package/dist/cjs/api/types/index.js +29 -0
- package/dist/cjs/index.d.ts +6 -1
- package/dist/cjs/index.js +12 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wrapper/PinnacleClient.d.ts +4 -1
- package/dist/cjs/wrapper/PinnacleClient.js +17 -6
- package/dist/cjs/wrapper/messages/Client.d.ts +1 -1
- package/dist/cjs/wrapper/voice/Client.d.ts +34 -0
- package/dist/cjs/wrapper/voice/Client.js +147 -0
- package/dist/cjs/wrapper/voice/VoiceSocket.d.ts +98 -0
- package/dist/cjs/wrapper/voice/VoiceSocket.js +371 -0
- package/dist/cjs/wrapper/voice/types.d.ts +199 -0
- package/dist/cjs/wrapper/voice/types.js +35 -0
- package/dist/esm/Client.d.mts +6 -0
- package/dist/esm/Client.mjs +12 -2
- package/dist/esm/api/errors/BadGatewayError.d.mts +6 -0
- package/dist/esm/api/errors/BadGatewayError.mjs +13 -0
- package/dist/esm/api/errors/ConflictError.d.mts +6 -0
- package/dist/esm/api/errors/ConflictError.mjs +13 -0
- package/dist/esm/api/errors/GoneError.d.mts +6 -0
- package/dist/esm/api/errors/GoneError.mjs +13 -0
- package/dist/esm/api/errors/ServiceUnavailableError.d.mts +6 -0
- package/dist/esm/api/errors/ServiceUnavailableError.mjs +13 -0
- package/dist/esm/api/errors/TooEarlyError.d.mts +6 -0
- package/dist/esm/api/errors/TooEarlyError.mjs +13 -0
- package/dist/esm/api/errors/UnprocessableEntityError.d.mts +6 -0
- package/dist/esm/api/errors/UnprocessableEntityError.mjs +13 -0
- package/dist/esm/api/errors/index.d.mts +6 -0
- package/dist/esm/api/errors/index.mjs +6 -0
- package/dist/esm/api/resources/calls/client/Client.d.mts +181 -0
- package/dist/esm/api/resources/calls/client/Client.mjs +751 -0
- package/dist/esm/api/resources/calls/client/index.d.mts +1 -0
- package/dist/esm/api/resources/calls/client/index.mjs +1 -0
- package/dist/esm/api/resources/calls/client/requests/CallsDownloadRecordingRequest.d.mts +8 -0
- package/dist/esm/api/resources/calls/client/requests/CallsDownloadRecordingRequest.mjs +2 -0
- package/dist/esm/api/resources/calls/client/requests/CallsListEventsRequest.d.mts +10 -0
- package/dist/esm/api/resources/calls/client/requests/CallsListEventsRequest.mjs +2 -0
- package/dist/esm/api/resources/calls/client/requests/CallsListRequest.d.mts +17 -0
- package/dist/esm/api/resources/calls/client/requests/CallsListRequest.mjs +2 -0
- package/dist/esm/api/resources/calls/client/requests/CreateCallParams.d.mts +17 -0
- package/dist/esm/api/resources/calls/client/requests/CreateCallParams.mjs +2 -0
- package/dist/esm/api/resources/calls/client/requests/CreateStreamTokenParams.d.mts +12 -0
- package/dist/esm/api/resources/calls/client/requests/CreateStreamTokenParams.mjs +2 -0
- package/dist/esm/api/resources/calls/client/requests/UpdateCallParams.d.mts +12 -0
- package/dist/esm/api/resources/calls/client/requests/UpdateCallParams.mjs +2 -0
- package/dist/esm/api/resources/calls/client/requests/index.d.mts +6 -0
- package/dist/esm/api/resources/calls/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/calls/index.d.mts +1 -0
- package/dist/esm/api/resources/calls/index.mjs +1 -0
- package/dist/esm/api/resources/forms/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/forms/client/Client.mjs +1 -1
- package/dist/esm/api/resources/index.d.mts +3 -0
- package/dist/esm/api/resources/index.mjs +3 -0
- package/dist/esm/api/resources/network/client/Client.d.mts +21 -0
- package/dist/esm/api/resources/network/client/Client.mjs +26 -0
- package/dist/esm/api/resources/network/client/index.d.mts +1 -0
- package/dist/esm/api/resources/network/client/index.mjs +1 -0
- package/dist/esm/api/resources/network/index.d.mts +2 -0
- package/dist/esm/api/resources/network/index.mjs +2 -0
- package/dist/esm/api/resources/network/resources/index.d.mts +8 -0
- package/dist/esm/api/resources/network/resources/index.mjs +8 -0
- package/dist/esm/api/resources/network/resources/requests/client/Client.d.mts +61 -0
- package/dist/esm/api/resources/network/resources/requests/client/Client.mjs +186 -0
- package/dist/esm/api/resources/network/resources/requests/client/index.d.mts +1 -0
- package/dist/esm/api/resources/network/resources/requests/client/index.mjs +1 -0
- package/dist/esm/api/resources/network/resources/requests/client/requests/ListNetworkRequestsParams.d.mts +21 -0
- package/dist/esm/api/resources/network/resources/requests/client/requests/ListNetworkRequestsParams.mjs +2 -0
- package/dist/esm/api/resources/network/resources/requests/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/network/resources/requests/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/network/resources/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/network/resources/requests/index.mjs +1 -0
- package/dist/esm/api/resources/network/resources/silentAuth/client/Client.d.mts +71 -0
- package/dist/esm/api/resources/network/resources/silentAuth/client/Client.mjs +197 -0
- package/dist/esm/api/resources/network/resources/silentAuth/client/index.d.mts +1 -0
- package/dist/esm/api/resources/network/resources/silentAuth/client/index.mjs +1 -0
- package/dist/esm/api/resources/network/resources/silentAuth/client/requests/SilentAuthCheckRequest.d.mts +10 -0
- package/dist/esm/api/resources/network/resources/silentAuth/client/requests/SilentAuthCheckRequest.mjs +2 -0
- package/dist/esm/api/resources/network/resources/silentAuth/client/requests/SilentAuthRequest.d.mts +34 -0
- package/dist/esm/api/resources/network/resources/silentAuth/client/requests/SilentAuthRequest.mjs +2 -0
- package/dist/esm/api/resources/network/resources/silentAuth/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/network/resources/silentAuth/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/network/resources/silentAuth/index.d.mts +1 -0
- package/dist/esm/api/resources/network/resources/silentAuth/index.mjs +1 -0
- package/dist/esm/api/resources/network/resources/simSwap/client/Client.d.mts +37 -0
- package/dist/esm/api/resources/network/resources/simSwap/client/Client.mjs +106 -0
- package/dist/esm/api/resources/network/resources/simSwap/client/index.d.mts +1 -0
- package/dist/esm/api/resources/network/resources/simSwap/client/index.mjs +1 -0
- package/dist/esm/api/resources/network/resources/simSwap/client/requests/SimSwapRequest.d.mts +13 -0
- package/dist/esm/api/resources/network/resources/simSwap/client/requests/SimSwapRequest.mjs +2 -0
- package/dist/esm/api/resources/network/resources/simSwap/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/network/resources/simSwap/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/network/resources/simSwap/index.d.mts +1 -0
- package/dist/esm/api/resources/network/resources/simSwap/index.mjs +1 -0
- package/dist/esm/api/resources/network/resources/subscriberMatch/client/Client.d.mts +47 -0
- package/dist/esm/api/resources/network/resources/subscriberMatch/client/Client.mjs +116 -0
- package/dist/esm/api/resources/network/resources/subscriberMatch/client/index.d.mts +1 -0
- package/dist/esm/api/resources/network/resources/subscriberMatch/client/index.mjs +1 -0
- package/dist/esm/api/resources/network/resources/subscriberMatch/client/requests/SubscriberMatchRequest.d.mts +22 -0
- package/dist/esm/api/resources/network/resources/subscriberMatch/client/requests/SubscriberMatchRequest.mjs +2 -0
- package/dist/esm/api/resources/network/resources/subscriberMatch/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/network/resources/subscriberMatch/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/network/resources/subscriberMatch/index.d.mts +1 -0
- package/dist/esm/api/resources/network/resources/subscriberMatch/index.mjs +1 -0
- package/dist/esm/api/resources/voiceStreams/index.d.mts +1 -0
- package/dist/esm/api/resources/voiceStreams/index.mjs +1 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceClientFrame.d.mts +10 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceClientFrame.mjs +2 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceClientMedia.d.mts +10 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceClientMedia.mjs +2 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceClientMediaFrame.d.mts +11 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceClientMediaFrame.mjs +7 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceCommandAckFrame.d.mts +22 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceCommandAckFrame.mjs +11 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceCommandAction.d.mts +15 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceCommandAction.mjs +15 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceCommandFrame.d.mts +15 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceCommandFrame.mjs +7 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceConnectedFrame.d.mts +11 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceConnectedFrame.mjs +7 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceEventFrame.d.mts +15 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceEventFrame.mjs +7 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceMediaTrack.d.mts +5 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceMediaTrack.mjs +5 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceServerFrame.d.mts +16 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceServerFrame.mjs +2 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceServerMedia.d.mts +10 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceServerMedia.mjs +2 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceServerMediaFrame.d.mts +13 -0
- package/dist/esm/api/resources/voiceStreams/types/VoiceServerMediaFrame.mjs +7 -0
- package/dist/esm/api/resources/voiceStreams/types/index.d.mts +12 -0
- package/dist/esm/api/resources/voiceStreams/types/index.mjs +12 -0
- package/dist/esm/api/types/AgentSummary.d.mts +2 -2
- package/dist/esm/api/types/Call.d.mts +16 -0
- package/dist/esm/api/types/Call.mjs +2 -0
- package/dist/esm/api/types/CallDirection.d.mts +11 -0
- package/dist/esm/api/types/CallDirection.mjs +11 -0
- package/dist/esm/api/types/CallEvent.d.mts +15 -0
- package/dist/esm/api/types/CallEvent.mjs +2 -0
- package/dist/esm/api/types/CallEventSource.d.mts +8 -0
- package/dist/esm/api/types/CallEventSource.mjs +8 -0
- package/dist/esm/api/types/CallMetadata.d.mts +4 -0
- package/dist/esm/api/types/CallMetadata.mjs +2 -0
- package/dist/esm/api/types/CallState.d.mts +25 -0
- package/dist/esm/api/types/CallState.mjs +25 -0
- package/dist/esm/api/types/CallStatusEvent.d.mts +41 -0
- package/dist/esm/api/types/CallStatusEvent.mjs +2 -0
- package/dist/esm/api/types/CallStreamToken.d.mts +7 -0
- package/dist/esm/api/types/CallStreamToken.mjs +2 -0
- package/dist/esm/api/types/CreatedCall.d.mts +18 -0
- package/dist/esm/api/types/CreatedCall.mjs +2 -0
- package/dist/esm/api/types/E164PhoneNumber.d.mts +4 -0
- package/dist/esm/api/types/E164PhoneNumber.mjs +2 -0
- package/dist/esm/api/types/HostedSilentAuthResponse.d.mts +8 -0
- package/dist/esm/api/types/HostedSilentAuthResponse.mjs +2 -0
- package/dist/esm/api/types/JsonSilentAuthResponse.d.mts +8 -0
- package/dist/esm/api/types/JsonSilentAuthResponse.mjs +2 -0
- package/dist/esm/api/types/ListCallEventsResponse.d.mts +5 -0
- package/dist/esm/api/types/ListCallEventsResponse.mjs +2 -0
- package/dist/esm/api/types/ListCallsResponse.d.mts +5 -0
- package/dist/esm/api/types/ListCallsResponse.mjs +2 -0
- package/dist/esm/api/types/ListNetworkRequestsResponse.d.mts +8 -0
- package/dist/esm/api/types/ListNetworkRequestsResponse.mjs +2 -0
- package/dist/esm/api/types/NetworkInsightStatus.d.mts +8 -0
- package/dist/esm/api/types/NetworkInsightStatus.mjs +8 -0
- package/dist/esm/api/types/NetworkRequestId.d.mts +4 -0
- package/dist/esm/api/types/NetworkRequestId.mjs +2 -0
- package/dist/esm/api/types/NetworkRequestResult.d.mts +5 -0
- package/dist/esm/api/types/NetworkRequestResult.mjs +2 -0
- package/dist/esm/api/types/NetworkRequestStatus.d.mts +9 -0
- package/dist/esm/api/types/NetworkRequestStatus.mjs +9 -0
- package/dist/esm/api/types/NetworkRequestSummary.d.mts +19 -0
- package/dist/esm/api/types/NetworkRequestSummary.mjs +2 -0
- package/dist/esm/api/types/NetworkRequestType.d.mts +7 -0
- package/dist/esm/api/types/NetworkRequestType.mjs +7 -0
- package/dist/esm/api/types/RecordingDownload.d.mts +5 -0
- package/dist/esm/api/types/RecordingDownload.mjs +2 -0
- package/dist/esm/api/types/RecordingState.d.mts +15 -0
- package/dist/esm/api/types/RecordingState.mjs +15 -0
- package/dist/esm/api/types/SilentAuthCheckResponse.d.mts +14 -0
- package/dist/esm/api/types/SilentAuthCheckResponse.mjs +9 -0
- package/dist/esm/api/types/SilentAuthResponse.d.mts +10 -0
- package/dist/esm/api/types/SilentAuthResponse.mjs +2 -0
- package/dist/esm/api/types/SimSwapResponse.d.mts +9 -0
- package/dist/esm/api/types/SimSwapResponse.mjs +2 -0
- package/dist/esm/api/types/SubscriberMatchAttributes.d.mts +27 -0
- package/dist/esm/api/types/SubscriberMatchAttributes.mjs +2 -0
- package/dist/esm/api/types/SubscriberMatchResponse.d.mts +46 -0
- package/dist/esm/api/types/SubscriberMatchResponse.mjs +2 -0
- package/dist/esm/api/types/SubscriberMatchResult.d.mts +12 -0
- package/dist/esm/api/types/SubscriberMatchResult.mjs +12 -0
- package/dist/esm/api/types/WebhookEventEnum.d.mts +1 -0
- package/dist/esm/api/types/WebhookEventEnum.mjs +1 -0
- package/dist/esm/api/types/index.d.mts +29 -0
- package/dist/esm/api/types/index.mjs +29 -0
- package/dist/esm/index.d.mts +6 -1
- package/dist/esm/index.mjs +4 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/esm/wrapper/PinnacleClient.d.mts +4 -1
- package/dist/esm/wrapper/PinnacleClient.mjs +16 -5
- package/dist/esm/wrapper/messages/Client.d.mts +1 -1
- package/dist/esm/wrapper/voice/Client.d.mts +34 -0
- package/dist/esm/wrapper/voice/Client.mjs +143 -0
- package/dist/esm/wrapper/voice/VoiceSocket.d.mts +98 -0
- package/dist/esm/wrapper/voice/VoiceSocket.mjs +366 -0
- package/dist/esm/wrapper/voice/types.d.mts +199 -0
- package/dist/esm/wrapper/voice/types.mjs +32 -0
- package/package.json +9 -8
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { VoiceCommandAction, } from "./types.mjs";
|
|
11
|
+
export class VoiceSocket {
|
|
12
|
+
constructor(socket, options = {}) {
|
|
13
|
+
this.listeners = new Map();
|
|
14
|
+
this.pendingAcks = new Map();
|
|
15
|
+
this.closedByUser = false;
|
|
16
|
+
this.reconnectAttempts = 0;
|
|
17
|
+
this.socket_ = socket;
|
|
18
|
+
this.createSocket = options.createSocket;
|
|
19
|
+
this.reconnect = normalizeReconnectOptions(options.reconnect);
|
|
20
|
+
this.bindSocket();
|
|
21
|
+
}
|
|
22
|
+
get socket() {
|
|
23
|
+
return this.socket_;
|
|
24
|
+
}
|
|
25
|
+
get readyState() {
|
|
26
|
+
return this.socket.readyState;
|
|
27
|
+
}
|
|
28
|
+
get isOpen() {
|
|
29
|
+
return this.socket.readyState === 1;
|
|
30
|
+
}
|
|
31
|
+
waitUntilOpen(timeoutMs = 10000) {
|
|
32
|
+
if (this.isOpen) {
|
|
33
|
+
return Promise.resolve();
|
|
34
|
+
}
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
const timeout = timeoutMs > 0
|
|
37
|
+
? setTimeout(() => {
|
|
38
|
+
cleanup();
|
|
39
|
+
reject(new Error("Timed out waiting for voice socket to open."));
|
|
40
|
+
}, timeoutMs)
|
|
41
|
+
: undefined;
|
|
42
|
+
const cleanup = () => {
|
|
43
|
+
if (timeout !== undefined) {
|
|
44
|
+
clearTimeout(timeout);
|
|
45
|
+
}
|
|
46
|
+
offOpen();
|
|
47
|
+
offClose();
|
|
48
|
+
offError();
|
|
49
|
+
};
|
|
50
|
+
const offOpen = this.on("open", () => {
|
|
51
|
+
cleanup();
|
|
52
|
+
resolve();
|
|
53
|
+
});
|
|
54
|
+
const offClose = this.on("close", () => {
|
|
55
|
+
cleanup();
|
|
56
|
+
reject(new Error("Voice socket closed before opening."));
|
|
57
|
+
});
|
|
58
|
+
const offError = this.on("error", (error) => {
|
|
59
|
+
cleanup();
|
|
60
|
+
reject(toError(error));
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
connect() {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
yield this.waitUntilOpen();
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
bindSocket() {
|
|
70
|
+
this.bind("open", (event) => this.emit("open", event));
|
|
71
|
+
this.bind("close", (event) => {
|
|
72
|
+
this.rejectPendingAcks(new Error("Voice socket closed before an ack was received."));
|
|
73
|
+
this.emit("close", event);
|
|
74
|
+
this.scheduleReconnect();
|
|
75
|
+
});
|
|
76
|
+
this.bind("error", (event) => this.emit("error", event));
|
|
77
|
+
this.bind("message", (event) => this.handleMessage(event.data));
|
|
78
|
+
}
|
|
79
|
+
on(event, listener) {
|
|
80
|
+
var _a;
|
|
81
|
+
const listeners = (_a = this.listeners.get(event)) !== null && _a !== void 0 ? _a : new Set();
|
|
82
|
+
listeners.add(listener);
|
|
83
|
+
this.listeners.set(event, listeners);
|
|
84
|
+
return () => {
|
|
85
|
+
listeners.delete(listener);
|
|
86
|
+
if (listeners.size === 0) {
|
|
87
|
+
this.listeners.delete(event);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
send(frame) {
|
|
92
|
+
this.socket.send(JSON.stringify(frame));
|
|
93
|
+
}
|
|
94
|
+
command(frame) {
|
|
95
|
+
this.send(frame);
|
|
96
|
+
return frame.command_id;
|
|
97
|
+
}
|
|
98
|
+
commandAndWait(frame_1) {
|
|
99
|
+
return __awaiter(this, arguments, void 0, function* (frame, options = {}) {
|
|
100
|
+
const ack = this.waitForAck(frame.command_id, options);
|
|
101
|
+
this.command(frame);
|
|
102
|
+
return ack;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
answer(params, commandId = createVoiceCommandId()) {
|
|
106
|
+
return this.command(withOptionalParams({ event: "command", command_id: commandId, action: "call.answer" }, params));
|
|
107
|
+
}
|
|
108
|
+
end(params, commandId = createVoiceCommandId()) {
|
|
109
|
+
return this.command(withOptionalParams({ event: "command", command_id: commandId, action: "call.end" }, params));
|
|
110
|
+
}
|
|
111
|
+
transfer(params, commandId = createVoiceCommandId()) {
|
|
112
|
+
return this.command({
|
|
113
|
+
event: "command",
|
|
114
|
+
command_id: commandId,
|
|
115
|
+
action: VoiceCommandAction.CallTransfer,
|
|
116
|
+
params,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
startRecording(commandId = createVoiceCommandId()) {
|
|
120
|
+
return this.command({
|
|
121
|
+
event: "command",
|
|
122
|
+
command_id: commandId,
|
|
123
|
+
action: VoiceCommandAction.RecordingStart,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
stopRecording(commandId = createVoiceCommandId()) {
|
|
127
|
+
return this.command({
|
|
128
|
+
event: "command",
|
|
129
|
+
command_id: commandId,
|
|
130
|
+
action: VoiceCommandAction.RecordingStop,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
playAudio(params, commandId = createVoiceCommandId()) {
|
|
134
|
+
return this.command({
|
|
135
|
+
event: "command",
|
|
136
|
+
command_id: commandId,
|
|
137
|
+
action: VoiceCommandAction.AudioPlay,
|
|
138
|
+
params,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
stopAudio(commandId = createVoiceCommandId()) {
|
|
142
|
+
return this.command({
|
|
143
|
+
event: "command",
|
|
144
|
+
command_id: commandId,
|
|
145
|
+
action: VoiceCommandAction.AudioStop,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
reduceNoise(params, commandId = createVoiceCommandId()) {
|
|
149
|
+
return this.command({
|
|
150
|
+
event: "command",
|
|
151
|
+
command_id: commandId,
|
|
152
|
+
action: VoiceCommandAction.AudioReduceNoise,
|
|
153
|
+
params,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
getInput(params, commandId = createVoiceCommandId()) {
|
|
157
|
+
return this.command(withOptionalParams({ event: "command", command_id: commandId, action: "input.get" }, params));
|
|
158
|
+
}
|
|
159
|
+
cancelInput(commandId = createVoiceCommandId()) {
|
|
160
|
+
return this.command({
|
|
161
|
+
event: "command",
|
|
162
|
+
command_id: commandId,
|
|
163
|
+
action: VoiceCommandAction.InputCancel,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
sendDtmf(params, commandId = createVoiceCommandId()) {
|
|
167
|
+
return this.command({
|
|
168
|
+
event: "command",
|
|
169
|
+
command_id: commandId,
|
|
170
|
+
action: VoiceCommandAction.DtmfSend,
|
|
171
|
+
params,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
updateState(params, commandId = createVoiceCommandId()) {
|
|
175
|
+
return this.command({
|
|
176
|
+
event: "command",
|
|
177
|
+
command_id: commandId,
|
|
178
|
+
action: VoiceCommandAction.CallUpdateState,
|
|
179
|
+
params,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
sendMedia(media) {
|
|
183
|
+
this.send({ event: "media", media });
|
|
184
|
+
}
|
|
185
|
+
waitForAck(commandId, options = {}) {
|
|
186
|
+
const existing = this.pendingAcks.get(commandId);
|
|
187
|
+
if (existing !== undefined) {
|
|
188
|
+
throw new Error(`Already waiting for ack ${commandId}.`);
|
|
189
|
+
}
|
|
190
|
+
return new Promise((resolve, reject) => {
|
|
191
|
+
var _a;
|
|
192
|
+
const timeoutMs = (_a = options.timeoutMs) !== null && _a !== void 0 ? _a : 10000;
|
|
193
|
+
const pending = {
|
|
194
|
+
resolve,
|
|
195
|
+
reject,
|
|
196
|
+
timeout: timeoutMs > 0
|
|
197
|
+
? setTimeout(() => {
|
|
198
|
+
this.pendingAcks.delete(commandId);
|
|
199
|
+
reject(new Error(`Timed out waiting for ack ${commandId}.`));
|
|
200
|
+
}, timeoutMs)
|
|
201
|
+
: undefined,
|
|
202
|
+
};
|
|
203
|
+
this.pendingAcks.set(commandId, pending);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
close(code, reason) {
|
|
207
|
+
this.closedByUser = true;
|
|
208
|
+
if (this.reconnectTimer !== undefined) {
|
|
209
|
+
clearTimeout(this.reconnectTimer);
|
|
210
|
+
this.reconnectTimer = undefined;
|
|
211
|
+
}
|
|
212
|
+
this.socket.close(code, reason);
|
|
213
|
+
}
|
|
214
|
+
reconnectNow() {
|
|
215
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
216
|
+
if (this.createSocket === undefined) {
|
|
217
|
+
throw new Error("Voice socket was not configured with a reconnect factory.");
|
|
218
|
+
}
|
|
219
|
+
if (this.reconnectPromise !== undefined) {
|
|
220
|
+
return this.reconnectPromise;
|
|
221
|
+
}
|
|
222
|
+
this.reconnectPromise = Promise.resolve()
|
|
223
|
+
.then(() => { var _a; return (_a = this.createSocket) === null || _a === void 0 ? void 0 : _a.call(this); })
|
|
224
|
+
.then((socket) => {
|
|
225
|
+
if (socket === undefined) {
|
|
226
|
+
throw new Error("Voice socket reconnect factory did not return a socket.");
|
|
227
|
+
}
|
|
228
|
+
this.closedByUser = false;
|
|
229
|
+
this.socket_ = socket;
|
|
230
|
+
this.bindSocket();
|
|
231
|
+
this.reconnectAttempts = 0;
|
|
232
|
+
this.emit("reconnected", socket);
|
|
233
|
+
return this;
|
|
234
|
+
})
|
|
235
|
+
.finally(() => {
|
|
236
|
+
this.reconnectPromise = undefined;
|
|
237
|
+
});
|
|
238
|
+
return this.reconnectPromise;
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
bind(type, listener) {
|
|
242
|
+
if (this.socket.addEventListener !== undefined) {
|
|
243
|
+
this.socket.addEventListener(type, listener);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (type === "open") {
|
|
247
|
+
this.socket.onopen = listener;
|
|
248
|
+
}
|
|
249
|
+
else if (type === "message") {
|
|
250
|
+
this.socket.onmessage = listener;
|
|
251
|
+
}
|
|
252
|
+
else if (type === "error") {
|
|
253
|
+
this.socket.onerror = listener;
|
|
254
|
+
}
|
|
255
|
+
else if (type === "close") {
|
|
256
|
+
this.socket.onclose = listener;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
handleMessage(data) {
|
|
260
|
+
try {
|
|
261
|
+
const frame = parseVoiceFrame(data);
|
|
262
|
+
this.emit("frame", frame);
|
|
263
|
+
if (frame.event === "ack") {
|
|
264
|
+
this.resolvePendingAck(frame);
|
|
265
|
+
this.emit("ack", frame);
|
|
266
|
+
}
|
|
267
|
+
else if (frame.event === "event") {
|
|
268
|
+
this.emit("event", frame);
|
|
269
|
+
}
|
|
270
|
+
else if (frame.event === "media") {
|
|
271
|
+
this.emit("media", frame);
|
|
272
|
+
}
|
|
273
|
+
else if (frame.event === "connected") {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
throw new Error("Voice socket received an unknown frame event.");
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
this.emit("error", error);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
resolvePendingAck(ack) {
|
|
285
|
+
const pending = this.pendingAcks.get(ack.command_id);
|
|
286
|
+
if (pending === undefined) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
this.pendingAcks.delete(ack.command_id);
|
|
290
|
+
if (pending.timeout !== undefined) {
|
|
291
|
+
clearTimeout(pending.timeout);
|
|
292
|
+
}
|
|
293
|
+
pending.resolve(ack);
|
|
294
|
+
}
|
|
295
|
+
rejectPendingAcks(error) {
|
|
296
|
+
for (const [commandId, pending] of this.pendingAcks.entries()) {
|
|
297
|
+
this.pendingAcks.delete(commandId);
|
|
298
|
+
if (pending.timeout !== undefined) {
|
|
299
|
+
clearTimeout(pending.timeout);
|
|
300
|
+
}
|
|
301
|
+
pending.reject(error);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
emit(event, payload) {
|
|
305
|
+
var _a;
|
|
306
|
+
for (const listener of (_a = this.listeners.get(event)) !== null && _a !== void 0 ? _a : []) {
|
|
307
|
+
listener(payload);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
scheduleReconnect() {
|
|
311
|
+
if (this.closedByUser || !this.reconnect.enabled || this.createSocket === undefined) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (this.reconnectTimer !== undefined || this.reconnectPromise !== undefined) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (this.reconnectAttempts >= this.reconnect.maxAttempts) {
|
|
318
|
+
this.emit("error", new Error("Voice socket reconnect attempts exhausted."));
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
this.reconnectAttempts += 1;
|
|
322
|
+
const delayMs = getReconnectDelay(this.reconnect, this.reconnectAttempts);
|
|
323
|
+
this.emit("reconnecting", { attempt: this.reconnectAttempts, delayMs });
|
|
324
|
+
this.reconnectTimer = setTimeout(() => {
|
|
325
|
+
this.reconnectTimer = undefined;
|
|
326
|
+
void this.reconnectNow().catch((error) => {
|
|
327
|
+
this.emit("error", error);
|
|
328
|
+
this.scheduleReconnect();
|
|
329
|
+
});
|
|
330
|
+
}, delayMs);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
export function createVoiceCommandId() {
|
|
334
|
+
const random = typeof crypto !== "undefined" && "randomUUID" in crypto
|
|
335
|
+
? crypto.randomUUID()
|
|
336
|
+
: `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
337
|
+
return `cmd_${random}`;
|
|
338
|
+
}
|
|
339
|
+
function parseVoiceFrame(data) {
|
|
340
|
+
if (typeof data !== "string") {
|
|
341
|
+
throw new Error("Voice socket received a non-string frame.");
|
|
342
|
+
}
|
|
343
|
+
return JSON.parse(data);
|
|
344
|
+
}
|
|
345
|
+
function withOptionalParams(frame, params) {
|
|
346
|
+
if (params === undefined) {
|
|
347
|
+
return frame;
|
|
348
|
+
}
|
|
349
|
+
return Object.assign(Object.assign({}, frame), { params });
|
|
350
|
+
}
|
|
351
|
+
function normalizeReconnectOptions(options = {}) {
|
|
352
|
+
var _a, _b, _c, _d, _e;
|
|
353
|
+
return {
|
|
354
|
+
enabled: (_a = options.enabled) !== null && _a !== void 0 ? _a : false,
|
|
355
|
+
maxAttempts: (_b = options.maxAttempts) !== null && _b !== void 0 ? _b : 5,
|
|
356
|
+
initialDelayMs: (_c = options.initialDelayMs) !== null && _c !== void 0 ? _c : 250,
|
|
357
|
+
maxDelayMs: (_d = options.maxDelayMs) !== null && _d !== void 0 ? _d : 5000,
|
|
358
|
+
backoffMultiplier: (_e = options.backoffMultiplier) !== null && _e !== void 0 ? _e : 2,
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
function getReconnectDelay(options, attempt) {
|
|
362
|
+
return Math.min(options.initialDelayMs * Math.pow(options.backoffMultiplier, Math.max(0, attempt - 1)), options.maxDelayMs);
|
|
363
|
+
}
|
|
364
|
+
function toError(error) {
|
|
365
|
+
return error instanceof Error ? error : new Error("Voice socket error.");
|
|
366
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
export declare const VoiceCommandAction: {
|
|
2
|
+
readonly CallAnswer: "call.answer";
|
|
3
|
+
readonly CallEnd: "call.end";
|
|
4
|
+
readonly CallTransfer: "call.transfer";
|
|
5
|
+
readonly RecordingStart: "recording.start";
|
|
6
|
+
readonly RecordingStop: "recording.stop";
|
|
7
|
+
readonly AudioPlay: "audio.play";
|
|
8
|
+
readonly AudioStop: "audio.stop";
|
|
9
|
+
readonly AudioReduceNoise: "audio.reduce_noise";
|
|
10
|
+
readonly InputGet: "input.get";
|
|
11
|
+
readonly InputCancel: "input.cancel";
|
|
12
|
+
readonly DtmfSend: "dtmf.send";
|
|
13
|
+
readonly CallUpdateState: "call.update_state";
|
|
14
|
+
};
|
|
15
|
+
export type VoiceCommandAction = (typeof VoiceCommandAction)[keyof typeof VoiceCommandAction];
|
|
16
|
+
export declare const VoiceCallEndCause: {
|
|
17
|
+
readonly UserBusy: "user_busy";
|
|
18
|
+
readonly CallRejected: "call_rejected";
|
|
19
|
+
};
|
|
20
|
+
export type VoiceCallEndCause = (typeof VoiceCallEndCause)[keyof typeof VoiceCallEndCause];
|
|
21
|
+
export declare const VoiceNoiseReductionEngine: {
|
|
22
|
+
readonly Default: "default";
|
|
23
|
+
readonly Krisp: "krisp";
|
|
24
|
+
readonly AiCoustics: "aicoustics";
|
|
25
|
+
};
|
|
26
|
+
export type VoiceNoiseReductionEngine = (typeof VoiceNoiseReductionEngine)[keyof typeof VoiceNoiseReductionEngine];
|
|
27
|
+
export declare const VoiceNoiseReductionDirection: {
|
|
28
|
+
readonly Inbound: "inbound";
|
|
29
|
+
readonly Outbound: "outbound";
|
|
30
|
+
readonly Both: "both";
|
|
31
|
+
};
|
|
32
|
+
export type VoiceNoiseReductionDirection = (typeof VoiceNoiseReductionDirection)[keyof typeof VoiceNoiseReductionDirection];
|
|
33
|
+
export declare const VoiceMediaTrack: {
|
|
34
|
+
readonly Inbound: "inbound";
|
|
35
|
+
readonly Outbound: "outbound";
|
|
36
|
+
};
|
|
37
|
+
export type VoiceMediaTrack = (typeof VoiceMediaTrack)[keyof typeof VoiceMediaTrack];
|
|
38
|
+
export type VoiceCallMetadata = Record<string, string>;
|
|
39
|
+
export interface VoiceCallAnswerCommandParams {
|
|
40
|
+
as?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface VoiceCallEndCommandParams {
|
|
43
|
+
cause?: VoiceCallEndCause;
|
|
44
|
+
}
|
|
45
|
+
export interface VoiceCallTransferDialParams {
|
|
46
|
+
to: string;
|
|
47
|
+
from?: string;
|
|
48
|
+
as?: string;
|
|
49
|
+
custom_headers?: Record<string, string>;
|
|
50
|
+
}
|
|
51
|
+
export interface VoiceCallTransferBridgeParams {
|
|
52
|
+
/** Pinnacle call ID. Provider call-control IDs are not accepted. */
|
|
53
|
+
call_id: string;
|
|
54
|
+
as?: string;
|
|
55
|
+
}
|
|
56
|
+
export type VoiceCallTransferCommandParams = VoiceCallTransferDialParams | VoiceCallTransferBridgeParams;
|
|
57
|
+
export type VoiceAudioPlayCommandParams = {
|
|
58
|
+
url: string;
|
|
59
|
+
loop?: number;
|
|
60
|
+
overlay?: boolean;
|
|
61
|
+
} | {
|
|
62
|
+
text: string;
|
|
63
|
+
voice?: string;
|
|
64
|
+
language?: string;
|
|
65
|
+
};
|
|
66
|
+
export interface VoiceAudioReduceNoiseCommandParams {
|
|
67
|
+
enabled: boolean;
|
|
68
|
+
engine?: VoiceNoiseReductionEngine;
|
|
69
|
+
direction?: VoiceNoiseReductionDirection;
|
|
70
|
+
}
|
|
71
|
+
export type VoicePrompt = {
|
|
72
|
+
url: string;
|
|
73
|
+
} | {
|
|
74
|
+
text: string;
|
|
75
|
+
voice?: string;
|
|
76
|
+
language?: string;
|
|
77
|
+
};
|
|
78
|
+
export interface VoiceAiExtraction {
|
|
79
|
+
extract: Record<string, unknown>;
|
|
80
|
+
instructions?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface VoiceInputGetCommandParams {
|
|
83
|
+
prompt?: VoicePrompt;
|
|
84
|
+
maxDigits?: number;
|
|
85
|
+
minDigits?: number;
|
|
86
|
+
terminatingDigit?: string;
|
|
87
|
+
validDigits?: string;
|
|
88
|
+
timeoutMs?: number;
|
|
89
|
+
interDigitTimeoutMs?: number;
|
|
90
|
+
ai?: VoiceAiExtraction;
|
|
91
|
+
}
|
|
92
|
+
export interface VoiceDtmfSendCommandParams {
|
|
93
|
+
digits: string;
|
|
94
|
+
duration_ms?: number;
|
|
95
|
+
}
|
|
96
|
+
export interface VoiceCallUpdateStateCommandParams {
|
|
97
|
+
metadata: VoiceCallMetadata;
|
|
98
|
+
}
|
|
99
|
+
export type VoiceCommandFrame = {
|
|
100
|
+
event: "command";
|
|
101
|
+
command_id: string;
|
|
102
|
+
action: "call.answer";
|
|
103
|
+
params?: VoiceCallAnswerCommandParams;
|
|
104
|
+
} | {
|
|
105
|
+
event: "command";
|
|
106
|
+
command_id: string;
|
|
107
|
+
action: "call.end";
|
|
108
|
+
params?: VoiceCallEndCommandParams;
|
|
109
|
+
} | {
|
|
110
|
+
event: "command";
|
|
111
|
+
command_id: string;
|
|
112
|
+
action: "call.transfer";
|
|
113
|
+
params: VoiceCallTransferCommandParams;
|
|
114
|
+
} | {
|
|
115
|
+
event: "command";
|
|
116
|
+
command_id: string;
|
|
117
|
+
action: "recording.start";
|
|
118
|
+
params?: undefined;
|
|
119
|
+
} | {
|
|
120
|
+
event: "command";
|
|
121
|
+
command_id: string;
|
|
122
|
+
action: "recording.stop";
|
|
123
|
+
params?: undefined;
|
|
124
|
+
} | {
|
|
125
|
+
event: "command";
|
|
126
|
+
command_id: string;
|
|
127
|
+
action: "audio.play";
|
|
128
|
+
params: VoiceAudioPlayCommandParams;
|
|
129
|
+
} | {
|
|
130
|
+
event: "command";
|
|
131
|
+
command_id: string;
|
|
132
|
+
action: "audio.stop";
|
|
133
|
+
params?: undefined;
|
|
134
|
+
} | {
|
|
135
|
+
event: "command";
|
|
136
|
+
command_id: string;
|
|
137
|
+
action: "audio.reduce_noise";
|
|
138
|
+
params: VoiceAudioReduceNoiseCommandParams;
|
|
139
|
+
} | {
|
|
140
|
+
event: "command";
|
|
141
|
+
command_id: string;
|
|
142
|
+
action: "input.get";
|
|
143
|
+
params?: VoiceInputGetCommandParams;
|
|
144
|
+
} | {
|
|
145
|
+
event: "command";
|
|
146
|
+
command_id: string;
|
|
147
|
+
action: "input.cancel";
|
|
148
|
+
params?: undefined;
|
|
149
|
+
} | {
|
|
150
|
+
event: "command";
|
|
151
|
+
command_id: string;
|
|
152
|
+
action: "dtmf.send";
|
|
153
|
+
params: VoiceDtmfSendCommandParams;
|
|
154
|
+
} | {
|
|
155
|
+
event: "command";
|
|
156
|
+
command_id: string;
|
|
157
|
+
action: "call.update_state";
|
|
158
|
+
params: VoiceCallUpdateStateCommandParams;
|
|
159
|
+
};
|
|
160
|
+
export interface VoiceClientMedia {
|
|
161
|
+
track?: VoiceMediaTrack;
|
|
162
|
+
payload: string;
|
|
163
|
+
chunk?: number;
|
|
164
|
+
timestamp?: string;
|
|
165
|
+
}
|
|
166
|
+
export interface VoiceClientMediaFrame {
|
|
167
|
+
event: "media";
|
|
168
|
+
media: VoiceClientMedia;
|
|
169
|
+
}
|
|
170
|
+
export type VoiceClientFrame = VoiceCommandFrame | VoiceClientMediaFrame;
|
|
171
|
+
export interface VoiceCommandAckFrame {
|
|
172
|
+
event: "ack";
|
|
173
|
+
command_id: string;
|
|
174
|
+
action: VoiceCommandAction;
|
|
175
|
+
status: "ok" | "error";
|
|
176
|
+
message?: string;
|
|
177
|
+
[key: string]: unknown;
|
|
178
|
+
}
|
|
179
|
+
export interface VoiceConnectedFrame {
|
|
180
|
+
event: "connected";
|
|
181
|
+
stream_sid: string;
|
|
182
|
+
sequence_number?: number;
|
|
183
|
+
}
|
|
184
|
+
export interface VoiceServerEventFrame {
|
|
185
|
+
event: "event";
|
|
186
|
+
type: string;
|
|
187
|
+
stream_sid: string;
|
|
188
|
+
call_session_id?: string;
|
|
189
|
+
sequence_number: number;
|
|
190
|
+
payload: Record<string, unknown>;
|
|
191
|
+
}
|
|
192
|
+
export interface VoiceServerMediaFrame {
|
|
193
|
+
event: "media";
|
|
194
|
+
stream_sid?: string;
|
|
195
|
+
call_session_id?: string;
|
|
196
|
+
sequence_number?: number;
|
|
197
|
+
media: VoiceClientMedia;
|
|
198
|
+
}
|
|
199
|
+
export type VoiceServerFrame = VoiceConnectedFrame | VoiceCommandAckFrame | VoiceServerEventFrame | VoiceServerMediaFrame;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const VoiceCommandAction = {
|
|
2
|
+
CallAnswer: "call.answer",
|
|
3
|
+
CallEnd: "call.end",
|
|
4
|
+
CallTransfer: "call.transfer",
|
|
5
|
+
RecordingStart: "recording.start",
|
|
6
|
+
RecordingStop: "recording.stop",
|
|
7
|
+
AudioPlay: "audio.play",
|
|
8
|
+
AudioStop: "audio.stop",
|
|
9
|
+
AudioReduceNoise: "audio.reduce_noise",
|
|
10
|
+
InputGet: "input.get",
|
|
11
|
+
InputCancel: "input.cancel",
|
|
12
|
+
DtmfSend: "dtmf.send",
|
|
13
|
+
CallUpdateState: "call.update_state",
|
|
14
|
+
};
|
|
15
|
+
export const VoiceCallEndCause = {
|
|
16
|
+
UserBusy: "user_busy",
|
|
17
|
+
CallRejected: "call_rejected",
|
|
18
|
+
};
|
|
19
|
+
export const VoiceNoiseReductionEngine = {
|
|
20
|
+
Default: "default",
|
|
21
|
+
Krisp: "krisp",
|
|
22
|
+
AiCoustics: "aicoustics",
|
|
23
|
+
};
|
|
24
|
+
export const VoiceNoiseReductionDirection = {
|
|
25
|
+
Inbound: "inbound",
|
|
26
|
+
Outbound: "outbound",
|
|
27
|
+
Both: "both",
|
|
28
|
+
};
|
|
29
|
+
export const VoiceMediaTrack = {
|
|
30
|
+
Inbound: "inbound",
|
|
31
|
+
Outbound: "outbound",
|
|
32
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rcs-js",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.23-rc.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": "github:pinnacle-dev/rcs-js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -43,17 +43,18 @@
|
|
|
43
43
|
"test:wire": "vitest --project wire"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"mime-types": "^3.0.1"
|
|
46
|
+
"mime-types": "^3.0.1",
|
|
47
|
+
"ws": "^8.21.0"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"vitest": "^3.2.4",
|
|
52
|
-
"msw": "2.11.2",
|
|
50
|
+
"@biomejs/biome": "2.3.1",
|
|
51
|
+
"@types/mime-types": "^3.0.1",
|
|
53
52
|
"@types/node": "^18.19.70",
|
|
53
|
+
"msw": "2.11.2",
|
|
54
|
+
"ts-loader": "^9.5.1",
|
|
54
55
|
"typescript": "~5.7.2",
|
|
55
|
-
"
|
|
56
|
-
"
|
|
56
|
+
"vitest": "^3.2.4",
|
|
57
|
+
"webpack": "^5.104.1"
|
|
57
58
|
},
|
|
58
59
|
"browser": {
|
|
59
60
|
"fs": false,
|