voice-react-native-sdk 1.6.2-fork.4
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/LICENSE +206 -0
- package/README.md +179 -0
- package/android/build.gradle +113 -0
- package/android/gradle.properties +29 -0
- package/android/src/main/AndroidManifest.xml +30 -0
- package/android/src/main/java/com/twiliovoicereactnative/AudioSwitchManager.java +141 -0
- package/android/src/main/java/com/twiliovoicereactnative/CallListenerProxy.java +186 -0
- package/android/src/main/java/com/twiliovoicereactnative/CallMessageListenerProxy.java +103 -0
- package/android/src/main/java/com/twiliovoicereactnative/CallRecordDatabase.java +183 -0
- package/android/src/main/java/com/twiliovoicereactnative/CommonConstants.java +195 -0
- package/android/src/main/java/com/twiliovoicereactnative/ConfigurationProperties.java +41 -0
- package/android/src/main/java/com/twiliovoicereactnative/Constants.java +23 -0
- package/android/src/main/java/com/twiliovoicereactnative/ExpoActivityLifecycleListener.java +27 -0
- package/android/src/main/java/com/twiliovoicereactnative/ExpoApplicationLifecycleListener.java +14 -0
- package/android/src/main/java/com/twiliovoicereactnative/ExpoModule.kt +36 -0
- package/android/src/main/java/com/twiliovoicereactnative/ExpoPackage.java +20 -0
- package/android/src/main/java/com/twiliovoicereactnative/JSEventEmitter.java +98 -0
- package/android/src/main/java/com/twiliovoicereactnative/MediaPlayerManager.java +58 -0
- package/android/src/main/java/com/twiliovoicereactnative/NotificationUtility.java +363 -0
- package/android/src/main/java/com/twiliovoicereactnative/ReactNativeArgumentsSerializer.java +276 -0
- package/android/src/main/java/com/twiliovoicereactnative/SDKLog.java +74 -0
- package/android/src/main/java/com/twiliovoicereactnative/StatsListenerProxy.java +178 -0
- package/android/src/main/java/com/twiliovoicereactnative/TwilioVoiceReactNativeModule.java +778 -0
- package/android/src/main/java/com/twiliovoicereactnative/TwilioVoiceReactNativePackage.java +28 -0
- package/android/src/main/java/com/twiliovoicereactnative/VoiceActivityProxy.java +101 -0
- package/android/src/main/java/com/twiliovoicereactnative/VoiceApplicationProxy.java +133 -0
- package/android/src/main/java/com/twiliovoicereactnative/VoiceFirebaseMessagingService.java +88 -0
- package/android/src/main/java/com/twiliovoicereactnative/VoiceService.java +403 -0
- package/android/src/main/res/drawable/answered_call_small_icon.png +0 -0
- package/android/src/main/res/drawable/ic_launcher_round.png +0 -0
- package/android/src/main/res/drawable/ic_launcher_sdk.png +0 -0
- package/android/src/main/res/drawable/incoming_call_small_icon.png +0 -0
- package/android/src/main/res/drawable/outgoing_call_small_icon.png +0 -0
- package/android/src/main/res/raw/disconnect.wav +0 -0
- package/android/src/main/res/raw/incoming.wav +0 -0
- package/android/src/main/res/raw/outgoing.wav +0 -0
- package/android/src/main/res/raw/ringtone.wav +0 -0
- package/android/src/main/res/raw/silent.wav +0 -0
- package/android/src/main/res/values/colors.xml +11 -0
- package/android/src/main/res/values/config.xml +5 -0
- package/android/src/main/res/values/dimens.xml +7 -0
- package/android/src/main/res/values/strings.xml +25 -0
- package/android/src/main/res/values/styles.xml +10 -0
- package/android/src/main/res/values-night/colors.xml +11 -0
- package/expo-config-plugin/android.js +191 -0
- package/expo-config-plugin/ios.js +22 -0
- package/expo-module.config.json +6 -0
- package/ios/TwilioVoicePushRegistry.h +19 -0
- package/ios/TwilioVoicePushRegistry.m +72 -0
- package/ios/TwilioVoiceReactNative+CallInvite.m +56 -0
- package/ios/TwilioVoiceReactNative+CallKit.m +533 -0
- package/ios/TwilioVoiceReactNative+CallMessage.m +81 -0
- package/ios/TwilioVoiceReactNative.h +74 -0
- package/ios/TwilioVoiceReactNative.m +1046 -0
- package/ios/TwilioVoiceReactNative.xcodeproj/project.pbxproj +328 -0
- package/ios/TwilioVoiceReactNativeConstants.h +200 -0
- package/ios/Utilities/TwilioVoiceStatsReport.h +175 -0
- package/lib/commonjs/AudioDevice.js +101 -0
- package/lib/commonjs/AudioDevice.js.map +1 -0
- package/lib/commonjs/Call.js +765 -0
- package/lib/commonjs/Call.js.map +1 -0
- package/lib/commonjs/CallInvite.js +452 -0
- package/lib/commonjs/CallInvite.js.map +1 -0
- package/lib/commonjs/CallMessage/CallMessage.js +54 -0
- package/lib/commonjs/CallMessage/CallMessage.js.map +1 -0
- package/lib/commonjs/CallMessage/IncomingCallMessage.js +120 -0
- package/lib/commonjs/CallMessage/IncomingCallMessage.js.map +1 -0
- package/lib/commonjs/CallMessage/OutgoingCallMessage.js +148 -0
- package/lib/commonjs/CallMessage/OutgoingCallMessage.js.map +1 -0
- package/lib/commonjs/ExpoModule.js +69 -0
- package/lib/commonjs/ExpoModule.js.map +1 -0
- package/lib/commonjs/Voice.js +611 -0
- package/lib/commonjs/Voice.js.map +1 -0
- package/lib/commonjs/common.js +26 -0
- package/lib/commonjs/common.js.map +1 -0
- package/lib/commonjs/constants.js +158 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/error/InvalidArgumentError.js +32 -0
- package/lib/commonjs/error/InvalidArgumentError.js.map +1 -0
- package/lib/commonjs/error/InvalidStateError.js +33 -0
- package/lib/commonjs/error/InvalidStateError.js.map +1 -0
- package/lib/commonjs/error/TwilioError.js +38 -0
- package/lib/commonjs/error/TwilioError.js.map +1 -0
- package/lib/commonjs/error/UnsupportedPlatformError.js +33 -0
- package/lib/commonjs/error/UnsupportedPlatformError.js.map +1 -0
- package/lib/commonjs/error/generated.js +2343 -0
- package/lib/commonjs/error/generated.js.map +1 -0
- package/lib/commonjs/error/index.js +112 -0
- package/lib/commonjs/error/index.js.map +1 -0
- package/lib/commonjs/error/utility.js +37 -0
- package/lib/commonjs/error/utility.js.map +1 -0
- package/lib/commonjs/index.js +95 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/type/AudioDevice.js +6 -0
- package/lib/commonjs/type/AudioDevice.js.map +1 -0
- package/lib/commonjs/type/Call.js +6 -0
- package/lib/commonjs/type/Call.js.map +1 -0
- package/lib/commonjs/type/CallInvite.js +6 -0
- package/lib/commonjs/type/CallInvite.js.map +1 -0
- package/lib/commonjs/type/CallKit.js +30 -0
- package/lib/commonjs/type/CallKit.js.map +1 -0
- package/lib/commonjs/type/CallMessage.js +6 -0
- package/lib/commonjs/type/CallMessage.js.map +1 -0
- package/lib/commonjs/type/Error.js +6 -0
- package/lib/commonjs/type/Error.js.map +1 -0
- package/lib/commonjs/type/NativeModule.js +6 -0
- package/lib/commonjs/type/NativeModule.js.map +1 -0
- package/lib/commonjs/type/RTCStats.js +29 -0
- package/lib/commonjs/type/RTCStats.js.map +1 -0
- package/lib/commonjs/type/Voice.js +6 -0
- package/lib/commonjs/type/Voice.js.map +1 -0
- package/lib/commonjs/type/common.js +2 -0
- package/lib/commonjs/type/common.js.map +1 -0
- package/lib/module/AudioDevice.js +97 -0
- package/lib/module/AudioDevice.js.map +1 -0
- package/lib/module/Call.js +766 -0
- package/lib/module/Call.js.map +1 -0
- package/lib/module/CallInvite.js +450 -0
- package/lib/module/CallInvite.js.map +1 -0
- package/lib/module/CallMessage/CallMessage.js +51 -0
- package/lib/module/CallMessage/CallMessage.js.map +1 -0
- package/lib/module/CallMessage/IncomingCallMessage.js +116 -0
- package/lib/module/CallMessage/IncomingCallMessage.js.map +1 -0
- package/lib/module/CallMessage/OutgoingCallMessage.js +154 -0
- package/lib/module/CallMessage/OutgoingCallMessage.js.map +1 -0
- package/lib/module/ExpoModule.js +58 -0
- package/lib/module/ExpoModule.js.map +1 -0
- package/lib/module/Voice.js +598 -0
- package/lib/module/Voice.js.map +1 -0
- package/lib/module/common.js +11 -0
- package/lib/module/common.js.map +1 -0
- package/lib/module/constants.js +151 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/error/InvalidArgumentError.js +23 -0
- package/lib/module/error/InvalidArgumentError.js.map +1 -0
- package/lib/module/error/InvalidStateError.js +24 -0
- package/lib/module/error/InvalidStateError.js.map +1 -0
- package/lib/module/error/TwilioError.js +29 -0
- package/lib/module/error/TwilioError.js.map +1 -0
- package/lib/module/error/UnsupportedPlatformError.js +24 -0
- package/lib/module/error/UnsupportedPlatformError.js.map +1 -0
- package/lib/module/error/generated.js +2315 -0
- package/lib/module/error/generated.js.map +1 -0
- package/lib/module/error/index.js +6 -0
- package/lib/module/error/index.js.map +1 -0
- package/lib/module/error/utility.js +27 -0
- package/lib/module/error/utility.js.map +1 -0
- package/lib/module/index.js +23 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/type/AudioDevice.js +2 -0
- package/lib/module/type/AudioDevice.js.map +1 -0
- package/lib/module/type/Call.js +2 -0
- package/lib/module/type/Call.js.map +1 -0
- package/lib/module/type/CallInvite.js +2 -0
- package/lib/module/type/CallInvite.js.map +1 -0
- package/lib/module/type/CallKit.js +22 -0
- package/lib/module/type/CallKit.js.map +1 -0
- package/lib/module/type/CallMessage.js +2 -0
- package/lib/module/type/CallMessage.js.map +1 -0
- package/lib/module/type/Error.js +2 -0
- package/lib/module/type/Error.js.map +1 -0
- package/lib/module/type/NativeModule.js +2 -0
- package/lib/module/type/NativeModule.js.map +1 -0
- package/lib/module/type/RTCStats.js +21 -0
- package/lib/module/type/RTCStats.js.map +1 -0
- package/lib/module/type/Voice.js +2 -0
- package/lib/module/type/Voice.js.map +1 -0
- package/lib/module/type/common.js +2 -0
- package/lib/module/type/common.js.map +1 -0
- package/lib/typescript/AudioDevice.d.ts +74 -0
- package/lib/typescript/Call.d.ts +874 -0
- package/lib/typescript/CallInvite.d.ts +484 -0
- package/lib/typescript/CallMessage/CallMessage.d.ts +53 -0
- package/lib/typescript/CallMessage/IncomingCallMessage.d.ts +75 -0
- package/lib/typescript/CallMessage/OutgoingCallMessage.d.ts +198 -0
- package/lib/typescript/ExpoModule.d.ts +13 -0
- package/lib/typescript/Voice.d.ts +620 -0
- package/lib/typescript/common.d.ts +11 -0
- package/lib/typescript/constants.d.ts +148 -0
- package/lib/typescript/error/InvalidArgumentError.d.ts +11 -0
- package/lib/typescript/error/InvalidStateError.d.ts +12 -0
- package/lib/typescript/error/TwilioError.d.ts +14 -0
- package/lib/typescript/error/UnsupportedPlatformError.d.ts +12 -0
- package/lib/typescript/error/generated.d.ts +1558 -0
- package/lib/typescript/error/index.d.ts +5 -0
- package/lib/typescript/error/utility.d.ts +12 -0
- package/lib/typescript/index.d.ts +18 -0
- package/lib/typescript/type/AudioDevice.d.ts +15 -0
- package/lib/typescript/type/Call.d.ts +59 -0
- package/lib/typescript/type/CallInvite.d.ts +40 -0
- package/lib/typescript/type/CallKit.d.ts +60 -0
- package/lib/typescript/type/CallMessage.d.ts +20 -0
- package/lib/typescript/type/Error.d.ts +9 -0
- package/lib/typescript/type/NativeModule.d.ts +59 -0
- package/lib/typescript/type/RTCStats.d.ts +91 -0
- package/lib/typescript/type/Voice.d.ts +16 -0
- package/lib/typescript/type/common.d.ts +15 -0
- package/package.json +167 -0
- package/src/AudioDevice.tsx +88 -0
- package/src/Call.tsx +1343 -0
- package/src/CallInvite.tsx +757 -0
- package/src/CallMessage/CallMessage.ts +83 -0
- package/src/CallMessage/IncomingCallMessage.ts +104 -0
- package/src/CallMessage/OutgoingCallMessage.ts +308 -0
- package/src/ExpoModule.ts +59 -0
- package/src/Voice.tsx +1010 -0
- package/src/common.ts +16 -0
- package/src/constants.ts +193 -0
- package/src/error/InvalidArgumentError.ts +19 -0
- package/src/error/InvalidStateError.ts +19 -0
- package/src/error/TwilioError.ts +22 -0
- package/src/error/UnsupportedPlatformError.ts +19 -0
- package/src/error/generated.ts +2277 -0
- package/src/error/index.ts +18 -0
- package/src/error/utility.ts +36 -0
- package/src/index.tsx +24 -0
- package/src/type/AudioDevice.ts +18 -0
- package/src/type/Call.ts +102 -0
- package/src/type/CallInvite.ts +59 -0
- package/src/type/CallKit.ts +61 -0
- package/src/type/CallMessage.ts +31 -0
- package/src/type/Error.ts +11 -0
- package/src/type/NativeModule.ts +93 -0
- package/src/type/RTCStats.ts +99 -0
- package/src/type/Voice.ts +31 -0
- package/src/type/common.ts +16 -0
- package/twilio-voice-react-native.podspec +22 -0
|
@@ -0,0 +1,874 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2022 Twilio, Inc. All rights reserved. Licensed under the Twilio
|
|
3
|
+
* license.
|
|
4
|
+
*
|
|
5
|
+
* See LICENSE in the project root for license information.
|
|
6
|
+
*/
|
|
7
|
+
import { EventEmitter } from 'eventemitter3';
|
|
8
|
+
import type { RTCStats } from './';
|
|
9
|
+
import type { NativeCallInfo } from './type/Call';
|
|
10
|
+
import type { CustomParameters } from './type/common';
|
|
11
|
+
import type { TwilioError } from './error/TwilioError';
|
|
12
|
+
import { CallMessage } from './CallMessage/CallMessage';
|
|
13
|
+
import { IncomingCallMessage } from './CallMessage/IncomingCallMessage';
|
|
14
|
+
import { OutgoingCallMessage } from './CallMessage/OutgoingCallMessage';
|
|
15
|
+
/**
|
|
16
|
+
* Defines strict typings for all events emitted by {@link (Call:class)
|
|
17
|
+
* | Call objects}.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Note that the `on` function is an alias for the `addListener` function.
|
|
21
|
+
* They share identical functionality and either may be used interchangeably.
|
|
22
|
+
*
|
|
23
|
+
* - See also the {@link (Call:class) | Call class}.
|
|
24
|
+
* - See also the {@link (Call:namespace) | Call namespace}.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export declare interface Call {
|
|
29
|
+
/**
|
|
30
|
+
* ------------
|
|
31
|
+
* Emit Typings
|
|
32
|
+
* ------------
|
|
33
|
+
*/
|
|
34
|
+
/** @internal */
|
|
35
|
+
emit(connectedEvent: Call.Event.Connected): boolean;
|
|
36
|
+
/** @internal */
|
|
37
|
+
emit(connectFailureEvent: Call.Event.ConnectFailure, error: TwilioError): boolean;
|
|
38
|
+
/** @internal */
|
|
39
|
+
emit(reconnectingEvent: Call.Event.Reconnecting, error: TwilioError): boolean;
|
|
40
|
+
/** @internal */
|
|
41
|
+
emit(reconnectedEvent: Call.Event.Reconnected): boolean;
|
|
42
|
+
/** @internal */
|
|
43
|
+
emit(disconnectedEvent: Call.Event.Disconnected, error?: TwilioError): boolean;
|
|
44
|
+
/** @internal */
|
|
45
|
+
emit(ringingEvent: Call.Event.Ringing): boolean;
|
|
46
|
+
/** @internal */
|
|
47
|
+
emit(qualityWarningsChangedEvent: Call.Event.QualityWarningsChanged, currentQualityWarnings: Call.QualityWarning[], previousQualityWarnings: Call.QualityWarning[]): boolean;
|
|
48
|
+
/** @internal */
|
|
49
|
+
emit(messageReceivedEvent: Call.Event.MessageReceived, incomingCallMessage: IncomingCallMessage): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* ----------------
|
|
52
|
+
* Listener Typings
|
|
53
|
+
* ----------------
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* Connected event. Raised when the call has successfully connected.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* call.addListener(Call.Event.Connected, () => {
|
|
61
|
+
* // call has been connected
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @param connectedEvent - The raised event string.
|
|
66
|
+
* @param listener - A listener function that will be invoked when the event
|
|
67
|
+
* is raised.
|
|
68
|
+
* @returns - The call object.
|
|
69
|
+
*/
|
|
70
|
+
addListener(connectedEvent: Call.Event.Connected, listener: Call.Listener.Connected): this;
|
|
71
|
+
/**
|
|
72
|
+
* {@inheritDoc (Call:interface).(addListener:1)}
|
|
73
|
+
*/
|
|
74
|
+
on(connectedEvent: Call.Event.Connected, listener: Call.Listener.Connected): this;
|
|
75
|
+
/**
|
|
76
|
+
* Connect failure event. Raised when the call has failed to connect.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* call.addListener(Call.Event.ConnectFailure, (error) => {
|
|
81
|
+
* // call was unable to connect, handle error
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @param connectFailureEvent - The raised event string.
|
|
86
|
+
* @param listener - A listener function that will be invoked when the event
|
|
87
|
+
* is raised.
|
|
88
|
+
* @returns - The call object.
|
|
89
|
+
*/
|
|
90
|
+
addListener(connectFailureEvent: Call.Event.ConnectFailure, listener: Call.Listener.ConnectFailure): this;
|
|
91
|
+
/**
|
|
92
|
+
* {@inheritDoc (Call:interface).(addListener:2)}
|
|
93
|
+
*/
|
|
94
|
+
on(connectFailureEvent: Call.Event.ConnectFailure, listener: Call.Listener.ConnectFailure): this;
|
|
95
|
+
/**
|
|
96
|
+
* Reconnecting event. Raised when the call is reconnecting.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* call.addListener(Call.Event.Reconnecting, (error) => {
|
|
101
|
+
* // call is attempting to reconnect, handle error
|
|
102
|
+
* });
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @param reconnectingEvent - The raised event string.
|
|
106
|
+
* @param listener - A listener function that will be invoked when the event
|
|
107
|
+
* is raised.
|
|
108
|
+
* @returns - The call object.
|
|
109
|
+
*/
|
|
110
|
+
addListener(reconnectingEvent: Call.Event.Reconnecting, listener: Call.Listener.Reconnecting): this;
|
|
111
|
+
/**
|
|
112
|
+
* {@inheritDoc (Call:interface).(addListener:3)}
|
|
113
|
+
*/
|
|
114
|
+
on(reconnectingEvent: Call.Event.Reconnecting, listener: Call.Listener.Reconnecting): this;
|
|
115
|
+
/**
|
|
116
|
+
* Reconnected event. Raised when the call has recovered and reconnected.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* call.addListener(Call.Event.Reconnected, () => {
|
|
121
|
+
* // call has reconnected
|
|
122
|
+
* });
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* @param reconnectedEvent - The raised event string.
|
|
126
|
+
* @param listener - A listener function that will be invoked when the event
|
|
127
|
+
* is raised.
|
|
128
|
+
* @returns - The call object.
|
|
129
|
+
*/
|
|
130
|
+
addListener(reconnectedEvent: Call.Event.Reconnected, listener: Call.Listener.Reconnected): this;
|
|
131
|
+
/**
|
|
132
|
+
* {@inheritDoc (Call:interface).(addListener:4)}
|
|
133
|
+
*/
|
|
134
|
+
on(reconnectedEvent: Call.Event.Reconnected, listener: Call.Listener.Reconnected): this;
|
|
135
|
+
/**
|
|
136
|
+
* Disconnected event. Raised when the call has disconnected.
|
|
137
|
+
*
|
|
138
|
+
* @remarks
|
|
139
|
+
* This event can occur in "naturally" disconnected calls and calls
|
|
140
|
+
* disconnected from issues such as network problems. If the SDK has detected
|
|
141
|
+
* an issue that has caused the call to disconnect, then the error parameter
|
|
142
|
+
* will be defined, otherwise it will be undefined.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* call.addListener(Call.Event.Disconnected, (error) => {
|
|
147
|
+
* // call has disconnected
|
|
148
|
+
* // if a natural disconnect occurred, then error is `undefined`
|
|
149
|
+
* // if an unnatural disconnect occurred, then error is defined
|
|
150
|
+
* });
|
|
151
|
+
* ```
|
|
152
|
+
*
|
|
153
|
+
* @param disconnectedEvent - The raised event string.
|
|
154
|
+
* @param listener - A listener function that will be invoked when the event
|
|
155
|
+
* is raised.
|
|
156
|
+
* @returns - The call object.
|
|
157
|
+
*/
|
|
158
|
+
addListener(disconnectedEvent: Call.Event.Disconnected, listener: Call.Listener.Disconnected): this;
|
|
159
|
+
/**
|
|
160
|
+
* {@inheritDoc (Call:interface).(addListener:5)}
|
|
161
|
+
*/
|
|
162
|
+
on(disconnectedEvent: Call.Event.Disconnected, listener: Call.Listener.Disconnected): this;
|
|
163
|
+
/**
|
|
164
|
+
* Ringing event. Raised when the call has begun to ring.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* call.addListener(Call.Event.Ringing, () => {
|
|
169
|
+
* // call is ringing
|
|
170
|
+
* });
|
|
171
|
+
* ```
|
|
172
|
+
*
|
|
173
|
+
* @param ringingEvent - The raised event string.
|
|
174
|
+
* @param listener - A listener function that will be invoked when the event
|
|
175
|
+
* is raised.
|
|
176
|
+
* @returns - The call object.
|
|
177
|
+
*/
|
|
178
|
+
addListener(ringingEvent: Call.Event.Ringing, listener: Call.Listener.Ringing): this;
|
|
179
|
+
/**
|
|
180
|
+
* {@inheritDoc (Call:interface).(addListener:6)}
|
|
181
|
+
*/
|
|
182
|
+
on(ringingEvent: Call.Event.Ringing, listener: Call.Listener.Ringing): this;
|
|
183
|
+
/**
|
|
184
|
+
* Quality warnings changed event. Raised when a call quality warning is set
|
|
185
|
+
* or unset. All "ongoing" call quality warnings are passed to the invoked
|
|
186
|
+
* listener function.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* call.addListener(
|
|
191
|
+
* Call.Event.QualityWarningsChanged,
|
|
192
|
+
* (
|
|
193
|
+
* currentWarnings: Call.QualityWarning[],
|
|
194
|
+
* previousWarnings: Call.QualityWarning[]
|
|
195
|
+
* ) => {
|
|
196
|
+
* // call quality warnings have changed
|
|
197
|
+
* }
|
|
198
|
+
* );
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
* @param qualityWarningsChangedEvent - The raised event string.
|
|
202
|
+
* @param listener - A listener function that will be invoked when the event
|
|
203
|
+
* is raised.
|
|
204
|
+
* @returns - The call object.
|
|
205
|
+
*/
|
|
206
|
+
addListener(qualityWarningsChangedEvent: Call.Event.QualityWarningsChanged, listener: Call.Listener.QualityWarningsChanged): this;
|
|
207
|
+
/**
|
|
208
|
+
* {@inheritDoc (Call:interface).(addListener:7)}
|
|
209
|
+
*/
|
|
210
|
+
on(qualityWarningsChangedEvent: Call.Event.QualityWarningsChanged, listener: Call.Listener.QualityWarningsChanged): this;
|
|
211
|
+
/**
|
|
212
|
+
* MessageReceived event. Raised when a {@link IncomingCallMessage} is
|
|
213
|
+
* received.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* call.addListener(Call.Event.MessageReceived, (message) => {
|
|
218
|
+
* // callMessage received
|
|
219
|
+
* })
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
222
|
+
* @param messageReceivedEvent - The raised event string.
|
|
223
|
+
* @param listener - A listener function that will be invoked when the event
|
|
224
|
+
* is raised.
|
|
225
|
+
* @returns - The callMessage object
|
|
226
|
+
*/
|
|
227
|
+
addListener(messageReceivedEvent: Call.Event.MessageReceived, listener: Call.Listener.MessageReceived): this;
|
|
228
|
+
/** {@inheritDoc (Call:interface).(addListener:8)} */
|
|
229
|
+
on(callMessageEvent: Call.Event.MessageReceived, listener: Call.Listener.MessageReceived): this;
|
|
230
|
+
/**
|
|
231
|
+
* Generic event listener typings.
|
|
232
|
+
* @param callEvent - The raised event string.
|
|
233
|
+
* @param listener - A listener function that will be invoked when the event
|
|
234
|
+
* is raised.
|
|
235
|
+
* @returns - The call object.
|
|
236
|
+
*/
|
|
237
|
+
addListener(callEvent: Call.Event, listener: Call.Listener.Generic): this;
|
|
238
|
+
/**
|
|
239
|
+
* {@inheritDoc (Call:interface).(addListener:9)}
|
|
240
|
+
*/
|
|
241
|
+
on(callEvent: Call.Event, listener: Call.Listener.Generic): this;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Provides access to information about a call, including the call parameters,
|
|
245
|
+
* and exposes functionality for a call such as disconnecting, muting, and
|
|
246
|
+
* holding.
|
|
247
|
+
*
|
|
248
|
+
* @remarks
|
|
249
|
+
* Note that the call information is fetched as soon as possible from the native
|
|
250
|
+
* layer, but there is no guarantee that all information is immediately
|
|
251
|
+
* available. Methods such as `Call.getFrom()` or `Call.getTo()` may return
|
|
252
|
+
* `undefined`.
|
|
253
|
+
*
|
|
254
|
+
* As call events are received from the native layer, call information will
|
|
255
|
+
* propagate from the native layer to the JS layer and become available.
|
|
256
|
+
* Therefore, it is good practice to read information from the call after an
|
|
257
|
+
* event occurs, or as events occur.
|
|
258
|
+
*
|
|
259
|
+
* - See the {@link (Call:namespace).Event} enum for events emitted by `Call`
|
|
260
|
+
* objects.
|
|
261
|
+
* - See the {@link (Call:interface) | Call interface} for overloaded event
|
|
262
|
+
* listening methods.
|
|
263
|
+
* - See the {@link (Call:namespace) | Call namespace} for types and
|
|
264
|
+
* enumerations used by this class.
|
|
265
|
+
*
|
|
266
|
+
* @public
|
|
267
|
+
*/
|
|
268
|
+
export declare class Call extends EventEmitter {
|
|
269
|
+
/**
|
|
270
|
+
* The `Uuid` of this call. Used to identify calls between the JS and native
|
|
271
|
+
* layer so we can associate events and native functionality between the
|
|
272
|
+
* layers.
|
|
273
|
+
*/
|
|
274
|
+
private _uuid;
|
|
275
|
+
/**
|
|
276
|
+
* Call custom parameters.
|
|
277
|
+
*/
|
|
278
|
+
private _customParameters;
|
|
279
|
+
/**
|
|
280
|
+
* Call `from` parameter.
|
|
281
|
+
*/
|
|
282
|
+
private _from?;
|
|
283
|
+
/**
|
|
284
|
+
* Initial `connected` timestamp. Milliseconds since epoch.
|
|
285
|
+
*/
|
|
286
|
+
private _initialConnectedTimestamp?;
|
|
287
|
+
/**
|
|
288
|
+
* A boolean representing if the call is currently muted.
|
|
289
|
+
*/
|
|
290
|
+
private _isMuted?;
|
|
291
|
+
/**
|
|
292
|
+
* A boolean representing if the call is currently on hold.
|
|
293
|
+
*/
|
|
294
|
+
private _isOnHold?;
|
|
295
|
+
/**
|
|
296
|
+
* A string representing the SID of this call.
|
|
297
|
+
*/
|
|
298
|
+
private _sid?;
|
|
299
|
+
/**
|
|
300
|
+
* The current state of the call.
|
|
301
|
+
*
|
|
302
|
+
* @remarks
|
|
303
|
+
* See {@link (Call:namespace).State}.
|
|
304
|
+
*/
|
|
305
|
+
private _state;
|
|
306
|
+
/**
|
|
307
|
+
* Call `to` parameter.
|
|
308
|
+
*/
|
|
309
|
+
private _to?;
|
|
310
|
+
/**
|
|
311
|
+
* Handlers for native call events. Set upon construction so we can
|
|
312
|
+
* dynamically bind events to handlers.
|
|
313
|
+
*
|
|
314
|
+
* @privateRemarks
|
|
315
|
+
* This is done by the constructor so this mapping isn't made every time the
|
|
316
|
+
* {@link (Call:class)._handleNativeEvent} function is invoked.
|
|
317
|
+
*/
|
|
318
|
+
private _nativeEventHandler;
|
|
319
|
+
/**
|
|
320
|
+
* Constructor for the {@link (Call:class) | Call class}. This should not be
|
|
321
|
+
* invoked by third-party code. All instances of the
|
|
322
|
+
* {@link (Call:class) | Call class} should be made by the SDK and emitted by
|
|
323
|
+
* {@link (Voice:class) | Voice objects}.
|
|
324
|
+
*
|
|
325
|
+
* @param nativeCallInfo - An object containing all of the data from the
|
|
326
|
+
* native layer necessary to fully describe a call, as well as invoke native
|
|
327
|
+
* functionality for the call.
|
|
328
|
+
*
|
|
329
|
+
* @internal
|
|
330
|
+
*/
|
|
331
|
+
constructor({ uuid, customParameters, from, sid, state, to, isMuted, isOnHold, initialConnectedTimestamp, }: NativeCallInfo);
|
|
332
|
+
/**
|
|
333
|
+
* This intermediate native call event handler acts as a "gate", only
|
|
334
|
+
* executing the actual call event handler (such as `Connected`) if this call
|
|
335
|
+
* object matches the `Uuid` of the call that had an event raised.
|
|
336
|
+
* @param nativeCallEvent - A call event directly from the native layer.
|
|
337
|
+
*/
|
|
338
|
+
private _handleNativeEvent;
|
|
339
|
+
/**
|
|
340
|
+
* Helper function to update the state of the call when a call event occurs
|
|
341
|
+
* that necessitates an update, i.e. upon a
|
|
342
|
+
* {@link (Call:namespace).Event.Connected | Connected event} we want to
|
|
343
|
+
* update the state of the call to also reflect the
|
|
344
|
+
* {@link (Call:namespace).State.Connected | Connected state}.
|
|
345
|
+
* @param nativeCallEvent - The native call event.
|
|
346
|
+
*/
|
|
347
|
+
private _update;
|
|
348
|
+
/**
|
|
349
|
+
* Handler for the the {@link (Call:namespace).Event.Connected} event.
|
|
350
|
+
* @param nativeCallEvent - The native call event.
|
|
351
|
+
*/
|
|
352
|
+
private _handleConnectedEvent;
|
|
353
|
+
/**
|
|
354
|
+
* Handler for the the {@link (Call:namespace).Event.ConnectFailure} event.
|
|
355
|
+
* @param nativeCallEvent - The native call event.
|
|
356
|
+
*/
|
|
357
|
+
private _handleConnectFailureEvent;
|
|
358
|
+
/**
|
|
359
|
+
* Handler for the the {@link (Call:namespace).Event.Disconnected} event.
|
|
360
|
+
* @param nativeCallEvent - The native call event.
|
|
361
|
+
*/
|
|
362
|
+
private _handleDisconnectedEvent;
|
|
363
|
+
/**
|
|
364
|
+
* Handler for the the {@link (Call:namespace).Event.Reconnecting} event.
|
|
365
|
+
* @param nativeCallEvent - The native call event.
|
|
366
|
+
*/
|
|
367
|
+
private _handleReconnectingEvent;
|
|
368
|
+
/**
|
|
369
|
+
* Handler for the the {@link (Call:namespace).Event.Reconnected} event.
|
|
370
|
+
* @param nativeCallEvent - The native call event.
|
|
371
|
+
*/
|
|
372
|
+
private _handleReconnectedEvent;
|
|
373
|
+
/**
|
|
374
|
+
* Handler for the the {@link (Call:namespace).Event.Ringing} event.
|
|
375
|
+
* @param nativeCallEvent - The native call event.
|
|
376
|
+
*/
|
|
377
|
+
private _handleRingingEvent;
|
|
378
|
+
/**
|
|
379
|
+
* Handler for the the {@link (Call:namespace).Event.QualityWarningsChanged}
|
|
380
|
+
* event.
|
|
381
|
+
* @param nativeCallEvent - The native call event.
|
|
382
|
+
*/
|
|
383
|
+
private _handleQualityWarningsChangedEvent;
|
|
384
|
+
/**
|
|
385
|
+
* Handler for the {@link (Call:namespace).Event.MessageReceived} event.
|
|
386
|
+
* @param nativeCallEvent - The native call event.
|
|
387
|
+
*/
|
|
388
|
+
private _handleMessageReceivedEvent;
|
|
389
|
+
/**
|
|
390
|
+
* Disconnect this side of the call.
|
|
391
|
+
* @returns
|
|
392
|
+
* A `Promise` that
|
|
393
|
+
* - Resolves when the call has disconnected.
|
|
394
|
+
* - Rejects if the native layer cannot disconnect the call.
|
|
395
|
+
*/
|
|
396
|
+
disconnect(): Promise<void>;
|
|
397
|
+
/**
|
|
398
|
+
* Get the mute status of this side of the call.
|
|
399
|
+
* @returns
|
|
400
|
+
* - A boolean representing the muted status of the call.
|
|
401
|
+
* - `undefined` if the call state has not yet been received from the native
|
|
402
|
+
* layer.
|
|
403
|
+
*/
|
|
404
|
+
isMuted(): boolean | undefined;
|
|
405
|
+
/**
|
|
406
|
+
* Get the hold status of this side of the call.
|
|
407
|
+
* @returns
|
|
408
|
+
* - A boolean representing the hold status of the call.
|
|
409
|
+
* - `undefined` if the call state has not yet been received from the native
|
|
410
|
+
* layer.
|
|
411
|
+
*/
|
|
412
|
+
isOnHold(): boolean | undefined;
|
|
413
|
+
/**
|
|
414
|
+
* Return a `Record` of custom parameters given to this call.
|
|
415
|
+
* @returns
|
|
416
|
+
* - A `Record` of custom parameters.
|
|
417
|
+
*/
|
|
418
|
+
getCustomParameters(): CustomParameters;
|
|
419
|
+
/**
|
|
420
|
+
* Get the value of the `from` parameter given to this call.
|
|
421
|
+
* @returns
|
|
422
|
+
* - A `String` representing the `from` parameter.
|
|
423
|
+
* - `undefined` if the call information has not yet been received from the
|
|
424
|
+
* native layer.
|
|
425
|
+
*/
|
|
426
|
+
getFrom(): string | undefined;
|
|
427
|
+
/**
|
|
428
|
+
* Get the timestamp (milliseconds since epoch) of the call connected event.
|
|
429
|
+
* @returns
|
|
430
|
+
* - A `number` representing the timestamp.
|
|
431
|
+
* - `undefined` if the call has not yet connected.
|
|
432
|
+
*/
|
|
433
|
+
getInitialConnectedTimestamp(): Date | undefined;
|
|
434
|
+
/**
|
|
435
|
+
* Get the call `SID`.
|
|
436
|
+
* @returns
|
|
437
|
+
* - A `String` representing the `SID` of the call.
|
|
438
|
+
* - `undefined` if the call information has not yet been received from the
|
|
439
|
+
* native layer.
|
|
440
|
+
*/
|
|
441
|
+
getSid(): string | undefined;
|
|
442
|
+
/**
|
|
443
|
+
* Get the state of the call object, such as {@link (Call:namespace).State.Connected} or
|
|
444
|
+
* {@link (Call:namespace).State.Disconnected}.
|
|
445
|
+
* @returns
|
|
446
|
+
* - A {@link (Call:namespace).State}.
|
|
447
|
+
*/
|
|
448
|
+
getState(): Call.State;
|
|
449
|
+
/**
|
|
450
|
+
* Gets the `PeerConnection` `WebRTC` stats for the ongoing call.
|
|
451
|
+
* @returns
|
|
452
|
+
* A `Promise` that
|
|
453
|
+
* - Resolves with a {@link RTCStats.StatsReport} object representing the
|
|
454
|
+
* `WebRTC` `PeerConnection` stats of a call.
|
|
455
|
+
* - Rejects when a {@link RTCStats.StatsReport} cannot be generated for a
|
|
456
|
+
* call.
|
|
457
|
+
*/
|
|
458
|
+
getStats(): Promise<RTCStats.StatsReport>;
|
|
459
|
+
/**
|
|
460
|
+
* Get the value of the `to` parameter given to this call.
|
|
461
|
+
* @returns
|
|
462
|
+
* - A `String` representing the `to` parameter.
|
|
463
|
+
* - `undefined` if the call information has not yet been received from the
|
|
464
|
+
* native layer.
|
|
465
|
+
*/
|
|
466
|
+
getTo(): string | undefined;
|
|
467
|
+
/**
|
|
468
|
+
* Put this end of the call on hold or not on hold.
|
|
469
|
+
*
|
|
470
|
+
* @example
|
|
471
|
+
* To put a call on hold
|
|
472
|
+
* ```typescript
|
|
473
|
+
* call.hold(true);
|
|
474
|
+
* ```
|
|
475
|
+
* @example
|
|
476
|
+
* To take a call off hold
|
|
477
|
+
* ```typescript
|
|
478
|
+
* call.hold(false);
|
|
479
|
+
* ```
|
|
480
|
+
*
|
|
481
|
+
* @param hold - A `boolean` representing whether or not to put this end of
|
|
482
|
+
* the call on hold.
|
|
483
|
+
*
|
|
484
|
+
* @returns
|
|
485
|
+
* A `Promise` that
|
|
486
|
+
* - Resolves with the hold status when the call is put on hold or not on
|
|
487
|
+
* hold.
|
|
488
|
+
* - Rejects when the call is not able to be put on hold or not on hold.
|
|
489
|
+
*/
|
|
490
|
+
hold(hold: boolean): Promise<boolean>;
|
|
491
|
+
/**
|
|
492
|
+
* Mute or unmute this end of the call.
|
|
493
|
+
*
|
|
494
|
+
* @example
|
|
495
|
+
* To mute a call
|
|
496
|
+
* ```typescript
|
|
497
|
+
* call.mute(true);
|
|
498
|
+
* ```
|
|
499
|
+
*
|
|
500
|
+
* @example
|
|
501
|
+
* To unmute a call
|
|
502
|
+
* ```typescript
|
|
503
|
+
* call.mute(false);
|
|
504
|
+
* ```
|
|
505
|
+
*
|
|
506
|
+
* @param mute - A `boolean` representing whether or not to mute this end of
|
|
507
|
+
* the call.
|
|
508
|
+
*
|
|
509
|
+
* @returns
|
|
510
|
+
* A `Promise` that
|
|
511
|
+
* - Resolves with the muted status of the call when the call is muted or
|
|
512
|
+
* unmuted.
|
|
513
|
+
* - Rejects when the call is not able to be muted or unmuted.
|
|
514
|
+
*/
|
|
515
|
+
mute(mute: boolean): Promise<boolean>;
|
|
516
|
+
/**
|
|
517
|
+
* Send DTMF digits.
|
|
518
|
+
*
|
|
519
|
+
* @example
|
|
520
|
+
* To send the `0` dialtone:
|
|
521
|
+
* ```typescript
|
|
522
|
+
* call.sendDigits('0');
|
|
523
|
+
* ```
|
|
524
|
+
*
|
|
525
|
+
* @example
|
|
526
|
+
* To send the `0` and then `1` dialtone:
|
|
527
|
+
* ```typescript
|
|
528
|
+
* call.sendDigits('01');
|
|
529
|
+
* ```
|
|
530
|
+
*
|
|
531
|
+
* @param digits - A sequence of DTMF digits in a string.
|
|
532
|
+
*
|
|
533
|
+
* @returns
|
|
534
|
+
* A `Promise` that
|
|
535
|
+
* - Resolves when the DTMF digits have been sent.
|
|
536
|
+
* - Rejects when DTMF tones are not able to be sent.
|
|
537
|
+
*/
|
|
538
|
+
sendDigits(digits: string): Promise<void>;
|
|
539
|
+
/**
|
|
540
|
+
* Send a CallMessage.
|
|
541
|
+
*
|
|
542
|
+
* @example
|
|
543
|
+
* To send a user-defined-message
|
|
544
|
+
* ```typescript
|
|
545
|
+
* const outgoingCallMessage: OutgoingCallMessage = await call.sendMessage({
|
|
546
|
+
* content: { key1: 'This is a messsage from the parent call' },
|
|
547
|
+
* contentType: 'application/json',
|
|
548
|
+
* messageType: 'user-defined-message'
|
|
549
|
+
* });
|
|
550
|
+
*
|
|
551
|
+
* outgoingCallMessage.addListener(OutgoingCallMessage.Event.Failure, (error) => {
|
|
552
|
+
* // outgoingCallMessage failed, handle error
|
|
553
|
+
* });
|
|
554
|
+
*
|
|
555
|
+
* outgoingCallMessage.addListener(OutgoingCallMessage.Event.Sent, () => {
|
|
556
|
+
* // outgoingCallMessage sent
|
|
557
|
+
* });
|
|
558
|
+
* ```
|
|
559
|
+
*
|
|
560
|
+
* @param message - The call message to send.
|
|
561
|
+
*
|
|
562
|
+
* @returns
|
|
563
|
+
* A `Promise` that
|
|
564
|
+
* - Resolves with the OutgoingCallMessage object.
|
|
565
|
+
* - Rejects when the message is unable to be sent.
|
|
566
|
+
*/
|
|
567
|
+
sendMessage(message: CallMessage): Promise<OutgoingCallMessage>;
|
|
568
|
+
/**
|
|
569
|
+
* Post feedback about a call.
|
|
570
|
+
*
|
|
571
|
+
* @example
|
|
572
|
+
* To report that a call had very significant audio latency:
|
|
573
|
+
* ```typescript
|
|
574
|
+
* call.postFeedback(Call.Score.Five, Call.Issue.AudioLatency);
|
|
575
|
+
* ```
|
|
576
|
+
*
|
|
577
|
+
* @param score - A score representing the serverity of the issue being
|
|
578
|
+
* reported.
|
|
579
|
+
* @param issue - The issue being reported.
|
|
580
|
+
* @returns
|
|
581
|
+
* A `Promise` that
|
|
582
|
+
* - Resolves when the feedback has been posted.
|
|
583
|
+
* - Rejects when the feedback is unable to be sent.
|
|
584
|
+
*/
|
|
585
|
+
postFeedback(score: Call.Score, issue: Call.Issue): Promise<void>;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Namespace for enumerations and types used by
|
|
589
|
+
* {@link (Call:class) | Call objects}.
|
|
590
|
+
*
|
|
591
|
+
* @remarks
|
|
592
|
+
* - See also the {@link (Call:class) | Call class}.
|
|
593
|
+
* - See also the {@link (Call:interface) | Call interface}.
|
|
594
|
+
*
|
|
595
|
+
* @public
|
|
596
|
+
*/
|
|
597
|
+
export declare namespace Call {
|
|
598
|
+
/**
|
|
599
|
+
* Enumeration of all event strings emitted by {@link (Call:class)} objects.
|
|
600
|
+
*/
|
|
601
|
+
enum Event {
|
|
602
|
+
/**
|
|
603
|
+
* Event string for the `Connected` event.
|
|
604
|
+
* See {@link (Call:interface).(addListener:1)}.
|
|
605
|
+
*/
|
|
606
|
+
'Connected' = "connected",
|
|
607
|
+
/**
|
|
608
|
+
* Event string for the `ConnectedFailure` event.
|
|
609
|
+
* See {@link (Call:interface).(addListener:2)}.
|
|
610
|
+
*/
|
|
611
|
+
'ConnectFailure' = "connectFailure",
|
|
612
|
+
/**
|
|
613
|
+
* Event string for the `Reconnecting` event.
|
|
614
|
+
* See {@link (Call:interface).(addListener:3)}.
|
|
615
|
+
*/
|
|
616
|
+
'Reconnecting' = "reconnecting",
|
|
617
|
+
/**
|
|
618
|
+
* Event string for the `Reconnected` event.
|
|
619
|
+
* See {@link (Call:interface).(addListener:4)}.
|
|
620
|
+
*/
|
|
621
|
+
'Reconnected' = "reconnected",
|
|
622
|
+
/**
|
|
623
|
+
* Event string for the `Disconnected` event.
|
|
624
|
+
* See {@link (Call:interface).(addListener:5)}.
|
|
625
|
+
*/
|
|
626
|
+
'Disconnected' = "disconnected",
|
|
627
|
+
/**
|
|
628
|
+
* Event string for the `Ringing` event.
|
|
629
|
+
* See {@link (Call:interface).(addListener:6)}.
|
|
630
|
+
*/
|
|
631
|
+
'Ringing' = "ringing",
|
|
632
|
+
/**
|
|
633
|
+
* Event string for the `QualityWarningsChanged` event.
|
|
634
|
+
* See {@link (Call:interface).(addListener:7)}.
|
|
635
|
+
*/
|
|
636
|
+
'QualityWarningsChanged' = "qualityWarningsChanged",
|
|
637
|
+
/**
|
|
638
|
+
* Event string for the `MessageReceived` event.
|
|
639
|
+
* See {@link (Call:interface).(addListener:8)}
|
|
640
|
+
*/
|
|
641
|
+
'MessageReceived' = "messageReceived"
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* An enumeration of all possible {@link (Call:class) | Call object} states.
|
|
645
|
+
*/
|
|
646
|
+
enum State {
|
|
647
|
+
/**
|
|
648
|
+
* Call `Connected` state.
|
|
649
|
+
*
|
|
650
|
+
* Occurs when the `Connected` and `Reconnected` event is raised.
|
|
651
|
+
*
|
|
652
|
+
* @remarks
|
|
653
|
+
*
|
|
654
|
+
* See {@link (Call:interface).(addListener:1)}.
|
|
655
|
+
*
|
|
656
|
+
* See {@link (Call:interface).(addListener:4)}.
|
|
657
|
+
*/
|
|
658
|
+
'Connected' = "connected",
|
|
659
|
+
/**
|
|
660
|
+
* Call `Connecting` state.
|
|
661
|
+
*
|
|
662
|
+
* The default state of an outgoing call.
|
|
663
|
+
*/
|
|
664
|
+
'Connecting' = "connecting",
|
|
665
|
+
/**
|
|
666
|
+
* Call `Disconnected` state.
|
|
667
|
+
*
|
|
668
|
+
* Occurs when the `Disconnected` or `ConnectFailure` event is raised.
|
|
669
|
+
*
|
|
670
|
+
* @remarks
|
|
671
|
+
*
|
|
672
|
+
* See {@link (Call:interface).(addListener:5)}.
|
|
673
|
+
*
|
|
674
|
+
* See {@link (Call:interface).(addListener:2)}.
|
|
675
|
+
*/
|
|
676
|
+
'Disconnected' = "disconnected",
|
|
677
|
+
/**
|
|
678
|
+
* Call `Reconnecting` state.
|
|
679
|
+
*
|
|
680
|
+
* Occurs when the `Reconnecting` event is raised.
|
|
681
|
+
*
|
|
682
|
+
* @remarks
|
|
683
|
+
*
|
|
684
|
+
* See {@link (Call:interface).(addListener:3)}.
|
|
685
|
+
*/
|
|
686
|
+
'Reconnecting' = "reconnecting",
|
|
687
|
+
/**
|
|
688
|
+
* Call `Ringing` state. Occurs when the `Ringing` event is raised.
|
|
689
|
+
*
|
|
690
|
+
* @remarks
|
|
691
|
+
*
|
|
692
|
+
* See {@link (Call:interface).(addListener:6)}.
|
|
693
|
+
*/
|
|
694
|
+
'Ringing' = "ringing"
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* An enumeration of all call quality-warning types.
|
|
698
|
+
*/
|
|
699
|
+
enum QualityWarning {
|
|
700
|
+
/**
|
|
701
|
+
* Raised when the call detects constant audio input, such as silence.
|
|
702
|
+
*/
|
|
703
|
+
'ConstantAudioInputLevel' = "constant-audio-input-level",
|
|
704
|
+
/**
|
|
705
|
+
* Raised when the network encounters high jitter.
|
|
706
|
+
*/
|
|
707
|
+
'HighJitter' = "high-jitter",
|
|
708
|
+
/**
|
|
709
|
+
* Raised when the network encounters high packet loss.
|
|
710
|
+
*/
|
|
711
|
+
'HighPacketLoss' = "high-packet-loss",
|
|
712
|
+
/**
|
|
713
|
+
* Raised when the network encounters high packet round-trip-time.
|
|
714
|
+
*/
|
|
715
|
+
'HighRtt' = "high-rtt",
|
|
716
|
+
/**
|
|
717
|
+
* Raised when the call detects a low mean-opinion-score or MOS.
|
|
718
|
+
*/
|
|
719
|
+
'LowMos' = "low-mos"
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* An enumeration of all scores that could be used to rate the experience of
|
|
723
|
+
* a call or issues encountered during the call.
|
|
724
|
+
*/
|
|
725
|
+
enum Score {
|
|
726
|
+
/**
|
|
727
|
+
* An issue was not encountered or there is no desire to report said issue.
|
|
728
|
+
*/
|
|
729
|
+
'NotReported' = 0,
|
|
730
|
+
/**
|
|
731
|
+
* An issue had severity approximately 1/5.
|
|
732
|
+
*/
|
|
733
|
+
'One' = 1,
|
|
734
|
+
/**
|
|
735
|
+
* An issue had severity approximately 2/5.
|
|
736
|
+
*/
|
|
737
|
+
'Two' = 2,
|
|
738
|
+
/**
|
|
739
|
+
* An issue had severity approximately 3/5.
|
|
740
|
+
*/
|
|
741
|
+
'Three' = 3,
|
|
742
|
+
/**
|
|
743
|
+
* An issue had severity approximately 4/5.
|
|
744
|
+
*/
|
|
745
|
+
'Four' = 4,
|
|
746
|
+
/**
|
|
747
|
+
* An issue had severity approximately 5/5.
|
|
748
|
+
*/
|
|
749
|
+
'Five' = 5
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* An enumeration of call issues that can be reported.
|
|
753
|
+
*/
|
|
754
|
+
enum Issue {
|
|
755
|
+
/**
|
|
756
|
+
* No issue is reported.
|
|
757
|
+
*/
|
|
758
|
+
'NotReported' = "not-reported",
|
|
759
|
+
/**
|
|
760
|
+
* The call was dropped unexpectedly.
|
|
761
|
+
*/
|
|
762
|
+
'DroppedCall' = "dropped-call",
|
|
763
|
+
/**
|
|
764
|
+
* The call encountered significant audio latency.
|
|
765
|
+
*/
|
|
766
|
+
'AudioLatency' = "audio-latency",
|
|
767
|
+
/**
|
|
768
|
+
* One party of the call could not hear the other callee.
|
|
769
|
+
*/
|
|
770
|
+
'OneWayAudio' = "one-way-audio",
|
|
771
|
+
/**
|
|
772
|
+
* Call audio was choppy.
|
|
773
|
+
*/
|
|
774
|
+
'ChoppyAudio' = "choppy-audio",
|
|
775
|
+
/**
|
|
776
|
+
* Call audio had significant noise.
|
|
777
|
+
*/
|
|
778
|
+
'NoisyCall' = "noisy-call",
|
|
779
|
+
/**
|
|
780
|
+
* Call audio had significant echo.
|
|
781
|
+
*/
|
|
782
|
+
'Echo' = "echo"
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Listener types for all events emitted by a
|
|
786
|
+
* {@link (Call:class) | Call object.}
|
|
787
|
+
*/
|
|
788
|
+
namespace Listener {
|
|
789
|
+
/**
|
|
790
|
+
* Connected event listener. This should be the function signature of any
|
|
791
|
+
* event listener bound to the {@link (Call:namespace).Event.Connected}
|
|
792
|
+
* event.
|
|
793
|
+
*
|
|
794
|
+
* @remarks
|
|
795
|
+
* See {@link (Call:interface).(addListener:1)}.
|
|
796
|
+
*/
|
|
797
|
+
type Connected = () => void;
|
|
798
|
+
/**
|
|
799
|
+
* Connect failure event listener. This should be the function signature of
|
|
800
|
+
* any event listener bound to the
|
|
801
|
+
* {@link (Call:namespace).Event.ConnectFailure} event.
|
|
802
|
+
*
|
|
803
|
+
* @remarks
|
|
804
|
+
* See {@link (Call:interface).(addListener:2)}.
|
|
805
|
+
*
|
|
806
|
+
* See {@link TwilioErrors} for all error classes.
|
|
807
|
+
*/
|
|
808
|
+
type ConnectFailure = (error: TwilioError) => void;
|
|
809
|
+
/**
|
|
810
|
+
* Reconnecting event listener. This should be the function signature of any
|
|
811
|
+
* event listener bound to the {@link (Call:namespace).Event.Reconnecting}
|
|
812
|
+
* event.
|
|
813
|
+
*
|
|
814
|
+
* @remarks
|
|
815
|
+
* See {@link (Call:interface).(addListener:3)}.
|
|
816
|
+
*
|
|
817
|
+
* See {@link TwilioErrors} for all error classes.
|
|
818
|
+
*/
|
|
819
|
+
type Reconnecting = (error: TwilioError) => void;
|
|
820
|
+
/**
|
|
821
|
+
* Reconnected event listener. This should be the function signature of any
|
|
822
|
+
* event listener bound to the {@link (Call:namespace).Event.Reconnected}
|
|
823
|
+
* event.
|
|
824
|
+
*
|
|
825
|
+
* @remarks
|
|
826
|
+
* See {@link (Call:interface).(addListener:4)}.
|
|
827
|
+
*/
|
|
828
|
+
type Reconnected = () => void;
|
|
829
|
+
/**
|
|
830
|
+
* Disconnected event listener. This should be the function signature of any
|
|
831
|
+
* event listener bound to the {@link (Call:namespace).Event.Disconnected}
|
|
832
|
+
* event.
|
|
833
|
+
*
|
|
834
|
+
* @remarks
|
|
835
|
+
* See {@link (Call:interface).(addListener:5)}.
|
|
836
|
+
*
|
|
837
|
+
* See {@link TwilioErrors} for all error classes.
|
|
838
|
+
*/
|
|
839
|
+
type Disconnected = (error?: TwilioError) => void;
|
|
840
|
+
/**
|
|
841
|
+
* Ringing event listener. This should be the function signature of any
|
|
842
|
+
* event listener bound to the {@link (Call:namespace).Event.Ringing} event.
|
|
843
|
+
*
|
|
844
|
+
* @remarks
|
|
845
|
+
* See {@link (Call:interface).(addListener:6)}.
|
|
846
|
+
*/
|
|
847
|
+
type Ringing = () => void;
|
|
848
|
+
/**
|
|
849
|
+
* Quality warnings changed event listener. This should be the function
|
|
850
|
+
* signature of any event listener bound to the
|
|
851
|
+
* {@link (Call:namespace).Event.QualityWarningsChanged} event.
|
|
852
|
+
*
|
|
853
|
+
* @remarks
|
|
854
|
+
* See {@link (Call:interface).(addListener:7)}.
|
|
855
|
+
*/
|
|
856
|
+
type QualityWarningsChanged = (currentQualityWarnings: Call.QualityWarning[], previousQualityWarnings: Call.QualityWarning[]) => void;
|
|
857
|
+
/**
|
|
858
|
+
* CallMessage received event listener. This should be the function signature of
|
|
859
|
+
* any event listener bound to the {@link (Call:namespace).Event.MessageReceived} event.
|
|
860
|
+
*
|
|
861
|
+
* @remarks
|
|
862
|
+
* See {@link (Call:interface).(addListener:8)}.
|
|
863
|
+
*/
|
|
864
|
+
type MessageReceived = (incomingCallMessage: IncomingCallMessage) => void;
|
|
865
|
+
/**
|
|
866
|
+
* Generic event listener. This should be the function signature of any
|
|
867
|
+
* event listener bound to any call event.
|
|
868
|
+
*
|
|
869
|
+
* @remarks
|
|
870
|
+
* See {@link (Call:interface).(addListener:9)}.
|
|
871
|
+
*/
|
|
872
|
+
type Generic = (...args: any[]) => void;
|
|
873
|
+
}
|
|
874
|
+
}
|