@wazo/sdk 0.43.15 → 0.44.0

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 (899) hide show
  1. package/dist/index.js +10630 -0
  2. package/dist/index.mjs +10541 -0
  3. package/{lib → dist}/types/domain/Contact.d.ts +3 -1
  4. package/dist/types/domain/Contact.d.ts.map +1 -0
  5. package/{lib → dist}/types/index.d.ts +13 -13
  6. package/dist/types/index.d.ts.map +1 -0
  7. package/dist/wazo-sdk.js +69378 -43
  8. package/dist/wazo-sdk.js.LICENSE.txt +684 -0
  9. package/package.json +10 -21
  10. package/esm/__tests__/api-client.test.js +0 -281
  11. package/esm/__tests__/web-rtc-client.test.js +0 -192
  12. package/esm/api/agentd.js +0 -23
  13. package/esm/api/amid.js +0 -17
  14. package/esm/api/application.js +0 -63
  15. package/esm/api/auth.js +0 -198
  16. package/esm/api/call-logd.js +0 -24
  17. package/esm/api/calld.js +0 -120
  18. package/esm/api/chatd.js +0 -50
  19. package/esm/api/confd.js +0 -77
  20. package/esm/api/ctid-ng.js +0 -96
  21. package/esm/api/dird.js +0 -110
  22. package/esm/api/webhookd.js +0 -7
  23. package/esm/api-client.js +0 -41
  24. package/esm/base-api-client.js +0 -125
  25. package/esm/checker/Checker.js +0 -54
  26. package/esm/checker/checks/aor.js +0 -28
  27. package/esm/checker/checks/api.js +0 -76
  28. package/esm/checker/checks/ice-ipv4.js +0 -69
  29. package/esm/checker/checks/index.js +0 -8
  30. package/esm/checker/checks/symmetric-nat.js +0 -59
  31. package/esm/checker/checks/wazo-websocket.js +0 -38
  32. package/esm/checker/checks/webrtc-transport.js +0 -35
  33. package/esm/checker/checks/webrtc.js +0 -40
  34. package/esm/constants.js +0 -11
  35. package/esm/domain/AdHocAPIConference.js +0 -102
  36. package/esm/domain/Agent.js +0 -30
  37. package/esm/domain/BadResponse.js +0 -21
  38. package/esm/domain/Call.js +0 -123
  39. package/esm/domain/CallLog.js +0 -157
  40. package/esm/domain/CallSession.js +0 -253
  41. package/esm/domain/CallerID.js +0 -24
  42. package/esm/domain/ChatMessage.js +0 -55
  43. package/esm/domain/ChatRoom.js +0 -30
  44. package/esm/domain/Contact.js +0 -464
  45. package/esm/domain/Country.js +0 -19
  46. package/esm/domain/Device/DebugDevice.js +0 -32
  47. package/esm/domain/Device/Device.js +0 -1
  48. package/esm/domain/DirectorySource.js +0 -1
  49. package/esm/domain/ExternalApp.js +0 -24
  50. package/esm/domain/Features.js +0 -77
  51. package/esm/domain/ForwardOption.js +0 -37
  52. package/esm/domain/Incall.js +0 -28
  53. package/esm/domain/IndirectTransfer.js +0 -40
  54. package/esm/domain/Line.js +0 -39
  55. package/esm/domain/Meeting.js +0 -61
  56. package/esm/domain/MeetingAuthorization.js +0 -46
  57. package/esm/domain/MeetingStatus.js +0 -14
  58. package/esm/domain/NotificationOptions.js +0 -45
  59. package/esm/domain/Phone/CTIPhone.js +0 -288
  60. package/esm/domain/Phone/Phone.js +0 -1
  61. package/esm/domain/Phone/WebRTCPhone.js +0 -1482
  62. package/esm/domain/Profile.js +0 -128
  63. package/esm/domain/Recording.js +0 -30
  64. package/esm/domain/Relocation.js +0 -20
  65. package/esm/domain/Room.js +0 -97
  66. package/esm/domain/SFUNotAvailableError.js +0 -6
  67. package/esm/domain/ServerError.js +0 -9
  68. package/esm/domain/Session.js +0 -174
  69. package/esm/domain/SipLine.js +0 -82
  70. package/esm/domain/Subscription.js +0 -42
  71. package/esm/domain/SwitchboardCall.js +0 -56
  72. package/esm/domain/Voicemail.js +0 -76
  73. package/esm/domain/__tests__/Agent.test.js +0 -37
  74. package/esm/domain/__tests__/Call.test.js +0 -25
  75. package/esm/domain/__tests__/CallLog.test.js +0 -181
  76. package/esm/domain/__tests__/CallSession.test.js +0 -78
  77. package/esm/domain/__tests__/Contact.test.js +0 -393
  78. package/esm/domain/__tests__/IndirectTransfer.test.js +0 -67
  79. package/esm/domain/__tests__/Line.test.js +0 -52
  80. package/esm/domain/__tests__/Meeting.test.js +0 -77
  81. package/esm/domain/__tests__/MeetingAuthorization.test.js +0 -49
  82. package/esm/domain/__tests__/Profile.test.js +0 -169
  83. package/esm/domain/__tests__/Room.test.js +0 -206
  84. package/esm/domain/__tests__/Session.test.js +0 -382
  85. package/esm/domain/__tests__/SipLine.test.js +0 -27
  86. package/esm/domain/__tests__/Voicemail.test.js +0 -90
  87. package/esm/domain/types.js +0 -2
  88. package/esm/index.js +0 -51
  89. package/esm/lib/WazoSessionDescriptionHandler.js +0 -429
  90. package/esm/pubkey.js +0 -10
  91. package/esm/service/CallApi.js +0 -61
  92. package/esm/service/IssueReporter.js +0 -331
  93. package/esm/service/__tests__/IssueReporter.test.js +0 -112
  94. package/esm/service/__tests__/getApiclient.test.js +0 -37
  95. package/esm/service/getApiClient.js +0 -94
  96. package/esm/simple/Auth.js +0 -384
  97. package/esm/simple/Configuration.js +0 -13
  98. package/esm/simple/Directory.js +0 -11
  99. package/esm/simple/Phone.js +0 -389
  100. package/esm/simple/Websocket.js +0 -81
  101. package/esm/simple/__tests__/Auth.test.js +0 -144
  102. package/esm/simple/index.js +0 -137
  103. package/esm/simple/room/LocalParticipant.js +0 -4
  104. package/esm/simple/room/Participant.js +0 -315
  105. package/esm/simple/room/RemoteParticipant.js +0 -10
  106. package/esm/simple/room/Room.js +0 -714
  107. package/esm/simple/room/SipRoom.js +0 -121
  108. package/esm/simple/room/Stream.js +0 -47
  109. package/esm/simple/room/__tests__/Participant.test.js +0 -71
  110. package/esm/simple/room/__tests__/RemoteParticipant.test.js +0 -12
  111. package/esm/simple/utils.js +0 -10
  112. package/esm/types/WebSocketMessage.js +0 -1
  113. package/esm/types/domain/Contact.d.ts +0 -332
  114. package/esm/types/domain/Contact.d.ts.map +0 -1
  115. package/esm/types/index.d.ts +0 -59
  116. package/esm/types/index.d.ts.map +0 -1
  117. package/esm/utils/Emitter.js +0 -19
  118. package/esm/utils/Heartbeat.js +0 -73
  119. package/esm/utils/PhoneNumberUtil.js +0 -67
  120. package/esm/utils/__tests__/Heartbeat.test.js +0 -65
  121. package/esm/utils/__tests__/PhoneNumberUtil.test.js +0 -70
  122. package/esm/utils/__tests__/api-requester.test.js +0 -166
  123. package/esm/utils/__tests__/array.test.js +0 -18
  124. package/esm/utils/__tests__/compare-version.test.js +0 -10
  125. package/esm/utils/__tests__/object.test.js +0 -76
  126. package/esm/utils/__tests__/sdp.test.js +0 -172
  127. package/esm/utils/__tests__/string.test.js +0 -49
  128. package/esm/utils/api-requester.js +0 -213
  129. package/esm/utils/array.js +0 -9
  130. package/esm/utils/compare-version.js +0 -17
  131. package/esm/utils/isMobile.js +0 -3
  132. package/esm/utils/new-from.js +0 -7
  133. package/esm/utils/object.js +0 -10
  134. package/esm/utils/once.js +0 -15
  135. package/esm/utils/sdp.js +0 -104
  136. package/esm/utils/string.js +0 -12
  137. package/esm/utils/update-from.js +0 -10
  138. package/esm/utils/webrtc.js +0 -37
  139. package/esm/web-rtc-client.js +0 -2200
  140. package/esm/websocket-client.js +0 -385
  141. package/index.js +0 -1
  142. package/lib/__tests__/api-client.test.js +0 -295
  143. package/lib/__tests__/web-rtc-client.test.js +0 -210
  144. package/lib/api/agentd.js +0 -28
  145. package/lib/api/amid.js +0 -28
  146. package/lib/api/application.js +0 -68
  147. package/lib/api/auth.js +0 -210
  148. package/lib/api/call-logd.js +0 -29
  149. package/lib/api/calld.js +0 -134
  150. package/lib/api/chatd.js +0 -68
  151. package/lib/api/confd.js +0 -91
  152. package/lib/api/ctid-ng.js +0 -101
  153. package/lib/api/dird.js +0 -124
  154. package/lib/api/webhookd.js +0 -12
  155. package/lib/api-client.js +0 -37
  156. package/lib/base-api-client.js +0 -133
  157. package/lib/checker/Checker.js +0 -68
  158. package/lib/checker/checks/aor.js +0 -42
  159. package/lib/checker/checks/api.js +0 -90
  160. package/lib/checker/checks/ice-ipv4.js +0 -73
  161. package/lib/checker/checks/index.js +0 -13
  162. package/lib/checker/checks/symmetric-nat.js +0 -61
  163. package/lib/checker/checks/wazo-websocket.js +0 -63
  164. package/lib/checker/checks/webrtc-transport.js +0 -49
  165. package/lib/checker/checks/webrtc.js +0 -54
  166. package/lib/constants.js +0 -14
  167. package/lib/domain/AdHocAPIConference.js +0 -101
  168. package/lib/domain/Agent.js +0 -25
  169. package/lib/domain/BadResponse.js +0 -19
  170. package/lib/domain/Call.js +0 -112
  171. package/lib/domain/CallLog.js +0 -151
  172. package/lib/domain/CallSession.js +0 -224
  173. package/lib/domain/CallerID.js +0 -27
  174. package/lib/domain/ChatMessage.js +0 -53
  175. package/lib/domain/ChatRoom.js +0 -32
  176. package/lib/domain/Contact.js +0 -439
  177. package/lib/domain/Country.js +0 -21
  178. package/lib/domain/Device/DebugDevice.js +0 -35
  179. package/lib/domain/Device/Device.js +0 -2
  180. package/lib/domain/DirectorySource.js +0 -2
  181. package/lib/domain/ExternalApp.js +0 -27
  182. package/lib/domain/Features.js +0 -87
  183. package/lib/domain/ForwardOption.js +0 -41
  184. package/lib/domain/Incall.js +0 -32
  185. package/lib/domain/IndirectTransfer.js +0 -42
  186. package/lib/domain/Line.js +0 -39
  187. package/lib/domain/Meeting.js +0 -55
  188. package/lib/domain/MeetingAuthorization.js +0 -45
  189. package/lib/domain/MeetingStatus.js +0 -15
  190. package/lib/domain/NotificationOptions.js +0 -49
  191. package/lib/domain/Phone/CTIPhone.js +0 -324
  192. package/lib/domain/Phone/Phone.js +0 -2
  193. package/lib/domain/Phone/WebRTCPhone.js +0 -1492
  194. package/lib/domain/Profile.js +0 -138
  195. package/lib/domain/Recording.js +0 -31
  196. package/lib/domain/Relocation.js +0 -18
  197. package/lib/domain/Room.js +0 -81
  198. package/lib/domain/SFUNotAvailableError.js +0 -9
  199. package/lib/domain/ServerError.js +0 -15
  200. package/lib/domain/Session.js +0 -166
  201. package/lib/domain/SipLine.js +0 -76
  202. package/lib/domain/Subscription.js +0 -34
  203. package/lib/domain/SwitchboardCall.js +0 -50
  204. package/lib/domain/Voicemail.js +0 -77
  205. package/lib/domain/__tests__/Agent.test.js +0 -42
  206. package/lib/domain/__tests__/Call.test.js +0 -30
  207. package/lib/domain/__tests__/CallLog.test.js +0 -166
  208. package/lib/domain/__tests__/CallSession.test.js +0 -83
  209. package/lib/domain/__tests__/Contact.test.js +0 -371
  210. package/lib/domain/__tests__/IndirectTransfer.test.js +0 -81
  211. package/lib/domain/__tests__/Line.test.js +0 -57
  212. package/lib/domain/__tests__/Meeting.test.js +0 -82
  213. package/lib/domain/__tests__/MeetingAuthorization.test.js +0 -54
  214. package/lib/domain/__tests__/Profile.test.js +0 -197
  215. package/lib/domain/__tests__/Room.test.js +0 -220
  216. package/lib/domain/__tests__/Session.test.js +0 -378
  217. package/lib/domain/__tests__/SipLine.test.js +0 -32
  218. package/lib/domain/__tests__/Voicemail.test.js +0 -95
  219. package/lib/domain/types.js +0 -38
  220. package/lib/index.js +0 -127
  221. package/lib/lib/WazoSessionDescriptionHandler.js +0 -434
  222. package/lib/pubkey.js +0 -12
  223. package/lib/service/CallApi.js +0 -112
  224. package/lib/service/IssueReporter.js +0 -317
  225. package/lib/service/__tests__/IssueReporter.test.js +0 -117
  226. package/lib/service/__tests__/getApiclient.test.js +0 -42
  227. package/lib/service/getApiClient.js +0 -114
  228. package/lib/simple/Auth.js +0 -433
  229. package/lib/simple/Configuration.js +0 -31
  230. package/lib/simple/Directory.js +0 -29
  231. package/lib/simple/Phone.js +0 -418
  232. package/lib/simple/Websocket.js +0 -116
  233. package/lib/simple/__tests__/Auth.test.js +0 -181
  234. package/lib/simple/index.js +0 -165
  235. package/lib/simple/room/LocalParticipant.js +0 -9
  236. package/lib/simple/room/Participant.js +0 -302
  237. package/lib/simple/room/RemoteParticipant.js +0 -15
  238. package/lib/simple/room/Room.js +0 -711
  239. package/lib/simple/room/SipRoom.js +0 -141
  240. package/lib/simple/room/Stream.js +0 -50
  241. package/lib/simple/room/__tests__/Participant.test.js +0 -85
  242. package/lib/simple/room/__tests__/RemoteParticipant.test.js +0 -17
  243. package/lib/simple/utils.js +0 -27
  244. package/lib/types/WebSocketMessage.js +0 -2
  245. package/lib/types/__tests__/api-client.test.d.ts +0 -2
  246. package/lib/types/__tests__/api-client.test.d.ts.map +0 -1
  247. package/lib/types/__tests__/web-rtc-client.test.d.ts +0 -2
  248. package/lib/types/__tests__/web-rtc-client.test.d.ts.map +0 -1
  249. package/lib/types/api/agentd.d.ts +0 -17
  250. package/lib/types/api/agentd.d.ts.map +0 -1
  251. package/lib/types/api/amid.d.ts +0 -8
  252. package/lib/types/api/amid.d.ts.map +0 -1
  253. package/lib/types/api/application.d.ts +0 -34
  254. package/lib/types/api/application.d.ts.map +0 -1
  255. package/lib/types/api/auth.d.ts +0 -69
  256. package/lib/types/api/auth.d.ts.map +0 -1
  257. package/lib/types/api/call-logd.d.ts +0 -12
  258. package/lib/types/api/call-logd.d.ts.map +0 -1
  259. package/lib/types/api/calld.d.ts +0 -52
  260. package/lib/types/api/calld.d.ts.map +0 -1
  261. package/lib/types/api/chatd.d.ts +0 -29
  262. package/lib/types/api/chatd.d.ts.map +0 -1
  263. package/lib/types/api/confd.d.ts +0 -46
  264. package/lib/types/api/confd.d.ts.map +0 -1
  265. package/lib/types/api/ctid-ng.d.ts +0 -36
  266. package/lib/types/api/ctid-ng.d.ts.map +0 -1
  267. package/lib/types/api/dird.d.ts +0 -33
  268. package/lib/types/api/dird.d.ts.map +0 -1
  269. package/lib/types/api/webhookd.d.ts +0 -24
  270. package/lib/types/api/webhookd.d.ts.map +0 -1
  271. package/lib/types/api-client.d.ts +0 -26
  272. package/lib/types/api-client.d.ts.map +0 -1
  273. package/lib/types/base-api-client.d.ts +0 -43
  274. package/lib/types/base-api-client.d.ts.map +0 -1
  275. package/lib/types/checker/Checker.d.ts +0 -13
  276. package/lib/types/checker/Checker.d.ts.map +0 -1
  277. package/lib/types/checker/checks/aor.d.ts +0 -6
  278. package/lib/types/checker/checks/aor.d.ts.map +0 -1
  279. package/lib/types/checker/checks/api.d.ts +0 -6
  280. package/lib/types/checker/checks/api.d.ts.map +0 -1
  281. package/lib/types/checker/checks/ice-ipv4.d.ts +0 -6
  282. package/lib/types/checker/checks/ice-ipv4.d.ts.map +0 -1
  283. package/lib/types/checker/checks/index.d.ts +0 -9
  284. package/lib/types/checker/checks/index.d.ts.map +0 -1
  285. package/lib/types/checker/checks/symmetric-nat.d.ts +0 -6
  286. package/lib/types/checker/checks/symmetric-nat.d.ts.map +0 -1
  287. package/lib/types/checker/checks/wazo-websocket.d.ts +0 -6
  288. package/lib/types/checker/checks/wazo-websocket.d.ts.map +0 -1
  289. package/lib/types/checker/checks/webrtc-transport.d.ts +0 -7
  290. package/lib/types/checker/checks/webrtc-transport.d.ts.map +0 -1
  291. package/lib/types/checker/checks/webrtc.d.ts +0 -6
  292. package/lib/types/checker/checks/webrtc.d.ts.map +0 -1
  293. package/lib/types/constants.d.ts +0 -12
  294. package/lib/types/constants.d.ts.map +0 -1
  295. package/lib/types/domain/AdHocAPIConference.d.ts +0 -54
  296. package/lib/types/domain/AdHocAPIConference.d.ts.map +0 -1
  297. package/lib/types/domain/Agent.d.ts +0 -31
  298. package/lib/types/domain/Agent.d.ts.map +0 -1
  299. package/lib/types/domain/BadResponse.d.ts +0 -11
  300. package/lib/types/domain/BadResponse.d.ts.map +0 -1
  301. package/lib/types/domain/Call.d.ts +0 -79
  302. package/lib/types/domain/Call.d.ts.map +0 -1
  303. package/lib/types/domain/CallLog.d.ts +0 -88
  304. package/lib/types/domain/CallLog.d.ts.map +0 -1
  305. package/lib/types/domain/CallSession.d.ts +0 -119
  306. package/lib/types/domain/CallSession.d.ts.map +0 -1
  307. package/lib/types/domain/CallerID.d.ts +0 -22
  308. package/lib/types/domain/CallerID.d.ts.map +0 -1
  309. package/lib/types/domain/ChatMessage.d.ts +0 -41
  310. package/lib/types/domain/ChatMessage.d.ts.map +0 -1
  311. package/lib/types/domain/ChatRoom.d.ts +0 -22
  312. package/lib/types/domain/ChatRoom.d.ts.map +0 -1
  313. package/lib/types/domain/Contact.d.ts.map +0 -1
  314. package/lib/types/domain/Country.d.ts +0 -21
  315. package/lib/types/domain/Country.d.ts.map +0 -1
  316. package/lib/types/domain/Device/DebugDevice.d.ts +0 -14
  317. package/lib/types/domain/Device/DebugDevice.d.ts.map +0 -1
  318. package/lib/types/domain/Device/Device.d.ts +0 -13
  319. package/lib/types/domain/Device/Device.d.ts.map +0 -1
  320. package/lib/types/domain/DirectorySource.d.ts +0 -13
  321. package/lib/types/domain/DirectorySource.d.ts.map +0 -1
  322. package/lib/types/domain/ExternalApp.d.ts +0 -22
  323. package/lib/types/domain/ExternalApp.d.ts.map +0 -1
  324. package/lib/types/domain/Features.d.ts +0 -26
  325. package/lib/types/domain/Features.d.ts.map +0 -1
  326. package/lib/types/domain/ForwardOption.d.ts +0 -28
  327. package/lib/types/domain/ForwardOption.d.ts.map +0 -1
  328. package/lib/types/domain/Incall.d.ts +0 -21
  329. package/lib/types/domain/Incall.d.ts.map +0 -1
  330. package/lib/types/domain/IndirectTransfer.d.ts +0 -31
  331. package/lib/types/domain/IndirectTransfer.d.ts.map +0 -1
  332. package/lib/types/domain/Line.d.ts +0 -35
  333. package/lib/types/domain/Line.d.ts.map +0 -1
  334. package/lib/types/domain/Meeting.d.ts +0 -45
  335. package/lib/types/domain/Meeting.d.ts.map +0 -1
  336. package/lib/types/domain/MeetingAuthorization.d.ts +0 -32
  337. package/lib/types/domain/MeetingAuthorization.d.ts.map +0 -1
  338. package/lib/types/domain/MeetingStatus.d.ts +0 -10
  339. package/lib/types/domain/MeetingStatus.d.ts.map +0 -1
  340. package/lib/types/domain/NotificationOptions.d.ts +0 -22
  341. package/lib/types/domain/NotificationOptions.d.ts.map +0 -1
  342. package/lib/types/domain/Phone/CTIPhone.d.ts +0 -79
  343. package/lib/types/domain/Phone/CTIPhone.d.ts.map +0 -1
  344. package/lib/types/domain/Phone/Phone.d.ts +0 -83
  345. package/lib/types/domain/Phone/Phone.d.ts.map +0 -1
  346. package/lib/types/domain/Phone/WebRTCPhone.d.ts +0 -183
  347. package/lib/types/domain/Phone/WebRTCPhone.d.ts.map +0 -1
  348. package/lib/types/domain/Profile.d.ts +0 -155
  349. package/lib/types/domain/Profile.d.ts.map +0 -1
  350. package/lib/types/domain/Recording.d.ts +0 -26
  351. package/lib/types/domain/Recording.d.ts.map +0 -1
  352. package/lib/types/domain/Relocation.d.ts +0 -23
  353. package/lib/types/domain/Relocation.d.ts.map +0 -1
  354. package/lib/types/domain/Room.d.ts +0 -33
  355. package/lib/types/domain/Room.d.ts.map +0 -1
  356. package/lib/types/domain/SFUNotAvailableError.d.ts +0 -4
  357. package/lib/types/domain/SFUNotAvailableError.d.ts.map +0 -1
  358. package/lib/types/domain/ServerError.d.ts +0 -6
  359. package/lib/types/domain/ServerError.d.ts.map +0 -1
  360. package/lib/types/domain/Session.d.ts +0 -100
  361. package/lib/types/domain/Session.d.ts.map +0 -1
  362. package/lib/types/domain/SipLine.d.ts +0 -54
  363. package/lib/types/domain/SipLine.d.ts.map +0 -1
  364. package/lib/types/domain/Subscription.d.ts +0 -43
  365. package/lib/types/domain/Subscription.d.ts.map +0 -1
  366. package/lib/types/domain/SwitchboardCall.d.ts +0 -62
  367. package/lib/types/domain/SwitchboardCall.d.ts.map +0 -1
  368. package/lib/types/domain/Voicemail.d.ts +0 -58
  369. package/lib/types/domain/Voicemail.d.ts.map +0 -1
  370. package/lib/types/domain/__tests__/Agent.test.d.ts +0 -2
  371. package/lib/types/domain/__tests__/Agent.test.d.ts.map +0 -1
  372. package/lib/types/domain/__tests__/Call.test.d.ts +0 -2
  373. package/lib/types/domain/__tests__/Call.test.d.ts.map +0 -1
  374. package/lib/types/domain/__tests__/CallLog.test.d.ts +0 -2
  375. package/lib/types/domain/__tests__/CallLog.test.d.ts.map +0 -1
  376. package/lib/types/domain/__tests__/CallSession.test.d.ts +0 -2
  377. package/lib/types/domain/__tests__/CallSession.test.d.ts.map +0 -1
  378. package/lib/types/domain/__tests__/Contact.test.d.ts +0 -2
  379. package/lib/types/domain/__tests__/Contact.test.d.ts.map +0 -1
  380. package/lib/types/domain/__tests__/IndirectTransfer.test.d.ts +0 -2
  381. package/lib/types/domain/__tests__/IndirectTransfer.test.d.ts.map +0 -1
  382. package/lib/types/domain/__tests__/Line.test.d.ts +0 -2
  383. package/lib/types/domain/__tests__/Line.test.d.ts.map +0 -1
  384. package/lib/types/domain/__tests__/Meeting.test.d.ts +0 -2
  385. package/lib/types/domain/__tests__/Meeting.test.d.ts.map +0 -1
  386. package/lib/types/domain/__tests__/MeetingAuthorization.test.d.ts +0 -2
  387. package/lib/types/domain/__tests__/MeetingAuthorization.test.d.ts.map +0 -1
  388. package/lib/types/domain/__tests__/Profile.test.d.ts +0 -2
  389. package/lib/types/domain/__tests__/Profile.test.d.ts.map +0 -1
  390. package/lib/types/domain/__tests__/Room.test.d.ts +0 -2
  391. package/lib/types/domain/__tests__/Room.test.d.ts.map +0 -1
  392. package/lib/types/domain/__tests__/Session.test.d.ts +0 -2
  393. package/lib/types/domain/__tests__/Session.test.d.ts.map +0 -1
  394. package/lib/types/domain/__tests__/SipLine.test.d.ts +0 -2
  395. package/lib/types/domain/__tests__/SipLine.test.d.ts.map +0 -1
  396. package/lib/types/domain/__tests__/Voicemail.test.d.ts +0 -2
  397. package/lib/types/domain/__tests__/Voicemail.test.d.ts.map +0 -1
  398. package/lib/types/domain/types.d.ts +0 -378
  399. package/lib/types/domain/types.d.ts.map +0 -1
  400. package/lib/types/index.d.ts.map +0 -1
  401. package/lib/types/lib/WazoSessionDescriptionHandler.d.ts +0 -31
  402. package/lib/types/lib/WazoSessionDescriptionHandler.d.ts.map +0 -1
  403. package/lib/types/pubkey.d.ts +0 -3
  404. package/lib/types/pubkey.d.ts.map +0 -1
  405. package/lib/types/service/CallApi.d.ts +0 -28
  406. package/lib/types/service/CallApi.d.ts.map +0 -1
  407. package/lib/types/service/IssueReporter.d.ts +0 -42
  408. package/lib/types/service/IssueReporter.d.ts.map +0 -1
  409. package/lib/types/service/__tests__/IssueReporter.test.d.ts +0 -2
  410. package/lib/types/service/__tests__/IssueReporter.test.d.ts.map +0 -1
  411. package/lib/types/service/__tests__/getApiclient.test.d.ts +0 -2
  412. package/lib/types/service/__tests__/getApiclient.test.d.ts.map +0 -1
  413. package/lib/types/service/getApiClient.d.ts +0 -21
  414. package/lib/types/service/getApiClient.d.ts.map +0 -1
  415. package/lib/types/simple/Auth.d.ts +0 -75
  416. package/lib/types/simple/Auth.d.ts.map +0 -1
  417. package/lib/types/simple/Configuration.d.ts +0 -7
  418. package/lib/types/simple/Configuration.d.ts.map +0 -1
  419. package/lib/types/simple/Directory.d.ts +0 -7
  420. package/lib/types/simple/Directory.d.ts.map +0 -1
  421. package/lib/types/simple/Phone.d.ts +0 -119
  422. package/lib/types/simple/Phone.d.ts.map +0 -1
  423. package/lib/types/simple/Websocket.d.ts +0 -21
  424. package/lib/types/simple/Websocket.d.ts.map +0 -1
  425. package/lib/types/simple/__tests__/Auth.test.d.ts +0 -2
  426. package/lib/types/simple/__tests__/Auth.test.d.ts.map +0 -1
  427. package/lib/types/simple/index.d.ts +0 -153
  428. package/lib/types/simple/index.d.ts.map +0 -1
  429. package/lib/types/simple/room/LocalParticipant.d.ts +0 -5
  430. package/lib/types/simple/room/LocalParticipant.d.ts.map +0 -1
  431. package/lib/types/simple/room/Participant.d.ts +0 -77
  432. package/lib/types/simple/room/Participant.d.ts.map +0 -1
  433. package/lib/types/simple/room/RemoteParticipant.d.ts +0 -7
  434. package/lib/types/simple/room/RemoteParticipant.d.ts.map +0 -1
  435. package/lib/types/simple/room/Room.d.ts +0 -127
  436. package/lib/types/simple/room/Room.d.ts.map +0 -1
  437. package/lib/types/simple/room/SipRoom.d.ts +0 -14
  438. package/lib/types/simple/room/SipRoom.d.ts.map +0 -1
  439. package/lib/types/simple/room/Stream.d.ts +0 -13
  440. package/lib/types/simple/room/Stream.d.ts.map +0 -1
  441. package/lib/types/simple/room/__tests__/Participant.test.d.ts +0 -2
  442. package/lib/types/simple/room/__tests__/Participant.test.d.ts.map +0 -1
  443. package/lib/types/simple/room/__tests__/RemoteParticipant.test.d.ts +0 -2
  444. package/lib/types/simple/room/__tests__/RemoteParticipant.test.d.ts.map +0 -1
  445. package/lib/types/simple/utils.d.ts +0 -3
  446. package/lib/types/simple/utils.d.ts.map +0 -1
  447. package/lib/types/types/WebSocketMessage.d.ts +0 -285
  448. package/lib/types/types/WebSocketMessage.d.ts.map +0 -1
  449. package/lib/types/utils/Emitter.d.ts +0 -18
  450. package/lib/types/utils/Emitter.d.ts.map +0 -1
  451. package/lib/types/utils/Heartbeat.d.ts +0 -22
  452. package/lib/types/utils/Heartbeat.d.ts.map +0 -1
  453. package/lib/types/utils/PhoneNumberUtil.d.ts +0 -7
  454. package/lib/types/utils/PhoneNumberUtil.d.ts.map +0 -1
  455. package/lib/types/utils/__tests__/Heartbeat.test.d.ts +0 -2
  456. package/lib/types/utils/__tests__/Heartbeat.test.d.ts.map +0 -1
  457. package/lib/types/utils/__tests__/PhoneNumberUtil.test.d.ts +0 -2
  458. package/lib/types/utils/__tests__/PhoneNumberUtil.test.d.ts.map +0 -1
  459. package/lib/types/utils/__tests__/api-requester.test.d.ts +0 -2
  460. package/lib/types/utils/__tests__/api-requester.test.d.ts.map +0 -1
  461. package/lib/types/utils/__tests__/array.test.d.ts +0 -2
  462. package/lib/types/utils/__tests__/array.test.d.ts.map +0 -1
  463. package/lib/types/utils/__tests__/compare-version.test.d.ts +0 -2
  464. package/lib/types/utils/__tests__/compare-version.test.d.ts.map +0 -1
  465. package/lib/types/utils/__tests__/object.test.d.ts +0 -2
  466. package/lib/types/utils/__tests__/object.test.d.ts.map +0 -1
  467. package/lib/types/utils/__tests__/sdp.test.d.ts +0 -2
  468. package/lib/types/utils/__tests__/sdp.test.d.ts.map +0 -1
  469. package/lib/types/utils/__tests__/string.test.d.ts +0 -2
  470. package/lib/types/utils/__tests__/string.test.d.ts.map +0 -1
  471. package/lib/types/utils/api-requester.d.ts +0 -48
  472. package/lib/types/utils/api-requester.d.ts.map +0 -1
  473. package/lib/types/utils/array.d.ts +0 -2
  474. package/lib/types/utils/array.d.ts.map +0 -1
  475. package/lib/types/utils/compare-version.d.ts +0 -3
  476. package/lib/types/utils/compare-version.d.ts.map +0 -1
  477. package/lib/types/utils/isMobile.d.ts +0 -3
  478. package/lib/types/utils/isMobile.d.ts.map +0 -1
  479. package/lib/types/utils/new-from.d.ts +0 -3
  480. package/lib/types/utils/new-from.d.ts.map +0 -1
  481. package/lib/types/utils/object.d.ts +0 -2
  482. package/lib/types/utils/object.d.ts.map +0 -1
  483. package/lib/types/utils/once.d.ts +0 -2
  484. package/lib/types/utils/once.d.ts.map +0 -1
  485. package/lib/types/utils/sdp.d.ts +0 -28
  486. package/lib/types/utils/sdp.d.ts.map +0 -1
  487. package/lib/types/utils/string.d.ts +0 -3
  488. package/lib/types/utils/string.d.ts.map +0 -1
  489. package/lib/types/utils/update-from.d.ts +0 -3
  490. package/lib/types/utils/update-from.d.ts.map +0 -1
  491. package/lib/types/utils/webrtc.d.ts +0 -15
  492. package/lib/types/utils/webrtc.d.ts.map +0 -1
  493. package/lib/types/web-rtc-client.d.ts +0 -198
  494. package/lib/types/web-rtc-client.d.ts.map +0 -1
  495. package/lib/types/websocket-client.d.ts +0 -138
  496. package/lib/types/websocket-client.d.ts.map +0 -1
  497. package/lib/utils/Emitter.js +0 -24
  498. package/lib/utils/Heartbeat.js +0 -66
  499. package/lib/utils/PhoneNumberUtil.js +0 -73
  500. package/lib/utils/__tests__/Heartbeat.test.js +0 -79
  501. package/lib/utils/__tests__/PhoneNumberUtil.test.js +0 -72
  502. package/lib/utils/__tests__/api-requester.test.js +0 -180
  503. package/lib/utils/__tests__/array.test.js +0 -20
  504. package/lib/utils/__tests__/compare-version.test.js +0 -15
  505. package/lib/utils/__tests__/object.test.js +0 -78
  506. package/lib/utils/__tests__/sdp.test.js +0 -188
  507. package/lib/utils/__tests__/string.test.js +0 -51
  508. package/lib/utils/api-requester.js +0 -200
  509. package/lib/utils/array.js +0 -13
  510. package/lib/utils/compare-version.js +0 -19
  511. package/lib/utils/isMobile.js +0 -5
  512. package/lib/utils/new-from.js +0 -9
  513. package/lib/utils/object.js +0 -14
  514. package/lib/utils/once.js +0 -18
  515. package/lib/utils/sdp.js +0 -115
  516. package/lib/utils/string.js +0 -17
  517. package/lib/utils/update-from.js +0 -12
  518. package/lib/utils/webrtc.js +0 -41
  519. package/lib/web-rtc-client.js +0 -2239
  520. package/lib/websocket-client.js +0 -390
  521. package/src/__tests__/api-client.test.ts +0 -315
  522. package/src/__tests__/web-rtc-client.test.ts +0 -198
  523. package/src/api/agentd.ts +0 -37
  524. package/src/api/amid.ts +0 -25
  525. package/src/api/application.ts +0 -96
  526. package/src/api/auth.ts +0 -305
  527. package/src/api/call-logd.ts +0 -38
  528. package/src/api/calld.ts +0 -185
  529. package/src/api/chatd.ts +0 -87
  530. package/src/api/confd.ts +0 -119
  531. package/src/api/ctid-ng.ts +0 -152
  532. package/src/api/dird.ts +0 -143
  533. package/src/api/webhookd.ts +0 -30
  534. package/src/api-client.ts +0 -65
  535. package/src/base-api-client.ts +0 -184
  536. package/src/checker/Checker.ts +0 -73
  537. package/src/checker/checks/aor.ts +0 -34
  538. package/src/checker/checks/api.ts +0 -78
  539. package/src/checker/checks/ice-ipv4.ts +0 -80
  540. package/src/checker/checks/index.ts +0 -9
  541. package/src/checker/checks/symmetric-nat.ts +0 -69
  542. package/src/checker/checks/wazo-websocket.ts +0 -41
  543. package/src/checker/checks/webrtc-transport.ts +0 -42
  544. package/src/checker/checks/webrtc.ts +0 -48
  545. package/src/constants.ts +0 -11
  546. package/src/domain/AdHocAPIConference.ts +0 -166
  547. package/src/domain/Agent.ts +0 -68
  548. package/src/domain/BadResponse.ts +0 -29
  549. package/src/domain/Call.ts +0 -217
  550. package/src/domain/CallLog.ts +0 -265
  551. package/src/domain/CallSession.ts +0 -401
  552. package/src/domain/CallerID.ts +0 -49
  553. package/src/domain/ChatMessage.ts +0 -107
  554. package/src/domain/ChatRoom.ts +0 -55
  555. package/src/domain/Contact.ts +0 -851
  556. package/src/domain/Country.ts +0 -19
  557. package/src/domain/Device/DebugDevice.ts +0 -44
  558. package/src/domain/Device/Device.ts +0 -12
  559. package/src/domain/DirectorySource.ts +0 -13
  560. package/src/domain/ExternalApp.ts +0 -46
  561. package/src/domain/Features.ts +0 -105
  562. package/src/domain/ForwardOption.ts +0 -65
  563. package/src/domain/Incall.ts +0 -50
  564. package/src/domain/IndirectTransfer.ts +0 -73
  565. package/src/domain/Line.ts +0 -79
  566. package/src/domain/Meeting.ts +0 -113
  567. package/src/domain/MeetingAuthorization.ts +0 -81
  568. package/src/domain/MeetingStatus.ts +0 -23
  569. package/src/domain/NotificationOptions.ts +0 -68
  570. package/src/domain/Phone/CTIPhone.ts +0 -381
  571. package/src/domain/Phone/Phone.ts +0 -81
  572. package/src/domain/Phone/WebRTCPhone.ts +0 -1830
  573. package/src/domain/Profile.ts +0 -289
  574. package/src/domain/Recording.ts +0 -60
  575. package/src/domain/Relocation.ts +0 -45
  576. package/src/domain/Room.ts +0 -141
  577. package/src/domain/SFUNotAvailableError.ts +0 -7
  578. package/src/domain/ServerError.ts +0 -12
  579. package/src/domain/Session.ts +0 -297
  580. package/src/domain/SipLine.ts +0 -154
  581. package/src/domain/Subscription.ts +0 -95
  582. package/src/domain/SwitchboardCall.ts +0 -127
  583. package/src/domain/Voicemail.ts +0 -138
  584. package/src/domain/__tests__/Agent.test.ts +0 -38
  585. package/src/domain/__tests__/Call.test.ts +0 -26
  586. package/src/domain/__tests__/CallLog.test.ts +0 -203
  587. package/src/domain/__tests__/CallSession.test.ts +0 -80
  588. package/src/domain/__tests__/Contact.test.ts +0 -407
  589. package/src/domain/__tests__/IndirectTransfer.test.ts +0 -68
  590. package/src/domain/__tests__/Line.test.ts +0 -53
  591. package/src/domain/__tests__/Meeting.test.ts +0 -93
  592. package/src/domain/__tests__/MeetingAuthorization.test.ts +0 -50
  593. package/src/domain/__tests__/Profile.test.ts +0 -170
  594. package/src/domain/__tests__/Room.test.ts +0 -207
  595. package/src/domain/__tests__/Session.test.ts +0 -385
  596. package/src/domain/__tests__/SipLine.test.ts +0 -30
  597. package/src/domain/__tests__/Voicemail.test.ts +0 -91
  598. package/src/domain/types.ts +0 -331
  599. package/src/index.ts +0 -60
  600. package/src/lib/WazoSessionDescriptionHandler.ts +0 -532
  601. package/src/pubkey.ts +0 -11
  602. package/src/service/CallApi.ts +0 -86
  603. package/src/service/IssueReporter.ts +0 -434
  604. package/src/service/__tests__/IssueReporter.test.ts +0 -127
  605. package/src/service/__tests__/getApiclient.test.ts +0 -46
  606. package/src/service/getApiClient.ts +0 -113
  607. package/src/simple/Auth.ts +0 -496
  608. package/src/simple/Configuration.ts +0 -18
  609. package/src/simple/Directory.ts +0 -16
  610. package/src/simple/Phone.ts +0 -531
  611. package/src/simple/Websocket.ts +0 -107
  612. package/src/simple/__tests__/Auth.test.ts +0 -168
  613. package/src/simple/index.ts +0 -153
  614. package/src/simple/room/LocalParticipant.ts +0 -5
  615. package/src/simple/room/Participant.ts +0 -409
  616. package/src/simple/room/RemoteParticipant.ts +0 -15
  617. package/src/simple/room/Room.ts +0 -942
  618. package/src/simple/room/SipRoom.ts +0 -164
  619. package/src/simple/room/Stream.ts +0 -64
  620. package/src/simple/room/__tests__/Participant.test.ts +0 -73
  621. package/src/simple/room/__tests__/RemoteParticipant.test.ts +0 -15
  622. package/src/simple/utils.ts +0 -12
  623. package/src/types/WebSocketMessage.ts +0 -335
  624. package/src/types/global.d.ts +0 -33
  625. package/src/types/wazo.d.ts +0 -1
  626. package/src/utils/Emitter.ts +0 -34
  627. package/src/utils/Heartbeat.ts +0 -102
  628. package/src/utils/PhoneNumberUtil.ts +0 -81
  629. package/src/utils/__tests__/Heartbeat.test.ts +0 -66
  630. package/src/utils/__tests__/PhoneNumberUtil.test.ts +0 -79
  631. package/src/utils/__tests__/api-requester.test.ts +0 -180
  632. package/src/utils/__tests__/array.test.ts +0 -19
  633. package/src/utils/__tests__/compare-version.test.ts +0 -11
  634. package/src/utils/__tests__/object.test.ts +0 -77
  635. package/src/utils/__tests__/sdp.test.ts +0 -173
  636. package/src/utils/__tests__/string.test.ts +0 -55
  637. package/src/utils/api-requester.ts +0 -294
  638. package/src/utils/array.ts +0 -11
  639. package/src/utils/compare-version.ts +0 -21
  640. package/src/utils/isMobile.ts +0 -4
  641. package/src/utils/new-from.ts +0 -7
  642. package/src/utils/object.ts +0 -12
  643. package/src/utils/once.ts +0 -14
  644. package/src/utils/sdp.ts +0 -140
  645. package/src/utils/string.ts +0 -15
  646. package/src/utils/update-from.ts +0 -11
  647. package/src/utils/webrtc.ts +0 -56
  648. package/src/web-rtc-client.ts +0 -2687
  649. package/src/websocket-client.ts +0 -475
  650. /package/{esm → dist}/types/__tests__/api-client.test.d.ts +0 -0
  651. /package/{esm → dist}/types/__tests__/api-client.test.d.ts.map +0 -0
  652. /package/{esm → dist}/types/__tests__/web-rtc-client.test.d.ts +0 -0
  653. /package/{esm → dist}/types/__tests__/web-rtc-client.test.d.ts.map +0 -0
  654. /package/{esm → dist}/types/api/agentd.d.ts +0 -0
  655. /package/{esm → dist}/types/api/agentd.d.ts.map +0 -0
  656. /package/{esm → dist}/types/api/amid.d.ts +0 -0
  657. /package/{esm → dist}/types/api/amid.d.ts.map +0 -0
  658. /package/{esm → dist}/types/api/application.d.ts +0 -0
  659. /package/{esm → dist}/types/api/application.d.ts.map +0 -0
  660. /package/{esm → dist}/types/api/auth.d.ts +0 -0
  661. /package/{esm → dist}/types/api/auth.d.ts.map +0 -0
  662. /package/{esm → dist}/types/api/call-logd.d.ts +0 -0
  663. /package/{esm → dist}/types/api/call-logd.d.ts.map +0 -0
  664. /package/{esm → dist}/types/api/calld.d.ts +0 -0
  665. /package/{esm → dist}/types/api/calld.d.ts.map +0 -0
  666. /package/{esm → dist}/types/api/chatd.d.ts +0 -0
  667. /package/{esm → dist}/types/api/chatd.d.ts.map +0 -0
  668. /package/{esm → dist}/types/api/confd.d.ts +0 -0
  669. /package/{esm → dist}/types/api/confd.d.ts.map +0 -0
  670. /package/{esm → dist}/types/api/ctid-ng.d.ts +0 -0
  671. /package/{esm → dist}/types/api/ctid-ng.d.ts.map +0 -0
  672. /package/{esm → dist}/types/api/dird.d.ts +0 -0
  673. /package/{esm → dist}/types/api/dird.d.ts.map +0 -0
  674. /package/{esm → dist}/types/api/webhookd.d.ts +0 -0
  675. /package/{esm → dist}/types/api/webhookd.d.ts.map +0 -0
  676. /package/{esm → dist}/types/api-client.d.ts +0 -0
  677. /package/{esm → dist}/types/api-client.d.ts.map +0 -0
  678. /package/{esm → dist}/types/base-api-client.d.ts +0 -0
  679. /package/{esm → dist}/types/base-api-client.d.ts.map +0 -0
  680. /package/{esm → dist}/types/checker/Checker.d.ts +0 -0
  681. /package/{esm → dist}/types/checker/Checker.d.ts.map +0 -0
  682. /package/{esm → dist}/types/checker/checks/aor.d.ts +0 -0
  683. /package/{esm → dist}/types/checker/checks/aor.d.ts.map +0 -0
  684. /package/{esm → dist}/types/checker/checks/api.d.ts +0 -0
  685. /package/{esm → dist}/types/checker/checks/api.d.ts.map +0 -0
  686. /package/{esm → dist}/types/checker/checks/ice-ipv4.d.ts +0 -0
  687. /package/{esm → dist}/types/checker/checks/ice-ipv4.d.ts.map +0 -0
  688. /package/{esm → dist}/types/checker/checks/index.d.ts +0 -0
  689. /package/{esm → dist}/types/checker/checks/index.d.ts.map +0 -0
  690. /package/{esm → dist}/types/checker/checks/symmetric-nat.d.ts +0 -0
  691. /package/{esm → dist}/types/checker/checks/symmetric-nat.d.ts.map +0 -0
  692. /package/{esm → dist}/types/checker/checks/wazo-websocket.d.ts +0 -0
  693. /package/{esm → dist}/types/checker/checks/wazo-websocket.d.ts.map +0 -0
  694. /package/{esm → dist}/types/checker/checks/webrtc-transport.d.ts +0 -0
  695. /package/{esm → dist}/types/checker/checks/webrtc-transport.d.ts.map +0 -0
  696. /package/{esm → dist}/types/checker/checks/webrtc.d.ts +0 -0
  697. /package/{esm → dist}/types/checker/checks/webrtc.d.ts.map +0 -0
  698. /package/{esm → dist}/types/constants.d.ts +0 -0
  699. /package/{esm → dist}/types/constants.d.ts.map +0 -0
  700. /package/{esm → dist}/types/domain/AdHocAPIConference.d.ts +0 -0
  701. /package/{esm → dist}/types/domain/AdHocAPIConference.d.ts.map +0 -0
  702. /package/{esm → dist}/types/domain/Agent.d.ts +0 -0
  703. /package/{esm → dist}/types/domain/Agent.d.ts.map +0 -0
  704. /package/{esm → dist}/types/domain/BadResponse.d.ts +0 -0
  705. /package/{esm → dist}/types/domain/BadResponse.d.ts.map +0 -0
  706. /package/{esm → dist}/types/domain/Call.d.ts +0 -0
  707. /package/{esm → dist}/types/domain/Call.d.ts.map +0 -0
  708. /package/{esm → dist}/types/domain/CallLog.d.ts +0 -0
  709. /package/{esm → dist}/types/domain/CallLog.d.ts.map +0 -0
  710. /package/{esm → dist}/types/domain/CallSession.d.ts +0 -0
  711. /package/{esm → dist}/types/domain/CallSession.d.ts.map +0 -0
  712. /package/{esm → dist}/types/domain/CallerID.d.ts +0 -0
  713. /package/{esm → dist}/types/domain/CallerID.d.ts.map +0 -0
  714. /package/{esm → dist}/types/domain/ChatMessage.d.ts +0 -0
  715. /package/{esm → dist}/types/domain/ChatMessage.d.ts.map +0 -0
  716. /package/{esm → dist}/types/domain/ChatRoom.d.ts +0 -0
  717. /package/{esm → dist}/types/domain/ChatRoom.d.ts.map +0 -0
  718. /package/{esm → dist}/types/domain/Country.d.ts +0 -0
  719. /package/{esm → dist}/types/domain/Country.d.ts.map +0 -0
  720. /package/{esm → dist}/types/domain/Device/DebugDevice.d.ts +0 -0
  721. /package/{esm → dist}/types/domain/Device/DebugDevice.d.ts.map +0 -0
  722. /package/{esm → dist}/types/domain/Device/Device.d.ts +0 -0
  723. /package/{esm → dist}/types/domain/Device/Device.d.ts.map +0 -0
  724. /package/{esm → dist}/types/domain/DirectorySource.d.ts +0 -0
  725. /package/{esm → dist}/types/domain/DirectorySource.d.ts.map +0 -0
  726. /package/{esm → dist}/types/domain/ExternalApp.d.ts +0 -0
  727. /package/{esm → dist}/types/domain/ExternalApp.d.ts.map +0 -0
  728. /package/{esm → dist}/types/domain/Features.d.ts +0 -0
  729. /package/{esm → dist}/types/domain/Features.d.ts.map +0 -0
  730. /package/{esm → dist}/types/domain/ForwardOption.d.ts +0 -0
  731. /package/{esm → dist}/types/domain/ForwardOption.d.ts.map +0 -0
  732. /package/{esm → dist}/types/domain/Incall.d.ts +0 -0
  733. /package/{esm → dist}/types/domain/Incall.d.ts.map +0 -0
  734. /package/{esm → dist}/types/domain/IndirectTransfer.d.ts +0 -0
  735. /package/{esm → dist}/types/domain/IndirectTransfer.d.ts.map +0 -0
  736. /package/{esm → dist}/types/domain/Line.d.ts +0 -0
  737. /package/{esm → dist}/types/domain/Line.d.ts.map +0 -0
  738. /package/{esm → dist}/types/domain/Meeting.d.ts +0 -0
  739. /package/{esm → dist}/types/domain/Meeting.d.ts.map +0 -0
  740. /package/{esm → dist}/types/domain/MeetingAuthorization.d.ts +0 -0
  741. /package/{esm → dist}/types/domain/MeetingAuthorization.d.ts.map +0 -0
  742. /package/{esm → dist}/types/domain/MeetingStatus.d.ts +0 -0
  743. /package/{esm → dist}/types/domain/MeetingStatus.d.ts.map +0 -0
  744. /package/{esm → dist}/types/domain/NotificationOptions.d.ts +0 -0
  745. /package/{esm → dist}/types/domain/NotificationOptions.d.ts.map +0 -0
  746. /package/{esm → dist}/types/domain/Phone/CTIPhone.d.ts +0 -0
  747. /package/{esm → dist}/types/domain/Phone/CTIPhone.d.ts.map +0 -0
  748. /package/{esm → dist}/types/domain/Phone/Phone.d.ts +0 -0
  749. /package/{esm → dist}/types/domain/Phone/Phone.d.ts.map +0 -0
  750. /package/{esm → dist}/types/domain/Phone/WebRTCPhone.d.ts +0 -0
  751. /package/{esm → dist}/types/domain/Phone/WebRTCPhone.d.ts.map +0 -0
  752. /package/{esm → dist}/types/domain/Profile.d.ts +0 -0
  753. /package/{esm → dist}/types/domain/Profile.d.ts.map +0 -0
  754. /package/{esm → dist}/types/domain/Recording.d.ts +0 -0
  755. /package/{esm → dist}/types/domain/Recording.d.ts.map +0 -0
  756. /package/{esm → dist}/types/domain/Relocation.d.ts +0 -0
  757. /package/{esm → dist}/types/domain/Relocation.d.ts.map +0 -0
  758. /package/{esm → dist}/types/domain/Room.d.ts +0 -0
  759. /package/{esm → dist}/types/domain/Room.d.ts.map +0 -0
  760. /package/{esm → dist}/types/domain/SFUNotAvailableError.d.ts +0 -0
  761. /package/{esm → dist}/types/domain/SFUNotAvailableError.d.ts.map +0 -0
  762. /package/{esm → dist}/types/domain/ServerError.d.ts +0 -0
  763. /package/{esm → dist}/types/domain/ServerError.d.ts.map +0 -0
  764. /package/{esm → dist}/types/domain/Session.d.ts +0 -0
  765. /package/{esm → dist}/types/domain/Session.d.ts.map +0 -0
  766. /package/{esm → dist}/types/domain/SipLine.d.ts +0 -0
  767. /package/{esm → dist}/types/domain/SipLine.d.ts.map +0 -0
  768. /package/{esm → dist}/types/domain/Subscription.d.ts +0 -0
  769. /package/{esm → dist}/types/domain/Subscription.d.ts.map +0 -0
  770. /package/{esm → dist}/types/domain/SwitchboardCall.d.ts +0 -0
  771. /package/{esm → dist}/types/domain/SwitchboardCall.d.ts.map +0 -0
  772. /package/{esm → dist}/types/domain/Voicemail.d.ts +0 -0
  773. /package/{esm → dist}/types/domain/Voicemail.d.ts.map +0 -0
  774. /package/{esm → dist}/types/domain/__tests__/Agent.test.d.ts +0 -0
  775. /package/{esm → dist}/types/domain/__tests__/Agent.test.d.ts.map +0 -0
  776. /package/{esm → dist}/types/domain/__tests__/Call.test.d.ts +0 -0
  777. /package/{esm → dist}/types/domain/__tests__/Call.test.d.ts.map +0 -0
  778. /package/{esm → dist}/types/domain/__tests__/CallLog.test.d.ts +0 -0
  779. /package/{esm → dist}/types/domain/__tests__/CallLog.test.d.ts.map +0 -0
  780. /package/{esm → dist}/types/domain/__tests__/CallSession.test.d.ts +0 -0
  781. /package/{esm → dist}/types/domain/__tests__/CallSession.test.d.ts.map +0 -0
  782. /package/{esm → dist}/types/domain/__tests__/Contact.test.d.ts +0 -0
  783. /package/{esm → dist}/types/domain/__tests__/Contact.test.d.ts.map +0 -0
  784. /package/{esm → dist}/types/domain/__tests__/IndirectTransfer.test.d.ts +0 -0
  785. /package/{esm → dist}/types/domain/__tests__/IndirectTransfer.test.d.ts.map +0 -0
  786. /package/{esm → dist}/types/domain/__tests__/Line.test.d.ts +0 -0
  787. /package/{esm → dist}/types/domain/__tests__/Line.test.d.ts.map +0 -0
  788. /package/{esm → dist}/types/domain/__tests__/Meeting.test.d.ts +0 -0
  789. /package/{esm → dist}/types/domain/__tests__/Meeting.test.d.ts.map +0 -0
  790. /package/{esm → dist}/types/domain/__tests__/MeetingAuthorization.test.d.ts +0 -0
  791. /package/{esm → dist}/types/domain/__tests__/MeetingAuthorization.test.d.ts.map +0 -0
  792. /package/{esm → dist}/types/domain/__tests__/Profile.test.d.ts +0 -0
  793. /package/{esm → dist}/types/domain/__tests__/Profile.test.d.ts.map +0 -0
  794. /package/{esm → dist}/types/domain/__tests__/Room.test.d.ts +0 -0
  795. /package/{esm → dist}/types/domain/__tests__/Room.test.d.ts.map +0 -0
  796. /package/{esm → dist}/types/domain/__tests__/Session.test.d.ts +0 -0
  797. /package/{esm → dist}/types/domain/__tests__/Session.test.d.ts.map +0 -0
  798. /package/{esm → dist}/types/domain/__tests__/SipLine.test.d.ts +0 -0
  799. /package/{esm → dist}/types/domain/__tests__/SipLine.test.d.ts.map +0 -0
  800. /package/{esm → dist}/types/domain/__tests__/Voicemail.test.d.ts +0 -0
  801. /package/{esm → dist}/types/domain/__tests__/Voicemail.test.d.ts.map +0 -0
  802. /package/{esm → dist}/types/domain/types.d.ts +0 -0
  803. /package/{esm → dist}/types/domain/types.d.ts.map +0 -0
  804. /package/{esm → dist}/types/lib/WazoSessionDescriptionHandler.d.ts +0 -0
  805. /package/{esm → dist}/types/lib/WazoSessionDescriptionHandler.d.ts.map +0 -0
  806. /package/{esm → dist}/types/pubkey.d.ts +0 -0
  807. /package/{esm → dist}/types/pubkey.d.ts.map +0 -0
  808. /package/{esm → dist}/types/service/CallApi.d.ts +0 -0
  809. /package/{esm → dist}/types/service/CallApi.d.ts.map +0 -0
  810. /package/{esm → dist}/types/service/IssueReporter.d.ts +0 -0
  811. /package/{esm → dist}/types/service/IssueReporter.d.ts.map +0 -0
  812. /package/{esm → dist}/types/service/__tests__/IssueReporter.test.d.ts +0 -0
  813. /package/{esm → dist}/types/service/__tests__/IssueReporter.test.d.ts.map +0 -0
  814. /package/{esm → dist}/types/service/__tests__/getApiclient.test.d.ts +0 -0
  815. /package/{esm → dist}/types/service/__tests__/getApiclient.test.d.ts.map +0 -0
  816. /package/{esm → dist}/types/service/getApiClient.d.ts +0 -0
  817. /package/{esm → dist}/types/service/getApiClient.d.ts.map +0 -0
  818. /package/{esm → dist}/types/simple/Auth.d.ts +0 -0
  819. /package/{esm → dist}/types/simple/Auth.d.ts.map +0 -0
  820. /package/{esm → dist}/types/simple/Configuration.d.ts +0 -0
  821. /package/{esm → dist}/types/simple/Configuration.d.ts.map +0 -0
  822. /package/{esm → dist}/types/simple/Directory.d.ts +0 -0
  823. /package/{esm → dist}/types/simple/Directory.d.ts.map +0 -0
  824. /package/{esm → dist}/types/simple/Phone.d.ts +0 -0
  825. /package/{esm → dist}/types/simple/Phone.d.ts.map +0 -0
  826. /package/{esm → dist}/types/simple/Websocket.d.ts +0 -0
  827. /package/{esm → dist}/types/simple/Websocket.d.ts.map +0 -0
  828. /package/{esm → dist}/types/simple/__tests__/Auth.test.d.ts +0 -0
  829. /package/{esm → dist}/types/simple/__tests__/Auth.test.d.ts.map +0 -0
  830. /package/{esm → dist}/types/simple/index.d.ts +0 -0
  831. /package/{esm → dist}/types/simple/index.d.ts.map +0 -0
  832. /package/{esm → dist}/types/simple/room/LocalParticipant.d.ts +0 -0
  833. /package/{esm → dist}/types/simple/room/LocalParticipant.d.ts.map +0 -0
  834. /package/{esm → dist}/types/simple/room/Participant.d.ts +0 -0
  835. /package/{esm → dist}/types/simple/room/Participant.d.ts.map +0 -0
  836. /package/{esm → dist}/types/simple/room/RemoteParticipant.d.ts +0 -0
  837. /package/{esm → dist}/types/simple/room/RemoteParticipant.d.ts.map +0 -0
  838. /package/{esm → dist}/types/simple/room/Room.d.ts +0 -0
  839. /package/{esm → dist}/types/simple/room/Room.d.ts.map +0 -0
  840. /package/{esm → dist}/types/simple/room/SipRoom.d.ts +0 -0
  841. /package/{esm → dist}/types/simple/room/SipRoom.d.ts.map +0 -0
  842. /package/{esm → dist}/types/simple/room/Stream.d.ts +0 -0
  843. /package/{esm → dist}/types/simple/room/Stream.d.ts.map +0 -0
  844. /package/{esm → dist}/types/simple/room/__tests__/Participant.test.d.ts +0 -0
  845. /package/{esm → dist}/types/simple/room/__tests__/Participant.test.d.ts.map +0 -0
  846. /package/{esm → dist}/types/simple/room/__tests__/RemoteParticipant.test.d.ts +0 -0
  847. /package/{esm → dist}/types/simple/room/__tests__/RemoteParticipant.test.d.ts.map +0 -0
  848. /package/{esm → dist}/types/simple/utils.d.ts +0 -0
  849. /package/{esm → dist}/types/simple/utils.d.ts.map +0 -0
  850. /package/{esm → dist}/types/types/WebSocketMessage.d.ts +0 -0
  851. /package/{esm → dist}/types/types/WebSocketMessage.d.ts.map +0 -0
  852. /package/{esm → dist}/types/utils/Emitter.d.ts +0 -0
  853. /package/{esm → dist}/types/utils/Emitter.d.ts.map +0 -0
  854. /package/{esm → dist}/types/utils/Heartbeat.d.ts +0 -0
  855. /package/{esm → dist}/types/utils/Heartbeat.d.ts.map +0 -0
  856. /package/{esm → dist}/types/utils/PhoneNumberUtil.d.ts +0 -0
  857. /package/{esm → dist}/types/utils/PhoneNumberUtil.d.ts.map +0 -0
  858. /package/{esm → dist}/types/utils/__tests__/Heartbeat.test.d.ts +0 -0
  859. /package/{esm → dist}/types/utils/__tests__/Heartbeat.test.d.ts.map +0 -0
  860. /package/{esm → dist}/types/utils/__tests__/PhoneNumberUtil.test.d.ts +0 -0
  861. /package/{esm → dist}/types/utils/__tests__/PhoneNumberUtil.test.d.ts.map +0 -0
  862. /package/{esm → dist}/types/utils/__tests__/api-requester.test.d.ts +0 -0
  863. /package/{esm → dist}/types/utils/__tests__/api-requester.test.d.ts.map +0 -0
  864. /package/{esm → dist}/types/utils/__tests__/array.test.d.ts +0 -0
  865. /package/{esm → dist}/types/utils/__tests__/array.test.d.ts.map +0 -0
  866. /package/{esm → dist}/types/utils/__tests__/compare-version.test.d.ts +0 -0
  867. /package/{esm → dist}/types/utils/__tests__/compare-version.test.d.ts.map +0 -0
  868. /package/{esm → dist}/types/utils/__tests__/object.test.d.ts +0 -0
  869. /package/{esm → dist}/types/utils/__tests__/object.test.d.ts.map +0 -0
  870. /package/{esm → dist}/types/utils/__tests__/sdp.test.d.ts +0 -0
  871. /package/{esm → dist}/types/utils/__tests__/sdp.test.d.ts.map +0 -0
  872. /package/{esm → dist}/types/utils/__tests__/string.test.d.ts +0 -0
  873. /package/{esm → dist}/types/utils/__tests__/string.test.d.ts.map +0 -0
  874. /package/{esm → dist}/types/utils/api-requester.d.ts +0 -0
  875. /package/{esm → dist}/types/utils/api-requester.d.ts.map +0 -0
  876. /package/{esm → dist}/types/utils/array.d.ts +0 -0
  877. /package/{esm → dist}/types/utils/array.d.ts.map +0 -0
  878. /package/{esm → dist}/types/utils/compare-version.d.ts +0 -0
  879. /package/{esm → dist}/types/utils/compare-version.d.ts.map +0 -0
  880. /package/{esm → dist}/types/utils/isMobile.d.ts +0 -0
  881. /package/{esm → dist}/types/utils/isMobile.d.ts.map +0 -0
  882. /package/{esm → dist}/types/utils/new-from.d.ts +0 -0
  883. /package/{esm → dist}/types/utils/new-from.d.ts.map +0 -0
  884. /package/{esm → dist}/types/utils/object.d.ts +0 -0
  885. /package/{esm → dist}/types/utils/object.d.ts.map +0 -0
  886. /package/{esm → dist}/types/utils/once.d.ts +0 -0
  887. /package/{esm → dist}/types/utils/once.d.ts.map +0 -0
  888. /package/{esm → dist}/types/utils/sdp.d.ts +0 -0
  889. /package/{esm → dist}/types/utils/sdp.d.ts.map +0 -0
  890. /package/{esm → dist}/types/utils/string.d.ts +0 -0
  891. /package/{esm → dist}/types/utils/string.d.ts.map +0 -0
  892. /package/{esm → dist}/types/utils/update-from.d.ts +0 -0
  893. /package/{esm → dist}/types/utils/update-from.d.ts.map +0 -0
  894. /package/{esm → dist}/types/utils/webrtc.d.ts +0 -0
  895. /package/{esm → dist}/types/utils/webrtc.d.ts.map +0 -0
  896. /package/{esm → dist}/types/web-rtc-client.d.ts +0 -0
  897. /package/{esm → dist}/types/web-rtc-client.d.ts.map +0 -0
  898. /package/{esm → dist}/types/websocket-client.d.ts +0 -0
  899. /package/{esm → dist}/types/websocket-client.d.ts.map +0 -0
@@ -1,942 +0,0 @@
1
- import type { Message } from 'sip.js/lib/api/message';
2
- import sdpParser from 'sdp-transform';
3
- import { SessionDescriptionHandler } from 'sip.js/lib/platform/web';
4
- import type CallSession from '../../domain/CallSession';
5
- import getApiClient from '../../service/getApiClient';
6
- import Emitter from '../../utils/Emitter';
7
- import Wazo from '../index';
8
- import Participant, { RawParticipant } from './Participant';
9
- import RemoteParticipant from './RemoteParticipant';
10
- import IssueReporter from '../../service/IssueReporter';
11
- import LocalParticipant from './LocalParticipant';
12
- import { PeerConnection, WazoSession } from '../../domain/types';
13
-
14
- export const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
15
- export const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
16
- const logger = IssueReporter.loggerFor('sdk-room');
17
-
18
- type ConnectArgs = {
19
- extension: string;
20
- constraints: Record<string, any>;
21
- audioOnly?: boolean;
22
- extra?: Record<string, any>;
23
- room: Room;
24
- meeting: any;
25
- };
26
-
27
- class Room extends Emitter {
28
- callSession?: CallSession;
29
-
30
- name: string;
31
-
32
- extension: string;
33
-
34
- sourceId: number | null | undefined;
35
-
36
- meetingUuid: string | null | undefined;
37
-
38
- participants: Participant[];
39
-
40
- callId: string | null | undefined;
41
-
42
- connected: boolean;
43
-
44
- localParticipant: LocalParticipant | null | undefined;
45
-
46
- _callIdStreamIdMap: Record<string, any>;
47
-
48
- _unassociatedVideoStreams: Record<string, MediaStream>;
49
-
50
- _unassociatedParticipants: Record<string, Participant>;
51
-
52
- _boundOnParticipantJoined: (...args: Array<any>) => any;
53
-
54
- _boundOnParticipantLeft: (...args: Array<any>) => any;
55
-
56
- _boundOnMessage: (...args: Array<any>) => any;
57
-
58
- _boundOnChat: (...args: Array<any>) => any;
59
-
60
- _boundOnSignal: (...args: Array<any>) => any;
61
-
62
- _boundSaveLocalVideoStream: (...args: Array<any>) => any;
63
-
64
- _boundOnReinvite: (...args: Array<any>) => any;
65
-
66
- audioStream: MediaStream | null | undefined;
67
-
68
- extra: Record<string, any>;
69
-
70
- // video tag representing the room audio stream
71
- roomAudioElement: HTMLAudioElement;
72
-
73
- CONFERENCE_USER_PARTICIPANT_JOINED: string;
74
-
75
- CONFERENCE_USER_PARTICIPANT_LEFT: string;
76
-
77
- MEETING_USER_PARTICIPANT_JOINED: string;
78
-
79
- MEETING_USER_PARTICIPANT_LEFT: string;
80
-
81
- ON_SHARE_SCREEN_ENDED: string;
82
-
83
- ON_MESSAGE: string;
84
-
85
- ON_CHAT: string;
86
-
87
- ON_SIGNAL: string;
88
-
89
- ON_AUDIO_STREAM: string;
90
-
91
- ON_VIDEO_STREAM: string;
92
-
93
- ON_REMOVE_STREAM: string;
94
-
95
- ON_DISCONNECTED: string;
96
-
97
- ON_JOINED: string;
98
-
99
- ON_VIDEO_INPUT_CHANGE: string;
100
-
101
- /**
102
- *
103
- * @param callSession CallSession
104
- * @param extension string
105
- * @param sourceId number
106
- * @param callId string
107
- * @param meetingUuid string
108
- * @param extra Object
109
- */
110
- constructor(callSession: CallSession, extension: string, sourceId: number | null | undefined, callId: string | null | undefined, meetingUuid: string | null | undefined, extra: Record<string, any> = {}) {
111
- super();
112
- logger.info('room initialized', {
113
- callId,
114
- extension,
115
- sourceId,
116
- meetingUuid,
117
- });
118
- // Represents the room callSession
119
- this.callSession = callSession;
120
- this.extension = extension;
121
- this.sourceId = sourceId;
122
- this.meetingUuid = meetingUuid;
123
- this.callId = callId;
124
- this.participants = [];
125
- this.connected = false;
126
- this.localParticipant = null;
127
- // [callId]: streamId
128
- this._callIdStreamIdMap = {};
129
- // Stream not yet associated to a participant, [streamId]: stream
130
- this._unassociatedVideoStreams = {};
131
- // Participant not yet associated to a stream, [participant.callId = label in setDescription]: Participant
132
- this._unassociatedParticipants = {};
133
- // The shared audio stream of the room
134
- this.audioStream = null;
135
- // Extra values passed to local participant
136
- this.extra = extra;
137
- // Sugar syntax for `room.EVENT_NAME`
138
- this.CONFERENCE_USER_PARTICIPANT_JOINED = Wazo.Websocket.CONFERENCE_USER_PARTICIPANT_JOINED;
139
- this.CONFERENCE_USER_PARTICIPANT_LEFT = Wazo.Websocket.CONFERENCE_USER_PARTICIPANT_LEFT;
140
- this.MEETING_USER_PARTICIPANT_JOINED = Wazo.Websocket.MEETING_USER_PARTICIPANT_JOINED;
141
- this.MEETING_USER_PARTICIPANT_LEFT = Wazo.Websocket.MEETING_USER_PARTICIPANT_LEFT;
142
- this.ON_SHARE_SCREEN_ENDED = Wazo.Phone.ON_SHARE_SCREEN_ENDED;
143
- this.ON_MESSAGE = Wazo.Phone.ON_MESSAGE;
144
- this.ON_CHAT = Wazo.Phone.ON_CHAT;
145
- this.ON_SIGNAL = Wazo.Phone.ON_SIGNAL;
146
- this.ON_AUDIO_STREAM = Wazo.Phone.ON_AUDIO_STREAM;
147
- this.ON_VIDEO_STREAM = Wazo.Phone.ON_VIDEO_STREAM;
148
- this.ON_REMOVE_STREAM = Wazo.Phone.ON_REMOVE_STREAM;
149
- this.ON_VIDEO_INPUT_CHANGE = Wazo.Phone.ON_VIDEO_INPUT_CHANGE;
150
- this.ON_DISCONNECTED = 'room/ON_DISCONNECTED';
151
- this.ON_JOINED = 'room/ON_JOINED';
152
- this._boundOnParticipantJoined = this._onParticipantJoined.bind(this);
153
- this._boundOnParticipantLeft = this._onParticipantLeft.bind(this);
154
- this._boundOnMessage = this._onMessage.bind(this);
155
- this._boundOnChat = this._onChat.bind(this);
156
- this._boundOnSignal = this._onSignal.bind(this);
157
- this._boundSaveLocalVideoStream = this._saveLocalVideoStream.bind(this);
158
- this._boundOnReinvite = this._onReinvite.bind(this);
159
- this.unbind();
160
-
161
- this._bindEvents();
162
-
163
- this._transferEvents();
164
- }
165
-
166
- /**
167
- *
168
- * @param extension string
169
- * @param constraints string
170
- * @param audioOnly boolean
171
- * @param extra Object
172
- * @param room ?Room
173
- * @param meeting ?Meeting
174
- * @returns {Promise<Room>}
175
- */
176
- static async connect({
177
- extension,
178
- constraints,
179
- audioOnly = false,
180
- extra,
181
- room,
182
- meeting,
183
- }: ConnectArgs) {
184
- logger.info('connecting to room', {
185
- extension,
186
- audioOnly,
187
- room: !!room,
188
- });
189
-
190
- if (!room) {
191
- await Wazo.Phone.connect({
192
- // @ts-ignore: Property 'audio' is missing
193
- media: constraints,
194
- });
195
- const withCamera = constraints && !!constraints.video;
196
-
197
- if (withCamera) {
198
- Wazo.Phone.checkSfu();
199
- }
200
-
201
- // Call_created is triggered before call_accepted, so we have to listen for it here.
202
- Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({
203
- data,
204
- }: { data: Record<string, any> }) => {
205
- logger.info('room call received via WS', {
206
- callId: data.call_id,
207
- });
208
-
209
- if (room) {
210
- room.setCallId(data.call_id);
211
- }
212
- });
213
- const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
214
- // @ts-fix: heads up: added an extra `null` here
215
- // eslint-disable-next-line no-param-reassign
216
- room = new Room(callSession as CallSession, extension, null, null, null, extra);
217
- // Wait for the call to be accepted
218
- await new Promise((resolve, reject) => {
219
- Wazo.Phone.once(Wazo.Phone.ON_CALL_ACCEPTED, resolve);
220
- Wazo.Phone.once(Wazo.Phone.ON_CALL_FAILED, reject);
221
- });
222
- }
223
-
224
- if (room && room.callSession && room.callSession.call) {
225
- room.setCallId(room.callSession.call.id);
226
- }
227
-
228
- if (!meeting) {
229
- // Fetch conference source
230
- const sources = await getApiClient().dird.fetchConferenceSource('default');
231
- // Retrieve conference sources
232
- const contacts = await getApiClient().dird.fetchConferenceContacts(sources.items[0]);
233
- // Retrieve conference
234
- const conference = contacts?.find(contact => contact.numbers?.find(number => String(number.number) === String(extension)));
235
- logger.info('connected to room', {
236
- sourceId: conference ? conference.sourceId : null,
237
- name: conference ? conference.name : null,
238
- });
239
-
240
- if (conference) {
241
- room.setSourceId(parseInt(`${conference.sourceId}`, 10));
242
- room.setName(`${conference.name}`);
243
- }
244
- } else if (meeting) {
245
- logger.info('Already connected to meeting', {
246
- uuid: meeting.uuid,
247
- name: meeting.name,
248
- });
249
- room.setMeetingUuid(meeting.uuid);
250
- room.setName(meeting.name);
251
- }
252
-
253
- return room;
254
- }
255
-
256
- static disconnect() {
257
- logger.info('static disconnection to room');
258
- Wazo.Phone.disconnect();
259
- }
260
-
261
- async disconnect() {
262
- logger.info('disconnection to room called');
263
- await Wazo.Phone.hangup(this.callSession as CallSession);
264
- this.callSession = undefined;
265
- this.eventEmitter.emit(this.ON_DISCONNECTED, this);
266
- this.connected = false;
267
- this.unbind();
268
- Wazo.Phone.off(this.ON_MESSAGE, this._boundOnMessage);
269
- Wazo.Phone.off(this.ON_CHAT, this._boundOnChat);
270
- Wazo.Phone.off(this.ON_SIGNAL, this._boundOnSignal);
271
- Wazo.Phone.off(this.ON_VIDEO_INPUT_CHANGE, this._boundSaveLocalVideoStream);
272
- Wazo.Phone.phone?.off(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
273
- Wazo.Websocket.off(this.CONFERENCE_USER_PARTICIPANT_JOINED, this._boundOnParticipantJoined);
274
- Wazo.Websocket.off(this.CONFERENCE_USER_PARTICIPANT_LEFT, this._boundOnParticipantLeft);
275
- Wazo.Websocket.off(this.MEETING_USER_PARTICIPANT_JOINED, this._boundOnParticipantJoined);
276
- Wazo.Websocket.off(this.MEETING_USER_PARTICIPANT_LEFT, this._boundOnParticipantLeft);
277
- }
278
-
279
- setSourceId(sourceId: number) {
280
- logger.info('set room source id', {
281
- sourceId,
282
- });
283
- this.sourceId = sourceId;
284
- }
285
-
286
- setMeetingUuid(meetingUuid: string) {
287
- logger.info('set meeting uuid', {
288
- meetingUuid,
289
- });
290
- this.meetingUuid = meetingUuid;
291
- }
292
-
293
- setCallId(callId: string) {
294
- logger.info('set room call id', {
295
- callId,
296
- });
297
-
298
- if (callId) {
299
- this.callId = callId;
300
- }
301
- }
302
-
303
- setName(name: string) {
304
- logger.info('set room name', {
305
- name,
306
- });
307
- this.name = name;
308
- }
309
-
310
- // @TODO: change sipSession to callSession
311
- sendMessage(body: string, sipSession: any = null) {
312
- return Wazo.Phone.sendMessage(body, sipSession);
313
- }
314
-
315
- sendChat(content: string) {
316
- return Wazo.Phone.sendChat(content);
317
- }
318
-
319
- sendSignal(content: any) {
320
- return Wazo.Phone.sendSignal(content);
321
- }
322
-
323
- async startScreenSharing(constraints: Record<string, any>) {
324
- logger.info('start room screen sharing', {
325
- constraints,
326
- });
327
- const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession as CallSession);
328
-
329
- if (!screensharingStream) {
330
- console.warn('screensharing stream is null (likely due to user cancellation)');
331
- return null;
332
- }
333
-
334
- this._onScreenSharing();
335
-
336
- return screensharingStream;
337
- }
338
-
339
- async stopScreenSharing(restoreLocalStream = true) {
340
- logger.info('stop room screen sharing');
341
- await Wazo.Phone.stopScreenSharing(this.callSession as CallSession, restoreLocalStream);
342
-
343
- if (this.localParticipant) {
344
- this._updateLocalParticipantStream();
345
-
346
- this.localParticipant.onStopScreensharing();
347
- }
348
- }
349
-
350
- turnCameraOff() {
351
- logger.info('turn room camera off');
352
- Wazo.Phone.turnCameraOff(this.callSession as CallSession);
353
-
354
- if (this.localParticipant) {
355
- this.localParticipant.onVideoMuted();
356
- }
357
- }
358
-
359
- turnCameraOn() {
360
- logger.info('turn room camera on');
361
- Wazo.Phone.turnCameraOn(this.callSession as CallSession);
362
-
363
- if (this.localParticipant) {
364
- this.localParticipant.onVideoUnMuted();
365
- }
366
- }
367
-
368
- mute() {
369
- logger.info('mute room');
370
- Wazo.Phone.mute(this.callSession as CallSession);
371
- this.sendMuteStatus();
372
- }
373
-
374
- unmute() {
375
- logger.info('unmute room');
376
- Wazo.Phone.unmute(this.callSession as CallSession);
377
- this.sendUnMuteStatus();
378
- }
379
-
380
- sendMuteStatus() {
381
- if (this.localParticipant) {
382
- this.localParticipant.onAudioMuted();
383
- }
384
- }
385
-
386
- sendUnMuteStatus() {
387
- if (this.localParticipant) {
388
- this.localParticipant.onAudioUnMuted();
389
- }
390
- }
391
-
392
- hold() {
393
- logger.info('hold room');
394
- Wazo.Phone.hold(this.callSession as CallSession);
395
-
396
- if (this.localParticipant) {
397
- this.localParticipant.onHold();
398
- }
399
- }
400
-
401
- async resume() {
402
- logger.info('resume room');
403
- const newStream = await Wazo.Phone.resume(this.callSession as CallSession);
404
-
405
- if (this.localParticipant) {
406
- // Update local participant stream (useful when resuming a shreenshared conference)
407
- this._updateLocalParticipantStream();
408
-
409
- this.localParticipant.onResume();
410
-
411
- if (!newStream && this.localParticipant.screensharing) {
412
- this.localParticipant.onStopScreensharing();
413
- }
414
- }
415
- }
416
-
417
- _updateLocalParticipantStream() {
418
- const localStream = Wazo.Phone.getLocalStream(this.callSession as CallSession);
419
-
420
- if (this.localParticipant && localStream) {
421
- const localWazoStream = new Wazo.Stream(localStream);
422
- this.localParticipant.resetStreams([localWazoStream]);
423
- }
424
- }
425
-
426
- sendDTMF(tone: string) {
427
- logger.info('send room DTMF', {
428
- tone,
429
- });
430
- Wazo.Phone.sendDTMF(tone, this.callSession as CallSession);
431
- }
432
-
433
- async sendReinvite(newConstraints: Record<string, any> | null = null) {
434
- logger.info('send room reinvite', {
435
- callId: this.callSession ? this.callSession.getId() : null,
436
- newConstraints,
437
- });
438
- const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
439
- Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
440
- if (Wazo.Phone.phone && Wazo.Phone.phone.currentScreenShare) {
441
- this._onScreenSharing();
442
- }
443
- });
444
- const response = await Wazo.Phone.phone?.sendReinvite(this.callSession, newConstraints, true);
445
-
446
- if (this.localParticipant && newConstraints && newConstraints.video) {
447
- const localVideoStream = Wazo.Phone.phone?.getLocalVideoStream(this.callSession as CallSession);
448
-
449
- if (localVideoStream) {
450
- this._associateStreamTo(localVideoStream, this.localParticipant);
451
- }
452
- } else if (this.localParticipant && wasScreensharing && newConstraints && !newConstraints.video) {
453
- // Downgrade from screenshare to audio
454
- this.localParticipant.onStopScreensharing();
455
- }
456
-
457
- return response;
458
- }
459
-
460
- hasALocalVideoTrack() {
461
- return Wazo.Phone.hasALocalVideoTrack(this.callSession as CallSession);
462
- }
463
-
464
- getLocalStream() {
465
- return Wazo.Phone.getLocalStream(this.callSession as CallSession);
466
- }
467
-
468
- getRemoteStream() {
469
- return Wazo.Phone.getRemoteStream(this.callSession as CallSession);
470
- }
471
-
472
- getRemoteVideoStream() {
473
- return Wazo.Phone.getRemoteVideoStream(this.callSession as CallSession);
474
- }
475
-
476
- _bindEvents() {
477
- if (!Wazo.Phone.phone || !Wazo.Phone.phone.currentSipSession) {
478
- return;
479
- }
480
-
481
- // Retrieve mapping
482
- (Wazo.Phone.phone.currentSipSession.sessionDescriptionHandler as SessionDescriptionHandler & { on: (input: string, options?: Record<string, any>) => void })?.on('setDescription', ({
483
- type,
484
- sdp: rawSdp,
485
- }: any) => {
486
- if (type !== 'offer') {
487
- return;
488
- }
489
-
490
- this._mapMsid(rawSdp);
491
- });
492
- // Listen to REINVITE to ba able to map msid after upgrading to video in a audio only conference
493
- // This allow to map msid with the non parsed (eg without the `stripVideo` modifier) SDP
494
- Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
495
- this.on(this.ON_AUDIO_STREAM, async stream => {
496
- logger.info('on room audio stream');
497
- this.audioStream = stream;
498
-
499
- if (!this.roomAudioElement) {
500
- const sessionId = Wazo.Phone.phone?.getSipSessionId(Wazo.Phone.phone?.currentSipSession as WazoSession);
501
- this.roomAudioElement = await Wazo.Phone.phone?.createAudioElementFor(sessionId as string) as HTMLAudioElement;
502
- this.roomAudioElement.srcObject = stream;
503
- } else {
504
- this.roomAudioElement.srcObject = stream;
505
- }
506
- });
507
- this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
508
- logger.info('on room video stream', {
509
- streamId,
510
- });
511
-
512
- this._mapMsid(sipSession.body.body);
513
-
514
- // ON_VIDEO_STREAM is called before PARTICIPANT_JOINED, so we have to keep stream in `_unassociatedVideoStreams`.
515
- this._unassociatedVideoStreams[streamId] = stream;
516
-
517
- const callId = this._getCallIdFromTrackId(streamId);
518
-
519
- const participant = callId ? this._getParticipantFromCallId(callId) : null;
520
-
521
- if (participant) {
522
- this.__associateStreams(participant);
523
- }
524
- });
525
- this.on(this.ON_REMOVE_STREAM, stream => {
526
- logger.info('on room remove stream');
527
- const participant = this.participants.find(someParticipant => someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
528
-
529
- if (!participant) {
530
- return;
531
- }
532
-
533
- participant.videoStreams = participant.videoStreams.filter(someStream => someStream.id !== stream.id);
534
- participant.streams = participant.streams.filter(someStream => someStream.id !== stream.id);
535
- participant.onStreamUnSubscribed(stream);
536
- });
537
- }
538
-
539
- _onScreenSharing() {
540
- if (this.localParticipant) {
541
- this.localParticipant.onScreensharing();
542
- }
543
- }
544
-
545
- _onReinvite(session: any, inviteRequest: any) {
546
- const body = inviteRequest.body || inviteRequest.message.body;
547
-
548
- if (body) {
549
- this._mapMsid(body);
550
-
551
- // Re-associate video streams
552
- this.participants.forEach(participant => {
553
- this.__associateStreams(participant);
554
- });
555
- }
556
- }
557
-
558
- _mapMsid(rawSdp: string) {
559
- const sdp = sdpParser.parse(rawSdp);
560
- // @ts-ignore: Property 'label' does not exist
561
- const labelMsidArray = sdp.media.filter((media) => !!media.label).map(({ label, msid }) => ({
562
- label: String(label),
563
- streamId: msid?.split(' ')[0],
564
- trackId: msid?.split(' ')[1],
565
- }));
566
- labelMsidArray.forEach(({
567
- label,
568
- streamId,
569
- trackId,
570
- }) => {
571
- this._callIdStreamIdMap[String(label)] = {
572
- streamId,
573
- trackId,
574
- };
575
- const callId = String(label);
576
-
577
- const participant = this._unassociatedParticipants[callId] || this._getParticipantFromCallId(callId);
578
-
579
- if (participant) {
580
- this.__associateStreams(participant);
581
- }
582
- });
583
- }
584
-
585
- _transferEvents() {
586
- Wazo.Websocket.on(this.CONFERENCE_USER_PARTICIPANT_JOINED, this._boundOnParticipantJoined);
587
- Wazo.Websocket.on(this.CONFERENCE_USER_PARTICIPANT_LEFT, this._boundOnParticipantLeft);
588
- Wazo.Websocket.on(this.MEETING_USER_PARTICIPANT_JOINED, this._boundOnParticipantJoined);
589
- Wazo.Websocket.on(this.MEETING_USER_PARTICIPANT_LEFT, this._boundOnParticipantLeft);
590
- // Phone events
591
- Wazo.Phone.on(this.ON_MESSAGE, this._boundOnMessage);
592
- Wazo.Phone.on(this.ON_CHAT, this._boundOnChat);
593
- Wazo.Phone.on(this.ON_SIGNAL, this._boundOnSignal);
594
- Wazo.Phone.on(this.ON_VIDEO_INPUT_CHANGE, this._boundSaveLocalVideoStream);
595
- [this.ON_AUDIO_STREAM, this.ON_VIDEO_STREAM, this.ON_REMOVE_STREAM].forEach(event => Wazo.Phone.on(event, (...args: any[]) => this.eventEmitter.emit.apply(this.eventEmitter, [event, ...args])));
596
- }
597
-
598
- _onMessage(message: Message & { method?: string, body?: string }): Record<string, any> | null | undefined {
599
- if (message.method !== 'MESSAGE') {
600
- return null;
601
- }
602
-
603
- let body;
604
-
605
- try {
606
- body = JSON.parse(message.body as string);
607
- } catch (e) {
608
- return null;
609
- }
610
-
611
- switch (body.type) {
612
- case 'ConfbridgeTalking':
613
- {
614
- // Update participant
615
- const channel = body.channels[0];
616
- const {
617
- id: callId,
618
- talking_status: talkingStatus,
619
- } = channel;
620
- const isTalking = talkingStatus === 'on';
621
- const participantIdx = this.participants.findIndex(participant => participant.callId === callId);
622
-
623
- if (participantIdx === -1) {
624
- return;
625
- }
626
-
627
- this.participants[participantIdx].onTalking(isTalking);
628
- break;
629
- }
630
-
631
- default:
632
- }
633
-
634
- this.eventEmitter.emit(this.ON_MESSAGE, body);
635
- return body;
636
- }
637
-
638
- _onChat(content: Record<string, any>) {
639
- this.eventEmitter.emit(this.ON_CHAT, content);
640
- }
641
-
642
- _onSignal(content: Record<string, any>) {
643
- const {
644
- type,
645
- } = content;
646
-
647
- switch (type) {
648
- // we're receiving a external update
649
- case SIGNAL_TYPE_PARTICIPANT_UPDATE:
650
- {
651
- const {
652
- status,
653
- } = content;
654
-
655
- const participant: Participant | null | undefined = this._getParticipantFromCallId(status.callId);
656
-
657
- if (participant) {
658
- // we're receiving, so no need to broadcast
659
- participant.updateStatus(status, false);
660
- }
661
-
662
- break;
663
- }
664
-
665
- // this is a request to broadcast our current status
666
- case SIGNAL_TYPE_PARTICIPANT_REQUEST:
667
- {
668
- const {
669
- callId,
670
- origin,
671
- } = content;
672
-
673
- // callId is null, someone's requesting everyone's state;
674
- // or callId is set and matches ours;
675
- if (this.localParticipant && (!callId || callId === this.localParticipant.callId)) {
676
- this.localParticipant.broadcastStatus(null, true);
677
- }
678
-
679
- // might as well update the requester's status
680
- const requester: Participant | null | undefined = this._getParticipantFromCallId(origin.callId);
681
-
682
- if (requester) {
683
- // @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
684
- logger.info('trigger room requester status', {
685
- origin,
686
- });
687
- requester.triggerUpdate('REQUESTER_UPDATE');
688
- }
689
-
690
- break;
691
- }
692
-
693
- case Wazo.Phone.ON_MESSAGE_TRACK_UPDATED:
694
- {
695
- const {
696
- callId,
697
- update,
698
- } = content;
699
- const participantIdx = this.participants.findIndex(p => p.callId === callId);
700
-
701
- if (participantIdx !== -1) {
702
- this.participants[participantIdx] = this._onParticipantTrackUpdate(this.participants[participantIdx], update);
703
- }
704
-
705
- break;
706
- }
707
-
708
- default:
709
- {
710
- console.warn('uncaught signal', content);
711
- }
712
- }
713
-
714
- this.eventEmitter.emit(Wazo.Phone.ON_SIGNAL, content);
715
- }
716
-
717
- async _onParticipantJoined(payload: Record<string, any>) {
718
- const participant = payload.data;
719
- const session = Wazo.Auth.getSession();
720
- let participants: Participant[] = [];
721
-
722
- // When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
723
- if (participant.user_uuid === session?.uuid) {
724
- logger.info('room current user joined');
725
- // Retrieve participants via an API calls
726
- const conferenceId = this.sourceId || payload.data.conference_id;
727
- let response;
728
-
729
- try {
730
- if (this.meetingUuid) {
731
- logger.info('fetching meeting participants', {
732
- meetingUuid: this.meetingUuid,
733
- });
734
- response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
735
- } else {
736
- logger.info('fetching conference participants', {
737
- conferenceId,
738
- });
739
- response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
740
- }
741
- } catch (e) {
742
- logger.error('room participants fetching, error', e);
743
- }
744
-
745
- if (response) {
746
- logger.info('conference participants fetched', {
747
- nb: response.items.length,
748
- });
749
- participants = response.items.map((item: RawParticipant) => {
750
- const isMe = item.call_id === this.callId;
751
- return isMe && item.call_id ? new Wazo.LocalParticipant(this, item, this.extra) : new Wazo.RemoteParticipant(this, item);
752
- });
753
- this.participants = participants;
754
- const localParticipant = participants.find((someParticipant: Participant) => someParticipant instanceof Wazo.LocalParticipant);
755
-
756
- if (!this.localParticipant && localParticipant) {
757
- this._onLocalParticipantJoined(localParticipant);
758
- }
759
-
760
- participants.forEach((someParticipant: Participant) => this._isParticipantJoining(someParticipant));
761
- this.eventEmitter.emit(this.ON_JOINED, localParticipant, participants);
762
- }
763
-
764
- return this.participants;
765
- }
766
-
767
- const remoteParticipant: RemoteParticipant | null | undefined = !this.participants.some(p => p.callId === participant.call_id) ? new Wazo.RemoteParticipant(this, participant) : null;
768
- logger.info('other room user joined', {
769
- callId: participant.call_id,
770
- remoteParticipant: !!remoteParticipant,
771
- });
772
-
773
- if (remoteParticipant) {
774
- this.participants.push(remoteParticipant);
775
-
776
- this._isParticipantJoining(remoteParticipant);
777
- }
778
-
779
- return remoteParticipant;
780
- }
781
-
782
- _onLocalParticipantJoined(localParticipant: LocalParticipant) {
783
- this.localParticipant = localParticipant;
784
-
785
- const localVideoStream = this._getLocalVideoStream();
786
-
787
- if (localVideoStream) {
788
- this._saveLocalVideoStream(localVideoStream);
789
- }
790
-
791
- this.connected = true;
792
- localParticipant.broadcastStatus(null, true);
793
-
794
- // we're in the room, now let's request everyone's status
795
- if (this.localParticipant) {
796
- this.sendSignal({
797
- type: SIGNAL_TYPE_PARTICIPANT_REQUEST,
798
- origin: this.localParticipant.getStatus(),
799
- });
800
- }
801
- }
802
-
803
- _isParticipantJoining(participant: Participant) {
804
- this.__associateStreams(participant);
805
-
806
- // @VALIDATE: no need to publicize ourselves, no?
807
- if (participant instanceof RemoteParticipant) {
808
- this.eventEmitter.emit(this.CONFERENCE_USER_PARTICIPANT_JOINED, participant);
809
- }
810
- }
811
-
812
- _saveLocalVideoStream(stream: MediaStream) {
813
- const {
814
- localParticipant,
815
- } = this;
816
-
817
- if (!localParticipant) {
818
- return;
819
- }
820
-
821
- const videoStream = new Wazo.Stream(stream, localParticipant);
822
-
823
- if (videoStream) {
824
- localParticipant.resetStreams([videoStream]);
825
- localParticipant.onStreamSubscribed(videoStream);
826
- }
827
-
828
- return videoStream;
829
- }
830
-
831
- _onParticipantLeft(payload: Record<string, any>) {
832
- const leftParticipant = this.participants.find(participant => participant && participant.callId === payload.data.call_id);
833
-
834
- // Trigger Participant.ON_DISCONNECT event
835
- if (leftParticipant) {
836
- leftParticipant.onDisconnect();
837
- }
838
-
839
- this.participants = this.participants.filter(participant => participant && participant.callId !== payload.data.call_id);
840
- this.eventEmitter.emit(this.CONFERENCE_USER_PARTICIPANT_LEFT, leftParticipant);
841
- }
842
-
843
- _onParticipantTrackUpdate(oldParticipant: Participant, update: string): Participant {
844
- const newParticipant = oldParticipant;
845
- const {
846
- trackId,
847
- streamId,
848
- } = this._callIdStreamIdMap[newParticipant.callId] || {};
849
-
850
- const pc = (Wazo.Phone.phone?.currentSipSession?.sessionDescriptionHandler as SessionDescriptionHandler)?.peerConnection as PeerConnection;
851
- // Can't use `getReceivers` here because on FF we make the mapping based on the streamId
852
- const stream = pc.getRemoteStreams().find(someStream => someStream.id === streamId || someStream.getTracks().some(track => track.id === trackId));
853
-
854
- if (update === 'downgrade') {
855
- newParticipant.resetStreams([]);
856
- newParticipant.onStreamUnSubscribed(stream);
857
- return newParticipant;
858
- }
859
-
860
- // Upgrade
861
- if (stream) {
862
- this._associateStreamTo(stream, newParticipant);
863
- }
864
-
865
- return newParticipant;
866
- }
867
-
868
- // Associate audio/video streams to the participant and triggers events on it
869
- __associateStreams(participant: Participant) {
870
- const {
871
- trackId,
872
- } = this._callIdStreamIdMap[participant.callId] || {};
873
-
874
- if (!trackId) {
875
- this._unassociatedParticipants[participant.callId] = participant;
876
- return;
877
- }
878
-
879
- if (!trackId || !participant || !this.localParticipant || participant.callId === this.localParticipant.callId) {
880
- return;
881
- }
882
-
883
- const streamId = this._getStreamIdFrTrackId(trackId);
884
-
885
- const key = this._getUnassociatedMapIdFromTrackIdOrStreamId(trackId, streamId);
886
-
887
- const stream = key ? this._unassociatedVideoStreams[key] : null;
888
-
889
- if (stream) {
890
- // Try to associate stream
891
- this._associateStreamTo(stream, participant);
892
-
893
- if (key) {
894
- delete this._unassociatedVideoStreams[key];
895
- }
896
- delete this._unassociatedParticipants[participant.callId];
897
- }
898
- }
899
-
900
- _getUnassociatedMapIdFromTrackIdOrStreamId(trackId: string, streamId: string | null | undefined) {
901
- // Find by trackId
902
- if (trackId in this._unassociatedVideoStreams) {
903
- return trackId;
904
- }
905
-
906
- // Find by streamId
907
- if (streamId && streamId in this._unassociatedVideoStreams) {
908
- return streamId;
909
- }
910
-
911
- // Find in all the streams by streamId (used on FF where we can't map by trackId)
912
- const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream: Record<string, any>) => stream && stream.id === streamId);
913
- return idx === -1 ? null : Object.keys(this._unassociatedVideoStreams)[idx];
914
- }
915
-
916
- _getStreamIdFrTrackId(trackId: string) {
917
- const mapping: Record<string, any> = Object.values(this._callIdStreamIdMap).find((map: Record<string, any>) => map.trackId === trackId);
918
- return mapping ? mapping.streamId : null;
919
- }
920
-
921
- _associateStreamTo(rawStream: MediaStream, participant: Participant) {
922
- const stream = new Wazo.Stream(rawStream, participant);
923
- participant.streams.push(stream);
924
- participant.videoStreams.push(stream);
925
- participant.onStreamSubscribed(stream);
926
- }
927
-
928
- _getCallIdFromTrackId(trackId: string) {
929
- return Object.keys(this._callIdStreamIdMap).find(key => this._callIdStreamIdMap[key].trackId === trackId);
930
- }
931
-
932
- _getParticipantFromCallId(callId: string) {
933
- return this.participants.find(participant => participant.callId === callId);
934
- }
935
-
936
- _getLocalVideoStream() {
937
- return Wazo.Phone.getLocalVideoStream(this.callSession as CallSession);
938
- }
939
-
940
- }
941
-
942
- export default Room;