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.
Files changed (227) hide show
  1. package/LICENSE +206 -0
  2. package/README.md +179 -0
  3. package/android/build.gradle +113 -0
  4. package/android/gradle.properties +29 -0
  5. package/android/src/main/AndroidManifest.xml +30 -0
  6. package/android/src/main/java/com/twiliovoicereactnative/AudioSwitchManager.java +141 -0
  7. package/android/src/main/java/com/twiliovoicereactnative/CallListenerProxy.java +186 -0
  8. package/android/src/main/java/com/twiliovoicereactnative/CallMessageListenerProxy.java +103 -0
  9. package/android/src/main/java/com/twiliovoicereactnative/CallRecordDatabase.java +183 -0
  10. package/android/src/main/java/com/twiliovoicereactnative/CommonConstants.java +195 -0
  11. package/android/src/main/java/com/twiliovoicereactnative/ConfigurationProperties.java +41 -0
  12. package/android/src/main/java/com/twiliovoicereactnative/Constants.java +23 -0
  13. package/android/src/main/java/com/twiliovoicereactnative/ExpoActivityLifecycleListener.java +27 -0
  14. package/android/src/main/java/com/twiliovoicereactnative/ExpoApplicationLifecycleListener.java +14 -0
  15. package/android/src/main/java/com/twiliovoicereactnative/ExpoModule.kt +36 -0
  16. package/android/src/main/java/com/twiliovoicereactnative/ExpoPackage.java +20 -0
  17. package/android/src/main/java/com/twiliovoicereactnative/JSEventEmitter.java +98 -0
  18. package/android/src/main/java/com/twiliovoicereactnative/MediaPlayerManager.java +58 -0
  19. package/android/src/main/java/com/twiliovoicereactnative/NotificationUtility.java +363 -0
  20. package/android/src/main/java/com/twiliovoicereactnative/ReactNativeArgumentsSerializer.java +276 -0
  21. package/android/src/main/java/com/twiliovoicereactnative/SDKLog.java +74 -0
  22. package/android/src/main/java/com/twiliovoicereactnative/StatsListenerProxy.java +178 -0
  23. package/android/src/main/java/com/twiliovoicereactnative/TwilioVoiceReactNativeModule.java +778 -0
  24. package/android/src/main/java/com/twiliovoicereactnative/TwilioVoiceReactNativePackage.java +28 -0
  25. package/android/src/main/java/com/twiliovoicereactnative/VoiceActivityProxy.java +101 -0
  26. package/android/src/main/java/com/twiliovoicereactnative/VoiceApplicationProxy.java +133 -0
  27. package/android/src/main/java/com/twiliovoicereactnative/VoiceFirebaseMessagingService.java +88 -0
  28. package/android/src/main/java/com/twiliovoicereactnative/VoiceService.java +403 -0
  29. package/android/src/main/res/drawable/answered_call_small_icon.png +0 -0
  30. package/android/src/main/res/drawable/ic_launcher_round.png +0 -0
  31. package/android/src/main/res/drawable/ic_launcher_sdk.png +0 -0
  32. package/android/src/main/res/drawable/incoming_call_small_icon.png +0 -0
  33. package/android/src/main/res/drawable/outgoing_call_small_icon.png +0 -0
  34. package/android/src/main/res/raw/disconnect.wav +0 -0
  35. package/android/src/main/res/raw/incoming.wav +0 -0
  36. package/android/src/main/res/raw/outgoing.wav +0 -0
  37. package/android/src/main/res/raw/ringtone.wav +0 -0
  38. package/android/src/main/res/raw/silent.wav +0 -0
  39. package/android/src/main/res/values/colors.xml +11 -0
  40. package/android/src/main/res/values/config.xml +5 -0
  41. package/android/src/main/res/values/dimens.xml +7 -0
  42. package/android/src/main/res/values/strings.xml +25 -0
  43. package/android/src/main/res/values/styles.xml +10 -0
  44. package/android/src/main/res/values-night/colors.xml +11 -0
  45. package/expo-config-plugin/android.js +191 -0
  46. package/expo-config-plugin/ios.js +22 -0
  47. package/expo-module.config.json +6 -0
  48. package/ios/TwilioVoicePushRegistry.h +19 -0
  49. package/ios/TwilioVoicePushRegistry.m +72 -0
  50. package/ios/TwilioVoiceReactNative+CallInvite.m +56 -0
  51. package/ios/TwilioVoiceReactNative+CallKit.m +533 -0
  52. package/ios/TwilioVoiceReactNative+CallMessage.m +81 -0
  53. package/ios/TwilioVoiceReactNative.h +74 -0
  54. package/ios/TwilioVoiceReactNative.m +1046 -0
  55. package/ios/TwilioVoiceReactNative.xcodeproj/project.pbxproj +328 -0
  56. package/ios/TwilioVoiceReactNativeConstants.h +200 -0
  57. package/ios/Utilities/TwilioVoiceStatsReport.h +175 -0
  58. package/lib/commonjs/AudioDevice.js +101 -0
  59. package/lib/commonjs/AudioDevice.js.map +1 -0
  60. package/lib/commonjs/Call.js +765 -0
  61. package/lib/commonjs/Call.js.map +1 -0
  62. package/lib/commonjs/CallInvite.js +452 -0
  63. package/lib/commonjs/CallInvite.js.map +1 -0
  64. package/lib/commonjs/CallMessage/CallMessage.js +54 -0
  65. package/lib/commonjs/CallMessage/CallMessage.js.map +1 -0
  66. package/lib/commonjs/CallMessage/IncomingCallMessage.js +120 -0
  67. package/lib/commonjs/CallMessage/IncomingCallMessage.js.map +1 -0
  68. package/lib/commonjs/CallMessage/OutgoingCallMessage.js +148 -0
  69. package/lib/commonjs/CallMessage/OutgoingCallMessage.js.map +1 -0
  70. package/lib/commonjs/ExpoModule.js +69 -0
  71. package/lib/commonjs/ExpoModule.js.map +1 -0
  72. package/lib/commonjs/Voice.js +611 -0
  73. package/lib/commonjs/Voice.js.map +1 -0
  74. package/lib/commonjs/common.js +26 -0
  75. package/lib/commonjs/common.js.map +1 -0
  76. package/lib/commonjs/constants.js +158 -0
  77. package/lib/commonjs/constants.js.map +1 -0
  78. package/lib/commonjs/error/InvalidArgumentError.js +32 -0
  79. package/lib/commonjs/error/InvalidArgumentError.js.map +1 -0
  80. package/lib/commonjs/error/InvalidStateError.js +33 -0
  81. package/lib/commonjs/error/InvalidStateError.js.map +1 -0
  82. package/lib/commonjs/error/TwilioError.js +38 -0
  83. package/lib/commonjs/error/TwilioError.js.map +1 -0
  84. package/lib/commonjs/error/UnsupportedPlatformError.js +33 -0
  85. package/lib/commonjs/error/UnsupportedPlatformError.js.map +1 -0
  86. package/lib/commonjs/error/generated.js +2343 -0
  87. package/lib/commonjs/error/generated.js.map +1 -0
  88. package/lib/commonjs/error/index.js +112 -0
  89. package/lib/commonjs/error/index.js.map +1 -0
  90. package/lib/commonjs/error/utility.js +37 -0
  91. package/lib/commonjs/error/utility.js.map +1 -0
  92. package/lib/commonjs/index.js +95 -0
  93. package/lib/commonjs/index.js.map +1 -0
  94. package/lib/commonjs/type/AudioDevice.js +6 -0
  95. package/lib/commonjs/type/AudioDevice.js.map +1 -0
  96. package/lib/commonjs/type/Call.js +6 -0
  97. package/lib/commonjs/type/Call.js.map +1 -0
  98. package/lib/commonjs/type/CallInvite.js +6 -0
  99. package/lib/commonjs/type/CallInvite.js.map +1 -0
  100. package/lib/commonjs/type/CallKit.js +30 -0
  101. package/lib/commonjs/type/CallKit.js.map +1 -0
  102. package/lib/commonjs/type/CallMessage.js +6 -0
  103. package/lib/commonjs/type/CallMessage.js.map +1 -0
  104. package/lib/commonjs/type/Error.js +6 -0
  105. package/lib/commonjs/type/Error.js.map +1 -0
  106. package/lib/commonjs/type/NativeModule.js +6 -0
  107. package/lib/commonjs/type/NativeModule.js.map +1 -0
  108. package/lib/commonjs/type/RTCStats.js +29 -0
  109. package/lib/commonjs/type/RTCStats.js.map +1 -0
  110. package/lib/commonjs/type/Voice.js +6 -0
  111. package/lib/commonjs/type/Voice.js.map +1 -0
  112. package/lib/commonjs/type/common.js +2 -0
  113. package/lib/commonjs/type/common.js.map +1 -0
  114. package/lib/module/AudioDevice.js +97 -0
  115. package/lib/module/AudioDevice.js.map +1 -0
  116. package/lib/module/Call.js +766 -0
  117. package/lib/module/Call.js.map +1 -0
  118. package/lib/module/CallInvite.js +450 -0
  119. package/lib/module/CallInvite.js.map +1 -0
  120. package/lib/module/CallMessage/CallMessage.js +51 -0
  121. package/lib/module/CallMessage/CallMessage.js.map +1 -0
  122. package/lib/module/CallMessage/IncomingCallMessage.js +116 -0
  123. package/lib/module/CallMessage/IncomingCallMessage.js.map +1 -0
  124. package/lib/module/CallMessage/OutgoingCallMessage.js +154 -0
  125. package/lib/module/CallMessage/OutgoingCallMessage.js.map +1 -0
  126. package/lib/module/ExpoModule.js +58 -0
  127. package/lib/module/ExpoModule.js.map +1 -0
  128. package/lib/module/Voice.js +598 -0
  129. package/lib/module/Voice.js.map +1 -0
  130. package/lib/module/common.js +11 -0
  131. package/lib/module/common.js.map +1 -0
  132. package/lib/module/constants.js +151 -0
  133. package/lib/module/constants.js.map +1 -0
  134. package/lib/module/error/InvalidArgumentError.js +23 -0
  135. package/lib/module/error/InvalidArgumentError.js.map +1 -0
  136. package/lib/module/error/InvalidStateError.js +24 -0
  137. package/lib/module/error/InvalidStateError.js.map +1 -0
  138. package/lib/module/error/TwilioError.js +29 -0
  139. package/lib/module/error/TwilioError.js.map +1 -0
  140. package/lib/module/error/UnsupportedPlatformError.js +24 -0
  141. package/lib/module/error/UnsupportedPlatformError.js.map +1 -0
  142. package/lib/module/error/generated.js +2315 -0
  143. package/lib/module/error/generated.js.map +1 -0
  144. package/lib/module/error/index.js +6 -0
  145. package/lib/module/error/index.js.map +1 -0
  146. package/lib/module/error/utility.js +27 -0
  147. package/lib/module/error/utility.js.map +1 -0
  148. package/lib/module/index.js +23 -0
  149. package/lib/module/index.js.map +1 -0
  150. package/lib/module/type/AudioDevice.js +2 -0
  151. package/lib/module/type/AudioDevice.js.map +1 -0
  152. package/lib/module/type/Call.js +2 -0
  153. package/lib/module/type/Call.js.map +1 -0
  154. package/lib/module/type/CallInvite.js +2 -0
  155. package/lib/module/type/CallInvite.js.map +1 -0
  156. package/lib/module/type/CallKit.js +22 -0
  157. package/lib/module/type/CallKit.js.map +1 -0
  158. package/lib/module/type/CallMessage.js +2 -0
  159. package/lib/module/type/CallMessage.js.map +1 -0
  160. package/lib/module/type/Error.js +2 -0
  161. package/lib/module/type/Error.js.map +1 -0
  162. package/lib/module/type/NativeModule.js +2 -0
  163. package/lib/module/type/NativeModule.js.map +1 -0
  164. package/lib/module/type/RTCStats.js +21 -0
  165. package/lib/module/type/RTCStats.js.map +1 -0
  166. package/lib/module/type/Voice.js +2 -0
  167. package/lib/module/type/Voice.js.map +1 -0
  168. package/lib/module/type/common.js +2 -0
  169. package/lib/module/type/common.js.map +1 -0
  170. package/lib/typescript/AudioDevice.d.ts +74 -0
  171. package/lib/typescript/Call.d.ts +874 -0
  172. package/lib/typescript/CallInvite.d.ts +484 -0
  173. package/lib/typescript/CallMessage/CallMessage.d.ts +53 -0
  174. package/lib/typescript/CallMessage/IncomingCallMessage.d.ts +75 -0
  175. package/lib/typescript/CallMessage/OutgoingCallMessage.d.ts +198 -0
  176. package/lib/typescript/ExpoModule.d.ts +13 -0
  177. package/lib/typescript/Voice.d.ts +620 -0
  178. package/lib/typescript/common.d.ts +11 -0
  179. package/lib/typescript/constants.d.ts +148 -0
  180. package/lib/typescript/error/InvalidArgumentError.d.ts +11 -0
  181. package/lib/typescript/error/InvalidStateError.d.ts +12 -0
  182. package/lib/typescript/error/TwilioError.d.ts +14 -0
  183. package/lib/typescript/error/UnsupportedPlatformError.d.ts +12 -0
  184. package/lib/typescript/error/generated.d.ts +1558 -0
  185. package/lib/typescript/error/index.d.ts +5 -0
  186. package/lib/typescript/error/utility.d.ts +12 -0
  187. package/lib/typescript/index.d.ts +18 -0
  188. package/lib/typescript/type/AudioDevice.d.ts +15 -0
  189. package/lib/typescript/type/Call.d.ts +59 -0
  190. package/lib/typescript/type/CallInvite.d.ts +40 -0
  191. package/lib/typescript/type/CallKit.d.ts +60 -0
  192. package/lib/typescript/type/CallMessage.d.ts +20 -0
  193. package/lib/typescript/type/Error.d.ts +9 -0
  194. package/lib/typescript/type/NativeModule.d.ts +59 -0
  195. package/lib/typescript/type/RTCStats.d.ts +91 -0
  196. package/lib/typescript/type/Voice.d.ts +16 -0
  197. package/lib/typescript/type/common.d.ts +15 -0
  198. package/package.json +167 -0
  199. package/src/AudioDevice.tsx +88 -0
  200. package/src/Call.tsx +1343 -0
  201. package/src/CallInvite.tsx +757 -0
  202. package/src/CallMessage/CallMessage.ts +83 -0
  203. package/src/CallMessage/IncomingCallMessage.ts +104 -0
  204. package/src/CallMessage/OutgoingCallMessage.ts +308 -0
  205. package/src/ExpoModule.ts +59 -0
  206. package/src/Voice.tsx +1010 -0
  207. package/src/common.ts +16 -0
  208. package/src/constants.ts +193 -0
  209. package/src/error/InvalidArgumentError.ts +19 -0
  210. package/src/error/InvalidStateError.ts +19 -0
  211. package/src/error/TwilioError.ts +22 -0
  212. package/src/error/UnsupportedPlatformError.ts +19 -0
  213. package/src/error/generated.ts +2277 -0
  214. package/src/error/index.ts +18 -0
  215. package/src/error/utility.ts +36 -0
  216. package/src/index.tsx +24 -0
  217. package/src/type/AudioDevice.ts +18 -0
  218. package/src/type/Call.ts +102 -0
  219. package/src/type/CallInvite.ts +59 -0
  220. package/src/type/CallKit.ts +61 -0
  221. package/src/type/CallMessage.ts +31 -0
  222. package/src/type/Error.ts +11 -0
  223. package/src/type/NativeModule.ts +93 -0
  224. package/src/type/RTCStats.ts +99 -0
  225. package/src/type/Voice.ts +31 -0
  226. package/src/type/common.ts +16 -0
  227. package/twilio-voice-react-native.podspec +22 -0
@@ -0,0 +1,5 @@
1
+ export { InvalidArgumentError } from './InvalidArgumentError';
2
+ export { InvalidStateError } from './InvalidStateError';
3
+ export { UnsupportedPlatformError } from './UnsupportedPlatformError';
4
+ export { TwilioError } from './TwilioError';
5
+ export { AuthorizationErrors, ClientErrors, ForbiddenErrors, GeneralErrors, MalformedRequestErrors, MediaErrors, RegistrationErrors, ServerErrors, SignalingErrors, SIPServerErrors, TwiMLErrors, UserMediaErrors, } from './generated';
@@ -0,0 +1,12 @@
1
+ import { TwilioError } from './TwilioError';
2
+ /**
3
+ * Uses the generated error-code map to create the appropriate error.
4
+ * If the code is "unexpected" such that there is no constructor for that
5
+ * specific code, this function will default to a generic {@link TwilioError}.
6
+ *
7
+ * @param message an error message
8
+ * @param code a Twilio error code, for example `31209`
9
+ *
10
+ * @returns a {@link TwilioError} or appropriate sub-class
11
+ */
12
+ export declare function constructTwilioError(message: string, code: number): TwilioError;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Provides access to Twilio Programmable Voice for React Native applications
3
+ * running on iOS and Android devices.
4
+ *
5
+ * @packageDocumentation
6
+ */
7
+ export { Voice } from './Voice';
8
+ export { AudioDevice } from './AudioDevice';
9
+ export { Call } from './Call';
10
+ export { CallInvite } from './CallInvite';
11
+ export { CallMessage } from './CallMessage/CallMessage';
12
+ export { IncomingCallMessage } from './CallMessage/IncomingCallMessage';
13
+ export { OutgoingCallMessage } from './CallMessage/OutgoingCallMessage';
14
+ export { CustomParameters } from './type/common';
15
+ export { CallKit } from './type/CallKit';
16
+ export { RTCStats } from './type/RTCStats';
17
+ import * as TwilioErrors from './error';
18
+ export { TwilioErrors };
@@ -0,0 +1,15 @@
1
+ import type { AudioDevice } from '../AudioDevice';
2
+ import type { Constants } from '../constants';
3
+ import type { Uuid } from './common';
4
+ export interface NativeAudioDeviceInfo {
5
+ uuid: Uuid;
6
+ type: AudioDevice.Type;
7
+ name: string;
8
+ }
9
+ export interface NativeAudioDevicesInfo {
10
+ audioDevices: NativeAudioDeviceInfo[];
11
+ selectedDevice?: NativeAudioDeviceInfo;
12
+ }
13
+ export interface NativeAudioDevicesUpdatedEvent extends NativeAudioDevicesInfo {
14
+ type: Constants.VoiceEventAudioDevicesUpdated;
15
+ }
@@ -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 { Call } from '../Call';
5
+ import type { NativeCallMessageInfo } from './CallMessage';
6
+ export interface NativeCallInfo {
7
+ uuid: Uuid;
8
+ customParameters?: CustomParameters;
9
+ from?: string;
10
+ [Constants.CallInfoInitialConnectedTimestamp]?: string;
11
+ isMuted?: boolean;
12
+ isOnHold?: boolean;
13
+ sid?: string;
14
+ state?: Call.State;
15
+ to?: string;
16
+ }
17
+ export interface NativeCallConnectedEvent {
18
+ type: Constants.CallEventConnected;
19
+ call: NativeCallInfo;
20
+ }
21
+ export interface NativeCallConnectFailureEvent {
22
+ type: Constants.CallEventConnectFailure;
23
+ call: NativeCallInfo;
24
+ error: NativeErrorInfo;
25
+ }
26
+ export interface NativeCallReconnectingEvent {
27
+ type: Constants.CallEventReconnecting;
28
+ call: NativeCallInfo;
29
+ error: NativeErrorInfo;
30
+ }
31
+ export interface NativeCallReconnectedEvent {
32
+ type: Constants.CallEventReconnected;
33
+ call: NativeCallInfo;
34
+ }
35
+ export interface NativeCallDisconnectedEvent {
36
+ type: Constants.CallEventDisconnected;
37
+ call: NativeCallInfo;
38
+ error?: NativeErrorInfo;
39
+ }
40
+ export interface NativeCallRingingEvent {
41
+ type: Constants.CallEventRinging;
42
+ call: NativeCallInfo;
43
+ }
44
+ export type NativeCallQualityWarnings = string[];
45
+ export interface NativeCallQualityWarningsEvent {
46
+ type: Constants.CallEventQualityWarningsChanged;
47
+ call: NativeCallInfo;
48
+ [Constants.CallEventCurrentWarnings]: NativeCallQualityWarnings;
49
+ [Constants.CallEventPreviousWarnings]: NativeCallQualityWarnings;
50
+ }
51
+ export interface NativeCallMessageReceivedEvent {
52
+ type: Constants.CallEventMessageReceived;
53
+ call: NativeCallInfo;
54
+ [Constants.CallMessage]: NativeCallMessageInfo;
55
+ }
56
+ export type NativeCallEvent = NativeCallConnectedEvent | NativeCallConnectFailureEvent | NativeCallReconnectingEvent | NativeCallReconnectedEvent | NativeCallDisconnectedEvent | NativeCallRingingEvent | NativeCallQualityWarningsEvent | NativeCallMessageReceivedEvent;
57
+ export type NativeCallEventType = Constants.CallEventConnectFailure | Constants.CallEventConnected | Constants.CallEventDisconnected | Constants.CallEventQualityWarningsChanged | Constants.CallEventReconnected | Constants.CallEventReconnecting | Constants.CallEventRinging | Constants.CallEventMessageReceived;
58
+ export type NativeCallFeedbackIssue = Constants.CallFeedbackIssueAudioLatency | Constants.CallFeedbackIssueChoppyAudio | Constants.CallFeedbackIssueDroppedCall | Constants.CallFeedbackIssueEcho | Constants.CallFeedbackIssueNoisyCall | Constants.CallFeedbackIssueNotReported | Constants.CallFeedbackIssueOneWayAudio;
59
+ export type NativeCallFeedbackScore = Constants.CallFeedbackScoreNotReported | Constants.CallFeedbackScoreOne | Constants.CallFeedbackScoreTwo | Constants.CallFeedbackScoreThree | Constants.CallFeedbackScoreFour | Constants.CallFeedbackScoreFive;
@@ -0,0 +1,40 @@
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
+ export interface BaseNativeCallInviteEvent {
6
+ callSid: string;
7
+ }
8
+ export interface NativeCallInviteInfo {
9
+ uuid: Uuid;
10
+ callSid: string;
11
+ customParameters?: CustomParameters;
12
+ from: string;
13
+ to: string;
14
+ }
15
+ export interface NativeCallInviteAcceptedEvent extends BaseNativeCallInviteEvent {
16
+ type: Constants.CallInviteEventTypeValueAccepted;
17
+ callInvite: NativeCallInviteInfo;
18
+ }
19
+ export interface NativeCallInviteNotificationTappedEvent extends BaseNativeCallInviteEvent {
20
+ type: Constants.CallInviteEventTypeValueNotificationTapped;
21
+ }
22
+ export interface NativeCallInviteRejectedEvent extends BaseNativeCallInviteEvent {
23
+ type: Constants.CallInviteEventTypeValueRejected;
24
+ callInvite: NativeCallInviteInfo;
25
+ }
26
+ export interface NativeCallInviteCancelledEvent extends BaseNativeCallInviteEvent {
27
+ type: Constants.CallInviteEventTypeValueCancelled;
28
+ cancelledCallInvite: NativeCancelledCallInviteInfo;
29
+ error?: NativeErrorInfo;
30
+ }
31
+ export interface NativeCancelledCallInviteInfo {
32
+ callSid: string;
33
+ from: string;
34
+ to: string;
35
+ }
36
+ export interface NativeCallInviteMessageReceivedEvent extends BaseNativeCallInviteEvent {
37
+ type: Constants.CallEventMessageReceived;
38
+ [Constants.CallMessage]: NativeCallMessageInfo;
39
+ }
40
+ export type NativeCallInviteEvent = NativeCallInviteNotificationTappedEvent | NativeCallInviteAcceptedEvent | NativeCallInviteRejectedEvent | NativeCallInviteCancelledEvent | NativeCallInviteMessageReceivedEvent;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @public
3
+ * CallKit related types.
4
+ */
5
+ export declare namespace CallKit {
6
+ /**
7
+ * @public
8
+ * iOS CallKit configuration options.
9
+ */
10
+ 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
+ * @public
44
+ * Enumeration of all supported handle types by iOS CallKit.
45
+ */
46
+ enum HandleType {
47
+ /**
48
+ * Generic handle.
49
+ */
50
+ Generic = 0,
51
+ /**
52
+ * Phone number handle.
53
+ */
54
+ PhoneNumber = 1,
55
+ /**
56
+ * Email address handle.
57
+ */
58
+ EmailAddress = 2
59
+ }
60
+ }
@@ -0,0 +1,20 @@
1
+ import type { Constants } from '../constants';
2
+ import type { NativeErrorInfo } from './Error';
3
+ export interface NativeCallMessageInfo {
4
+ [Constants.CallMessageContent]: any;
5
+ [Constants.CallMessageContentType]: string;
6
+ [Constants.CallMessageMessageType]: string;
7
+ [Constants.VoiceEventSid]?: string;
8
+ }
9
+ export interface NativeCallMessageEventBase {
10
+ [Constants.VoiceEventSid]: string;
11
+ }
12
+ export interface NativeCallMessageFailureEvent extends NativeCallMessageEventBase {
13
+ type: Constants.CallEventMessageFailure;
14
+ error: NativeErrorInfo;
15
+ }
16
+ export interface NativeCallMessageSentEvent extends NativeCallMessageEventBase {
17
+ type: Constants.CallEventMessageSent;
18
+ }
19
+ export type NativeCallMessageEvent = NativeCallMessageFailureEvent | NativeCallMessageSentEvent;
20
+ export type NativeCallMessageEventType = Constants.CallEventMessageFailure | Constants.CallEventMessageSent;
@@ -0,0 +1,9 @@
1
+ import type { Constants } from '../constants';
2
+ export interface NativeErrorInfo {
3
+ code: number;
4
+ message: string;
5
+ }
6
+ export interface NativeErrorEvent {
7
+ type: Constants.VoiceEventError;
8
+ error: NativeErrorInfo;
9
+ }
@@ -0,0 +1,59 @@
1
+ import type { NativeModulesStatic } from 'react-native';
2
+ import type { CallInvite } from '../CallInvite';
3
+ import type { NativeAudioDevicesInfo } from './AudioDevice';
4
+ import type { NativeCallInfo, NativeCallFeedbackIssue, NativeCallFeedbackScore } from './Call';
5
+ import type { NativeCallInviteInfo } from './CallInvite';
6
+ import type { Uuid } from './common';
7
+ import type { RTCStats } from './RTCStats';
8
+ export interface TwilioVoiceReactNative extends NativeModulesStatic {
9
+ /**
10
+ * Native types.
11
+ *
12
+ * The following event related functions are required by the React Native
13
+ * bindings.
14
+ */
15
+ addListener: (eventType: string) => void;
16
+ removeListeners: (count: number) => void;
17
+ /**
18
+ * Call bindings.
19
+ */
20
+ call_disconnect(callUuid: Uuid): Promise<void>;
21
+ call_getStats(callUuid: Uuid): Promise<RTCStats.StatsReport>;
22
+ call_hold(callUuid: Uuid, hold: boolean): Promise<boolean>;
23
+ call_isOnHold(callUuid: Uuid): Promise<boolean>;
24
+ call_isMuted(callUuid: Uuid): Promise<boolean>;
25
+ call_mute(callUuid: Uuid, mute: boolean): Promise<boolean>;
26
+ call_postFeedback(callUuid: Uuid, score: NativeCallFeedbackScore, issue: NativeCallFeedbackIssue): Promise<void>;
27
+ call_sendDigits(callUuid: Uuid, digits: string): Promise<void>;
28
+ call_sendMessage(callUuid: Uuid, content: string, contentType: string, messageType: string): Promise<string>;
29
+ /**
30
+ * Call Invite bindings.
31
+ */
32
+ callInvite_accept(callInviteUuid: Uuid, acceptOptions: CallInvite.AcceptOptions): Promise<NativeCallInfo>;
33
+ callInvite_isValid(callInviteUuid: Uuid): Promise<boolean>;
34
+ callInvite_reject(callInviteUuid: Uuid): Promise<void>;
35
+ callInvite_updateCallerHandle(callInviteUuid: Uuid, handle: string): Promise<void>;
36
+ /**
37
+ * Voice bindings.
38
+ */
39
+ voice_connect_android(token: string, twimlParams: Record<string, any>, notificationDisplayName: string | undefined): Promise<NativeCallInfo>;
40
+ voice_connect_ios(token: string, twimlParams: Record<string, any>, contactHandle: string): Promise<NativeCallInfo>;
41
+ voice_initializePushRegistry(): Promise<void>;
42
+ voice_setCallKitConfiguration(configuration: Record<string, any>): Promise<void>;
43
+ voice_setIncomingCallContactHandleTemplate(template?: string): Promise<void>;
44
+ voice_getAudioDevices(): Promise<NativeAudioDevicesInfo>;
45
+ voice_getCalls(): Promise<NativeCallInfo[]>;
46
+ voice_getCallInvites(): Promise<NativeCallInviteInfo[]>;
47
+ voice_getDeviceToken(): Promise<string>;
48
+ voice_getVersion(): Promise<string>;
49
+ voice_handleEvent(remoteMessage: Record<string, string>): Promise<boolean>;
50
+ voice_register(accessToken: string): Promise<void>;
51
+ voice_selectAudioDevice(audioDeviceUuid: Uuid): Promise<void>;
52
+ voice_showNativeAvRoutePicker(): Promise<void>;
53
+ voice_unregister(accessToken: string): Promise<void>;
54
+ /**
55
+ * System/permissions related bindings.
56
+ */
57
+ system_isFullScreenNotificationEnabled(): Promise<boolean>;
58
+ system_requestFullScreenNotificationPermission(): Promise<void>;
59
+ }
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Types related to WebRTC stats.
3
+ *
4
+ * @public
5
+ */
6
+ export declare namespace RTCStats {
7
+ 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
+ interface IceCandidatePairStats {
15
+ activeCandidatePair: boolean;
16
+ availableIncomingBitrate: number;
17
+ availableOutgoingBitrate: number;
18
+ bytesReceived: number;
19
+ bytesSent: number;
20
+ consentRequestsReceived: number;
21
+ consentRequestsSent: number;
22
+ consentResponsesReceived: number;
23
+ consentResponsesSent: number;
24
+ currentRoundTripTime: number;
25
+ localCandidateId: string;
26
+ localCandidateIp: string;
27
+ nominated: boolean;
28
+ priority: number;
29
+ readable: boolean;
30
+ relayProtocol: string;
31
+ remoteCandidateId: string;
32
+ remoteCandidateIp: string;
33
+ requestsReceieved: number;
34
+ requestsSent: number;
35
+ responsesRecieved: number;
36
+ responsesSent: number;
37
+ retransmissionsReceived: number;
38
+ retransmissionsSent: number;
39
+ state: IceCandidatePairState;
40
+ totalRoundTripTime: number;
41
+ transportId: string;
42
+ writeable: boolean;
43
+ }
44
+ interface IceCandidateStats {
45
+ candidateType: string;
46
+ deleted: boolean;
47
+ ip: string;
48
+ isRemote: boolean;
49
+ port: number;
50
+ priority: number;
51
+ protocol: string;
52
+ transportId: string;
53
+ url: string;
54
+ }
55
+ interface BaseTrackStats {
56
+ codec: string;
57
+ packetsLost: number;
58
+ ssrc: string;
59
+ timestamp: number;
60
+ trackId: string;
61
+ }
62
+ interface LocalTrackStats extends BaseTrackStats {
63
+ bytesSent: number;
64
+ packetsSent: number;
65
+ roundTripTime: number;
66
+ }
67
+ interface LocalAudioTrackStats extends LocalTrackStats {
68
+ audioLevel: number;
69
+ jitter: number;
70
+ }
71
+ interface RemoteTrackStats extends BaseTrackStats {
72
+ bytesRecieved: number;
73
+ packetsReceived: number;
74
+ }
75
+ interface RemoteAudioTrackStats extends RemoteTrackStats {
76
+ audioLevel: number;
77
+ jitter: number;
78
+ mos: number;
79
+ }
80
+ /**
81
+ * WebRTC stats report. Contains diagnostics information about
82
+ * `RTCPeerConnection`s and summarizes data for an ongoing call.
83
+ */
84
+ interface StatsReport {
85
+ iceCandidatePairStats: IceCandidatePairStats[];
86
+ iceCandidateStats: IceCandidateStats[];
87
+ localAudioTrackStats: LocalAudioTrackStats[];
88
+ peerConnectionId: string;
89
+ remoteAudioTrackStats: RemoteAudioTrackStats[];
90
+ }
91
+ }
@@ -0,0 +1,16 @@
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
+ export interface NativeRegisteredEvent {
6
+ type: Constants.VoiceEventRegistered;
7
+ }
8
+ export interface NativeUnregisteredEvent {
9
+ type: Constants.VoiceEventUnregistered;
10
+ }
11
+ export interface NativeCallInviteIncomingEvent {
12
+ [Constants.VoiceEventType]: Constants.VoiceEventTypeValueIncomingCallInvite;
13
+ callInvite: NativeCallInviteInfo;
14
+ }
15
+ export type NativeVoiceEvent = NativeAudioDevicesUpdatedEvent | NativeCallInviteIncomingEvent | NativeErrorEvent | NativeRegisteredEvent | NativeUnregisteredEvent;
16
+ export type NativeVoiceEventType = Constants.VoiceEventAudioDevicesUpdated | Constants.VoiceEventTypeValueIncomingCallInvite | Constants.VoiceEventError | Constants.VoiceEventRegistered | Constants.VoiceEventUnregistered;
@@ -0,0 +1,15 @@
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
+ export type Uuid = string;
package/package.json ADDED
@@ -0,0 +1,167 @@
1
+ {
2
+ "name": "voice-react-native-sdk",
3
+ "version": "1.6.2-fork.4",
4
+ "description": "Twilio Voice React Native SDK",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "cpp",
16
+ "twilio-voice-react-native.podspec",
17
+ "expo-config-plugin",
18
+ "expo-module.config.json",
19
+ "!lib/typescript/test/app",
20
+ "!android/build",
21
+ "!ios/build",
22
+ "!**/__tests__",
23
+ "!**/__fixtures__",
24
+ "!**/__mocks__"
25
+ ],
26
+ "scripts": {
27
+ "app": "yarn run check && yarn --cwd test/app",
28
+ "bootstrap": "yarn run build:constants && yarn --cwd test/app && yarn && yarn pods",
29
+ "build:api:extractor": "api-extractor run --local",
30
+ "build:api:documenter": "api-documenter markdown --input-folder ./temp --output-folder ./docs/api",
31
+ "build:constants": "node ./scripts/generate-constants.js",
32
+ "build:docs": "yarn run prepare && yarn run build:api:extractor && yarn run build:api:documenter",
33
+ "build:errors": "node ./scripts/generate-errors.js",
34
+ "check:lint": "eslint \"**/*.{js,ts,tsx}\"",
35
+ "check:test": "jest",
36
+ "check:type": "tsc --noEmit",
37
+ "check:api": "git diff --exit-code src/error/generated.ts api/",
38
+ "check": "yarn run build:constants && yarn run build:errors && yarn run build:docs && yarn run check:api && yarn run check:type && yarn run check:lint && yarn run check:test --coverage",
39
+ "pods": "cd test/app && pod-install --quiet",
40
+ "prepare": "yarn run build:constants && bob build",
41
+ "release": "release",
42
+ "test": "jest"
43
+ },
44
+ "keywords": [
45
+ "react-native",
46
+ "ios",
47
+ "android"
48
+ ],
49
+ "repository": "https://github.com/ContractorAI/twilio-voice-react-native-expo",
50
+ "author": "Domenic Belcastro (https://github.com/domenic39)",
51
+ "license": "MIT",
52
+ "bugs": {
53
+ "url": "https://github.com/ContractorAI/twilio-voice-react-native-expo/issues"
54
+ },
55
+ "homepage": "https://github.com/ContractorAI/twilio-voice-react-native-expo#readme",
56
+ "publishConfig": {
57
+ "registry": "https://registry.npmjs.org/"
58
+ },
59
+ "devDependencies": {
60
+ "@babel/core": "^7.25.2",
61
+ "@babel/preset-env": "7.23.8",
62
+ "@commitlint/config-conventional": "^11.0.0",
63
+ "@microsoft/api-extractor": "^7.25.2",
64
+ "@ngrok/ngrok": "^1.3.0",
65
+ "@react-native-community/eslint-config": "^2.0.0",
66
+ "@types/jest": "^28.1.6",
67
+ "@types/react": "~19.0.10",
68
+ "@types/react-native": "0.62.13",
69
+ "api-documenter": "github:twilio/api-documenter#v0.0.1",
70
+ "axios": "^1.11.0",
71
+ "commitlint": "^11.0.0",
72
+ "cors": "^2.8.5",
73
+ "detox": "^20.40.2",
74
+ "eslint": "^7.2.0",
75
+ "eslint-config-prettier": "^7.0.0",
76
+ "eslint-plugin-prettier": "^3.1.3",
77
+ "expo": "~53.0.22",
78
+ "express": "^4.19.2",
79
+ "husky": "^4.2.5",
80
+ "jest": "~29.7.0",
81
+ "metro-react-native-babel-preset": "0.76.8",
82
+ "pod-install": "^0.1.0",
83
+ "prettier": "^2.0.5",
84
+ "react": "19.0.0",
85
+ "react-native": "0.79.6",
86
+ "react-native-builder-bob": "^0.18.0",
87
+ "twilio": "^4.21.0",
88
+ "twilio-release-tool": "^1.0.2",
89
+ "typescript": "~5.9.2"
90
+ },
91
+ "peerDependencies": {
92
+ "expo": ">=53.0.0",
93
+ "react": "*",
94
+ "react-native": "*"
95
+ },
96
+ "jest": {
97
+ "preset": "react-native",
98
+ "modulePathIgnorePatterns": [
99
+ "<rootDir>/test",
100
+ "<rootDir>/lib",
101
+ "<rootDir>/types"
102
+ ]
103
+ },
104
+ "husky": {
105
+ "hooks": {
106
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
107
+ "pre-commit": "yarn run check"
108
+ }
109
+ },
110
+ "commitlint": {
111
+ "extends": [
112
+ "@commitlint/config-conventional"
113
+ ]
114
+ },
115
+ "eslintConfig": {
116
+ "root": true,
117
+ "extends": [
118
+ "@react-native-community",
119
+ "prettier"
120
+ ],
121
+ "rules": {
122
+ "prettier/prettier": [
123
+ "error",
124
+ {
125
+ "quoteProps": "consistent",
126
+ "singleQuote": true,
127
+ "tabWidth": 2,
128
+ "trailingComma": "es5",
129
+ "useTabs": false
130
+ }
131
+ ]
132
+ }
133
+ },
134
+ "eslintIgnore": [
135
+ "node_modules/",
136
+ "lib/",
137
+ "test/app/",
138
+ "src/error/generated.ts",
139
+ "coverage/"
140
+ ],
141
+ "prettier": {
142
+ "quoteProps": "consistent",
143
+ "singleQuote": true,
144
+ "tabWidth": 2,
145
+ "trailingComma": "es5",
146
+ "useTabs": false
147
+ },
148
+ "react-native-builder-bob": {
149
+ "source": "src",
150
+ "output": "lib",
151
+ "targets": [
152
+ "commonjs",
153
+ "module",
154
+ [
155
+ "typescript",
156
+ {
157
+ "project": "tsconfig.build.json"
158
+ }
159
+ ]
160
+ ]
161
+ },
162
+ "dependencies": {
163
+ "@twilio/voice-errors": "1.8.0",
164
+ "eventemitter3": "^4.0.7",
165
+ "expo-modules-core": "^2.5.0"
166
+ }
167
+ }