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,18 @@
|
|
|
1
|
+
export { InvalidArgumentError } from './InvalidArgumentError';
|
|
2
|
+
export { InvalidStateError } from './InvalidStateError';
|
|
3
|
+
export { UnsupportedPlatformError } from './UnsupportedPlatformError';
|
|
4
|
+
export { TwilioError } from './TwilioError';
|
|
5
|
+
export {
|
|
6
|
+
AuthorizationErrors,
|
|
7
|
+
ClientErrors,
|
|
8
|
+
ForbiddenErrors,
|
|
9
|
+
GeneralErrors,
|
|
10
|
+
MalformedRequestErrors,
|
|
11
|
+
MediaErrors,
|
|
12
|
+
RegistrationErrors,
|
|
13
|
+
ServerErrors,
|
|
14
|
+
SignalingErrors,
|
|
15
|
+
SIPServerErrors,
|
|
16
|
+
TwiMLErrors,
|
|
17
|
+
UserMediaErrors,
|
|
18
|
+
} from './generated';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { errorsByCode } from './generated';
|
|
2
|
+
import { TwilioError } from './TwilioError';
|
|
3
|
+
import { InvalidArgumentError } from './InvalidArgumentError';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Uses the generated error-code map to create the appropriate error.
|
|
7
|
+
* If the code is "unexpected" such that there is no constructor for that
|
|
8
|
+
* specific code, this function will default to a generic {@link TwilioError}.
|
|
9
|
+
*
|
|
10
|
+
* @param message an error message
|
|
11
|
+
* @param code a Twilio error code, for example `31209`
|
|
12
|
+
*
|
|
13
|
+
* @returns a {@link TwilioError} or appropriate sub-class
|
|
14
|
+
*/
|
|
15
|
+
export function constructTwilioError(
|
|
16
|
+
message: string,
|
|
17
|
+
code: number
|
|
18
|
+
): TwilioError {
|
|
19
|
+
if (typeof message !== 'string') {
|
|
20
|
+
throw new InvalidArgumentError(
|
|
21
|
+
'The "message" argument is not of type "string".'
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (typeof code !== 'number') {
|
|
26
|
+
throw new InvalidArgumentError(
|
|
27
|
+
'The "code" argument is not of type "number".'
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const ErrorClass = errorsByCode.get(code);
|
|
32
|
+
|
|
33
|
+
return typeof ErrorClass !== 'undefined'
|
|
34
|
+
? new ErrorClass(message)
|
|
35
|
+
: new TwilioError(message, code);
|
|
36
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright © 2022 Twilio, Inc. All rights reserved. Licensed under the Twilio
|
|
2
|
+
// license.
|
|
3
|
+
|
|
4
|
+
// See LICENSE in the project root for license information.
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Provides access to Twilio Programmable Voice for React Native applications
|
|
8
|
+
* running on iOS and Android devices.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
export { Voice } from './Voice';
|
|
13
|
+
export { AudioDevice } from './AudioDevice';
|
|
14
|
+
export { Call } from './Call';
|
|
15
|
+
export { CallInvite } from './CallInvite';
|
|
16
|
+
export { CallMessage } from './CallMessage/CallMessage';
|
|
17
|
+
export { IncomingCallMessage } from './CallMessage/IncomingCallMessage';
|
|
18
|
+
export { OutgoingCallMessage } from './CallMessage/OutgoingCallMessage';
|
|
19
|
+
export { CustomParameters } from './type/common';
|
|
20
|
+
export { CallKit } from './type/CallKit';
|
|
21
|
+
export { RTCStats } from './type/RTCStats';
|
|
22
|
+
|
|
23
|
+
import * as TwilioErrors from './error';
|
|
24
|
+
export { TwilioErrors };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AudioDevice } from '../AudioDevice';
|
|
2
|
+
import type { Constants } from '../constants';
|
|
3
|
+
import type { Uuid } from './common';
|
|
4
|
+
|
|
5
|
+
export interface NativeAudioDeviceInfo {
|
|
6
|
+
uuid: Uuid;
|
|
7
|
+
type: AudioDevice.Type;
|
|
8
|
+
name: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface NativeAudioDevicesInfo {
|
|
12
|
+
audioDevices: NativeAudioDeviceInfo[];
|
|
13
|
+
selectedDevice?: NativeAudioDeviceInfo;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface NativeAudioDevicesUpdatedEvent extends NativeAudioDevicesInfo {
|
|
17
|
+
type: Constants.VoiceEventAudioDevicesUpdated;
|
|
18
|
+
}
|
package/src/type/Call.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { Constants } from '../constants';
|
|
2
|
+
import type { CustomParameters, Uuid } from './common';
|
|
3
|
+
import type { NativeErrorInfo } from './Error';
|
|
4
|
+
import type { Call } from '../Call';
|
|
5
|
+
import type { NativeCallMessageInfo } from './CallMessage';
|
|
6
|
+
|
|
7
|
+
export interface NativeCallInfo {
|
|
8
|
+
uuid: Uuid;
|
|
9
|
+
customParameters?: CustomParameters;
|
|
10
|
+
from?: string;
|
|
11
|
+
[Constants.CallInfoInitialConnectedTimestamp]?: string;
|
|
12
|
+
isMuted?: boolean;
|
|
13
|
+
isOnHold?: boolean;
|
|
14
|
+
sid?: string;
|
|
15
|
+
state?: Call.State;
|
|
16
|
+
to?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface NativeCallConnectedEvent {
|
|
20
|
+
type: Constants.CallEventConnected;
|
|
21
|
+
call: NativeCallInfo;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface NativeCallConnectFailureEvent {
|
|
25
|
+
type: Constants.CallEventConnectFailure;
|
|
26
|
+
call: NativeCallInfo;
|
|
27
|
+
error: NativeErrorInfo;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface NativeCallReconnectingEvent {
|
|
31
|
+
type: Constants.CallEventReconnecting;
|
|
32
|
+
call: NativeCallInfo;
|
|
33
|
+
error: NativeErrorInfo;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface NativeCallReconnectedEvent {
|
|
37
|
+
type: Constants.CallEventReconnected;
|
|
38
|
+
call: NativeCallInfo;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface NativeCallDisconnectedEvent {
|
|
42
|
+
type: Constants.CallEventDisconnected;
|
|
43
|
+
call: NativeCallInfo;
|
|
44
|
+
error?: NativeErrorInfo;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface NativeCallRingingEvent {
|
|
48
|
+
type: Constants.CallEventRinging;
|
|
49
|
+
call: NativeCallInfo;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type NativeCallQualityWarnings = string[];
|
|
53
|
+
|
|
54
|
+
export interface NativeCallQualityWarningsEvent {
|
|
55
|
+
type: Constants.CallEventQualityWarningsChanged;
|
|
56
|
+
call: NativeCallInfo;
|
|
57
|
+
[Constants.CallEventCurrentWarnings]: NativeCallQualityWarnings;
|
|
58
|
+
[Constants.CallEventPreviousWarnings]: NativeCallQualityWarnings;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface NativeCallMessageReceivedEvent {
|
|
62
|
+
type: Constants.CallEventMessageReceived;
|
|
63
|
+
call: NativeCallInfo;
|
|
64
|
+
[Constants.CallMessage]: NativeCallMessageInfo;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type NativeCallEvent =
|
|
68
|
+
| NativeCallConnectedEvent
|
|
69
|
+
| NativeCallConnectFailureEvent
|
|
70
|
+
| NativeCallReconnectingEvent
|
|
71
|
+
| NativeCallReconnectedEvent
|
|
72
|
+
| NativeCallDisconnectedEvent
|
|
73
|
+
| NativeCallRingingEvent
|
|
74
|
+
| NativeCallQualityWarningsEvent
|
|
75
|
+
| NativeCallMessageReceivedEvent;
|
|
76
|
+
|
|
77
|
+
export type NativeCallEventType =
|
|
78
|
+
| Constants.CallEventConnectFailure
|
|
79
|
+
| Constants.CallEventConnected
|
|
80
|
+
| Constants.CallEventDisconnected
|
|
81
|
+
| Constants.CallEventQualityWarningsChanged
|
|
82
|
+
| Constants.CallEventReconnected
|
|
83
|
+
| Constants.CallEventReconnecting
|
|
84
|
+
| Constants.CallEventRinging
|
|
85
|
+
| Constants.CallEventMessageReceived;
|
|
86
|
+
|
|
87
|
+
export type NativeCallFeedbackIssue =
|
|
88
|
+
| Constants.CallFeedbackIssueAudioLatency
|
|
89
|
+
| Constants.CallFeedbackIssueChoppyAudio
|
|
90
|
+
| Constants.CallFeedbackIssueDroppedCall
|
|
91
|
+
| Constants.CallFeedbackIssueEcho
|
|
92
|
+
| Constants.CallFeedbackIssueNoisyCall
|
|
93
|
+
| Constants.CallFeedbackIssueNotReported
|
|
94
|
+
| Constants.CallFeedbackIssueOneWayAudio;
|
|
95
|
+
|
|
96
|
+
export type NativeCallFeedbackScore =
|
|
97
|
+
| Constants.CallFeedbackScoreNotReported
|
|
98
|
+
| Constants.CallFeedbackScoreOne
|
|
99
|
+
| Constants.CallFeedbackScoreTwo
|
|
100
|
+
| Constants.CallFeedbackScoreThree
|
|
101
|
+
| Constants.CallFeedbackScoreFour
|
|
102
|
+
| Constants.CallFeedbackScoreFive;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Constants } from '../constants';
|
|
2
|
+
import type { CustomParameters, Uuid } from './common';
|
|
3
|
+
import type { NativeErrorInfo } from './Error';
|
|
4
|
+
import type { NativeCallMessageInfo } from './CallMessage';
|
|
5
|
+
|
|
6
|
+
export interface BaseNativeCallInviteEvent {
|
|
7
|
+
callSid: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface NativeCallInviteInfo {
|
|
11
|
+
uuid: Uuid;
|
|
12
|
+
callSid: string;
|
|
13
|
+
customParameters?: CustomParameters;
|
|
14
|
+
from: string;
|
|
15
|
+
to: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface NativeCallInviteAcceptedEvent
|
|
19
|
+
extends BaseNativeCallInviteEvent {
|
|
20
|
+
type: Constants.CallInviteEventTypeValueAccepted;
|
|
21
|
+
callInvite: NativeCallInviteInfo;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface NativeCallInviteNotificationTappedEvent
|
|
25
|
+
extends BaseNativeCallInviteEvent {
|
|
26
|
+
type: Constants.CallInviteEventTypeValueNotificationTapped;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface NativeCallInviteRejectedEvent
|
|
30
|
+
extends BaseNativeCallInviteEvent {
|
|
31
|
+
type: Constants.CallInviteEventTypeValueRejected;
|
|
32
|
+
callInvite: NativeCallInviteInfo;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface NativeCallInviteCancelledEvent
|
|
36
|
+
extends BaseNativeCallInviteEvent {
|
|
37
|
+
type: Constants.CallInviteEventTypeValueCancelled;
|
|
38
|
+
cancelledCallInvite: NativeCancelledCallInviteInfo;
|
|
39
|
+
error?: NativeErrorInfo;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface NativeCancelledCallInviteInfo {
|
|
43
|
+
callSid: string;
|
|
44
|
+
from: string;
|
|
45
|
+
to: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface NativeCallInviteMessageReceivedEvent
|
|
49
|
+
extends BaseNativeCallInviteEvent {
|
|
50
|
+
type: Constants.CallEventMessageReceived;
|
|
51
|
+
[Constants.CallMessage]: NativeCallMessageInfo;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type NativeCallInviteEvent =
|
|
55
|
+
| NativeCallInviteNotificationTappedEvent
|
|
56
|
+
| NativeCallInviteAcceptedEvent
|
|
57
|
+
| NativeCallInviteRejectedEvent
|
|
58
|
+
| NativeCallInviteCancelledEvent
|
|
59
|
+
| NativeCallInviteMessageReceivedEvent;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
* CallKit related types.
|
|
4
|
+
*/
|
|
5
|
+
export namespace CallKit {
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
* iOS CallKit configuration options.
|
|
9
|
+
*/
|
|
10
|
+
export type ConfigurationOptions = {
|
|
11
|
+
/**
|
|
12
|
+
* Filename of a 80x80 PNG image that will show in the system call UI as the app icon.
|
|
13
|
+
*/
|
|
14
|
+
callKitIconTemplateImageData: string;
|
|
15
|
+
/**
|
|
16
|
+
* Include call history in system recents (`true` by default).
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Only supported on iOS 11 and newer versions.
|
|
20
|
+
*/
|
|
21
|
+
callKitIncludesCallsInRecents: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Maximum number of call groups (`2` by default).
|
|
24
|
+
*/
|
|
25
|
+
callKitMaximumCallGroups: number;
|
|
26
|
+
/**
|
|
27
|
+
* Maximum number of calls per group (`5` by default).
|
|
28
|
+
*/
|
|
29
|
+
callKitMaximumCallsPerCallGroup: number;
|
|
30
|
+
/**
|
|
31
|
+
* Filename of the incoming call ringing tone.
|
|
32
|
+
*/
|
|
33
|
+
callKitRingtoneSound: string;
|
|
34
|
+
/**
|
|
35
|
+
* Supported handle types.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* See {@link CallKit.HandleType}.
|
|
39
|
+
*/
|
|
40
|
+
callKitSupportedHandleTypes: HandleType[];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @public
|
|
45
|
+
* Enumeration of all supported handle types by iOS CallKit.
|
|
46
|
+
*/
|
|
47
|
+
export enum HandleType {
|
|
48
|
+
/**
|
|
49
|
+
* Generic handle.
|
|
50
|
+
*/
|
|
51
|
+
Generic = 0,
|
|
52
|
+
/**
|
|
53
|
+
* Phone number handle.
|
|
54
|
+
*/
|
|
55
|
+
PhoneNumber = 1,
|
|
56
|
+
/**
|
|
57
|
+
* Email address handle.
|
|
58
|
+
*/
|
|
59
|
+
EmailAddress = 2,
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Constants } from '../constants';
|
|
2
|
+
import type { NativeErrorInfo } from './Error';
|
|
3
|
+
|
|
4
|
+
export interface NativeCallMessageInfo {
|
|
5
|
+
[Constants.CallMessageContent]: any;
|
|
6
|
+
[Constants.CallMessageContentType]: string;
|
|
7
|
+
[Constants.CallMessageMessageType]: string;
|
|
8
|
+
[Constants.VoiceEventSid]?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface NativeCallMessageEventBase {
|
|
12
|
+
[Constants.VoiceEventSid]: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface NativeCallMessageFailureEvent
|
|
16
|
+
extends NativeCallMessageEventBase {
|
|
17
|
+
type: Constants.CallEventMessageFailure;
|
|
18
|
+
error: NativeErrorInfo;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface NativeCallMessageSentEvent extends NativeCallMessageEventBase {
|
|
22
|
+
type: Constants.CallEventMessageSent;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type NativeCallMessageEvent =
|
|
26
|
+
| NativeCallMessageFailureEvent
|
|
27
|
+
| NativeCallMessageSentEvent;
|
|
28
|
+
|
|
29
|
+
export type NativeCallMessageEventType =
|
|
30
|
+
| Constants.CallEventMessageFailure
|
|
31
|
+
| Constants.CallEventMessageSent;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { NativeModulesStatic } from 'react-native';
|
|
2
|
+
import type { CallInvite } from '../CallInvite';
|
|
3
|
+
import type { NativeAudioDevicesInfo } from './AudioDevice';
|
|
4
|
+
import type {
|
|
5
|
+
NativeCallInfo,
|
|
6
|
+
NativeCallFeedbackIssue,
|
|
7
|
+
NativeCallFeedbackScore,
|
|
8
|
+
} from './Call';
|
|
9
|
+
import type { NativeCallInviteInfo } from './CallInvite';
|
|
10
|
+
import type { Uuid } from './common';
|
|
11
|
+
import type { RTCStats } from './RTCStats';
|
|
12
|
+
|
|
13
|
+
export interface TwilioVoiceReactNative extends NativeModulesStatic {
|
|
14
|
+
/**
|
|
15
|
+
* Native types.
|
|
16
|
+
*
|
|
17
|
+
* The following event related functions are required by the React Native
|
|
18
|
+
* bindings.
|
|
19
|
+
*/
|
|
20
|
+
addListener: (eventType: string) => void;
|
|
21
|
+
removeListeners: (count: number) => void;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Call bindings.
|
|
25
|
+
*/
|
|
26
|
+
call_disconnect(callUuid: Uuid): Promise<void>;
|
|
27
|
+
call_getStats(callUuid: Uuid): Promise<RTCStats.StatsReport>;
|
|
28
|
+
call_hold(callUuid: Uuid, hold: boolean): Promise<boolean>;
|
|
29
|
+
call_isOnHold(callUuid: Uuid): Promise<boolean>;
|
|
30
|
+
call_isMuted(callUuid: Uuid): Promise<boolean>;
|
|
31
|
+
call_mute(callUuid: Uuid, mute: boolean): Promise<boolean>;
|
|
32
|
+
call_postFeedback(
|
|
33
|
+
callUuid: Uuid,
|
|
34
|
+
score: NativeCallFeedbackScore,
|
|
35
|
+
issue: NativeCallFeedbackIssue
|
|
36
|
+
): Promise<void>;
|
|
37
|
+
call_sendDigits(callUuid: Uuid, digits: string): Promise<void>;
|
|
38
|
+
call_sendMessage(
|
|
39
|
+
callUuid: Uuid,
|
|
40
|
+
content: string,
|
|
41
|
+
contentType: string,
|
|
42
|
+
messageType: string
|
|
43
|
+
): Promise<string>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Call Invite bindings.
|
|
47
|
+
*/
|
|
48
|
+
callInvite_accept(
|
|
49
|
+
callInviteUuid: Uuid,
|
|
50
|
+
acceptOptions: CallInvite.AcceptOptions
|
|
51
|
+
): Promise<NativeCallInfo>;
|
|
52
|
+
callInvite_isValid(callInviteUuid: Uuid): Promise<boolean>;
|
|
53
|
+
callInvite_reject(callInviteUuid: Uuid): Promise<void>;
|
|
54
|
+
callInvite_updateCallerHandle(
|
|
55
|
+
callInviteUuid: Uuid,
|
|
56
|
+
handle: string
|
|
57
|
+
): Promise<void>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Voice bindings.
|
|
61
|
+
*/
|
|
62
|
+
voice_connect_android(
|
|
63
|
+
token: string,
|
|
64
|
+
twimlParams: Record<string, any>,
|
|
65
|
+
notificationDisplayName: string | undefined
|
|
66
|
+
): Promise<NativeCallInfo>;
|
|
67
|
+
voice_connect_ios(
|
|
68
|
+
token: string,
|
|
69
|
+
twimlParams: Record<string, any>,
|
|
70
|
+
contactHandle: string
|
|
71
|
+
): Promise<NativeCallInfo>;
|
|
72
|
+
voice_initializePushRegistry(): Promise<void>;
|
|
73
|
+
voice_setCallKitConfiguration(
|
|
74
|
+
configuration: Record<string, any>
|
|
75
|
+
): Promise<void>;
|
|
76
|
+
voice_setIncomingCallContactHandleTemplate(template?: string): Promise<void>;
|
|
77
|
+
voice_getAudioDevices(): Promise<NativeAudioDevicesInfo>;
|
|
78
|
+
voice_getCalls(): Promise<NativeCallInfo[]>;
|
|
79
|
+
voice_getCallInvites(): Promise<NativeCallInviteInfo[]>;
|
|
80
|
+
voice_getDeviceToken(): Promise<string>;
|
|
81
|
+
voice_getVersion(): Promise<string>;
|
|
82
|
+
voice_handleEvent(remoteMessage: Record<string, string>): Promise<boolean>;
|
|
83
|
+
voice_register(accessToken: string): Promise<void>;
|
|
84
|
+
voice_selectAudioDevice(audioDeviceUuid: Uuid): Promise<void>;
|
|
85
|
+
voice_showNativeAvRoutePicker(): Promise<void>;
|
|
86
|
+
voice_unregister(accessToken: string): Promise<void>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* System/permissions related bindings.
|
|
90
|
+
*/
|
|
91
|
+
system_isFullScreenNotificationEnabled(): Promise<boolean>;
|
|
92
|
+
system_requestFullScreenNotificationPermission(): Promise<void>;
|
|
93
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types related to WebRTC stats.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export namespace RTCStats {
|
|
7
|
+
export enum IceCandidatePairState {
|
|
8
|
+
STATE_FAILED = 'STATE_FAILED',
|
|
9
|
+
STATE_FROZEN = 'STATE_FROZEN',
|
|
10
|
+
STATE_IN_PROGRESS = 'STATE_IN_PROGRESS',
|
|
11
|
+
STATE_SUCCEEDED = 'STATE_SUCCEEDED',
|
|
12
|
+
STATE_WAITING = 'STATE_WAITING',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface IceCandidatePairStats {
|
|
16
|
+
activeCandidatePair: boolean;
|
|
17
|
+
availableIncomingBitrate: number;
|
|
18
|
+
availableOutgoingBitrate: number;
|
|
19
|
+
bytesReceived: number;
|
|
20
|
+
bytesSent: number;
|
|
21
|
+
consentRequestsReceived: number;
|
|
22
|
+
consentRequestsSent: number;
|
|
23
|
+
consentResponsesReceived: number;
|
|
24
|
+
consentResponsesSent: number;
|
|
25
|
+
currentRoundTripTime: number;
|
|
26
|
+
localCandidateId: string;
|
|
27
|
+
localCandidateIp: string;
|
|
28
|
+
nominated: boolean;
|
|
29
|
+
priority: number;
|
|
30
|
+
readable: boolean;
|
|
31
|
+
relayProtocol: string;
|
|
32
|
+
remoteCandidateId: string;
|
|
33
|
+
remoteCandidateIp: string;
|
|
34
|
+
requestsReceieved: number;
|
|
35
|
+
requestsSent: number;
|
|
36
|
+
responsesRecieved: number;
|
|
37
|
+
responsesSent: number;
|
|
38
|
+
retransmissionsReceived: number;
|
|
39
|
+
retransmissionsSent: number;
|
|
40
|
+
state: IceCandidatePairState;
|
|
41
|
+
totalRoundTripTime: number;
|
|
42
|
+
transportId: string;
|
|
43
|
+
writeable: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface IceCandidateStats {
|
|
47
|
+
candidateType: string;
|
|
48
|
+
deleted: boolean;
|
|
49
|
+
ip: string;
|
|
50
|
+
isRemote: boolean;
|
|
51
|
+
port: number;
|
|
52
|
+
priority: number;
|
|
53
|
+
protocol: string;
|
|
54
|
+
transportId: string;
|
|
55
|
+
url: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface BaseTrackStats {
|
|
59
|
+
codec: string;
|
|
60
|
+
packetsLost: number;
|
|
61
|
+
ssrc: string;
|
|
62
|
+
timestamp: number;
|
|
63
|
+
trackId: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface LocalTrackStats extends BaseTrackStats {
|
|
67
|
+
bytesSent: number;
|
|
68
|
+
packetsSent: number;
|
|
69
|
+
roundTripTime: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface LocalAudioTrackStats extends LocalTrackStats {
|
|
73
|
+
audioLevel: number;
|
|
74
|
+
jitter: number;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface RemoteTrackStats extends BaseTrackStats {
|
|
78
|
+
bytesRecieved: number;
|
|
79
|
+
packetsReceived: number;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface RemoteAudioTrackStats extends RemoteTrackStats {
|
|
83
|
+
audioLevel: number;
|
|
84
|
+
jitter: number;
|
|
85
|
+
mos: number;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* WebRTC stats report. Contains diagnostics information about
|
|
90
|
+
* `RTCPeerConnection`s and summarizes data for an ongoing call.
|
|
91
|
+
*/
|
|
92
|
+
export interface StatsReport {
|
|
93
|
+
iceCandidatePairStats: IceCandidatePairStats[];
|
|
94
|
+
iceCandidateStats: IceCandidateStats[];
|
|
95
|
+
localAudioTrackStats: LocalAudioTrackStats[];
|
|
96
|
+
peerConnectionId: string;
|
|
97
|
+
remoteAudioTrackStats: RemoteAudioTrackStats[];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Constants } from '../constants';
|
|
2
|
+
import type { NativeAudioDevicesUpdatedEvent } from './AudioDevice';
|
|
3
|
+
import type { NativeCallInviteInfo } from './CallInvite';
|
|
4
|
+
import type { NativeErrorEvent } from './Error';
|
|
5
|
+
|
|
6
|
+
export interface NativeRegisteredEvent {
|
|
7
|
+
type: Constants.VoiceEventRegistered;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface NativeUnregisteredEvent {
|
|
11
|
+
type: Constants.VoiceEventUnregistered;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface NativeCallInviteIncomingEvent {
|
|
15
|
+
[Constants.VoiceEventType]: Constants.VoiceEventTypeValueIncomingCallInvite;
|
|
16
|
+
callInvite: NativeCallInviteInfo;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type NativeVoiceEvent =
|
|
20
|
+
| NativeAudioDevicesUpdatedEvent
|
|
21
|
+
| NativeCallInviteIncomingEvent
|
|
22
|
+
| NativeErrorEvent
|
|
23
|
+
| NativeRegisteredEvent
|
|
24
|
+
| NativeUnregisteredEvent;
|
|
25
|
+
|
|
26
|
+
export type NativeVoiceEventType =
|
|
27
|
+
| Constants.VoiceEventAudioDevicesUpdated
|
|
28
|
+
| Constants.VoiceEventTypeValueIncomingCallInvite
|
|
29
|
+
| Constants.VoiceEventError
|
|
30
|
+
| Constants.VoiceEventRegistered
|
|
31
|
+
| Constants.VoiceEventUnregistered;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Call custom parameters. If custom parameters are present for a call, then
|
|
3
|
+
* it will have this typing.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* - `Call`s will have a method to access custom parameters, see
|
|
7
|
+
* {@link (Call:class).getCustomParameters}.
|
|
8
|
+
* - `CallInvite`s will have a method to access custom parameters for the call
|
|
9
|
+
* that is associated with the invite, see
|
|
10
|
+
* {@link (CallInvite:class).getCustomParameters}.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export type CustomParameters = Record<string, string>;
|
|
15
|
+
|
|
16
|
+
export type Uuid = string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "twilio-voice-react-native"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => "11.0" }
|
|
14
|
+
s.source = { :git => "https://github.com/mhuynh5757/twilio-voice-react-native.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm}"
|
|
17
|
+
|
|
18
|
+
s.dependency "React-Core"
|
|
19
|
+
s.dependency "TwilioVoice", "6.12.1"
|
|
20
|
+
s.xcconfig = { 'VALID_ARCHS' => 'arm64 x86_64' }
|
|
21
|
+
s.pod_target_xcconfig = { 'VALID_ARCHS[sdk=iphoneos*]' => 'arm64', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'arm64 x86_64' }
|
|
22
|
+
end
|