sinch-rtc 1.4.11 → 2.42.6

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.

Potentially problematic release.


This version of sinch-rtc might be problematic. Click here for more details.

Files changed (546) hide show
  1. package/README.md +67 -153
  2. package/npm/src/ClientRegistration.d.ts +16 -0
  3. package/npm/src/ClientRegistration.js +22 -0
  4. package/npm/src/DefaultSinchClient.d.ts +59 -0
  5. package/npm/src/DefaultSinchClient.js +253 -0
  6. package/npm/src/DefaultSinchClientBuilder.d.ts +22 -0
  7. package/npm/src/DefaultSinchClientBuilder.js +99 -0
  8. package/npm/src/MediaStreamOptions.d.ts +4 -0
  9. package/npm/src/MediaStreamOptions.js +3 -0
  10. package/npm/src/Sinch.d.ts +10 -0
  11. package/npm/src/Sinch.js +23 -0
  12. package/npm/src/SinchClient.d.ts +82 -0
  13. package/npm/src/SinchClient.js +3 -0
  14. package/npm/src/SinchClientBuilder.d.ts +69 -0
  15. package/npm/src/SinchClientBuilder.js +3 -0
  16. package/npm/src/SinchClientListener.d.ts +31 -0
  17. package/npm/src/SinchClientListener.js +3 -0
  18. package/npm/src/SinchError.d.ts +27 -0
  19. package/npm/src/SinchError.js +37 -0
  20. package/npm/src/calling/Call.d.ts +114 -0
  21. package/npm/src/calling/Call.js +3 -0
  22. package/npm/src/calling/CallClient.d.ts +113 -0
  23. package/npm/src/calling/CallClient.js +3 -0
  24. package/npm/src/calling/CallClientInstance.d.ts +77 -0
  25. package/npm/src/calling/CallClientInstance.js +362 -0
  26. package/npm/src/calling/CallDetails.d.ts +99 -0
  27. package/npm/src/calling/CallDetails.js +3 -0
  28. package/npm/src/calling/CallEndCause.d.ts +11 -0
  29. package/npm/src/calling/CallEndCause.js +16 -0
  30. package/npm/src/calling/CallInitiator.d.ts +4 -0
  31. package/npm/src/calling/CallInitiator.js +3 -0
  32. package/npm/src/calling/DefaultCall.d.ts +87 -0
  33. package/npm/src/calling/DefaultCall.js +223 -0
  34. package/npm/src/calling/DefaultCallClient.d.ts +38 -0
  35. package/npm/src/calling/DefaultCallClient.js +95 -0
  36. package/npm/src/calling/DefaultCallDetails.d.ts +42 -0
  37. package/npm/src/calling/DefaultCallDetails.js +116 -0
  38. package/npm/src/calling/InboundCall.d.ts +16 -0
  39. package/npm/src/calling/InboundCall.js +52 -0
  40. package/npm/src/calling/InternalCall.d.ts +7 -0
  41. package/npm/src/calling/InternalCall.js +3 -0
  42. package/npm/src/calling/OutboundCall.d.ts +28 -0
  43. package/npm/src/calling/OutboundCall.js +119 -0
  44. package/npm/src/calling/PubSubClient.d.ts +30 -0
  45. package/npm/src/calling/PubSubClient.js +98 -0
  46. package/npm/src/calling/PublicCallListenerCallbackMapper.d.ts +17 -0
  47. package/npm/src/calling/PublicCallListenerCallbackMapper.js +79 -0
  48. package/npm/src/calling/WebRtcStatsUtils.d.ts +3 -0
  49. package/npm/src/calling/WebRtcStatsUtils.js +24 -0
  50. package/npm/src/calling/index.d.ts +8 -0
  51. package/npm/src/calling/index.js +25 -0
  52. package/npm/src/calling/listeners/CallClientEventFanout.d.ts +9 -0
  53. package/npm/src/calling/listeners/CallClientEventFanout.js +17 -0
  54. package/npm/src/calling/listeners/CallClientListener.d.ts +15 -0
  55. package/npm/src/calling/listeners/CallClientListener.js +3 -0
  56. package/npm/src/calling/listeners/CallEventsManagers.d.ts +25 -0
  57. package/npm/src/calling/listeners/CallEventsManagers.js +128 -0
  58. package/npm/src/calling/listeners/CallListener.d.ts +77 -0
  59. package/npm/src/calling/listeners/CallListener.js +3 -0
  60. package/npm/src/calling/listeners/CallQualityWarningEventFanout.d.ts +9 -0
  61. package/npm/src/calling/listeners/CallQualityWarningEventFanout.js +16 -0
  62. package/npm/src/calling/listeners/ClientEventFanout.d.ts +13 -0
  63. package/npm/src/calling/listeners/ClientEventFanout.js +33 -0
  64. package/npm/src/calling/listeners/EventFanout.d.ts +18 -0
  65. package/npm/src/calling/listeners/EventFanout.js +40 -0
  66. package/npm/src/calling/listeners/InternalCallListener.d.ts +13 -0
  67. package/npm/src/calling/listeners/InternalCallListener.js +3 -0
  68. package/npm/src/calling/listeners/InternalSinchClientListener.d.ts +9 -0
  69. package/npm/src/calling/listeners/InternalSinchClientListener.js +3 -0
  70. package/npm/src/calling/listeners/TrackEventFanout.d.ts +8 -0
  71. package/npm/src/calling/listeners/TrackEventFanout.js +16 -0
  72. package/npm/src/calling/models/CallDestination.d.ts +5 -0
  73. package/npm/src/calling/models/CallDestination.js +3 -0
  74. package/npm/src/calling/models/CallDirection.d.ts +4 -0
  75. package/npm/src/calling/models/CallDirection.js +9 -0
  76. package/npm/src/calling/models/CallState.d.ts +8 -0
  77. package/npm/src/calling/models/CallState.js +13 -0
  78. package/npm/src/calling/models/index.d.ts +3 -0
  79. package/npm/src/calling/models/index.js +20 -0
  80. package/npm/src/calling/quality/CallQualityDataCollector.d.ts +15 -0
  81. package/npm/src/calling/quality/CallQualityDataCollector.js +68 -0
  82. package/npm/src/calling/quality/CallQualityWarningController.d.ts +18 -0
  83. package/npm/src/calling/quality/CallQualityWarningController.js +41 -0
  84. package/npm/src/calling/quality/CallQualityWarningControllerFactory.d.ts +6 -0
  85. package/npm/src/calling/quality/CallQualityWarningControllerFactory.js +3 -0
  86. package/npm/src/calling/quality/CallQualityWarningEventType.d.ts +13 -0
  87. package/npm/src/calling/quality/CallQualityWarningEventType.js +18 -0
  88. package/npm/src/calling/quality/CallQualityWarningMediaStreamType.d.ts +7 -0
  89. package/npm/src/calling/quality/CallQualityWarningMediaStreamType.js +12 -0
  90. package/npm/src/calling/quality/DefaultCallQualityWarningControllerFactory.d.ts +7 -0
  91. package/npm/src/calling/quality/DefaultCallQualityWarningControllerFactory.js +11 -0
  92. package/npm/src/calling/quality/StatsBuffer.d.ts +49 -0
  93. package/npm/src/calling/quality/StatsBuffer.js +73 -0
  94. package/npm/src/calling/quality/detectors/AudioLevelDetectorHandler.d.ts +6 -0
  95. package/npm/src/calling/quality/detectors/AudioLevelDetectorHandler.js +3 -0
  96. package/npm/src/calling/quality/detectors/BaseDetector.d.ts +20 -0
  97. package/npm/src/calling/quality/detectors/BaseDetector.js +37 -0
  98. package/npm/src/calling/quality/detectors/BufferedWarningDetector.d.ts +20 -0
  99. package/npm/src/calling/quality/detectors/BufferedWarningDetector.js +40 -0
  100. package/npm/src/calling/quality/detectors/CallQualityDetectorsFactory.d.ts +9 -0
  101. package/npm/src/calling/quality/detectors/CallQualityDetectorsFactory.js +39 -0
  102. package/npm/src/calling/quality/detectors/HighInboundJitterDetector.d.ts +13 -0
  103. package/npm/src/calling/quality/detectors/HighInboundJitterDetector.js +33 -0
  104. package/npm/src/calling/quality/detectors/HighInboundPacketLossDetector.d.ts +16 -0
  105. package/npm/src/calling/quality/detectors/HighInboundPacketLossDetector.js +47 -0
  106. package/npm/src/calling/quality/detectors/HighRemoteInboundRttDetector.d.ts +10 -0
  107. package/npm/src/calling/quality/detectors/HighRemoteInboundRttDetector.js +38 -0
  108. package/npm/src/calling/quality/detectors/MissingMediaStreamWarningDetector.d.ts +23 -0
  109. package/npm/src/calling/quality/detectors/MissingMediaStreamWarningDetector.js +66 -0
  110. package/npm/src/calling/quality/detectors/WebRtcStatsDetector.d.ts +5 -0
  111. package/npm/src/calling/quality/detectors/WebRtcStatsDetector.js +9 -0
  112. package/npm/src/calling/quality/detectors/constant/ConstantAudioLevelDetector.d.ts +18 -0
  113. package/npm/src/calling/quality/detectors/constant/ConstantAudioLevelDetector.js +51 -0
  114. package/npm/src/calling/quality/detectors/constant/ConstantInboundAudioLevelDetectorHandler.d.ts +7 -0
  115. package/npm/src/calling/quality/detectors/constant/ConstantInboundAudioLevelDetectorHandler.js +16 -0
  116. package/npm/src/calling/quality/detectors/constant/ConstantOutboundAudioLevelDetectorHandler.d.ts +7 -0
  117. package/npm/src/calling/quality/detectors/constant/ConstantOutboundAudioLevelDetectorHandler.js +16 -0
  118. package/npm/src/calling/quality/detectors/zero/ZeroAudioLevelDetector.d.ts +13 -0
  119. package/npm/src/calling/quality/detectors/zero/ZeroAudioLevelDetector.js +45 -0
  120. package/npm/src/calling/quality/detectors/zero/ZeroInboundAudioLevelDetectorHandler.d.ts +7 -0
  121. package/npm/src/calling/quality/detectors/zero/ZeroInboundAudioLevelDetectorHandler.js +16 -0
  122. package/npm/src/calling/quality/detectors/zero/ZeroOutboundAudioLevelDetectorHandler.d.ts +7 -0
  123. package/npm/src/calling/quality/detectors/zero/ZeroOutboundAudioLevelDetectorHandler.js +16 -0
  124. package/npm/src/calling/quality/events/CallQualityWarningEvent.d.ts +20 -0
  125. package/npm/src/calling/quality/events/CallQualityWarningEvent.js +3 -0
  126. package/npm/src/calling/quality/events/ConstantInboundAudioLevelWarningEvent.d.ts +13 -0
  127. package/npm/src/calling/quality/events/ConstantInboundAudioLevelWarningEvent.js +17 -0
  128. package/npm/src/calling/quality/events/ConstantOutboundAudioLevelWarningEvent.d.ts +13 -0
  129. package/npm/src/calling/quality/events/ConstantOutboundAudioLevelWarningEvent.js +17 -0
  130. package/npm/src/calling/quality/events/HighInboundJitterWarningEvent.d.ts +15 -0
  131. package/npm/src/calling/quality/events/HighInboundJitterWarningEvent.js +18 -0
  132. package/npm/src/calling/quality/events/HighInboundPacketLossWarningEvent.d.ts +15 -0
  133. package/npm/src/calling/quality/events/HighInboundPacketLossWarningEvent.js +18 -0
  134. package/npm/src/calling/quality/events/HighRemoteInboundRttWarningEvent.d.ts +15 -0
  135. package/npm/src/calling/quality/events/HighRemoteInboundRttWarningEvent.js +18 -0
  136. package/npm/src/calling/quality/events/MissingMediaStreamWarningEvent.d.ts +12 -0
  137. package/npm/src/calling/quality/events/MissingMediaStreamWarningEvent.js +16 -0
  138. package/npm/src/calling/quality/events/ZeroInboundAudioLevelWarningEvent.d.ts +13 -0
  139. package/npm/src/calling/quality/events/ZeroInboundAudioLevelWarningEvent.js +17 -0
  140. package/npm/src/calling/quality/events/ZeroOutboundAudioLevelWarningEvent.d.ts +13 -0
  141. package/npm/src/calling/quality/events/ZeroOutboundAudioLevelWarningEvent.js +17 -0
  142. package/npm/src/calling/reporting/CallDestination.d.ts +13 -0
  143. package/npm/src/calling/reporting/CallDestination.js +47 -0
  144. package/npm/src/calling/reporting/CallOrigin.d.ts +11 -0
  145. package/npm/src/calling/reporting/CallOrigin.js +28 -0
  146. package/npm/src/calling/reporting/CallReportUtils.d.ts +36 -0
  147. package/npm/src/calling/reporting/CallReportUtils.js +195 -0
  148. package/npm/src/calling/reporting/CallReporter.d.ts +15 -0
  149. package/npm/src/calling/reporting/CallReporter.js +73 -0
  150. package/npm/src/calling/reporting/ClientEvent.d.ts +29 -0
  151. package/npm/src/calling/reporting/ClientEvent.js +48 -0
  152. package/npm/src/calling/reporting/ClientEventsCollector.d.ts +13 -0
  153. package/npm/src/calling/reporting/ClientEventsCollector.js +35 -0
  154. package/npm/src/calling/reporting/MxpEventsCollector.d.ts +54 -0
  155. package/npm/src/calling/reporting/MxpEventsCollector.js +157 -0
  156. package/npm/src/calling/reporting/WebRTCStats.d.ts +10 -0
  157. package/npm/src/calling/reporting/WebRTCStats.js +31 -0
  158. package/npm/src/calling/reporting/WebRTCStats.types.d.ts +64 -0
  159. package/npm/src/calling/reporting/WebRTCStats.types.js +21 -0
  160. package/npm/src/calling/reporting/WebRTCStatsCollector.d.ts +42 -0
  161. package/npm/src/calling/reporting/WebRTCStatsCollector.js +328 -0
  162. package/npm/src/constants.d.ts +8 -0
  163. package/npm/src/constants.js +13 -0
  164. package/npm/src/features/Features.d.ts +29 -0
  165. package/npm/src/features/Features.js +156 -0
  166. package/npm/src/index.d.ts +22 -0
  167. package/npm/src/index.js +39 -0
  168. package/npm/src/instance/DeviceVersion.d.ts +10 -0
  169. package/npm/src/instance/DeviceVersion.js +25 -0
  170. package/npm/src/instance/InstanceController.d.ts +54 -0
  171. package/npm/src/instance/InstanceController.js +262 -0
  172. package/npm/src/instance/UserInstance.d.ts +20 -0
  173. package/npm/src/instance/UserInstance.js +65 -0
  174. package/npm/src/instance/index.d.ts +3 -0
  175. package/npm/src/instance/index.js +20 -0
  176. package/npm/src/instance/jwt.d.ts +11 -0
  177. package/npm/src/instance/jwt.js +36 -0
  178. package/npm/src/models/Capability.d.ts +7 -0
  179. package/npm/src/models/Capability.js +12 -0
  180. package/npm/src/models/SinchConfig.d.ts +11 -0
  181. package/npm/src/models/SinchConfig.js +3 -0
  182. package/npm/src/models/index.d.ts +2 -0
  183. package/npm/src/models/index.js +19 -0
  184. package/npm/src/mxp/Codec.d.ts +35 -0
  185. package/npm/src/mxp/Codec.js +95 -0
  186. package/npm/src/mxp/MXPError.d.ts +16 -0
  187. package/npm/src/mxp/MXPError.js +37 -0
  188. package/npm/src/mxp/Message.d.ts +32 -0
  189. package/npm/src/mxp/Message.js +152 -0
  190. package/npm/src/mxp/MessageBuilder.d.ts +16 -0
  191. package/npm/src/mxp/MessageBuilder.js +36 -0
  192. package/npm/src/mxp/MxpClientEvent.d.ts +5 -0
  193. package/npm/src/mxp/MxpClientEvent.js +10 -0
  194. package/npm/src/mxp/MxpMessageChannel.d.ts +32 -0
  195. package/npm/src/mxp/MxpMessageChannel.js +105 -0
  196. package/npm/src/mxp/Protocol.d.ts +49 -0
  197. package/npm/src/mxp/Protocol.js +146 -0
  198. package/npm/src/mxp/SessionMessageBuffer.d.ts +7 -0
  199. package/npm/src/mxp/SessionMessageBuffer.js +39 -0
  200. package/npm/src/mxp/index.d.ts +10 -0
  201. package/npm/src/mxp/index.js +27 -0
  202. package/npm/src/mxp/models/Body.d.ts +20 -0
  203. package/npm/src/mxp/models/Body.js +39 -0
  204. package/npm/src/mxp/models/Client.d.ts +12 -0
  205. package/npm/src/mxp/models/Client.js +3 -0
  206. package/npm/src/mxp/models/MessageModel.d.ts +15 -0
  207. package/npm/src/mxp/models/MessageModel.js +3 -0
  208. package/npm/src/mxp/models/Method.d.ts +13 -0
  209. package/npm/src/mxp/models/Method.js +18 -0
  210. package/npm/src/mxp/models/SymmetricKey.d.ts +10 -0
  211. package/npm/src/mxp/models/SymmetricKey.js +17 -0
  212. package/npm/src/mxp/models/index.d.ts +5 -0
  213. package/npm/src/mxp/models/index.js +22 -0
  214. package/npm/src/ocra/ApiClient.d.ts +78 -0
  215. package/npm/src/ocra/ApiClient.js +274 -0
  216. package/npm/src/ocra/Context.d.ts +11 -0
  217. package/npm/src/ocra/Context.js +21 -0
  218. package/npm/src/ocra/GzipEncodingMiddleware.d.ts +8 -0
  219. package/npm/src/ocra/GzipEncodingMiddleware.js +44 -0
  220. package/npm/src/ocra/OcraConfig.d.ts +5 -0
  221. package/npm/src/ocra/OcraConfig.js +6 -0
  222. package/npm/src/ocra/api/apis/CallApi.d.ts +29 -0
  223. package/npm/src/ocra/api/apis/CallApi.js +71 -0
  224. package/npm/src/ocra/api/apis/CallReportApi.d.ts +29 -0
  225. package/npm/src/ocra/api/apis/CallReportApi.js +70 -0
  226. package/npm/src/ocra/api/apis/ConfigApi.d.ts +30 -0
  227. package/npm/src/ocra/api/apis/ConfigApi.js +72 -0
  228. package/npm/src/ocra/api/apis/DebugApi.d.ts +29 -0
  229. package/npm/src/ocra/api/apis/DebugApi.js +69 -0
  230. package/npm/src/ocra/api/apis/FeatureFlagsApi.d.ts +33 -0
  231. package/npm/src/ocra/api/apis/FeatureFlagsApi.js +71 -0
  232. package/npm/src/ocra/api/apis/IceApi.d.ts +30 -0
  233. package/npm/src/ocra/api/apis/IceApi.js +72 -0
  234. package/npm/src/ocra/api/apis/InstanceApi.d.ts +56 -0
  235. package/npm/src/ocra/api/apis/InstanceApi.js +167 -0
  236. package/npm/src/ocra/api/apis/PushApi.d.ts +88 -0
  237. package/npm/src/ocra/api/apis/PushApi.js +257 -0
  238. package/npm/src/ocra/api/apis/index.d.ts +8 -0
  239. package/npm/src/ocra/api/apis/index.js +25 -0
  240. package/npm/src/ocra/api/index.d.ts +3 -0
  241. package/npm/src/ocra/api/index.js +20 -0
  242. package/npm/src/ocra/api/models/ApnPushProfile.d.ts +60 -0
  243. package/npm/src/ocra/api/models/ApnPushProfile.js +65 -0
  244. package/npm/src/ocra/api/models/ApplicationConfigPushConfig.d.ts +27 -0
  245. package/npm/src/ocra/api/models/ApplicationConfigPushConfig.js +42 -0
  246. package/npm/src/ocra/api/models/AudioRouteEvent.d.ts +33 -0
  247. package/npm/src/ocra/api/models/AudioRouteEvent.js +43 -0
  248. package/npm/src/ocra/api/models/AudioRouteEventLog.d.ts +34 -0
  249. package/npm/src/ocra/api/models/AudioRouteEventLog.js +44 -0
  250. package/npm/src/ocra/api/models/BasicCallReport.d.ts +168 -0
  251. package/npm/src/ocra/api/models/BasicCallReport.js +89 -0
  252. package/npm/src/ocra/api/models/CallInitiationRequest.d.ts +78 -0
  253. package/npm/src/ocra/api/models/CallInitiationRequest.js +59 -0
  254. package/npm/src/ocra/api/models/CallInitiationResponse.d.ts +72 -0
  255. package/npm/src/ocra/api/models/CallInitiationResponse.js +57 -0
  256. package/npm/src/ocra/api/models/CallQuality.d.ts +34 -0
  257. package/npm/src/ocra/api/models/CallQuality.js +44 -0
  258. package/npm/src/ocra/api/models/CallReport.d.ts +228 -0
  259. package/npm/src/ocra/api/models/CallReport.js +109 -0
  260. package/npm/src/ocra/api/models/CallReportInstance.d.ts +40 -0
  261. package/npm/src/ocra/api/models/CallReportInstance.js +47 -0
  262. package/npm/src/ocra/api/models/CallResult.d.ts +29 -0
  263. package/npm/src/ocra/api/models/CallResult.js +45 -0
  264. package/npm/src/ocra/api/models/ClientError.d.ts +40 -0
  265. package/npm/src/ocra/api/models/ClientError.js +47 -0
  266. package/npm/src/ocra/api/models/ClientErrorDomain.d.ts +25 -0
  267. package/npm/src/ocra/api/models/ClientErrorDomain.js +41 -0
  268. package/npm/src/ocra/api/models/ClientEvent.d.ts +46 -0
  269. package/npm/src/ocra/api/models/ClientEvent.js +49 -0
  270. package/npm/src/ocra/api/models/ClientEvents.d.ts +34 -0
  271. package/npm/src/ocra/api/models/ClientEvents.js +44 -0
  272. package/npm/src/ocra/api/models/Config.d.ts +73 -0
  273. package/npm/src/ocra/api/models/Config.js +66 -0
  274. package/npm/src/ocra/api/models/ConnectionInfo.d.ts +40 -0
  275. package/npm/src/ocra/api/models/ConnectionInfo.js +46 -0
  276. package/npm/src/ocra/api/models/ConnectionInfoV2.d.ts +66 -0
  277. package/npm/src/ocra/api/models/ConnectionInfoV2.js +63 -0
  278. package/npm/src/ocra/api/models/CreateInstanceRequest.d.ts +52 -0
  279. package/npm/src/ocra/api/models/CreateInstanceRequest.js +51 -0
  280. package/npm/src/ocra/api/models/CreateInstanceResponse.d.ts +34 -0
  281. package/npm/src/ocra/api/models/CreateInstanceResponse.js +44 -0
  282. package/npm/src/ocra/api/models/Destination.d.ts +50 -0
  283. package/npm/src/ocra/api/models/Destination.js +58 -0
  284. package/npm/src/ocra/api/models/Direction.d.ts +23 -0
  285. package/npm/src/ocra/api/models/Direction.js +39 -0
  286. package/npm/src/ocra/api/models/Domain.d.ts +25 -0
  287. package/npm/src/ocra/api/models/Domain.js +41 -0
  288. package/npm/src/ocra/api/models/ErrorResponse.d.ts +27 -0
  289. package/npm/src/ocra/api/models/ErrorResponse.js +41 -0
  290. package/npm/src/ocra/api/models/EventResult.d.ts +48 -0
  291. package/npm/src/ocra/api/models/EventResult.js +57 -0
  292. package/npm/src/ocra/api/models/EventType.d.ts +23 -0
  293. package/npm/src/ocra/api/models/EventType.js +39 -0
  294. package/npm/src/ocra/api/models/ExtendedCallReport.d.ts +204 -0
  295. package/npm/src/ocra/api/models/ExtendedCallReport.js +101 -0
  296. package/npm/src/ocra/api/models/ExtendedCallReportAllOf.d.ts +58 -0
  297. package/npm/src/ocra/api/models/ExtendedCallReportAllOf.js +53 -0
  298. package/npm/src/ocra/api/models/FcmPushProfile.d.ts +33 -0
  299. package/npm/src/ocra/api/models/FcmPushProfile.js +43 -0
  300. package/npm/src/ocra/api/models/IceCandidate.d.ts +64 -0
  301. package/npm/src/ocra/api/models/IceCandidate.js +55 -0
  302. package/npm/src/ocra/api/models/IceCandidateType.d.ts +27 -0
  303. package/npm/src/ocra/api/models/IceCandidateType.js +43 -0
  304. package/npm/src/ocra/api/models/IceServer.d.ts +66 -0
  305. package/npm/src/ocra/api/models/IceServer.js +63 -0
  306. package/npm/src/ocra/api/models/IceServerAllOf.d.ts +27 -0
  307. package/npm/src/ocra/api/models/IceServerAllOf.js +41 -0
  308. package/npm/src/ocra/api/models/IceServersResponse.d.ts +28 -0
  309. package/npm/src/ocra/api/models/IceServersResponse.js +42 -0
  310. package/npm/src/ocra/api/models/Instance.d.ts +58 -0
  311. package/npm/src/ocra/api/models/Instance.js +53 -0
  312. package/npm/src/ocra/api/models/InstanceVersionData.d.ts +64 -0
  313. package/npm/src/ocra/api/models/InstanceVersionData.js +55 -0
  314. package/npm/src/ocra/api/models/IpProtocolVersion.d.ts +24 -0
  315. package/npm/src/ocra/api/models/IpProtocolVersion.js +40 -0
  316. package/npm/src/ocra/api/models/MediaStreamType.d.ts +23 -0
  317. package/npm/src/ocra/api/models/MediaStreamType.js +39 -0
  318. package/npm/src/ocra/api/models/ModelError.d.ts +39 -0
  319. package/npm/src/ocra/api/models/ModelError.js +46 -0
  320. package/npm/src/ocra/api/models/MxpPubSubConfig.d.ts +51 -0
  321. package/npm/src/ocra/api/models/MxpPubSubConfig.js +50 -0
  322. package/npm/src/ocra/api/models/OpaquePushProfile.d.ts +45 -0
  323. package/npm/src/ocra/api/models/OpaquePushProfile.js +47 -0
  324. package/npm/src/ocra/api/models/Origin.d.ts +34 -0
  325. package/npm/src/ocra/api/models/Origin.js +45 -0
  326. package/npm/src/ocra/api/models/PlatformIdentifier.d.ts +25 -0
  327. package/npm/src/ocra/api/models/PlatformIdentifier.js +41 -0
  328. package/npm/src/ocra/api/models/PrimaryMediaTransportType.d.ts +23 -0
  329. package/npm/src/ocra/api/models/PrimaryMediaTransportType.js +39 -0
  330. package/npm/src/ocra/api/models/PushConfig.d.ts +33 -0
  331. package/npm/src/ocra/api/models/PushConfig.js +44 -0
  332. package/npm/src/ocra/api/models/PushNotification.d.ts +48 -0
  333. package/npm/src/ocra/api/models/PushNotification.js +48 -0
  334. package/npm/src/ocra/api/models/PushNotificationDestination.d.ts +33 -0
  335. package/npm/src/ocra/api/models/PushNotificationDestination.js +43 -0
  336. package/npm/src/ocra/api/models/PushProfile.d.ts +58 -0
  337. package/npm/src/ocra/api/models/PushProfile.js +53 -0
  338. package/npm/src/ocra/api/models/PushProvider.d.ts +25 -0
  339. package/npm/src/ocra/api/models/PushProvider.js +41 -0
  340. package/npm/src/ocra/api/models/RelayProtocol.d.ts +24 -0
  341. package/npm/src/ocra/api/models/RelayProtocol.js +40 -0
  342. package/npm/src/ocra/api/models/RemotePeerInstance.d.ts +40 -0
  343. package/npm/src/ocra/api/models/RemotePeerInstance.js +47 -0
  344. package/npm/src/ocra/api/models/RemotePeerInstancePushProfile.d.ts +39 -0
  345. package/npm/src/ocra/api/models/RemotePeerInstancePushProfile.js +46 -0
  346. package/npm/src/ocra/api/models/RtcConfig.d.ts +34 -0
  347. package/npm/src/ocra/api/models/RtcConfig.js +45 -0
  348. package/npm/src/ocra/api/models/RtcProfile.d.ts +39 -0
  349. package/npm/src/ocra/api/models/RtcProfile.js +45 -0
  350. package/npm/src/ocra/api/models/SdpSemantics.d.ts +23 -0
  351. package/npm/src/ocra/api/models/SdpSemantics.js +39 -0
  352. package/npm/src/ocra/api/models/SemanticVersion.d.ts +33 -0
  353. package/npm/src/ocra/api/models/SemanticVersion.js +43 -0
  354. package/npm/src/ocra/api/models/TransportProtocol.d.ts +23 -0
  355. package/npm/src/ocra/api/models/TransportProtocol.js +39 -0
  356. package/npm/src/ocra/api/models/UpaPushProfile.d.ts +41 -0
  357. package/npm/src/ocra/api/models/UpaPushProfile.js +45 -0
  358. package/npm/src/ocra/api/models/UpdateInstanceRequest.d.ts +34 -0
  359. package/npm/src/ocra/api/models/UpdateInstanceRequest.js +44 -0
  360. package/npm/src/ocra/api/models/UpdateInstanceTtlRequest.d.ts +27 -0
  361. package/npm/src/ocra/api/models/UpdateInstanceTtlRequest.js +42 -0
  362. package/npm/src/ocra/api/models/UpdateInstanceTtlResponse.d.ts +33 -0
  363. package/npm/src/ocra/api/models/UpdateInstanceTtlResponse.js +43 -0
  364. package/npm/src/ocra/api/models/UserDebugInfoResponse.d.ts +51 -0
  365. package/npm/src/ocra/api/models/UserDebugInfoResponse.js +49 -0
  366. package/npm/src/ocra/api/models/W3CPushProfile.d.ts +46 -0
  367. package/npm/src/ocra/api/models/W3CPushProfile.js +48 -0
  368. package/npm/src/ocra/api/models/W3CPushProfileKeys.d.ts +33 -0
  369. package/npm/src/ocra/api/models/W3CPushProfileKeys.js +43 -0
  370. package/npm/src/ocra/api/models/WarningEvent.d.ts +46 -0
  371. package/npm/src/ocra/api/models/WarningEvent.js +49 -0
  372. package/npm/src/ocra/api/models/WarningEventName.d.ts +30 -0
  373. package/npm/src/ocra/api/models/WarningEventName.js +46 -0
  374. package/npm/src/ocra/api/models/WarningEventType.d.ts +23 -0
  375. package/npm/src/ocra/api/models/WarningEventType.js +39 -0
  376. package/npm/src/ocra/api/models/WebrtcRTCIceServer.d.ts +60 -0
  377. package/npm/src/ocra/api/models/WebrtcRTCIceServer.js +61 -0
  378. package/npm/src/ocra/api/models/WebrtcRTCOAuthCredential.d.ts +33 -0
  379. package/npm/src/ocra/api/models/WebrtcRTCOAuthCredential.js +43 -0
  380. package/npm/src/ocra/api/models/WebrtcRTCSessionDescription.d.ts +33 -0
  381. package/npm/src/ocra/api/models/WebrtcRTCSessionDescription.js +43 -0
  382. package/npm/src/ocra/api/models/index.d.ts +69 -0
  383. package/npm/src/ocra/api/models/index.js +86 -0
  384. package/npm/src/ocra/api/runtime.d.ts +140 -0
  385. package/npm/src/ocra/api/runtime.js +254 -0
  386. package/npm/src/ocra/auth/Authentication.d.ts +4 -0
  387. package/npm/src/ocra/auth/Authentication.js +3 -0
  388. package/npm/src/ocra/auth/InstanceAuthentication.d.ts +8 -0
  389. package/npm/src/ocra/auth/InstanceAuthentication.js +3 -0
  390. package/npm/src/ocra/auth/InstanceCredentials.d.ts +6 -0
  391. package/npm/src/ocra/auth/InstanceCredentials.js +3 -0
  392. package/npm/src/ocra/auth/InstanceRequestSignatureV1Authentication.d.ts +15 -0
  393. package/npm/src/ocra/auth/InstanceRequestSignatureV1Authentication.js +37 -0
  394. package/npm/src/ocra/auth/JwtAuthentication.d.ts +7 -0
  395. package/npm/src/ocra/auth/JwtAuthentication.js +22 -0
  396. package/npm/src/ocra/auth/Request.d.ts +7 -0
  397. package/npm/src/ocra/auth/Request.js +3 -0
  398. package/npm/src/ocra/auth/SignatureV1.d.ts +20 -0
  399. package/npm/src/ocra/auth/SignatureV1.js +95 -0
  400. package/npm/src/ocra/auth/SignatureV1RequestSigner.d.ts +4 -0
  401. package/npm/src/ocra/auth/SignatureV1RequestSigner.js +15 -0
  402. package/npm/src/ocra/auth/index.d.ts +7 -0
  403. package/npm/src/ocra/auth/index.js +24 -0
  404. package/npm/src/ocra/requestHeaders/CorrelationContext.d.ts +8 -0
  405. package/npm/src/ocra/requestHeaders/CorrelationContext.js +33 -0
  406. package/npm/src/ocra/requestHeaders/RequestHeaders.d.ts +4 -0
  407. package/npm/src/ocra/requestHeaders/RequestHeaders.js +3 -0
  408. package/npm/src/ocra/requestHeaders/SinchRequestHeaders.d.ts +7 -0
  409. package/npm/src/ocra/requestHeaders/SinchRequestHeaders.js +24 -0
  410. package/npm/src/ocra/requestHeaders/index.d.ts +2 -0
  411. package/npm/src/ocra/requestHeaders/index.js +19 -0
  412. package/npm/src/push/CallNotificationResult.d.ts +40 -0
  413. package/npm/src/push/CallNotificationResult.js +3 -0
  414. package/npm/src/push/DefaultNotificationResult.d.ts +14 -0
  415. package/npm/src/push/DefaultNotificationResult.js +49 -0
  416. package/npm/src/push/Domain.d.ts +6 -0
  417. package/npm/src/push/Domain.js +11 -0
  418. package/npm/src/push/NotificationResult.d.ts +26 -0
  419. package/npm/src/push/NotificationResult.js +3 -0
  420. package/npm/src/push/OcraPushService.d.ts +20 -0
  421. package/npm/src/push/OcraPushService.js +98 -0
  422. package/npm/src/push/PushFactory.d.ts +7 -0
  423. package/npm/src/push/PushFactory.js +15 -0
  424. package/npm/src/push/PushPayload.d.ts +21 -0
  425. package/npm/src/push/PushPayload.js +88 -0
  426. package/npm/src/push/PushService.d.ts +9 -0
  427. package/npm/src/push/PushService.js +3 -0
  428. package/npm/src/push/PushServiceWorker.d.ts +22 -0
  429. package/npm/src/push/PushServiceWorker.js +90 -0
  430. package/npm/src/push/PushType.d.ts +3 -0
  431. package/npm/src/push/PushType.js +8 -0
  432. package/npm/src/push/PushWorker.d.ts +25 -0
  433. package/npm/src/push/PushWorker.js +70 -0
  434. package/npm/src/push/index.d.ts +6 -0
  435. package/npm/src/push/index.js +23 -0
  436. package/npm/src/rtc/DefaultMediaStreamFactory.d.ts +10 -0
  437. package/npm/src/rtc/DefaultMediaStreamFactory.js +59 -0
  438. package/npm/src/rtc/IceServer.d.ts +22 -0
  439. package/npm/src/rtc/IceServer.js +66 -0
  440. package/npm/src/rtc/MediaController.d.ts +9 -0
  441. package/npm/src/rtc/MediaController.js +36 -0
  442. package/npm/src/rtc/MediaManager.d.ts +9 -0
  443. package/npm/src/rtc/MediaManager.js +36 -0
  444. package/npm/src/rtc/MediaStreamFactory.d.ts +4 -0
  445. package/npm/src/rtc/MediaStreamFactory.js +3 -0
  446. package/npm/src/rtc/PeerConnection.d.ts +66 -0
  447. package/npm/src/rtc/PeerConnection.js +283 -0
  448. package/npm/src/rtc/PeerConnectionClient.d.ts +63 -0
  449. package/npm/src/rtc/PeerConnectionClient.js +296 -0
  450. package/npm/src/rtc/PeerConnectionClientObserver.d.ts +4 -0
  451. package/npm/src/rtc/PeerConnectionClientObserver.js +3 -0
  452. package/npm/src/rtc/PeerConnectionObserver.d.ts +8 -0
  453. package/npm/src/rtc/PeerConnectionObserver.js +3 -0
  454. package/npm/src/rtc/WebRTCFactory.d.ts +3 -0
  455. package/npm/src/rtc/WebRTCFactory.js +10 -0
  456. package/npm/src/rtc/index.d.ts +2 -0
  457. package/npm/src/rtc/index.js +19 -0
  458. package/npm/src/session/Direction.d.ts +4 -0
  459. package/npm/src/session/Direction.js +9 -0
  460. package/npm/src/session/EstablishedState.d.ts +10 -0
  461. package/npm/src/session/EstablishedState.js +85 -0
  462. package/npm/src/session/InboundSession.d.ts +11 -0
  463. package/npm/src/session/InboundSession.js +143 -0
  464. package/npm/src/session/OutboundSession.d.ts +7 -0
  465. package/npm/src/session/OutboundSession.js +163 -0
  466. package/npm/src/session/RealTimeScheduler.d.ts +5 -0
  467. package/npm/src/session/RealTimeScheduler.js +13 -0
  468. package/npm/src/session/Scheduler.d.ts +4 -0
  469. package/npm/src/session/Scheduler.js +3 -0
  470. package/npm/src/session/Session.d.ts +88 -0
  471. package/npm/src/session/Session.js +293 -0
  472. package/npm/src/session/SessionEvent.d.ts +7 -0
  473. package/npm/src/session/SessionEvent.js +3 -0
  474. package/npm/src/session/SessionState.d.ts +7 -0
  475. package/npm/src/session/SessionState.js +12 -0
  476. package/npm/src/session/SessionStateBase.d.ts +23 -0
  477. package/npm/src/session/SessionStateBase.js +63 -0
  478. package/npm/src/session/TerminatedState.d.ts +7 -0
  479. package/npm/src/session/TerminatedState.js +16 -0
  480. package/npm/src/session/TerminationCause.d.ts +11 -0
  481. package/npm/src/session/TerminationCause.js +18 -0
  482. package/npm/src/session/fsm/CancellationToken.d.ts +15 -0
  483. package/npm/src/session/fsm/CancellationToken.js +33 -0
  484. package/npm/src/session/fsm/FsmState.d.ts +34 -0
  485. package/npm/src/session/fsm/FsmState.js +100 -0
  486. package/npm/src/session/fsm/FsmTransition.d.ts +5 -0
  487. package/npm/src/session/fsm/FsmTransition.js +3 -0
  488. package/npm/src/session/fsm/FsmTransitions.d.ts +9 -0
  489. package/npm/src/session/fsm/FsmTransitions.js +24 -0
  490. package/npm/src/session/fsm/InvalidStateTransition.d.ts +5 -0
  491. package/npm/src/session/fsm/InvalidStateTransition.js +11 -0
  492. package/npm/src/session/fsm/NullState.d.ts +21 -0
  493. package/npm/src/session/fsm/NullState.js +54 -0
  494. package/npm/src/session/fsm/TimerEvent.d.ts +8 -0
  495. package/npm/src/session/fsm/TimerEvent.js +20 -0
  496. package/npm/src/session/fsm/index.d.ts +7 -0
  497. package/npm/src/session/fsm/index.js +24 -0
  498. package/npm/src/session/jsep/JsepMessage.d.ts +15 -0
  499. package/npm/src/session/jsep/JsepMessage.js +52 -0
  500. package/npm/src/session/jsep/Sdp.d.ts +17 -0
  501. package/npm/src/session/jsep/Sdp.js +29 -0
  502. package/npm/src/session/jsep/SessionDescription.d.ts +17 -0
  503. package/npm/src/session/jsep/SessionDescription.js +34 -0
  504. package/npm/src/session/jsep/index.d.ts +2 -0
  505. package/npm/src/session/jsep/index.js +19 -0
  506. package/npm/src/storage/FeatureStorage.d.ts +19 -0
  507. package/npm/src/storage/FeatureStorage.js +61 -0
  508. package/npm/src/storage/InstanceStorage.d.ts +6 -0
  509. package/npm/src/storage/InstanceStorage.js +3 -0
  510. package/npm/src/storage/KeyValueStorage.d.ts +8 -0
  511. package/npm/src/storage/KeyValueStorage.js +22 -0
  512. package/npm/src/storage/SettingStorage.d.ts +8 -0
  513. package/npm/src/storage/SettingStorage.js +19 -0
  514. package/npm/src/storage/StorageFactory.d.ts +9 -0
  515. package/npm/src/storage/StorageFactory.js +22 -0
  516. package/npm/src/storage/UserInstanceStorage.d.ts +26 -0
  517. package/npm/src/storage/UserInstanceStorage.js +44 -0
  518. package/npm/src/utils/Base64.helper.d.ts +34 -0
  519. package/npm/src/utils/Base64.helper.js +79 -0
  520. package/npm/src/utils/Crypto.helper.d.ts +9 -0
  521. package/npm/src/utils/Crypto.helper.js +28 -0
  522. package/npm/src/utils/Date.helper.d.ts +9 -0
  523. package/npm/src/utils/Date.helper.js +19 -0
  524. package/npm/src/utils/Env.helper.d.ts +8 -0
  525. package/npm/src/utils/Env.helper.js +37 -0
  526. package/npm/src/utils/Errors.d.ts +11 -0
  527. package/npm/src/utils/Errors.js +26 -0
  528. package/npm/src/utils/Event.d.ts +8 -0
  529. package/npm/src/utils/Event.js +27 -0
  530. package/npm/src/utils/Promise.helper.d.ts +5 -0
  531. package/npm/src/utils/Promise.helper.js +29 -0
  532. package/npm/src/utils/String.helper.d.ts +23 -0
  533. package/npm/src/utils/String.helper.js +48 -0
  534. package/npm/src/utils/TimeService.d.ts +6 -0
  535. package/npm/src/utils/TimeService.js +16 -0
  536. package/npm/src/utils/Type.helper.d.ts +12 -0
  537. package/npm/src/utils/Type.helper.js +36 -0
  538. package/npm/src/utils/Utils.d.ts +4 -0
  539. package/npm/src/utils/Utils.js +16 -0
  540. package/npm/src/utils/index.d.ts +8 -0
  541. package/npm/src/utils/index.js +25 -0
  542. package/package.json +100 -41
  543. package/VERSION.js +0 -1
  544. package/examples/IM_basic_chat.js +0 -111
  545. package/lib/sinch.node.min.js +0 -1
  546. package/package.json~ +0 -50
package/README.md CHANGED
@@ -1,189 +1,103 @@
1
- Sinch Javascript SDK 1.4.8
2
- ==========================
3
- Welcome to Sinch JS SDK, http://www.sinch.com
1
+ # Sinch RTC SDK - JavaScript
4
2
 
5
- For REST API helper libraries see node modules sinch-rest-api or sinch-request (signing only).
3
+ ## Setting Up the Development Environment
6
4
 
7
- Copyright 2014-2017, Sinch AB (reg. no 556969-5397)
5
+ Build tools are installed using [Nix](https://nixos.org/download.html) package manager.
6
+ Before running any `make` commands, ensure your Nix environment is configured to use the correct channel for dependencies.
8
7
 
8
+ 1. **Add the NixOS 25.05 channel**
9
9
 
10
- Features
11
- ========
12
- - Sinch SDK for web
13
- - PSTN Calling
14
- - Make calls using WebRTC
15
- - Web/app calling
16
- - Make and receive calls using WebRTC
17
- - Call both web clients and native (iOS and Android)
18
- - SIP calling
19
- - Make calls connected to SIP clients
20
- - Conference calling
21
- - Instant messaging
22
- - Cross platform, using native SDK's for iOS and Android
23
- - Conversations with up to 10 participants
24
- - Delivery receipts
25
- - Video calling (beta)
26
- - Web clients only
27
- - Group p2p calling
28
- - Web clients only
29
- - Phone number verification
30
- - SMS verification
31
- - Callout verification
32
- - Partner user management
33
- - Authentication ticket for session creation
34
- - Allows full user management for partner
35
- - Sample python (tornado) backend in samples folder (SinchAUTHsample)
36
- - NOTE: Review your app setting for "JS Auth" in the Sinch portal
37
- - Sinch user management
38
- - Create user, update password and basic profile
39
- - Authenticate as user
40
- - Generate authentication tickets when running as backend
41
-
42
- Should you encounter any bugs, glitches, lack of functionality or other problems
43
- using our SDK, please send us an email to dev@sinch.com.
44
- Your help in this regard is greatly appreciated.
45
-
46
-
47
- Quick start
48
- ===========
10
+ Open your `.nix-channels` file (usually in your home directory) and add the following line:
49
11
 
50
- - Include Sinch JS SDK with:
12
+ ```bash
13
+ https://nixos.org/channels/nixos-25.05 nixpkgs-25
14
+ ```
51
15
 
52
- <script src="//cdn.sinch.com/latest/sinch.min.js"></script>
16
+ 2. **Update Nix channels**
53
17
 
54
- - Read the user-guide for introduction and the reference docs for details
18
+ Run the following commands to update your channels:
55
19
 
56
- - Look at the sample apps for inspiration
57
-
58
-
59
- Install using Bower
60
- ===================
61
-
62
- You can install Sinch RTC SDK in your project using Bower;
63
-
64
- bower install sinch
65
-
66
- Import the Sinch SDK in your website using
67
-
68
- <script src="PATH_TO_BOWER_MODULES/sinch-rtc/sinch.min.js"></script>
20
+ ```bash
21
+ nix-channel --update
22
+ nix-channel --list
23
+ ```
69
24
 
25
+ You should see something like:
70
26
 
71
- Install using Node JS
72
- =====================
73
-
74
- Sinch is also available as a node package. Install Sinch RTC SDK using;
75
-
76
- npm install sinch-rtc
77
-
78
- Import Sinch SDK in your javascript using
79
-
80
- var SinchClient = require('sinch-rtc');
81
-
82
- var sinchClient = new SinchClient({
83
- applicationKey: 'YOUR KEY',
84
- capabilities: {messaging: true},
85
- onLogMessage: function(message) {
86
- console.log(message);
87
- }
88
- });
27
+ ```bash
28
+ nixpkgs-25 https://nixos.org/channels/nixos-25.05
29
+ ```
89
30
 
90
- sinchClient.start(CREDENTIALS).then(function() {
91
- console.log('Success!');
92
- })
31
+ You can now safely run `make` commands
93
32
 
94
- Applications developed with node package does not quite yet support Browserify,
95
- without some minor modifications.
33
+ To install a local devenv, run:
96
34
 
35
+ make devenv
97
36
 
98
- Getting Started
99
- ===============
100
- Familiarise yourself with the user guide (documentation folder or online).
37
+ In the root of this repository run:
101
38
 
102
- Have a look at the Sample App in the samples/ folder, where you'll find:
103
- - SinchIMsample, our Instant Messaging sample app
104
- - SinchPSTNsample, our PSTN calling sample app
105
- - SinchWEBsample, our Web to Web calling sample app
106
- - SinchAUTHsample, our sample for demonstrating integrating a custom backend
107
- for user authentication (useful for native app compatability)
108
- - python-backend-sample, a sample backend for Sinch written in Python
109
- (see README.md for more information on getting started)
110
- - SinchVIDEOsample, sample for person to person video calling
111
- - SinchGROUPVIDEOsample, sample for group video conferencing
112
- - SinchVERsample, sample for SMS number verification
113
- - SinchCALLOUTsample, sample for Callout number verification
39
+ make sync
114
40
 
115
- These sample apps demonstrate user management, session handling and more.
116
- The interesting stuff can be found in the .js files.
41
+ This will
117
42
 
118
- In order to get started follow these steps:
43
+ - Sync git submodules.
44
+ - Set up npm environment [https://www.npmjs.com/]
119
45
 
120
- 1. Try open SinchIMsample/index.html in a web-browser (Chrome or Firefox).
121
- Open the developer console.
122
- 2. In the browser window you should see a web form where you can either create
123
- a new user or login as a user.
124
- 3. Try creating a user
125
- 4. An error message "Illegal Authorization Header" error is shown. This is
126
- because the sample app don't use your app key yet.
127
- 5. Go to www.sinch.com, create an account and a new application (or use an
128
- already existing app)
129
- 6. Replace MY_APPLICATION_KEY in IMsample.js with your application key.
130
- 7. Try creating a user, now it should work!
131
- Note: Only if "JS Auth" is enabled in portal for your app
132
- 8. Open the same page in a separate window and create another user
133
- 9. You can now try sending messages between these two users.
46
+ When the script finishes, it should be possible to run.
134
47
 
135
- Have a look at the source code in IMsample.js, enable the onLogMessage callback
136
- if you're curious about the activity under the hood. It's a good way to have
137
- logging enabled during development for easy error tracking.
48
+ make serve
138
49
 
139
- You can also activate session loading by enabling the if-statement on line 45,
140
- by removing "false" from the if-statement. The PSTN and AUTH sample application
141
- has this activated by default, please see the PSTNsample.js file for reference.
50
+ this will build the sdk and start a local http server on port 5050 if everything works you should be able to load [http://localhost:5050/reference-apps/javascript/samples/]
142
51
 
143
- As for the PSTN sample app, you may have to load the application from a web
144
- server (can be local), depending on the security settings for WebRTC in your
145
- browser. Also, when trying PSTN calls please ensure you replace
146
- "MY_APPLICATION_KEY" with your actual key.
52
+ ## Build and Test Sdk
147
53
 
54
+ ### Build
148
55
 
149
- Documentation
150
- =============
151
- The user-guide is available in the docs/ folder.
152
- Open index.html and read about:
56
+ make build
153
57
 
154
- - Instructions for first-time developers
155
- - Using Sinch in your app for sending and receiving messages
156
- - Using Sinch in your app for making PSTN calls
157
- - Using Sinch in your app for making data calls
158
- - Learn about sinch authentication
159
- - Session Management
160
- - Other information about Sinch, such as creating your app, note on export
161
- regulations and more.
58
+ ### Generate ocra api from ocra design
162
59
 
163
- Reference documentation is available in docs/ folder. Read about:
60
+ make ocra
164
61
 
165
- - SinchClient (starting point)
166
- - MessageClient
167
- - CallClient
62
+ ### Build and start local http server
168
63
 
64
+ make serve
169
65
 
170
- Known issues
171
- ============
172
- - There is an issue running too many instances at the same time. No more than
173
- 5-6 instances can be run at the same time in the same browser.
174
- (if problem experienced, restart browser and only run one instance and try
175
- again with fewer instances)
176
- - After three failed login attempts on one user accounts, that account is
177
- locked for a while with no ability to unlock (when using Sinch auth).
178
- - Restore messages missed since last login is currently disabled.
179
- - When browser close, any ongoing PSTN calls are not terminated properly but
180
- relies on B-side doing a time-out. (~ 1 minute)
181
- - Browserify is not yet supported for Node JS distribution.
66
+ ### Tests
182
67
 
68
+ make test
183
69
 
70
+ ### Create the jssdk package
184
71
 
72
+ make dist
185
73
 
74
+ ## E2E Smoke test
186
75
 
76
+ ### Build Sdk for E2E smoke test
187
77
 
78
+ make bidiro
188
79
 
80
+ ### Build and start local host for running test host app
189
81
 
82
+ make bidiro-serve
83
+
84
+ This will start a local webserver at port 1080 and a WebSocket proxy listening on port 3000. To run the test host app use <http://localhost:1080/sinch/{channel}/?sdk={sdk}>
85
+
86
+ {channel} is an identifier for the channel and can be any string. WebSocket message to this app should be sent to http://{host}:3000/bidiro/{channel}
87
+
88
+ {sdk} is the folder where the sdk is located. By defaulr {sdk} is "sdk" which is the folder where the local built (make bidiro) sdk is located.
89
+
90
+ ### Running E2E Tests inside docker locally
91
+
92
+ `npm run e2e`
93
+
94
+ ## Prerequisites
95
+
96
+ 1. Make sure you have cloned the [E2E repository](https://gitlab.com/sinch/sinch-projects/voice/rtc-sdk-e2e-test) in your home directory
97
+ 2. The JS sdk and E2E respository are in the same parent directory
98
+ 3. Docker or [Docker Desktop](https://www.docker.com/products/docker-desktop/) is installed on your machine
99
+ 4. Replace `localhost` with `bidirohost` for `sinch.device.1` and `sinch.device.1` in `parameters-js-v2.xml`.
100
+
101
+ ### Design
102
+
103
+ For design document, see [design/README.md](design/README.md)
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Callback object to be used to proceed in user registration/setup when
3
+ * registration credentials for the user in question have been obtained.
4
+ */
5
+ export declare class ClientRegistration {
6
+ register: (jwtSignature: string) => Promise<void>;
7
+ registerFailed: () => void;
8
+ /**
9
+ * Methods to call when registration credentials for the user have been
10
+ * obtained.
11
+ *
12
+ * @param register - Callback to call with a signed JWT token for this user.
13
+ * @param registerFailed - Callback to call when registration for the user has failed
14
+ */
15
+ constructor(register: (jwtSignature: string) => Promise<void>, registerFailed: () => void);
16
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientRegistration = void 0;
4
+ /**
5
+ * Callback object to be used to proceed in user registration/setup when
6
+ * registration credentials for the user in question have been obtained.
7
+ */
8
+ class ClientRegistration {
9
+ /**
10
+ * Methods to call when registration credentials for the user have been
11
+ * obtained.
12
+ *
13
+ * @param register - Callback to call with a signed JWT token for this user.
14
+ * @param registerFailed - Callback to call when registration for the user has failed
15
+ */
16
+ constructor(register, registerFailed) {
17
+ this.register = register;
18
+ this.registerFailed = registerFailed;
19
+ }
20
+ }
21
+ exports.ClientRegistration = ClientRegistration;
22
+ //# sourceMappingURL=ClientRegistration.js.map
@@ -0,0 +1,59 @@
1
+ import { CallInitiator, CallClient } from "./calling";
2
+ import { SinchConfig } from "./models";
3
+ import { SinchClientListener } from "./SinchClientListener";
4
+ import { CallInitiationResponse, Config, InitiateCallRequest } from "./ocra/api";
5
+ import { SinchClient } from "./SinchClient";
6
+ import { NotificationResult } from "./push/NotificationResult";
7
+ export declare class DefaultSinchClient implements CallInitiator, SinchClient {
8
+ private static readonly OCRA_PATH;
9
+ private readonly ServiceWorkerName;
10
+ applicationKey: string;
11
+ userId: string;
12
+ private callerIdentifier?;
13
+ private defaultCallClient;
14
+ private clientEvent;
15
+ private instanceController;
16
+ private isClientStarted;
17
+ private apiClient;
18
+ private onStartedAction;
19
+ private pushWorker?;
20
+ private pushService;
21
+ private features;
22
+ private useRelayIceCandidatesOnly;
23
+ private addTurnListener;
24
+ private isUsingManagedPush;
25
+ private instanceConfigJson?;
26
+ private instanceConfigUpdateInterval?;
27
+ /**
28
+ * @param config -
29
+ * config.applicationKey - application unique key from Sinch portal
30
+ * config.userId - userId for whom instance is created
31
+ * [config.ttl] TODO: TTL param for setting lifetime of Ocra instance
32
+ */
33
+ constructor(config: SinchConfig);
34
+ set pushNotificationDisplayName(displayName: string | undefined);
35
+ get pushNotificationDisplayName(): string | undefined;
36
+ setUseRelayIceCandidatesOnly(useRelayIceCandidatesOnly: boolean): void;
37
+ private processExternalPushNotification;
38
+ private getBaseUrl;
39
+ private isUrl;
40
+ start(instanceConfig?: Config): Promise<void>;
41
+ setSupportManagedPush(serviceWorker?: string): Promise<void>;
42
+ disableManagedPushSupport(): Promise<void>;
43
+ private failed;
44
+ private setupPush;
45
+ private createAndSetUpCallReporter;
46
+ private started;
47
+ private setupConfigCheck;
48
+ private clearInstanceConfigUpdateInterval;
49
+ addListener(listener: SinchClientListener): void;
50
+ removeListener(listener: SinchClientListener): void;
51
+ initiateCall(request: InitiateCallRequest): Promise<CallInitiationResponse>;
52
+ onPush: (message: any) => void;
53
+ get callClient(): CallClient;
54
+ terminate(): void;
55
+ get localUserId(): string;
56
+ isStarted(): boolean;
57
+ relayRemotePushNotification(payload: Record<string, string>): NotificationResult;
58
+ showPushNotification(title: string, options: NotificationOptions): void;
59
+ }
@@ -0,0 +1,253 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DefaultSinchClient = void 0;
13
+ const calling_1 = require("./calling");
14
+ const models_1 = require("./models");
15
+ const api_1 = require("./ocra/api");
16
+ const InstanceController_1 = require("./instance/InstanceController");
17
+ const fsm_1 = require("./session/fsm");
18
+ const push_1 = require("./push");
19
+ const ClientEventFanout_1 = require("./calling/listeners/ClientEventFanout");
20
+ const CallReporter_1 = require("./calling/reporting/CallReporter");
21
+ const ApiClient_1 = require("./ocra/ApiClient");
22
+ const utils_1 = require("./utils");
23
+ const Features_1 = require("./features/Features");
24
+ const StorageFactory_1 = require("./storage/StorageFactory");
25
+ const IceServer_1 = require("./rtc/IceServer");
26
+ class DefaultSinchClient {
27
+ /**
28
+ * @param config -
29
+ * config.applicationKey - application unique key from Sinch portal
30
+ * config.userId - userId for whom instance is created
31
+ * [config.ttl] TODO: TTL param for setting lifetime of Ocra instance
32
+ */
33
+ constructor(config) {
34
+ this.ServiceWorkerName = "sw.js";
35
+ this.isClientStarted = false;
36
+ this.useRelayIceCandidatesOnly = false;
37
+ this.isUsingManagedPush = false;
38
+ this.processExternalPushNotification = (json) => {
39
+ const payload = {
40
+ sinch: json,
41
+ name: "ForSmokeTests",
42
+ };
43
+ this.relayRemotePushNotification(payload);
44
+ };
45
+ this.onPush = (message) => {
46
+ this.relayRemotePushNotification(message.data);
47
+ };
48
+ this.clientEvent = new ClientEventFanout_1.ClientEventFanout(this);
49
+ this.features = Features_1.FeaturesFactory.create(StorageFactory_1.StorageFactory.createFeatureStorage());
50
+ if (!config || !config.applicationKey) {
51
+ throw new Error("Parameter appKey is required");
52
+ }
53
+ this.applicationKey = config.applicationKey;
54
+ this.userId = config.userId;
55
+ this.callerIdentifier = config.callerIdentifier;
56
+ this.apiClient = ApiClient_1.ApiClientFactory.create(new api_1.Configuration({
57
+ basePath: this.getBaseUrl(config.baseUrl),
58
+ fetchApi: config.fetchApi,
59
+ }));
60
+ this.instanceController = new InstanceController_1.InstanceController(this.applicationKey, this.userId, this.clientEvent, this.apiClient);
61
+ this.pushService = push_1.PushFactory.createPushService(this.userId, this.apiClient);
62
+ this.defaultCallClient = calling_1.CallClientFactory.create(this.userId, this.applicationKey, config.mediaManager);
63
+ this.onStartedAction = new Array();
64
+ this.addTurnListener = (0, utils_1.pipe)(IceServer_1.onTurnFeatureFlagChanged, this.features.addListener.bind(this.features));
65
+ }
66
+ set pushNotificationDisplayName(displayName) {
67
+ if (displayName && displayName.length > 255)
68
+ throw new fsm_1.ArgumentError("displayName must not exceed 255 bytes", (0, utils_1.nameof)(displayName));
69
+ this.pushService.pushNotificationDisplayName = displayName;
70
+ }
71
+ get pushNotificationDisplayName() {
72
+ return this.pushService.pushNotificationDisplayName;
73
+ }
74
+ setUseRelayIceCandidatesOnly(useRelayIceCandidatesOnly) {
75
+ this.useRelayIceCandidatesOnly = useRelayIceCandidatesOnly;
76
+ }
77
+ getBaseUrl(url) {
78
+ return ((!this.isUrl(url) ? "https://" : "") + url + DefaultSinchClient.OCRA_PATH);
79
+ }
80
+ isUrl(urlOrHost) {
81
+ return urlOrHost.startsWith("http://") || urlOrHost.startsWith("https://");
82
+ }
83
+ start(instanceConfig) {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ try {
86
+ this.started(yield this.instanceController.start(), instanceConfig);
87
+ }
88
+ catch (ex) {
89
+ this.isClientStarted = false;
90
+ console.error(ex);
91
+ this.failed("Unable to create instance!");
92
+ }
93
+ });
94
+ }
95
+ setSupportManagedPush(serviceWorker) {
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ this.instanceController.toggleCapability(models_1.Capability.Push, true);
98
+ this.isUsingManagedPush = true;
99
+ this.pushWorker = push_1.PushFactory.createPushWorker(serviceWorker !== null && serviceWorker !== void 0 ? serviceWorker : this.ServiceWorkerName, this.pushService);
100
+ yield this.pushWorker.register();
101
+ this.pushWorker.addEventListener(this.onPush);
102
+ });
103
+ }
104
+ disableManagedPushSupport() {
105
+ return __awaiter(this, void 0, void 0, function* () {
106
+ var _a;
107
+ this.instanceController.toggleCapability(models_1.Capability.Push, false);
108
+ this.isUsingManagedPush = false;
109
+ yield ((_a = this.pushWorker) === null || _a === void 0 ? void 0 : _a.unregister());
110
+ this.pushWorker = undefined;
111
+ });
112
+ }
113
+ failed(reason) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ this.clientEvent.onEvent({ eventType: "failed", context: reason });
116
+ });
117
+ }
118
+ setupPush(instance, applicationServerKey) {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ if (!applicationServerKey)
121
+ throw new fsm_1.InvalidOperationError("Missing public VAPID key");
122
+ if (this.pushWorker) {
123
+ // todo: this key should be populated from the instanceConfig once the push backend is ready, for now fallback on hardcoded.
124
+ yield this.pushWorker.start(applicationServerKey, instance);
125
+ }
126
+ });
127
+ }
128
+ createAndSetUpCallReporter(instance) {
129
+ return new CallReporter_1.CallReporter(this.userId, instance, this.apiClient);
130
+ }
131
+ started(instance, config) {
132
+ return __awaiter(this, void 0, void 0, function* () {
133
+ var _a;
134
+ try {
135
+ if (this.instanceController.authentication) {
136
+ const instanceConfig = config !== null && config !== void 0 ? config : (yield this.apiClient.getConfig({
137
+ instanceId: instance.id,
138
+ userId: this.userId,
139
+ }));
140
+ this.instanceConfigJson = JSON.stringify(instanceConfig);
141
+ this.setupConfigCheck(instance, instanceConfig);
142
+ this.instanceController.setUpdateInstanceTtlWindow(instanceConfig.updateInstanceTtlWindowDays);
143
+ this.apiClient.setUpdateInstanceTtlWindow(instanceConfig.updateInstanceTtlWindowDays);
144
+ yield this.instanceController.prolongInstanceIfNeeded();
145
+ this.addTurnListener(this.instanceController);
146
+ const fetchIceServers = (0, IceServer_1.createIceServerFetcher)(this.apiClient, this.userId, instance.id);
147
+ this.features.setUserInstance(this.userId, instance.id, this.applicationKey);
148
+ const callReporter = this.createAndSetUpCallReporter(instance);
149
+ if (this.features.shouldRefresh()) {
150
+ yield this.features.refresh(this.apiClient);
151
+ }
152
+ if (this.isUsingManagedPush) {
153
+ yield this.setupPush(instance, (_a = instanceConfig.pushConfig) === null || _a === void 0 ? void 0 : _a.w3cApplicationServerKey);
154
+ }
155
+ this.defaultCallClient.init(this, instanceConfig.rtcProfile, instanceConfig.rtcConfig, fetchIceServers, callReporter, this.pushService, this.useRelayIceCandidatesOnly, this.features, instance.id, this.callerIdentifier);
156
+ this.isClientStarted = true;
157
+ this.onStartedAction.splice(0).forEach((a) => a());
158
+ this.clientEvent.onEvent({ eventType: "started" });
159
+ }
160
+ }
161
+ catch (error) {
162
+ this.failed(error).catch(() => {
163
+ console.error(error);
164
+ });
165
+ }
166
+ });
167
+ }
168
+ setupConfigCheck(instance, instanceConfig) {
169
+ var _a, _b;
170
+ const configUpdater = () => __awaiter(this, void 0, void 0, function* () {
171
+ var _a;
172
+ const newInstanceConfig = yield this.apiClient.getConfig({
173
+ instanceId: instance.id,
174
+ userId: this.userId,
175
+ });
176
+ const newInstanceConfigJson = JSON.stringify(newInstanceConfig);
177
+ if (this.instanceConfigJson !== newInstanceConfigJson) {
178
+ this.clearInstanceConfigUpdateInterval();
179
+ // eslint-disable-next-line no-constant-condition
180
+ while (true) {
181
+ if (!((_a = this.defaultCallClient.getInstance()) === null || _a === void 0 ? void 0 : _a.hasActiveCall())) {
182
+ console.log("New instance config - restarting client");
183
+ this.terminate();
184
+ this.start(newInstanceConfig);
185
+ break;
186
+ }
187
+ yield utils_1.PromiseHelper.sleep(1000);
188
+ }
189
+ }
190
+ });
191
+ const interval = setInterval(configUpdater, instanceConfig.configRefreshIntervalMs);
192
+ this.instanceConfigUpdateInterval = (_b = (_a = interval.unref) === null || _a === void 0 ? void 0 : _a.call(interval)) !== null && _b !== void 0 ? _b : interval;
193
+ }
194
+ clearInstanceConfigUpdateInterval() {
195
+ if (this.instanceConfigUpdateInterval != null) {
196
+ clearInterval(this.instanceConfigUpdateInterval);
197
+ this.instanceConfigUpdateInterval = undefined;
198
+ }
199
+ }
200
+ addListener(listener) {
201
+ this.clientEvent.addListener(listener);
202
+ }
203
+ removeListener(listener) {
204
+ this.clientEvent.removeListener(listener);
205
+ }
206
+ initiateCall(request) {
207
+ if (this.isClientStarted) {
208
+ return this.apiClient.initiateCall(request);
209
+ }
210
+ else {
211
+ throw new fsm_1.InvalidOperationError("Can not initiate a call before authentication");
212
+ }
213
+ }
214
+ get callClient() {
215
+ return this.defaultCallClient;
216
+ }
217
+ terminate() {
218
+ this.isClientStarted = false;
219
+ this.instanceController.terminate();
220
+ this.clearInstanceConfigUpdateInterval();
221
+ this.features.resetListeners();
222
+ this.clientEvent.onEvent({ eventType: "terminated" });
223
+ }
224
+ get localUserId() {
225
+ return this.userId;
226
+ }
227
+ isStarted() {
228
+ return this.isClientStarted;
229
+ }
230
+ relayRemotePushNotification(payload) {
231
+ const result = new push_1.DefaultNotificationResult(payload.sinch, payload.name);
232
+ if (result.isValid()) {
233
+ if (this.isStarted()) {
234
+ this.defaultCallClient.handleCallPushPayload(result);
235
+ }
236
+ else {
237
+ this.onStartedAction.push(() => this.defaultCallClient.handleCallPushPayload(result));
238
+ this.start();
239
+ }
240
+ }
241
+ return result;
242
+ }
243
+ showPushNotification(title, options) {
244
+ var _a;
245
+ (_a = this.pushWorker) === null || _a === void 0 ? void 0 : _a.showNotification(title, options);
246
+ }
247
+ }
248
+ exports.DefaultSinchClient = DefaultSinchClient;
249
+ DefaultSinchClient.OCRA_PATH = "/ocra";
250
+ // Export as standalone to global scope
251
+ if (typeof window !== "undefined")
252
+ window.SinchClient = DefaultSinchClient;
253
+ //# sourceMappingURL=DefaultSinchClient.js.map
@@ -0,0 +1,22 @@
1
+ import { MediaStreamFactory } from "./rtc/MediaStreamFactory";
2
+ import { SinchClient } from "./SinchClient";
3
+ import { SinchClientBuilder } from "./SinchClientBuilder";
4
+ export declare class DefaultSinchClientBuilder implements SinchClientBuilder {
5
+ private clientUserId?;
6
+ private clientApplicationKey?;
7
+ private clientEnvironmentHost?;
8
+ private clientCallerIdentifier?;
9
+ private clientVideoConstraints?;
10
+ private clientFetchApi?;
11
+ private clientMediaStreamFactory?;
12
+ userId(userId: string): SinchClientBuilder;
13
+ applicationKey(applicationKey: string): SinchClientBuilder;
14
+ environmentHost(environmentHost: string): SinchClientBuilder;
15
+ callerIdentifier(callerIdentifier: string): SinchClientBuilder;
16
+ fetchApi(fetchApi: (input: RequestInfo, init?: RequestInit) => Promise<Response>): SinchClientBuilder;
17
+ mediaStreamFactory(mediaStreamFactory: MediaStreamFactory): SinchClientBuilder;
18
+ videoConfiguration(videoConstraints: MediaTrackConstraints): SinchClientBuilder;
19
+ silentMediaStream(): SinchClientBuilder;
20
+ private getDefaultMediaStreamFactory;
21
+ build(): SinchClient;
22
+ }