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,175 @@
1
+ //
2
+ // TwilioVoiceStatsReport.h
3
+ // TwilioVoiceReactNative
4
+ //
5
+ // Copyright © 2022 Twilio, Inc. All rights reserved.
6
+ //
7
+
8
+ @import TwilioVoice;
9
+
10
+ #import "TwilioVoiceReactNativeConstants.h"
11
+
12
+ @interface TwilioVoiceStatsReport : NSObject
13
+
14
+ + (NSArray *)jsonWithStatsReportsArray:(NSArray<TVOStatsReport *> *)statsReports;
15
+
16
+ + (NSDictionary *)jsonWithStatsReport:(TVOStatsReport *)statsReport;
17
+ + (NSArray *)jsonWithLocalAudioTrackStats:(NSArray<TVOLocalAudioTrackStats *> *)audioTrackStatsArray;
18
+ + (NSArray *)jsonWithRemoteAudioTrackStats:(NSArray<TVORemoteAudioTrackStats *> *)audioTrackStatsArray;
19
+ + (NSArray *)jsonWithIceCandidateStats:(NSArray<TVOIceCandidateStats *> *)iceCandidateStatsArray;
20
+ + (NSArray *)jsonWithIceCandidatePairStats:(NSArray<TVOIceCandidatePairStats *> *)iceCandidatePairStatsArray;
21
+
22
+ @end
23
+
24
+
25
+ @implementation TwilioVoiceStatsReport
26
+
27
+ + (NSArray *)jsonWithStatsReportsArray:(NSArray<TVOStatsReport *> *)statsReports {
28
+ NSMutableArray *reportsArray = [NSMutableArray array];
29
+ for (TVOStatsReport *report in statsReports) {
30
+ [reportsArray addObject:[self jsonWithStatsReport:report]];
31
+ }
32
+ return reportsArray;
33
+ }
34
+
35
+ + (NSDictionary *)jsonWithStatsReport:(TVOStatsReport *)statsReport {
36
+ return @{
37
+ kTwilioVoiceReactNativePeerConnectionId: statsReport.peerConnectionId,
38
+ kTwilioVoiceReactNativeLocalAudioTrackStats: [self jsonWithLocalAudioTrackStats:statsReport.localAudioTrackStats],
39
+ kTwilioVoiceReactNativeRemoteAudioTrackStats: [self jsonWithRemoteAudioTrackStats:statsReport.remoteAudioTrackStats],
40
+ kTwilioVoiceReactNativeIceCandidateStats: [self jsonWithIceCandidateStats:statsReport.iceCandidateStats],
41
+ kTwilioVoiceReactNativeIceCandidatePairStats: [self jsonWithIceCandidatePairStats:statsReport.iceCandidatePairStats]
42
+ };
43
+ }
44
+
45
+ + (NSArray *)jsonWithLocalAudioTrackStats:(NSArray<TVOLocalAudioTrackStats *> *)audioTrackStatsArray {
46
+ NSMutableArray *localAudioTrackStatsReport = [NSMutableArray array];
47
+
48
+ for (TVOLocalAudioTrackStats *localAudioTrackStats in audioTrackStatsArray) {
49
+ [localAudioTrackStatsReport addObject:@{
50
+ // Base track stats
51
+ kTwilioVoiceReactNativeCodec: localAudioTrackStats.codec,
52
+ kTwilioVoiceReactNativePacketsLost: @(localAudioTrackStats.packetsLost),
53
+ kTwilioVoiceReactNativeSsrc: localAudioTrackStats.ssrc,
54
+ kTwilioVoiceReactNativeTimestamp: @(localAudioTrackStats.timestamp),
55
+ kTwilioVoiceReactNativeTrackId: localAudioTrackStats.trackId,
56
+
57
+ // Local track stats
58
+ kTwilioVoiceReactNativeBytesSent: @(localAudioTrackStats.bytesSent),
59
+ kTwilioVoiceReactNativePacketsSent: @(localAudioTrackStats.packetsSent),
60
+ kTwilioVoiceReactNativeRoundTripTime: @(localAudioTrackStats.roundTripTime),
61
+
62
+ // Local audio track stats
63
+ kTwilioVoiceReactNativeAudioLevel: @(localAudioTrackStats.audioLevel),
64
+ kTwilioVoiceReactNativeJitter: @(localAudioTrackStats.jitter)
65
+ }];
66
+ }
67
+
68
+ return localAudioTrackStatsReport;
69
+ }
70
+
71
+ + (NSArray *)jsonWithRemoteAudioTrackStats:(NSArray<TVORemoteAudioTrackStats *> *)audioTrackStatsArray {
72
+ NSMutableArray *remoteAudioTrackStatsReport = [NSMutableArray array];
73
+
74
+ for (TVORemoteAudioTrackStats *remoteAudioTrackStats in audioTrackStatsArray) {
75
+ [remoteAudioTrackStatsReport addObject:@{
76
+ // Base track stats
77
+ kTwilioVoiceReactNativeCodec: remoteAudioTrackStats.codec,
78
+ kTwilioVoiceReactNativePacketsLost: @(remoteAudioTrackStats.packetsLost),
79
+ kTwilioVoiceReactNativeSsrc: remoteAudioTrackStats.ssrc,
80
+ kTwilioVoiceReactNativeTimestamp: @(remoteAudioTrackStats.timestamp),
81
+ kTwilioVoiceReactNativeTrackId: remoteAudioTrackStats.trackId,
82
+
83
+ // Remote track stats
84
+ kTwilioVoiceReactNativeBytesReceived: @(remoteAudioTrackStats.bytesReceived),
85
+ kTwilioVoiceReactNativePacketsReceived: @(remoteAudioTrackStats.packetsReceived),
86
+
87
+ // Remote audio track stats
88
+ kTwilioVoiceReactNativeAudioLevel: @(remoteAudioTrackStats.audioLevel),
89
+ kTwilioVoiceReactNativeJitter: @(remoteAudioTrackStats.jitter),
90
+ kTwilioVoiceReactNativeMos: @(remoteAudioTrackStats.mos)
91
+ }];
92
+ }
93
+
94
+ return remoteAudioTrackStatsReport;
95
+ }
96
+
97
+ + (NSArray *)jsonWithIceCandidateStats:(NSArray<TVOIceCandidateStats *> *)iceCandidateStatsArray {
98
+ NSMutableArray *iceCandidateStatsReport = [NSMutableArray array];
99
+
100
+ for (TVOIceCandidateStats *iceCandidateStats in iceCandidateStatsArray) {
101
+ [iceCandidateStatsReport addObject:@{
102
+ kTwilioVoiceReactNativeCandidateType: iceCandidateStats.candidateType,
103
+ kTwilioVoiceReactNativeDeleted: @(iceCandidateStats.deleted),
104
+ kTwilioVoiceReactNativeIp: iceCandidateStats.ip,
105
+ kTwilioVoiceReactNativeIsRemote: @(iceCandidateStats.isRemote),
106
+ kTwilioVoiceReactNativePort: @(iceCandidateStats.port),
107
+ kTwilioVoiceReactNativePriority: @(iceCandidateStats.priority),
108
+ kTwilioVoiceReactNativeProtocol: iceCandidateStats.protocol,
109
+ kTwilioVoiceReactNativeTransportId: iceCandidateStats.transportId,
110
+ kTwilioVoiceReactNativeUrl: iceCandidateStats.url
111
+ }];
112
+ }
113
+
114
+ return iceCandidateStatsReport;
115
+ }
116
+
117
+ + (NSArray *)jsonWithIceCandidatePairStats:(NSArray<TVOIceCandidatePairStats *> *)iceCandidatePairStatsArray {
118
+ NSMutableArray *iceCandidatePairStatsReport = [NSMutableArray array];
119
+
120
+ for (TVOIceCandidatePairStats *iceCandidatePairStats in iceCandidatePairStatsArray) {
121
+ [iceCandidatePairStatsReport addObject:@{
122
+ kTwilioVoiceReactNativeActiveCandidatePair: @(iceCandidatePairStats.activeCandidatePair),
123
+ kTwilioVoiceReactNativeAvailableIncomingBitrate: @(iceCandidatePairStats.availableIncomingBitrate),
124
+ kTwilioVoiceReactNativeAvailableOutgoingBitrate: @(iceCandidatePairStats.availableOutgoingBitrate),
125
+ kTwilioVoiceReactNativeBytesReceived: @(iceCandidatePairStats.bytesReceived),
126
+ kTwilioVoiceReactNativeBytesSent: @(iceCandidatePairStats.bytesSent),
127
+ kTwilioVoiceReactNativeConsentRequestsReceived: @(iceCandidatePairStats.consentRequestsReceived),
128
+ kTwilioVoiceReactNativeConsentRequestsSent: @(iceCandidatePairStats.consentRequestsSent),
129
+ kTwilioVoiceReactNativeConsentResponsesReceived: @(iceCandidatePairStats.consentResponsesReceived),
130
+ kTwilioVoiceReactNativeConsentResponsesSent: @(iceCandidatePairStats.consentResponsesSent),
131
+ kTwilioVoiceReactNativeCurrentRoundTripTime: @(iceCandidatePairStats.currentRoundTripTime),
132
+ kTwilioVoiceReactNativeLocalCandidateId: iceCandidatePairStats.localCandidateId,
133
+ kTwilioVoiceReactNativeLocalCandidateIp: iceCandidatePairStats.localCandidateIp,
134
+ kTwilioVoiceReactNativeNominated: @(iceCandidatePairStats.nominated),
135
+ kTwilioVoiceReactNativePriority: @(iceCandidatePairStats.priority),
136
+ kTwilioVoiceReactNativeReadable: @(iceCandidatePairStats.readable),
137
+ kTwilioVoiceReactNativeRelayProtocol: iceCandidatePairStats.relayProtocol,
138
+ kTwilioVoiceReactNativeRemoteCandidateId: iceCandidatePairStats.remoteCandidateId,
139
+ kTwilioVoiceReactNativeRemoteCandidateIp: iceCandidatePairStats.remoteCandidateIp,
140
+ kTwilioVoiceReactNativeRequestsReceived: @(iceCandidatePairStats.requestsReceived),
141
+ kTwilioVoiceReactNativeRequestsSent: @(iceCandidatePairStats.requestsSent),
142
+ kTwilioVoiceReactNativeResponsesReceived: @(iceCandidatePairStats.responsesReceived),
143
+ kTwilioVoiceReactNativeResponsesSent: @(iceCandidatePairStats.responsesSent),
144
+ kTwilioVoiceReactNativeRetransmissionsReceived: @(iceCandidatePairStats.retransmissionsReceived),
145
+ kTwilioVoiceReactNativeRetransmissionsSent: @(iceCandidatePairStats.retransmissionsSent),
146
+ kTwilioVoiceReactNativeState: [self stringWithIceCandidatePairState:iceCandidatePairStats.state],
147
+ kTwilioVoiceReactNativeTotalRoundTripTime: @(iceCandidatePairStats.totalRoundTripTime),
148
+ kTwilioVoiceReactNativeTransportId: iceCandidatePairStats.transportId,
149
+ kTwilioVoiceReactNativeWriteable: @(iceCandidatePairStats.writeable)
150
+ }];
151
+ }
152
+
153
+ return iceCandidatePairStatsReport;
154
+ }
155
+
156
+ + (NSString *)stringWithIceCandidatePairState:(TVOIceCandidatePairState)state {
157
+ switch (state) {
158
+ case TVOIceCandidatePairStateFailed:
159
+ return kTwilioVoiceReactNativeStateFailed;
160
+ case TVOIceCandidatePairStateFrozen:
161
+ return kTwilioVoiceReactNativeStateFrozen;
162
+ case TVOIceCandidatePairStateInProgress:
163
+ return kTwilioVoiceReactNativeStateInProgress;
164
+ case TVOIceCandidatePairStateSucceeded:
165
+ return kTwilioVoiceReactNativeStateSucceeded;
166
+ case TVOIceCandidatePairStateWaiting:
167
+ return kTwilioVoiceReactNativeStateWaiting;
168
+ case TVOIceCandidatePairStateUnknown:
169
+ return kTwilioVoiceReactNativeStateUnknown;
170
+ default:
171
+ return kTwilioVoiceReactNativeStateUnknown;
172
+ }
173
+ }
174
+
175
+ @end
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AudioDevice = void 0;
7
+
8
+ var _common = require("./common");
9
+
10
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+
12
+ /**
13
+ * Describes audio devices as reported by the native layer and allows the
14
+ * native selection of the described audio device.
15
+ *
16
+ * @remarks
17
+ * To fetch a list of available audio devices and the currently selected audio
18
+ * device, see {@link (Voice:class).getAudioDevices}.
19
+ *
20
+ * - See also the {@link (AudioDevice:namespace) | AudioDevice namespace} for
21
+ * types used by this class.
22
+ *
23
+ * @public
24
+ */
25
+ class AudioDevice {
26
+ /**
27
+ * The native-UUID of this object. This is generated by the native layer and
28
+ * is used to associate functionality between the JS and native layers.
29
+ *
30
+ * @internal
31
+ */
32
+
33
+ /**
34
+ * The type of the audio device.
35
+ */
36
+
37
+ /**
38
+ * The name of the audio device.
39
+ */
40
+
41
+ /**
42
+ * Audio device class constructor.
43
+ * @param audioDeviceInformation - A record describing an audio device.
44
+ *
45
+ * @internal
46
+ */
47
+ constructor({
48
+ uuid,
49
+ type,
50
+ name
51
+ }) {
52
+ _defineProperty(this, "uuid", void 0);
53
+
54
+ _defineProperty(this, "type", void 0);
55
+
56
+ _defineProperty(this, "name", void 0);
57
+
58
+ this.uuid = uuid;
59
+ this.type = type;
60
+ this.name = name;
61
+ }
62
+ /**
63
+ * Calling this method will select this audio device as the active audio
64
+ * device.
65
+ * @returns
66
+ * A `Promise` that
67
+ * - Resolves with `void` when the audio device has been successfully
68
+ * selected as the active audio device.
69
+ * - Rejects if the audio device cannot be selected.
70
+ */
71
+
72
+
73
+ select() {
74
+ return _common.NativeModule.voice_selectAudioDevice(this.uuid);
75
+ }
76
+
77
+ }
78
+ /**
79
+ * Contains interfaces and enumerations associated with audio devices.
80
+ *
81
+ * @remarks
82
+ * - See also the {@link (AudioDevice:class) | AudioDevice class}.
83
+ *
84
+ * @public
85
+ */
86
+
87
+
88
+ exports.AudioDevice = AudioDevice;
89
+
90
+ (function (_AudioDevice) {
91
+ let Type;
92
+
93
+ (function (Type) {
94
+ Type["Earpiece"] = "earpiece";
95
+ Type["Speaker"] = "speaker";
96
+ Type["Bluetooth"] = "bluetooth";
97
+ })(Type || (Type = {}));
98
+
99
+ _AudioDevice.Type = Type;
100
+ })(AudioDevice || (exports.AudioDevice = AudioDevice = {}));
101
+ //# sourceMappingURL=AudioDevice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["AudioDevice.tsx"],"names":["AudioDevice","constructor","uuid","type","name","select","NativeModule","voice_selectAudioDevice","Type"],"mappings":";;;;;;;AAOA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,WAAN,CAAkB;AACvB;AACF;AACA;AACA;AACA;AACA;;AAGE;AACF;AACA;;AAGE;AACF;AACA;;AAGE;AACF;AACA;AACA;AACA;AACA;AACEC,EAAAA,WAAW,CAAC;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,IAAR;AAAcC,IAAAA;AAAd,GAAD,EAA8C;AAAA;;AAAA;;AAAA;;AACvD,SAAKF,IAAL,GAAYA,IAAZ;AACA,SAAKC,IAAL,GAAYA,IAAZ;AACA,SAAKC,IAAL,GAAYA,IAAZ;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACEC,EAAAA,MAAM,GAAkB;AACtB,WAAOC,qBAAaC,uBAAb,CAAqC,KAAKL,IAA1C,CAAP;AACD;;AA1CsB;AA6CzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;MAMcM,I;;aAAAA,I;AAAAA,IAAAA,I;AAAAA,IAAAA,I;AAAAA,IAAAA,I;KAAAA,I,KAAAA,I;;;GALGR,W,2BAAAA,W","sourcesContent":["/**\n * Copyright © 2022 Twilio, Inc. All rights reserved. Licensed under the Twilio\n * license.\n *\n * See LICENSE in the project root for license information.\n */\n\nimport { NativeModule } from './common';\nimport type { NativeAudioDeviceInfo } from './type/AudioDevice';\nimport type { Uuid } from './type/common';\n\n/**\n * Describes audio devices as reported by the native layer and allows the\n * native selection of the described audio device.\n *\n * @remarks\n * To fetch a list of available audio devices and the currently selected audio\n * device, see {@link (Voice:class).getAudioDevices}.\n *\n * - See also the {@link (AudioDevice:namespace) | AudioDevice namespace} for\n * types used by this class.\n *\n * @public\n */\nexport class AudioDevice {\n /**\n * The native-UUID of this object. This is generated by the native layer and\n * is used to associate functionality between the JS and native layers.\n *\n * @internal\n */\n uuid: Uuid;\n\n /**\n * The type of the audio device.\n */\n type: AudioDevice.Type;\n\n /**\n * The name of the audio device.\n */\n name: string;\n\n /**\n * Audio device class constructor.\n * @param audioDeviceInformation - A record describing an audio device.\n *\n * @internal\n */\n constructor({ uuid, type, name }: NativeAudioDeviceInfo) {\n this.uuid = uuid;\n this.type = type;\n this.name = name;\n }\n\n /**\n * Calling this method will select this audio device as the active audio\n * device.\n * @returns\n * A `Promise` that\n * - Resolves with `void` when the audio device has been successfully\n * selected as the active audio device.\n * - Rejects if the audio device cannot be selected.\n */\n select(): Promise<void> {\n return NativeModule.voice_selectAudioDevice(this.uuid);\n }\n}\n\n/**\n * Contains interfaces and enumerations associated with audio devices.\n *\n * @remarks\n * - See also the {@link (AudioDevice:class) | AudioDevice class}.\n *\n * @public\n */\nexport namespace AudioDevice {\n /**\n * Audio device type enumeration. Describes all possible audio device types as\n * reportable by the native layer.\n */\n export enum Type {\n Earpiece = 'earpiece',\n Speaker = 'speaker',\n Bluetooth = 'bluetooth',\n }\n}\n"]}