ue-softphone-sdk 4.0.0 → 4.0.1

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 (394) hide show
  1. package/dist/lib/ue-soft-phone.min.js +1 -1
  2. package/dist/ue-softphone-sdk.js +1 -1
  3. package/package.json +4 -1
  4. package/.babelrc +0 -12
  5. package/.gitlab-ci.yml +0 -3
  6. package/Dockerfile +0 -17
  7. package/dist/lib/types/lib/sip.js/api/ack.d.ts +0 -12
  8. package/dist/lib/types/lib/sip.js/api/bye.d.ts +0 -16
  9. package/dist/lib/types/lib/sip.js/api/dtmf.d.ts +0 -15
  10. package/dist/lib/types/lib/sip.js/api/emitter.d.ts +0 -88
  11. package/dist/lib/types/lib/sip.js/api/exceptions/content-type-unsupported.d.ts +0 -8
  12. package/dist/lib/types/lib/sip.js/api/exceptions/index.d.ts +0 -5
  13. package/dist/lib/types/lib/sip.js/api/exceptions/request-pending.d.ts +0 -9
  14. package/dist/lib/types/lib/sip.js/api/exceptions/session-description-handler.d.ts +0 -8
  15. package/dist/lib/types/lib/sip.js/api/exceptions/session-terminated.d.ts +0 -8
  16. package/dist/lib/types/lib/sip.js/api/exceptions/state-transition.d.ts +0 -8
  17. package/dist/lib/types/lib/sip.js/api/index.d.ts +0 -59
  18. package/dist/lib/types/lib/sip.js/api/info.d.ts +0 -16
  19. package/dist/lib/types/lib/sip.js/api/invitation-accept-options.d.ts +0 -19
  20. package/dist/lib/types/lib/sip.js/api/invitation-progress-options.d.ts +0 -38
  21. package/dist/lib/types/lib/sip.js/api/invitation-reject-options.d.ts +0 -25
  22. package/dist/lib/types/lib/sip.js/api/invitation.d.ts +0 -179
  23. package/dist/lib/types/lib/sip.js/api/inviter-cancel-options.d.ts +0 -9
  24. package/dist/lib/types/lib/sip.js/api/inviter-invite-options.d.ts +0 -28
  25. package/dist/lib/types/lib/sip.js/api/inviter-options.d.ts +0 -43
  26. package/dist/lib/types/lib/sip.js/api/inviter.d.ts +0 -236
  27. package/dist/lib/types/lib/sip.js/api/message.d.ts +0 -16
  28. package/dist/lib/types/lib/sip.js/api/messager-message-options.d.ts +0 -11
  29. package/dist/lib/types/lib/sip.js/api/messager-options.d.ts +0 -17
  30. package/dist/lib/types/lib/sip.js/api/messager.d.ts +0 -26
  31. package/dist/lib/types/lib/sip.js/api/notification.d.ts +0 -16
  32. package/dist/lib/types/lib/sip.js/api/notifier.d.ts +0 -8
  33. package/dist/lib/types/lib/sip.js/api/publisher-options.d.ts +0 -33
  34. package/dist/lib/types/lib/sip.js/api/publisher-publish-options.d.ts +0 -6
  35. package/dist/lib/types/lib/sip.js/api/publisher-state.d.ts +0 -21
  36. package/dist/lib/types/lib/sip.js/api/publisher-unpublish-options.d.ts +0 -6
  37. package/dist/lib/types/lib/sip.js/api/publisher.d.ts +0 -65
  38. package/dist/lib/types/lib/sip.js/api/referral.d.ts +0 -38
  39. package/dist/lib/types/lib/sip.js/api/registerer-options.d.ts +0 -46
  40. package/dist/lib/types/lib/sip.js/api/registerer-register-options.d.ts +0 -11
  41. package/dist/lib/types/lib/sip.js/api/registerer-state.d.ts +0 -21
  42. package/dist/lib/types/lib/sip.js/api/registerer-unregister-options.d.ts +0 -16
  43. package/dist/lib/types/lib/sip.js/api/registerer.d.ts +0 -144
  44. package/dist/lib/types/lib/sip.js/api/session-bye-options.d.ts +0 -11
  45. package/dist/lib/types/lib/sip.js/api/session-delegate.d.ts +0 -79
  46. package/dist/lib/types/lib/sip.js/api/session-description-handler-factory.d.ts +0 -15
  47. package/dist/lib/types/lib/sip.js/api/session-description-handler.d.ts +0 -74
  48. package/dist/lib/types/lib/sip.js/api/session-info-options.d.ts +0 -11
  49. package/dist/lib/types/lib/sip.js/api/session-invite-options.d.ts +0 -28
  50. package/dist/lib/types/lib/sip.js/api/session-message-options.d.ts +0 -11
  51. package/dist/lib/types/lib/sip.js/api/session-options.d.ts +0 -8
  52. package/dist/lib/types/lib/sip.js/api/session-refer-options.d.ts +0 -14
  53. package/dist/lib/types/lib/sip.js/api/session-state.d.ts +0 -45
  54. package/dist/lib/types/lib/sip.js/api/session.d.ts +0 -359
  55. package/dist/lib/types/lib/sip.js/api/subscriber-options.d.ts +0 -11
  56. package/dist/lib/types/lib/sip.js/api/subscriber-subscribe-options.d.ts +0 -6
  57. package/dist/lib/types/lib/sip.js/api/subscriber.d.ts +0 -94
  58. package/dist/lib/types/lib/sip.js/api/subscription-delegate.d.ts +0 -12
  59. package/dist/lib/types/lib/sip.js/api/subscription-options.d.ts +0 -8
  60. package/dist/lib/types/lib/sip.js/api/subscription-state.d.ts +0 -19
  61. package/dist/lib/types/lib/sip.js/api/subscription-subscribe-options.d.ts +0 -6
  62. package/dist/lib/types/lib/sip.js/api/subscription-unsubscribe-options.d.ts +0 -6
  63. package/dist/lib/types/lib/sip.js/api/subscription.d.ts +0 -84
  64. package/dist/lib/types/lib/sip.js/api/transport-state.d.ts +0 -37
  65. package/dist/lib/types/lib/sip.js/api/transport.d.ts +0 -159
  66. package/dist/lib/types/lib/sip.js/api/user-agent-delegate.d.ts +0 -84
  67. package/dist/lib/types/lib/sip.js/api/user-agent-options.d.ts +0 -253
  68. package/dist/lib/types/lib/sip.js/api/user-agent-state.d.ts +0 -14
  69. package/dist/lib/types/lib/sip.js/api/user-agent.d.ts +0 -200
  70. package/dist/lib/types/lib/sip.js/core/dialogs/dialog-state.d.ts +0 -34
  71. package/dist/lib/types/lib/sip.js/core/dialogs/dialog.d.ts +0 -161
  72. package/dist/lib/types/lib/sip.js/core/dialogs/index.d.ts +0 -4
  73. package/dist/lib/types/lib/sip.js/core/dialogs/session-dialog.d.ts +0 -196
  74. package/dist/lib/types/lib/sip.js/core/dialogs/subscription-dialog.d.ts +0 -120
  75. package/dist/lib/types/lib/sip.js/core/exceptions/exception.d.ts +0 -8
  76. package/dist/lib/types/lib/sip.js/core/exceptions/index.d.ts +0 -3
  77. package/dist/lib/types/lib/sip.js/core/exceptions/transaction-state-error.d.ts +0 -8
  78. package/dist/lib/types/lib/sip.js/core/exceptions/transport-error.d.ts +0 -8
  79. package/dist/lib/types/lib/sip.js/core/index.d.ts +0 -15
  80. package/dist/lib/types/lib/sip.js/core/log/index.d.ts +0 -3
  81. package/dist/lib/types/lib/sip.js/core/log/levels.d.ts +0 -10
  82. package/dist/lib/types/lib/sip.js/core/log/logger-factory.d.ts +0 -21
  83. package/dist/lib/types/lib/sip.js/core/log/logger.d.ts +0 -19
  84. package/dist/lib/types/lib/sip.js/core/messages/body.d.ts +0 -64
  85. package/dist/lib/types/lib/sip.js/core/messages/digest-authentication.d.ts +0 -51
  86. package/dist/lib/types/lib/sip.js/core/messages/incoming-message.d.ts +0 -79
  87. package/dist/lib/types/lib/sip.js/core/messages/incoming-request-message.d.ts +0 -10
  88. package/dist/lib/types/lib/sip.js/core/messages/incoming-request.d.ts +0 -67
  89. package/dist/lib/types/lib/sip.js/core/messages/incoming-response-message.d.ts +0 -10
  90. package/dist/lib/types/lib/sip.js/core/messages/incoming-response.d.ts +0 -12
  91. package/dist/lib/types/lib/sip.js/core/messages/index.d.ts +0 -13
  92. package/dist/lib/types/lib/sip.js/core/messages/md5.d.ts +0 -32
  93. package/dist/lib/types/lib/sip.js/core/messages/methods/ack.d.ts +0 -18
  94. package/dist/lib/types/lib/sip.js/core/messages/methods/bye.d.ts +0 -21
  95. package/dist/lib/types/lib/sip.js/core/messages/methods/cancel.d.ts +0 -21
  96. package/dist/lib/types/lib/sip.js/core/messages/methods/constants.d.ts +0 -20
  97. package/dist/lib/types/lib/sip.js/core/messages/methods/index.d.ts +0 -13
  98. package/dist/lib/types/lib/sip.js/core/messages/methods/info.d.ts +0 -21
  99. package/dist/lib/types/lib/sip.js/core/messages/methods/invite.d.ts +0 -86
  100. package/dist/lib/types/lib/sip.js/core/messages/methods/message.d.ts +0 -21
  101. package/dist/lib/types/lib/sip.js/core/messages/methods/notify.d.ts +0 -21
  102. package/dist/lib/types/lib/sip.js/core/messages/methods/prack.d.ts +0 -21
  103. package/dist/lib/types/lib/sip.js/core/messages/methods/publish.d.ts +0 -21
  104. package/dist/lib/types/lib/sip.js/core/messages/methods/refer.d.ts +0 -21
  105. package/dist/lib/types/lib/sip.js/core/messages/methods/register.d.ts +0 -21
  106. package/dist/lib/types/lib/sip.js/core/messages/methods/subscribe.d.ts +0 -54
  107. package/dist/lib/types/lib/sip.js/core/messages/outgoing-request-message.d.ts +0 -94
  108. package/dist/lib/types/lib/sip.js/core/messages/outgoing-request.d.ts +0 -67
  109. package/dist/lib/types/lib/sip.js/core/messages/outgoing-response.d.ts +0 -42
  110. package/dist/lib/types/lib/sip.js/core/messages/parser.d.ts +0 -14
  111. package/dist/lib/types/lib/sip.js/core/messages/utils.d.ts +0 -24
  112. package/dist/lib/types/lib/sip.js/core/session/index.d.ts +0 -2
  113. package/dist/lib/types/lib/sip.js/core/session/session-delegate.d.ts +0 -70
  114. package/dist/lib/types/lib/sip.js/core/session/session.d.ts +0 -134
  115. package/dist/lib/types/lib/sip.js/core/subscription/index.d.ts +0 -2
  116. package/dist/lib/types/lib/sip.js/core/subscription/subscription-delegate.d.ts +0 -27
  117. package/dist/lib/types/lib/sip.js/core/subscription/subscription.d.ts +0 -55
  118. package/dist/lib/types/lib/sip.js/core/timers.d.ts +0 -20
  119. package/dist/lib/types/lib/sip.js/core/transactions/client-transaction.d.ts +0 -45
  120. package/dist/lib/types/lib/sip.js/core/transactions/index.d.ts +0 -10
  121. package/dist/lib/types/lib/sip.js/core/transactions/invite-client-transaction.d.ts +0 -116
  122. package/dist/lib/types/lib/sip.js/core/transactions/invite-server-transaction.d.ts +0 -127
  123. package/dist/lib/types/lib/sip.js/core/transactions/non-invite-client-transaction.d.ts +0 -69
  124. package/dist/lib/types/lib/sip.js/core/transactions/non-invite-server-transaction.d.ts +0 -57
  125. package/dist/lib/types/lib/sip.js/core/transactions/server-transaction.d.ts +0 -35
  126. package/dist/lib/types/lib/sip.js/core/transactions/transaction-state.d.ts +0 -13
  127. package/dist/lib/types/lib/sip.js/core/transactions/transaction-user.d.ts +0 -72
  128. package/dist/lib/types/lib/sip.js/core/transactions/transaction.d.ts +0 -79
  129. package/dist/lib/types/lib/sip.js/core/transport.d.ts +0 -31
  130. package/dist/lib/types/lib/sip.js/core/user-agent-core/allowed-methods.d.ts +0 -4
  131. package/dist/lib/types/lib/sip.js/core/user-agent-core/index.d.ts +0 -3
  132. package/dist/lib/types/lib/sip.js/core/user-agent-core/user-agent-core-configuration.d.ts +0 -99
  133. package/dist/lib/types/lib/sip.js/core/user-agent-core/user-agent-core-delegate.d.ts +0 -37
  134. package/dist/lib/types/lib/sip.js/core/user-agent-core/user-agent-core.d.ts +0 -179
  135. package/dist/lib/types/lib/sip.js/core/user-agents/bye-user-agent-client.d.ts +0 -10
  136. package/dist/lib/types/lib/sip.js/core/user-agents/bye-user-agent-server.d.ts +0 -10
  137. package/dist/lib/types/lib/sip.js/core/user-agents/cancel-user-agent-client.d.ts +0 -10
  138. package/dist/lib/types/lib/sip.js/core/user-agents/index.d.ts +0 -26
  139. package/dist/lib/types/lib/sip.js/core/user-agents/info-user-agent-client.d.ts +0 -10
  140. package/dist/lib/types/lib/sip.js/core/user-agents/info-user-agent-server.d.ts +0 -10
  141. package/dist/lib/types/lib/sip.js/core/user-agents/invite-user-agent-client.d.ts +0 -35
  142. package/dist/lib/types/lib/sip.js/core/user-agents/invite-user-agent-server.d.ts +0 -77
  143. package/dist/lib/types/lib/sip.js/core/user-agents/message-user-agent-client.d.ts +0 -10
  144. package/dist/lib/types/lib/sip.js/core/user-agents/message-user-agent-server.d.ts +0 -10
  145. package/dist/lib/types/lib/sip.js/core/user-agents/notify-user-agent-client.d.ts +0 -10
  146. package/dist/lib/types/lib/sip.js/core/user-agents/notify-user-agent-server.d.ts +0 -16
  147. package/dist/lib/types/lib/sip.js/core/user-agents/prack-user-agent-client.d.ts +0 -10
  148. package/dist/lib/types/lib/sip.js/core/user-agents/prack-user-agent-server.d.ts +0 -16
  149. package/dist/lib/types/lib/sip.js/core/user-agents/publish-user-agent-client.d.ts +0 -10
  150. package/dist/lib/types/lib/sip.js/core/user-agents/re-invite-user-agent-client.d.ts +0 -18
  151. package/dist/lib/types/lib/sip.js/core/user-agents/re-invite-user-agent-server.d.ts +0 -41
  152. package/dist/lib/types/lib/sip.js/core/user-agents/re-subscribe-user-agent-client.d.ts +0 -17
  153. package/dist/lib/types/lib/sip.js/core/user-agents/re-subscribe-user-agent-server.d.ts +0 -10
  154. package/dist/lib/types/lib/sip.js/core/user-agents/refer-user-agent-client.d.ts +0 -10
  155. package/dist/lib/types/lib/sip.js/core/user-agents/refer-user-agent-server.d.ts +0 -16
  156. package/dist/lib/types/lib/sip.js/core/user-agents/register-user-agent-client.d.ts +0 -10
  157. package/dist/lib/types/lib/sip.js/core/user-agents/register-user-agent-server.d.ts +0 -11
  158. package/dist/lib/types/lib/sip.js/core/user-agents/subscribe-user-agent-client.d.ts +0 -65
  159. package/dist/lib/types/lib/sip.js/core/user-agents/subscribe-user-agent-server.d.ts +0 -11
  160. package/dist/lib/types/lib/sip.js/core/user-agents/user-agent-client.d.ts +0 -103
  161. package/dist/lib/types/lib/sip.js/core/user-agents/user-agent-server.d.ts +0 -79
  162. package/dist/lib/types/lib/sip.js/grammar/grammar.d.ts +0 -26
  163. package/dist/lib/types/lib/sip.js/grammar/index.d.ts +0 -4
  164. package/dist/lib/types/lib/sip.js/grammar/name-addr-header.d.ts +0 -24
  165. package/dist/lib/types/lib/sip.js/grammar/parameters.d.ts +0 -16
  166. package/dist/lib/types/lib/sip.js/grammar/pegjs/dist/grammar.d.ts +0 -50
  167. package/dist/lib/types/lib/sip.js/grammar/uri.d.ts +0 -62
  168. package/dist/lib/types/lib/sip.js/index.d.ts +0 -9
  169. package/dist/lib/types/lib/sip.js/platform/web/index.d.ts +0 -4
  170. package/dist/lib/types/lib/sip.js/platform/web/modifiers/index.d.ts +0 -5
  171. package/dist/lib/types/lib/sip.js/platform/web/modifiers/modifiers.d.ts +0 -41
  172. package/dist/lib/types/lib/sip.js/platform/web/session-description-handler/index.d.ts +0 -14
  173. package/dist/lib/types/lib/sip.js/platform/web/session-description-handler/media-stream-factory-default.d.ts +0 -6
  174. package/dist/lib/types/lib/sip.js/platform/web/session-description-handler/media-stream-factory.d.ts +0 -6
  175. package/dist/lib/types/lib/sip.js/platform/web/session-description-handler/peer-connection-configuration-default.d.ts +0 -5
  176. package/dist/lib/types/lib/sip.js/platform/web/session-description-handler/peer-connection-delegate.d.ts +0 -63
  177. package/dist/lib/types/lib/sip.js/platform/web/session-description-handler/session-description-handler-configuration.d.ts +0 -16
  178. package/dist/lib/types/lib/sip.js/platform/web/session-description-handler/session-description-handler-factory-default.d.ts +0 -11
  179. package/dist/lib/types/lib/sip.js/platform/web/session-description-handler/session-description-handler-factory-options.d.ts +0 -9
  180. package/dist/lib/types/lib/sip.js/platform/web/session-description-handler/session-description-handler-factory.d.ts +0 -16
  181. package/dist/lib/types/lib/sip.js/platform/web/session-description-handler/session-description-handler-options.d.ts +0 -47
  182. package/dist/lib/types/lib/sip.js/platform/web/session-description-handler/session-description-handler.d.ts +0 -212
  183. package/dist/lib/types/lib/sip.js/platform/web/simple-user/index.d.ts +0 -7
  184. package/dist/lib/types/lib/sip.js/platform/web/simple-user/simple-user-delegate.d.ts +0 -72
  185. package/dist/lib/types/lib/sip.js/platform/web/simple-user/simple-user-options.d.ts +0 -90
  186. package/dist/lib/types/lib/sip.js/platform/web/simple-user/simple-user.d.ts +0 -226
  187. package/dist/lib/types/lib/sip.js/platform/web/transport/index.d.ts +0 -6
  188. package/dist/lib/types/lib/sip.js/platform/web/transport/transport-options.d.ts +0 -30
  189. package/dist/lib/types/lib/sip.js/platform/web/transport/transport.d.ts +0 -125
  190. package/dist/lib/types/lib/sip.js/version.d.ts +0 -1
  191. package/dist/lib/types/webrtc/webrtc-method.d.ts +0 -2
  192. package/dist/lib/types/webrtc/webrtc.d.ts +0 -38
  193. package/index.html/index.html +0 -118
  194. package/nginx.conf +0 -56
  195. package/rollup-new.config.mjs +0 -20
  196. package/rollup.config.js +0 -45
  197. package/src/config.ts +0 -19
  198. package/src/index.ts +0 -2473
  199. package/src/lib/sip.js/api/ack.ts +0 -15
  200. package/src/lib/sip.js/api/api-extractor.json +0 -350
  201. package/src/lib/sip.js/api/bye.ts +0 -27
  202. package/src/lib/sip.js/api/dtmf.ts +0 -27
  203. package/src/lib/sip.js/api/emitter.ts +0 -110
  204. package/src/lib/sip.js/api/exceptions/content-type-unsupported.ts +0 -11
  205. package/src/lib/sip.js/api/exceptions/index.ts +0 -5
  206. package/src/lib/sip.js/api/exceptions/request-pending.ts +0 -12
  207. package/src/lib/sip.js/api/exceptions/session-description-handler.ts +0 -11
  208. package/src/lib/sip.js/api/exceptions/session-terminated.ts +0 -11
  209. package/src/lib/sip.js/api/exceptions/state-transition.ts +0 -11
  210. package/src/lib/sip.js/api/index.ts +0 -59
  211. package/src/lib/sip.js/api/info.ts +0 -27
  212. package/src/lib/sip.js/api/invitation-accept-options.ts +0 -20
  213. package/src/lib/sip.js/api/invitation-progress-options.ts +0 -36
  214. package/src/lib/sip.js/api/invitation-reject-options.ts +0 -22
  215. package/src/lib/sip.js/api/invitation.ts +0 -815
  216. package/src/lib/sip.js/api/inviter-cancel-options.ts +0 -9
  217. package/src/lib/sip.js/api/inviter-invite-options.ts +0 -29
  218. package/src/lib/sip.js/api/inviter-options.ts +0 -44
  219. package/src/lib/sip.js/api/inviter.ts +0 -1126
  220. package/src/lib/sip.js/api/message.ts +0 -27
  221. package/src/lib/sip.js/api/messager-message-options.ts +0 -12
  222. package/src/lib/sip.js/api/messager-options.ts +0 -18
  223. package/src/lib/sip.js/api/messager.ts +0 -89
  224. package/src/lib/sip.js/api/notification.ts +0 -27
  225. package/src/lib/sip.js/api/notifier.ts +0 -7
  226. package/src/lib/sip.js/api/publisher-options.ts +0 -34
  227. package/src/lib/sip.js/api/publisher-publish-options.ts +0 -6
  228. package/src/lib/sip.js/api/publisher-state.ts +0 -21
  229. package/src/lib/sip.js/api/publisher-unpublish-options.ts +0 -6
  230. package/src/lib/sip.js/api/publisher.ts +0 -421
  231. package/src/lib/sip.js/api/referral.ts +0 -89
  232. package/src/lib/sip.js/api/registerer-options.ts +0 -55
  233. package/src/lib/sip.js/api/registerer-register-options.ts +0 -12
  234. package/src/lib/sip.js/api/registerer-state.ts +0 -21
  235. package/src/lib/sip.js/api/registerer-unregister-options.ts +0 -17
  236. package/src/lib/sip.js/api/registerer.ts +0 -819
  237. package/src/lib/sip.js/api/session-bye-options.ts +0 -12
  238. package/src/lib/sip.js/api/session-delegate.ts +0 -87
  239. package/src/lib/sip.js/api/session-description-handler-factory.ts +0 -16
  240. package/src/lib/sip.js/api/session-description-handler.ts +0 -89
  241. package/src/lib/sip.js/api/session-info-options.ts +0 -12
  242. package/src/lib/sip.js/api/session-invite-options.ts +0 -29
  243. package/src/lib/sip.js/api/session-message-options.ts +0 -12
  244. package/src/lib/sip.js/api/session-options.ts +0 -8
  245. package/src/lib/sip.js/api/session-refer-options.ts +0 -15
  246. package/src/lib/sip.js/api/session-state.ts +0 -45
  247. package/src/lib/sip.js/api/session.ts +0 -1454
  248. package/src/lib/sip.js/api/subscriber-options.ts +0 -12
  249. package/src/lib/sip.js/api/subscriber-subscribe-options.ts +0 -6
  250. package/src/lib/sip.js/api/subscriber.ts +0 -537
  251. package/src/lib/sip.js/api/subscription-delegate.ts +0 -13
  252. package/src/lib/sip.js/api/subscription-options.ts +0 -8
  253. package/src/lib/sip.js/api/subscription-state.ts +0 -19
  254. package/src/lib/sip.js/api/subscription-subscribe-options.ts +0 -6
  255. package/src/lib/sip.js/api/subscription-unsubscribe-options.ts +0 -6
  256. package/src/lib/sip.js/api/subscription.ts +0 -161
  257. package/src/lib/sip.js/api/transport-state.ts +0 -37
  258. package/src/lib/sip.js/api/transport.ts +0 -169
  259. package/src/lib/sip.js/api/user-agent-delegate.ts +0 -95
  260. package/src/lib/sip.js/api/user-agent-options.ts +0 -322
  261. package/src/lib/sip.js/api/user-agent-state.ts +0 -14
  262. package/src/lib/sip.js/api/user-agent.ts +0 -1013
  263. package/src/lib/sip.js/core/api-extractor.json +0 -350
  264. package/src/lib/sip.js/core/dialogs/dialog-state.ts +0 -35
  265. package/src/lib/sip.js/core/dialogs/dialog.ts +0 -605
  266. package/src/lib/sip.js/core/dialogs/index.ts +0 -4
  267. package/src/lib/sip.js/core/dialogs/session-dialog.ts +0 -997
  268. package/src/lib/sip.js/core/dialogs/subscription-dialog.ts +0 -558
  269. package/src/lib/sip.js/core/exceptions/exception.ts +0 -11
  270. package/src/lib/sip.js/core/exceptions/index.ts +0 -3
  271. package/src/lib/sip.js/core/exceptions/transaction-state-error.ts +0 -11
  272. package/src/lib/sip.js/core/exceptions/transport-error.ts +0 -11
  273. package/src/lib/sip.js/core/index.ts +0 -19
  274. package/src/lib/sip.js/core/log/index.ts +0 -3
  275. package/src/lib/sip.js/core/log/levels.ts +0 -10
  276. package/src/lib/sip.js/core/log/logger-factory.ts +0 -119
  277. package/src/lib/sip.js/core/log/logger.ts +0 -42
  278. package/src/lib/sip.js/core/messages/body.ts +0 -171
  279. package/src/lib/sip.js/core/messages/digest-authentication.ts +0 -190
  280. package/src/lib/sip.js/core/messages/incoming-message.ts +0 -152
  281. package/src/lib/sip.js/core/messages/incoming-request-message.ts +0 -14
  282. package/src/lib/sip.js/core/messages/incoming-request.ts +0 -75
  283. package/src/lib/sip.js/core/messages/incoming-response-message.ts +0 -14
  284. package/src/lib/sip.js/core/messages/incoming-response.ts +0 -13
  285. package/src/lib/sip.js/core/messages/index.ts +0 -18
  286. package/src/lib/sip.js/core/messages/md5.ts +0 -437
  287. package/src/lib/sip.js/core/messages/methods/ack.ts +0 -22
  288. package/src/lib/sip.js/core/messages/methods/bye.ts +0 -22
  289. package/src/lib/sip.js/core/messages/methods/cancel.ts +0 -22
  290. package/src/lib/sip.js/core/messages/methods/constants.ts +0 -21
  291. package/src/lib/sip.js/core/messages/methods/index.ts +0 -13
  292. package/src/lib/sip.js/core/messages/methods/info.ts +0 -22
  293. package/src/lib/sip.js/core/messages/methods/invite.ts +0 -104
  294. package/src/lib/sip.js/core/messages/methods/message.ts +0 -22
  295. package/src/lib/sip.js/core/messages/methods/notify.ts +0 -22
  296. package/src/lib/sip.js/core/messages/methods/prack.ts +0 -22
  297. package/src/lib/sip.js/core/messages/methods/publish.ts +0 -22
  298. package/src/lib/sip.js/core/messages/methods/refer.ts +0 -22
  299. package/src/lib/sip.js/core/messages/methods/register.ts +0 -22
  300. package/src/lib/sip.js/core/messages/methods/subscribe.ts +0 -59
  301. package/src/lib/sip.js/core/messages/outgoing-request-message.ts +0 -299
  302. package/src/lib/sip.js/core/messages/outgoing-request.ts +0 -77
  303. package/src/lib/sip.js/core/messages/outgoing-response.ts +0 -174
  304. package/src/lib/sip.js/core/messages/parser.ts +0 -265
  305. package/src/lib/sip.js/core/messages/utils.ts +0 -144
  306. package/src/lib/sip.js/core/session/index.ts +0 -2
  307. package/src/lib/sip.js/core/session/session-delegate.ts +0 -88
  308. package/src/lib/sip.js/core/session/session.ts +0 -158
  309. package/src/lib/sip.js/core/subscription/index.ts +0 -2
  310. package/src/lib/sip.js/core/subscription/subscription-delegate.ts +0 -30
  311. package/src/lib/sip.js/core/subscription/subscription.ts +0 -61
  312. package/src/lib/sip.js/core/timers.ts +0 -24
  313. package/src/lib/sip.js/core/transactions/client-transaction.ts +0 -78
  314. package/src/lib/sip.js/core/transactions/index.ts +0 -10
  315. package/src/lib/sip.js/core/transactions/invite-client-transaction.ts +0 -505
  316. package/src/lib/sip.js/core/transactions/invite-server-transaction.ts +0 -433
  317. package/src/lib/sip.js/core/transactions/non-invite-client-transaction.ts +0 -258
  318. package/src/lib/sip.js/core/transactions/non-invite-server-transaction.ts +0 -242
  319. package/src/lib/sip.js/core/transactions/server-transaction.ts +0 -47
  320. package/src/lib/sip.js/core/transactions/transaction-state.ts +0 -13
  321. package/src/lib/sip.js/core/transactions/transaction-user.ts +0 -82
  322. package/src/lib/sip.js/core/transactions/transaction.ts +0 -149
  323. package/src/lib/sip.js/core/transport.ts +0 -32
  324. package/src/lib/sip.js/core/user-agent-core/allowed-methods.ts +0 -19
  325. package/src/lib/sip.js/core/user-agent-core/index.ts +0 -3
  326. package/src/lib/sip.js/core/user-agent-core/user-agent-core-configuration.ts +0 -111
  327. package/src/lib/sip.js/core/user-agent-core/user-agent-core-delegate.ts +0 -50
  328. package/src/lib/sip.js/core/user-agent-core/user-agent-core.ts +0 -905
  329. package/src/lib/sip.js/core/user-agents/bye-user-agent-client.ts +0 -16
  330. package/src/lib/sip.js/core/user-agents/bye-user-agent-server.ts +0 -14
  331. package/src/lib/sip.js/core/user-agents/cancel-user-agent-client.ts +0 -14
  332. package/src/lib/sip.js/core/user-agents/index.ts +0 -26
  333. package/src/lib/sip.js/core/user-agents/info-user-agent-client.ts +0 -15
  334. package/src/lib/sip.js/core/user-agents/info-user-agent-server.ts +0 -14
  335. package/src/lib/sip.js/core/user-agents/invite-user-agent-client.ts +0 -406
  336. package/src/lib/sip.js/core/user-agents/invite-user-agent-server.ts +0 -269
  337. package/src/lib/sip.js/core/user-agents/message-user-agent-client.ts +0 -14
  338. package/src/lib/sip.js/core/user-agents/message-user-agent-server.ts +0 -14
  339. package/src/lib/sip.js/core/user-agents/notify-user-agent-client.ts +0 -15
  340. package/src/lib/sip.js/core/user-agents/notify-user-agent-server.ts +0 -30
  341. package/src/lib/sip.js/core/user-agents/prack-user-agent-client.ts +0 -16
  342. package/src/lib/sip.js/core/user-agents/prack-user-agent-server.ts +0 -37
  343. package/src/lib/sip.js/core/user-agents/publish-user-agent-client.ts +0 -14
  344. package/src/lib/sip.js/core/user-agents/re-invite-user-agent-client.ts +0 -128
  345. package/src/lib/sip.js/core/user-agents/re-invite-user-agent-server.ts +0 -109
  346. package/src/lib/sip.js/core/user-agents/re-subscribe-user-agent-client.ts +0 -78
  347. package/src/lib/sip.js/core/user-agents/re-subscribe-user-agent-server.ts +0 -14
  348. package/src/lib/sip.js/core/user-agents/refer-user-agent-client.ts +0 -15
  349. package/src/lib/sip.js/core/user-agents/refer-user-agent-server.ts +0 -30
  350. package/src/lib/sip.js/core/user-agents/register-user-agent-client.ts +0 -14
  351. package/src/lib/sip.js/core/user-agents/register-user-agent-server.ts +0 -14
  352. package/src/lib/sip.js/core/user-agents/subscribe-user-agent-client.ts +0 -342
  353. package/src/lib/sip.js/core/user-agents/subscribe-user-agent-server.ts +0 -14
  354. package/src/lib/sip.js/core/user-agents/user-agent-client.ts +0 -378
  355. package/src/lib/sip.js/core/user-agents/user-agent-server.ts +0 -276
  356. package/src/lib/sip.js/grammar/grammar.ts +0 -55
  357. package/src/lib/sip.js/grammar/index.ts +0 -4
  358. package/src/lib/sip.js/grammar/name-addr-header.ts +0 -58
  359. package/src/lib/sip.js/grammar/parameters.ts +0 -45
  360. package/src/lib/sip.js/grammar/pegjs/README.md +0 -9
  361. package/src/lib/sip.js/grammar/pegjs/dist/grammar.ts +0 -1557
  362. package/src/lib/sip.js/grammar/pegjs/src/grammar.pegjs +0 -1009
  363. package/src/lib/sip.js/grammar/uri.ts +0 -370
  364. package/src/lib/sip.js/index.ts +0 -20
  365. package/src/lib/sip.js/platform/react/README.md +0 -1
  366. package/src/lib/sip.js/platform/web/index.ts +0 -4
  367. package/src/lib/sip.js/platform/web/modifiers/index.ts +0 -5
  368. package/src/lib/sip.js/platform/web/modifiers/modifiers.ts +0 -180
  369. package/src/lib/sip.js/platform/web/session-description-handler/api-extractor.json +0 -350
  370. package/src/lib/sip.js/platform/web/session-description-handler/index.ts +0 -14
  371. package/src/lib/sip.js/platform/web/session-description-handler/media-stream-factory-default.ts +0 -22
  372. package/src/lib/sip.js/platform/web/session-description-handler/media-stream-factory.ts +0 -10
  373. package/src/lib/sip.js/platform/web/session-description-handler/peer-connection-configuration-default.ts +0 -17
  374. package/src/lib/sip.js/platform/web/session-description-handler/peer-connection-delegate.ts +0 -72
  375. package/src/lib/sip.js/platform/web/session-description-handler/session-description-handler-configuration.ts +0 -17
  376. package/src/lib/sip.js/platform/web/session-description-handler/session-description-handler-factory-default.ts +0 -45
  377. package/src/lib/sip.js/platform/web/session-description-handler/session-description-handler-factory-options.ts +0 -10
  378. package/src/lib/sip.js/platform/web/session-description-handler/session-description-handler-factory.ts +0 -17
  379. package/src/lib/sip.js/platform/web/session-description-handler/session-description-handler-options.ts +0 -56
  380. package/src/lib/sip.js/platform/web/session-description-handler/session-description-handler.ts +0 -938
  381. package/src/lib/sip.js/platform/web/simple-user/api-extractor.json +0 -350
  382. package/src/lib/sip.js/platform/web/simple-user/index.ts +0 -7
  383. package/src/lib/sip.js/platform/web/simple-user/simple-user-delegate.ts +0 -82
  384. package/src/lib/sip.js/platform/web/simple-user/simple-user-options.ts +0 -102
  385. package/src/lib/sip.js/platform/web/simple-user/simple-user.ts +0 -1099
  386. package/src/lib/sip.js/platform/web/transport/api-extractor.json +0 -350
  387. package/src/lib/sip.js/platform/web/transport/index.ts +0 -6
  388. package/src/lib/sip.js/platform/web/transport/transport-options.ts +0 -34
  389. package/src/lib/sip.js/platform/web/transport/transport.ts +0 -743
  390. package/src/lib/sip.js/version.ts +0 -1
  391. package/src/lib/socket.io.esm.min.js +0 -7
  392. package/src/webrtc/webrtc-method.ts +0 -49
  393. package/src/webrtc/webrtc.ts +0 -350
  394. package/tsconfig.json +0 -21
@@ -1,938 +0,0 @@
1
- // @ts-nocheck
2
- import {
3
- BodyAndContentType,
4
- SessionDescriptionHandler as SessionDescriptionHandlerDefinition,
5
- SessionDescriptionHandlerModifier
6
- } from '../../../api'
7
- import { Logger } from '../../../core'
8
- import { MediaStreamFactory } from './media-stream-factory'
9
- import { SessionDescriptionHandlerConfiguration } from './session-description-handler-configuration'
10
- import { SessionDescriptionHandlerOptions } from './session-description-handler-options'
11
- import { PeerConnectionDelegate } from './peer-connection-delegate'
12
-
13
- type ResolveFunction = () => void
14
- type RejectFunction = (reason: Error) => void
15
-
16
- /**
17
- * A base class implementing a WebRTC session description handler for sip.js.
18
- * @remarks
19
- * It is expected/intended to be extended by specific WebRTC based applications.
20
- * @privateRemarks
21
- * So do not put application specific implementation in here.
22
- * @public
23
- */
24
- export class SessionDescriptionHandler implements SessionDescriptionHandlerDefinition {
25
- /** Logger. */
26
- protected logger: Logger
27
- /** Media stream factory. */
28
- protected mediaStreamFactory: MediaStreamFactory
29
- /** Configuration options. */
30
- protected sessionDescriptionHandlerConfiguration?: SessionDescriptionHandlerConfiguration
31
-
32
- /** The local media stream. */
33
- protected _localMediaStream: MediaStream
34
- /** The remote media stream. */
35
- protected _remoteMediaStream: MediaStream
36
- /** The data channel. Undefined before created. */
37
- protected _dataChannel: RTCDataChannel | undefined
38
- /** The peer connection. Undefined after SessionDescriptionHandler.close(). */
39
- protected _peerConnection: RTCPeerConnection | undefined
40
- /** The peer connection delegate. */
41
- protected _peerConnectionDelegate: PeerConnectionDelegate | undefined
42
-
43
- private iceGatheringCompletePromise: Promise<void> | undefined
44
- private iceGatheringCompleteTimeoutId: number | undefined
45
- private iceGatheringCompleteResolve: ResolveFunction | undefined
46
- private iceGatheringCompleteReject: RejectFunction | undefined
47
- private localMediaStreamConstraints: MediaStreamConstraints | undefined
48
- private onDataChannel: ((dataChannel: RTCDataChannel) => void) | undefined
49
-
50
- /**
51
- * Constructor
52
- * @param logger - A logger
53
- * @param mediaStreamFactory - A factory to provide a MediaStream
54
- * @param options - Options passed from the SessionDescriptionHandleFactory
55
- */
56
- constructor(
57
- logger: Logger,
58
- mediaStreamFactory: MediaStreamFactory,
59
- sessionDescriptionHandlerConfiguration?: SessionDescriptionHandlerConfiguration
60
- ) {
61
- logger.debug('SessionDescriptionHandler.constructor')
62
- this.logger = logger
63
- this.mediaStreamFactory = mediaStreamFactory
64
- this.sessionDescriptionHandlerConfiguration = sessionDescriptionHandlerConfiguration
65
- this._localMediaStream = new MediaStream()
66
- this._remoteMediaStream = new MediaStream()
67
- this._peerConnection = new RTCPeerConnection(sessionDescriptionHandlerConfiguration?.peerConnectionConfiguration)
68
- this.initPeerConnectionEventHandlers()
69
- }
70
-
71
- /**
72
- * The local media stream currently being sent.
73
- *
74
- * @remarks
75
- * The local media stream initially has no tracks, so the presence of tracks
76
- * should not be assumed. Furthermore, tracks may be added or removed if the
77
- * local media changes - for example, on upgrade from audio only to a video session.
78
- * At any given time there will be at most one audio track and one video track
79
- * (it's possible that this restriction may not apply to sub-classes).
80
- * Use `MediaStream.onaddtrack` or add a listener for the `addtrack` event
81
- * to detect when a new track becomes available:
82
- * https://developer.mozilla.org/en-US/docs/Web/API/MediaStream/onaddtrack
83
- */
84
- get localMediaStream(): MediaStream {
85
- return this._localMediaStream
86
- }
87
-
88
- /**
89
- * The remote media stream currently being received.
90
- *
91
- * @remarks
92
- * The remote media stream initially has no tracks, so the presence of tracks
93
- * should not be assumed. Furthermore, tracks may be added or removed if the
94
- * remote media changes - for example, on upgrade from audio only to a video session.
95
- * At any given time there will be at most one audio track and one video track
96
- * (it's possible that this restriction may not apply to sub-classes).
97
- * Use `MediaStream.onaddtrack` or add a listener for the `addtrack` event
98
- * to detect when a new track becomes available:
99
- * https://developer.mozilla.org/en-US/docs/Web/API/MediaStream/onaddtrack
100
- */
101
- get remoteMediaStream(): MediaStream {
102
- return this._remoteMediaStream
103
- }
104
-
105
- /**
106
- * The data channel. Undefined before it is created.
107
- */
108
- get dataChannel(): RTCDataChannel | undefined {
109
- return this._dataChannel
110
- }
111
-
112
- /**
113
- * The peer connection. Undefined if peer connection has closed.
114
- *
115
- * @remarks
116
- * While access to the underlying `RTCPeerConnection` is provided, note that
117
- * using methods with modify it may break the operation of this class.
118
- * In particular, this class depends on exclusive access to the
119
- * event handler properties. If you need access to the peer connection
120
- * events, either register for events using `addEventListener()` on
121
- * the `RTCPeerConnection` or set the `peerConnectionDelegate` on
122
- * this `SessionDescriptionHandler`.
123
- */
124
- get peerConnection(): RTCPeerConnection | undefined {
125
- return this._peerConnection
126
- }
127
-
128
- /**
129
- * A delegate which provides access to the peer connection event handlers.
130
- *
131
- * @remarks
132
- * Setting the peer connection event handlers directly is not supported
133
- * and may break this class. As this class depends on exclusive access
134
- * to them, a delegate may be set which provides alternative access to
135
- * the event handlers in a fashion which is supported.
136
- */
137
- get peerConnectionDelegate(): PeerConnectionDelegate | undefined {
138
- return this._peerConnectionDelegate
139
- }
140
-
141
- set peerConnectionDelegate(delegate: PeerConnectionDelegate | undefined) {
142
- this._peerConnectionDelegate = delegate
143
- }
144
-
145
- // The addtrack event does not get fired when JavaScript code explicitly adds tracks to the stream (by calling addTrack()).
146
- // https://developer.mozilla.org/en-US/docs/Web/API/MediaStream/onaddtrack
147
- private static dispatchAddTrackEvent(stream: MediaStream, track: MediaStreamTrack): void {
148
- stream.dispatchEvent(new MediaStreamTrackEvent('addtrack', { track }))
149
- }
150
- // The removetrack event does not get fired when JavaScript code explicitly removes tracks from the stream (by calling removeTrack()).
151
- // https://developer.mozilla.org/en-US/docs/Web/API/MediaStream/onremovetrack
152
- private static dispatchRemoveTrackEvent(stream: MediaStream, track: MediaStreamTrack): void {
153
- stream.dispatchEvent(new MediaStreamTrackEvent('removetrack', { track }))
154
- }
155
-
156
- /**
157
- * Stop tracks and close peer connection.
158
- */
159
- public close(): void {
160
- this.logger.debug('SessionDescriptionHandler.close')
161
- if (this._peerConnection === undefined) {
162
- return
163
- }
164
- this._peerConnection.getReceivers().forEach((receiver) => {
165
- receiver.track && receiver.track.stop()
166
- })
167
- this._peerConnection.getSenders().forEach((sender) => {
168
- sender.track && sender.track.stop()
169
- })
170
- if (this._dataChannel) {
171
- this._dataChannel.close()
172
- }
173
- this._peerConnection.close()
174
- this._peerConnection = undefined
175
- }
176
-
177
- /**
178
- * Creates an offer or answer.
179
- * @param options - Options bucket.
180
- * @param modifiers - Modifiers.
181
- */
182
- public getDescription(
183
- options?: SessionDescriptionHandlerOptions,
184
- modifiers?: Array<SessionDescriptionHandlerModifier>
185
- ): Promise<BodyAndContentType> {
186
- this.logger.debug('SessionDescriptionHandler.getDescription')
187
- if (this._peerConnection === undefined) {
188
- return Promise.reject(new Error('Peer connection closed.'))
189
- }
190
- // Callback on data channel creation
191
- this.onDataChannel = options?.onDataChannel
192
-
193
- // ICE will restart upon applying an offer created with the iceRestart option
194
- const iceRestart = options?.offerOptions?.iceRestart
195
-
196
- // ICE gathering timeout may be set on a per call basis, otherwise the configured default is used
197
- const iceTimeout =
198
- options?.iceGatheringTimeout === undefined
199
- ? this.sessionDescriptionHandlerConfiguration?.iceGatheringTimeout
200
- : options?.iceGatheringTimeout
201
-
202
- return this.getLocalMediaStream(options)
203
- .then(() => this.updateDirection(options))
204
- .then(() => this.createDataChannel(options))
205
- .then(() => this.createLocalOfferOrAnswer(options))
206
- .then((sessionDescription) => this.applyModifiers(sessionDescription, modifiers))
207
- .then((sessionDescription) => this.setLocalSessionDescription(sessionDescription))
208
- .then(() => this.waitForIceGatheringComplete(iceRestart, iceTimeout))
209
- .then(() => this.getLocalSessionDescription())
210
- .then((sessionDescription) => {
211
- return {
212
- body: sessionDescription.sdp,
213
- contentType: 'application/sdp'
214
- }
215
- })
216
- .catch((error) => {
217
- this.logger.error('SessionDescriptionHandler.getDescription failed - ' + error)
218
- throw error
219
- })
220
- }
221
-
222
- /**
223
- * Returns true if the SessionDescriptionHandler can handle the Content-Type described by a SIP message.
224
- * @param contentType - The content type that is in the SIP Message.
225
- */
226
- public hasDescription(contentType: string): boolean {
227
- this.logger.debug('SessionDescriptionHandler.hasDescription')
228
- return contentType === 'application/sdp'
229
- }
230
-
231
- /**
232
- * Send DTMF via RTP (RFC 4733).
233
- * Returns true if DTMF send is successful, false otherwise.
234
- * @param tones - A string containing DTMF digits.
235
- * @param options - Options object to be used by sendDtmf.
236
- */
237
- public sendDtmf(tones: string, options?: { duration: number; interToneGap: number }): boolean {
238
- this.logger.debug('SessionDescriptionHandler.sendDtmf')
239
- if (this._peerConnection === undefined) {
240
- this.logger.error('SessionDescriptionHandler.sendDtmf failed - peer connection closed')
241
- return false
242
- }
243
- const senders = this._peerConnection.getSenders()
244
- if (senders.length === 0) {
245
- this.logger.error('SessionDescriptionHandler.sendDtmf failed - no senders')
246
- return false
247
- }
248
- const dtmfSender = senders[0].dtmf
249
- if (!dtmfSender) {
250
- this.logger.error('SessionDescriptionHandler.sendDtmf failed - no DTMF sender')
251
- return false
252
- }
253
- const duration = options?.duration
254
- const interToneGap = options?.interToneGap
255
- try {
256
- dtmfSender.insertDTMF(tones, duration, interToneGap)
257
- } catch (e) {
258
- this.logger.error(e)
259
- return false
260
- }
261
- this.logger.log('SessionDescriptionHandler.sendDtmf sent via RTP: ' + tones.toString())
262
- return true
263
- }
264
-
265
- /**
266
- * Sets an offer or answer.
267
- * @param sdp - The session description.
268
- * @param options - Options bucket.
269
- * @param modifiers - Modifiers.
270
- */
271
- public setDescription(
272
- sdp: string,
273
- options?: SessionDescriptionHandlerOptions,
274
- modifiers?: Array<SessionDescriptionHandlerModifier>
275
- ): Promise<void> {
276
- this.logger.debug('SessionDescriptionHandler.setDescription')
277
- if (this._peerConnection === undefined) {
278
- return Promise.reject(new Error('Peer connection closed.'))
279
- }
280
-
281
- // Callback on data channel creation
282
- this.onDataChannel = options?.onDataChannel
283
-
284
- // SDP type
285
- const type = this._peerConnection.signalingState === 'have-local-offer' ? 'answer' : 'offer'
286
-
287
- return this.getLocalMediaStream(options)
288
- .then(() => this.applyModifiers({ sdp, type }, modifiers))
289
- .then((sessionDescription) => this.setRemoteSessionDescription(sessionDescription))
290
- .catch((error) => {
291
- this.logger.error('SessionDescriptionHandler.setDescription failed - ' + error)
292
- throw error
293
- })
294
- }
295
-
296
- /**
297
- * Applies modifiers to SDP prior to setting the local or remote description.
298
- * @param sdp - SDP to modify.
299
- * @param modifiers - Modifiers to apply.
300
- */
301
- protected applyModifiers(
302
- sdp: RTCSessionDescriptionInit,
303
- modifiers?: Array<SessionDescriptionHandlerModifier>
304
- ): Promise<RTCSessionDescriptionInit> {
305
- this.logger.debug('SessionDescriptionHandler.applyModifiers')
306
- if (!modifiers || modifiers.length === 0) {
307
- return Promise.resolve(sdp)
308
- }
309
- return modifiers
310
- .reduce((cur, next) => cur.then(next), Promise.resolve(sdp))
311
- .then((modified) => {
312
- this.logger.debug('SessionDescriptionHandler.applyModifiers - modified sdp')
313
- if (!modified.sdp || !modified.type) {
314
- throw new Error('Invalid SDP.')
315
- }
316
- return { sdp: modified.sdp, type: modified.type }
317
- })
318
- }
319
-
320
- /**
321
- * Create a data channel.
322
- * @remarks
323
- * Only creates a data channel if SessionDescriptionHandlerOptions.dataChannel is true.
324
- * Only creates a data channel if creating a local offer.
325
- * Only if one does not already exist.
326
- * @param options - Session description handler options.
327
- */
328
- protected createDataChannel(options?: SessionDescriptionHandlerOptions): Promise<void> {
329
- if (this._peerConnection === undefined) {
330
- return Promise.reject(new Error('Peer connection closed.'))
331
- }
332
- // only create a data channel if requested
333
- if (options?.dataChannel !== true) {
334
- return Promise.resolve()
335
- }
336
- // do not create a data channel if we already have one
337
- if (this._dataChannel) {
338
- return Promise.resolve()
339
- }
340
- switch (this._peerConnection.signalingState) {
341
- case 'stable':
342
- // if we are stable, assume we are creating a local offer so create a data channel
343
- this.logger.debug('SessionDescriptionHandler.createDataChannel - creating data channel')
344
- try {
345
- this._dataChannel = this._peerConnection.createDataChannel(
346
- options?.dataChannelLabel || '',
347
- options?.dataChannelOptions
348
- )
349
- if (this.onDataChannel) {
350
- this.onDataChannel(this._dataChannel)
351
- }
352
- return Promise.resolve()
353
- } catch (error) {
354
- return Promise.reject(error)
355
- }
356
- case 'have-remote-offer':
357
- return Promise.resolve()
358
- case 'have-local-offer':
359
- case 'have-local-pranswer':
360
- case 'have-remote-pranswer':
361
- case 'closed':
362
- default:
363
- return Promise.reject(new Error('Invalid signaling state ' + this._peerConnection.signalingState))
364
- }
365
- }
366
-
367
- /**
368
- * Depending on current signaling state, create a local offer or answer.
369
- * @param options - Session description handler options.
370
- */
371
- protected createLocalOfferOrAnswer(options?: SessionDescriptionHandlerOptions): Promise<RTCSessionDescriptionInit> {
372
- if (this._peerConnection === undefined) {
373
- return Promise.reject(new Error('Peer connection closed.'))
374
- }
375
- switch (this._peerConnection.signalingState) {
376
- case 'stable':
377
- // if we are stable, assume we are creating a local offer
378
- this.logger.debug('SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP offer')
379
- return this._peerConnection.createOffer(options?.offerOptions)
380
- case 'have-remote-offer':
381
- // if we have a remote offer, assume we are creating a local answer
382
- this.logger.debug('SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP answer')
383
- return this._peerConnection.createAnswer(options?.answerOptions)
384
- case 'have-local-offer':
385
- case 'have-local-pranswer':
386
- case 'have-remote-pranswer':
387
- case 'closed':
388
- default:
389
- return Promise.reject(new Error('Invalid signaling state ' + this._peerConnection.signalingState))
390
- }
391
- }
392
-
393
- /**
394
- * Get a media stream from the media stream factory and set the local media stream.
395
- * @param options - Session description handler options.
396
- */
397
- protected getLocalMediaStream(options?: SessionDescriptionHandlerOptions): Promise<void> {
398
- this.logger.debug('SessionDescriptionHandler.getLocalMediaStream')
399
- if (this._peerConnection === undefined) {
400
- return Promise.reject(new Error('Peer connection closed.'))
401
- }
402
- let constraints: MediaStreamConstraints = { ...options?.constraints }
403
-
404
- // if we already have a local media stream...
405
- if (this.localMediaStreamConstraints) {
406
- // ignore constraint "downgrades"
407
- constraints.audio = constraints.audio || this.localMediaStreamConstraints.audio
408
- constraints.video = constraints.video || this.localMediaStreamConstraints.video
409
-
410
- // if constraints have not changed, do not get a new media stream
411
- if (
412
- JSON.stringify(this.localMediaStreamConstraints.audio) === JSON.stringify(constraints.audio) &&
413
- JSON.stringify(this.localMediaStreamConstraints.video) === JSON.stringify(constraints.video)
414
- ) {
415
- return Promise.resolve()
416
- }
417
- } else {
418
- // if no constraints have been specified, default to audio for initial media stream
419
- if (constraints.audio === undefined && constraints.video === undefined) {
420
- constraints = { audio: true }
421
- }
422
- }
423
-
424
- this.localMediaStreamConstraints = constraints
425
- return this.mediaStreamFactory(constraints, this).then((mediaStream) => this.setLocalMediaStream(mediaStream))
426
- }
427
-
428
- /**
429
- * Sets the peer connection's sender tracks and local media stream tracks.
430
- *
431
- * @remarks
432
- * Only the first audio and video tracks of the provided MediaStream are utilized.
433
- * Adds tracks if audio and/or video tracks are not already present, otherwise replaces tracks.
434
- *
435
- * @param stream - Media stream containing tracks to be utilized.
436
- */
437
- protected setLocalMediaStream(stream: MediaStream): Promise<void> {
438
- this.logger.debug('SessionDescriptionHandler.setLocalMediaStream')
439
-
440
- if (!this._peerConnection) {
441
- throw new Error('Peer connection undefined.')
442
- }
443
- const pc = this._peerConnection
444
-
445
- const localStream = this._localMediaStream
446
-
447
- const trackUpdates: Array<Promise<void>> = []
448
-
449
- const updateTrack = (newTrack: MediaStreamTrack): void => {
450
- const kind = newTrack.kind
451
- if (kind !== 'audio' && kind !== 'video') {
452
- throw new Error(`Unknown new track kind ${kind}.`)
453
- }
454
- const sender = pc.getSenders().find((sender) => sender.track && sender.track.kind === kind)
455
- if (sender) {
456
- trackUpdates.push(
457
- new Promise<void>((resolve) => {
458
- this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - replacing sender ${kind} track`)
459
- resolve()
460
- }).then(() =>
461
- sender
462
- .replaceTrack(newTrack)
463
- .then(() => {
464
- const oldTrack = localStream.getTracks().find((localTrack) => localTrack.kind === kind)
465
- if (oldTrack) {
466
- oldTrack.stop()
467
- localStream.removeTrack(oldTrack)
468
- SessionDescriptionHandler.dispatchRemoveTrackEvent(localStream, oldTrack)
469
- }
470
- localStream.addTrack(newTrack)
471
- SessionDescriptionHandler.dispatchAddTrackEvent(localStream, newTrack)
472
- })
473
- .catch((error: Error) => {
474
- this.logger.error(
475
- `SessionDescriptionHandler.setLocalMediaStream - failed to replace sender ${kind} track`
476
- )
477
- throw error
478
- })
479
- )
480
- )
481
- } else {
482
- trackUpdates.push(
483
- new Promise<void>((resolve) => {
484
- this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - adding sender ${kind} track`)
485
- resolve()
486
- }).then(() => {
487
- // Review: could make streamless tracks a configurable option?
488
- // https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addTrack#Usage_notes
489
- try {
490
- pc.addTrack(newTrack, localStream)
491
- } catch (error) {
492
- this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${kind} track`)
493
- throw error
494
- }
495
- localStream.addTrack(newTrack)
496
- SessionDescriptionHandler.dispatchAddTrackEvent(localStream, newTrack)
497
- })
498
- )
499
- }
500
- }
501
-
502
- // update peer connection audio tracks
503
- const audioTracks = stream.getAudioTracks()
504
- if (audioTracks.length) {
505
- updateTrack(audioTracks[0])
506
- }
507
-
508
- // update peer connection video tracks
509
- const videoTracks = stream.getVideoTracks()
510
- if (videoTracks.length) {
511
- updateTrack(videoTracks[0])
512
- }
513
-
514
- return trackUpdates.reduce((p, x) => p.then(() => x), Promise.resolve())
515
- }
516
-
517
- /**
518
- * Gets the peer connection's local session description.
519
- */
520
- protected getLocalSessionDescription(): Promise<RTCSessionDescription> {
521
- this.logger.debug('SessionDescriptionHandler.getLocalSessionDescription')
522
- if (this._peerConnection === undefined) {
523
- return Promise.reject(new Error('Peer connection closed.'))
524
- }
525
- const sdp = this._peerConnection.localDescription
526
- if (!sdp) {
527
- return Promise.reject(new Error('Failed to get local session description'))
528
- }
529
- return Promise.resolve(sdp)
530
- }
531
-
532
- /**
533
- * Sets the peer connection's local session description.
534
- * @param sessionDescription - sessionDescription The session description.
535
- */
536
- protected setLocalSessionDescription(sessionDescription: RTCSessionDescriptionInit): Promise<void> {
537
- this.logger.debug('SessionDescriptionHandler.setLocalSessionDescription')
538
- if (this._peerConnection === undefined) {
539
- return Promise.reject(new Error('Peer connection closed.'))
540
- }
541
- return this._peerConnection.setLocalDescription(sessionDescription)
542
- }
543
-
544
- /**
545
- * Sets the peer connection's remote session description.
546
- * @param sessionDescription - The session description.
547
- */
548
- protected setRemoteSessionDescription(sessionDescription: RTCSessionDescriptionInit): Promise<void> {
549
- this.logger.debug('SessionDescriptionHandler.setRemoteSessionDescription')
550
- if (this._peerConnection === undefined) {
551
- return Promise.reject(new Error('Peer connection closed.'))
552
- }
553
- const sdp = sessionDescription.sdp
554
- let type: RTCSdpType
555
- switch (this._peerConnection.signalingState) {
556
- case 'stable':
557
- // if we are stable assume this is a remote offer
558
- type = 'offer'
559
- break
560
- case 'have-local-offer':
561
- // if we made an offer, assume this is a remote answer
562
- type = 'answer'
563
- break
564
- case 'have-local-pranswer':
565
- case 'have-remote-offer':
566
- case 'have-remote-pranswer':
567
- case 'closed':
568
- default:
569
- return Promise.reject(new Error('Invalid signaling state ' + this._peerConnection.signalingState))
570
- }
571
- if (!sdp) {
572
- this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription failed - cannot set null sdp')
573
- return Promise.reject(new Error('SDP is undefined'))
574
- }
575
- return this._peerConnection.setRemoteDescription({ sdp, type })
576
- }
577
-
578
- /**
579
- * Sets a remote media stream track.
580
- *
581
- * @remarks
582
- * Adds tracks if audio and/or video tracks are not already present, otherwise replaces tracks.
583
- *
584
- * @param track - Media stream track to be utilized.
585
- */
586
- protected setRemoteTrack(track: MediaStreamTrack): void {
587
- this.logger.debug('SessionDescriptionHandler.setRemoteTrack')
588
-
589
- const remoteStream = this._remoteMediaStream
590
-
591
- if (remoteStream.getTrackById(track.id)) {
592
- this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - have remote ${track.kind} track`)
593
- } else if (track.kind === 'audio') {
594
- this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${track.kind} track`)
595
- remoteStream.getAudioTracks().forEach((track) => {
596
- track.stop()
597
- remoteStream.removeTrack(track)
598
- SessionDescriptionHandler.dispatchRemoveTrackEvent(remoteStream, track)
599
- })
600
- remoteStream.addTrack(track)
601
- SessionDescriptionHandler.dispatchAddTrackEvent(remoteStream, track)
602
- } else if (track.kind === 'video') {
603
- this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${track.kind} track`)
604
- remoteStream.getVideoTracks().forEach((track) => {
605
- track.stop()
606
- remoteStream.removeTrack(track)
607
- SessionDescriptionHandler.dispatchRemoveTrackEvent(remoteStream, track)
608
- })
609
- remoteStream.addTrack(track)
610
- SessionDescriptionHandler.dispatchAddTrackEvent(remoteStream, track)
611
- }
612
- }
613
-
614
- /**
615
- * Depending on the current signaling state and the session hold state, update transceiver direction.
616
- * @param options - Session description handler options.
617
- */
618
- protected updateDirection(options?: SessionDescriptionHandlerOptions): Promise<void> {
619
- if (this._peerConnection === undefined) {
620
- return Promise.reject(new Error('Peer connection closed.'))
621
- }
622
-
623
- // 4.2.3. setDirection
624
- //
625
- // The setDirection method sets the direction of a transceiver, which
626
- // affects the direction property of the associated "m=" section on
627
- // future calls to createOffer and createAnswer. The permitted values
628
- // for direction are "recvonly", "sendrecv", "sendonly", and "inactive",
629
- // mirroring the identically named direction attributes defined in
630
- // [RFC4566], Section 6.
631
- //
632
- // When creating offers, the transceiver direction is directly reflected
633
- // in the output, even for re-offers. When creating answers, the
634
- // transceiver direction is intersected with the offered direction, as
635
- // explained in Section 5.3 below.
636
- //
637
- // Note that while setDirection sets the direction property of the
638
- // transceiver immediately (Section 4.2.4), this property does not
639
- // immediately affect whether the transceiver's RtpSender will send or
640
- // its RtpReceiver will receive. The direction in effect is represented
641
- // by the currentDirection property, which is only updated when an
642
- // answer is applied.
643
- //
644
- // 4.2.4. direction
645
- //
646
- // The direction property indicates the last value passed into
647
- // setDirection. If setDirection has never been called, it is set to
648
- // the direction the transceiver was initialized with.
649
- //
650
- // 4.2.5. currentDirection
651
- //
652
- // The currentDirection property indicates the last negotiated direction
653
- // for the transceiver's associated "m=" section. More specifically, it
654
- // indicates the direction attribute [RFC3264] of the associated "m="
655
- // section in the last applied answer (including provisional answers),
656
- // with "send" and "recv" directions reversed if it was a remote answer.
657
- // For example, if the direction attribute for the associated "m="
658
- // section in a remote answer is "recvonly", currentDirection is set to
659
- // "sendonly".
660
- //
661
- // If an answer that references this transceiver has not yet been
662
- // applied or if the transceiver is stopped, currentDirection is set to
663
- // "null".
664
- // https://tools.ietf.org/html/rfc8829#section-4.2.3
665
- //
666
- // * A direction attribute, determined by applying the rules regarding
667
- // the offered direction specified in [RFC3264], Section 6.1, and
668
- // then intersecting with the direction of the associated
669
- // RtpTransceiver. For example, in the case where an "m=" section is
670
- // offered as "sendonly" and the local transceiver is set to
671
- // "sendrecv", the result in the answer is a "recvonly" direction.
672
- // https://tools.ietf.org/html/rfc8829#section-5.3.1
673
- //
674
- // If a stream is offered as sendonly, the corresponding stream MUST be
675
- // marked as recvonly or inactive in the answer. If a media stream is
676
- // listed as recvonly in the offer, the answer MUST be marked as
677
- // sendonly or inactive in the answer. If an offered media stream is
678
- // listed as sendrecv (or if there is no direction attribute at the
679
- // media or session level, in which case the stream is sendrecv by
680
- // default), the corresponding stream in the answer MAY be marked as
681
- // sendonly, recvonly, sendrecv, or inactive. If an offered media
682
- // stream is listed as inactive, it MUST be marked as inactive in the
683
- // answer.
684
- // https://tools.ietf.org/html/rfc3264#section-6.1
685
-
686
- switch (this._peerConnection.signalingState) {
687
- case 'stable':
688
- // if we are stable, assume we are creating a local offer
689
- this.logger.debug('SessionDescriptionHandler.updateDirection - setting offer direction')
690
- {
691
- // determine the direction to offer given the current direction and hold state
692
- const directionToOffer = (currentDirection: RTCRtpTransceiverDirection): RTCRtpTransceiverDirection => {
693
- switch (currentDirection) {
694
- case 'inactive':
695
- return options?.hold ? 'inactive' : 'recvonly'
696
- case 'recvonly':
697
- return options?.hold ? 'inactive' : 'recvonly'
698
- case 'sendonly':
699
- return options?.hold ? 'sendonly' : 'sendrecv'
700
- case 'sendrecv':
701
- return options?.hold ? 'sendonly' : 'sendrecv'
702
- case 'stopped':
703
- return 'stopped'
704
- default:
705
- throw new Error('Should never happen')
706
- }
707
- }
708
- // set the transceiver direction to the offer direction
709
- this._peerConnection.getTransceivers().forEach((transceiver) => {
710
- if (transceiver.direction /* guarding, but should always be true */) {
711
- const offerDirection = directionToOffer(transceiver.direction)
712
- if (transceiver.direction !== offerDirection) {
713
- transceiver.direction = offerDirection
714
- }
715
- }
716
- })
717
- }
718
- break
719
- case 'have-remote-offer':
720
- // if we have a remote offer, assume we are creating a local answer
721
- this.logger.debug('SessionDescriptionHandler.updateDirection - setting answer direction')
722
-
723
- // FIXME: This is not the correct way to determine the answer direction as it is only
724
- // considering first match in the offered SDP and using that to determine the answer direction.
725
- // While that may be fine for our current use cases, it is not a generally correct approach.
726
- {
727
- // determine the offered direction
728
- const offeredDirection = ((): 'inactive' | 'recvonly' | 'sendonly' | 'sendrecv' => {
729
- const description = this._peerConnection.remoteDescription
730
- if (!description) {
731
- throw new Error('Failed to read remote offer')
732
- }
733
- const searchResult = /a=sendrecv\r\n|a=sendonly\r\n|a=recvonly\r\n|a=inactive\r\n/.exec(description.sdp)
734
- if (searchResult) {
735
- switch (searchResult[0]) {
736
- case 'a=inactive\r\n':
737
- return 'inactive'
738
- case 'a=recvonly\r\n':
739
- return 'recvonly'
740
- case 'a=sendonly\r\n':
741
- return 'sendonly'
742
- case 'a=sendrecv\r\n':
743
- return 'sendrecv'
744
- default:
745
- throw new Error('Should never happen')
746
- }
747
- }
748
- return 'sendrecv'
749
- })()
750
-
751
- // determine the answer direction based on the offered direction and our hold state
752
- const answerDirection = ((): 'inactive' | 'recvonly' | 'sendonly' | 'sendrecv' => {
753
- switch (offeredDirection) {
754
- case 'inactive':
755
- return 'inactive'
756
- case 'recvonly':
757
- return 'sendonly'
758
- case 'sendonly':
759
- return options?.hold ? 'inactive' : 'recvonly'
760
- case 'sendrecv':
761
- return options?.hold ? 'sendonly' : 'sendrecv'
762
- default:
763
- throw new Error('Should never happen')
764
- }
765
- })()
766
-
767
- // set the transceiver direction to the answer direction
768
- this._peerConnection.getTransceivers().forEach((transceiver) => {
769
- if (transceiver.direction /* guarding, but should always be true */) {
770
- if (transceiver.direction !== 'stopped' && transceiver.direction !== answerDirection) {
771
- transceiver.direction = answerDirection
772
- }
773
- }
774
- })
775
- }
776
- break
777
- case 'have-local-offer':
778
- case 'have-local-pranswer':
779
- case 'have-remote-pranswer':
780
- case 'closed':
781
- default:
782
- return Promise.reject(new Error('Invalid signaling state ' + this._peerConnection.signalingState))
783
- }
784
- return Promise.resolve()
785
- }
786
-
787
- /**
788
- * Called when ICE gathering completes and resolves any waiting promise.
789
- */
790
- protected iceGatheringComplete(): void {
791
- this.logger.debug('SessionDescriptionHandler.iceGatheringComplete')
792
- // clear timer if need be
793
- if (this.iceGatheringCompleteTimeoutId !== undefined) {
794
- this.logger.debug('SessionDescriptionHandler.iceGatheringComplete - clearing timeout')
795
- clearTimeout(this.iceGatheringCompleteTimeoutId)
796
- this.iceGatheringCompleteTimeoutId = undefined
797
- }
798
- // resolve and cleanup promise if need be
799
- if (this.iceGatheringCompletePromise !== undefined) {
800
- this.logger.debug('SessionDescriptionHandler.iceGatheringComplete - resolving promise')
801
- this.iceGatheringCompleteResolve && this.iceGatheringCompleteResolve()
802
- this.iceGatheringCompletePromise = undefined
803
- this.iceGatheringCompleteResolve = undefined
804
- this.iceGatheringCompleteReject = undefined
805
- }
806
- }
807
-
808
- /**
809
- * Wait for ICE gathering to complete.
810
- * @param restart - If true, waits if current state is "complete" (waits for transition to "complete").
811
- * @param timeout - Milliseconds after which waiting times out. No timeout if 0.
812
- */
813
- protected waitForIceGatheringComplete(restart = false, timeout = 0): Promise<void> {
814
- this.logger.debug('SessionDescriptionHandler.waitForIceGatheringToComplete')
815
- if (this._peerConnection === undefined) {
816
- return Promise.reject('Peer connection closed.')
817
- }
818
- // guard already complete
819
- if (!restart && this._peerConnection.iceGatheringState === 'complete') {
820
- this.logger.debug('SessionDescriptionHandler.waitForIceGatheringToComplete - already complete')
821
- return Promise.resolve()
822
- }
823
- // only one may be waiting, reject any prior
824
- if (this.iceGatheringCompletePromise !== undefined) {
825
- this.logger.debug('SessionDescriptionHandler.waitForIceGatheringToComplete - rejecting prior waiting promise')
826
- this.iceGatheringCompleteReject && this.iceGatheringCompleteReject(new Error('Promise superseded.'))
827
- this.iceGatheringCompletePromise = undefined
828
- this.iceGatheringCompleteResolve = undefined
829
- this.iceGatheringCompleteReject = undefined
830
- }
831
- this.iceGatheringCompletePromise = new Promise<void>((resolve, reject) => {
832
- this.iceGatheringCompleteResolve = resolve
833
- this.iceGatheringCompleteReject = reject
834
- if (timeout > 0) {
835
- this.logger.debug('SessionDescriptionHandler.waitForIceGatheringToComplete - timeout in ' + timeout)
836
- this.iceGatheringCompleteTimeoutId = setTimeout(() => {
837
- this.logger.debug('SessionDescriptionHandler.waitForIceGatheringToComplete - timeout')
838
- this.iceGatheringComplete()
839
- }, timeout)
840
- }
841
- })
842
- return this.iceGatheringCompletePromise
843
- }
844
-
845
- /**
846
- * Initializes the peer connection event handlers
847
- */
848
- private initPeerConnectionEventHandlers(): void {
849
- this.logger.debug('SessionDescriptionHandler.initPeerConnectionEventHandlers')
850
-
851
- if (!this._peerConnection) throw new Error('Peer connection undefined.')
852
- const peerConnection = this._peerConnection
853
-
854
- peerConnection.onconnectionstatechange = (event): void => {
855
- const newState = peerConnection.connectionState
856
- this.logger.debug(`SessionDescriptionHandler.onconnectionstatechange ${newState}`)
857
- if (this._peerConnectionDelegate?.onconnectionstatechange) {
858
- this._peerConnectionDelegate.onconnectionstatechange(event)
859
- }
860
- }
861
-
862
- peerConnection.ondatachannel = (event): void => {
863
- this.logger.debug(`SessionDescriptionHandler.ondatachannel`)
864
- this._dataChannel = event.channel
865
- if (this.onDataChannel) {
866
- this.onDataChannel(this._dataChannel)
867
- }
868
- if (this._peerConnectionDelegate?.ondatachannel) {
869
- this._peerConnectionDelegate.ondatachannel(event)
870
- }
871
- }
872
-
873
- peerConnection.onicecandidate = (event): void => {
874
- this.logger.debug(`SessionDescriptionHandler.onicecandidate`)
875
- if (this._peerConnectionDelegate?.onicecandidate) {
876
- this._peerConnectionDelegate.onicecandidate(event)
877
- }
878
- }
879
-
880
- peerConnection.onicecandidateerror = (event): void => {
881
- this.logger.debug(`SessionDescriptionHandler.onicecandidateerror`)
882
- if (this._peerConnectionDelegate?.onicecandidateerror) {
883
- this._peerConnectionDelegate.onicecandidateerror(event)
884
- }
885
- }
886
-
887
- peerConnection.oniceconnectionstatechange = (event): void => {
888
- const newState = peerConnection.iceConnectionState
889
- this.logger.debug(`SessionDescriptionHandler.oniceconnectionstatechange ${newState}`)
890
- if (this._peerConnectionDelegate?.oniceconnectionstatechange) {
891
- this._peerConnectionDelegate.oniceconnectionstatechange(event)
892
- }
893
- }
894
-
895
- peerConnection.onicegatheringstatechange = (event): void => {
896
- const newState = peerConnection.iceGatheringState
897
- this.logger.debug(`SessionDescriptionHandler.onicegatheringstatechange ${newState}`)
898
- if (newState === 'complete') {
899
- this.iceGatheringComplete() // complete waiting for ICE gathering to complete
900
- }
901
- if (this._peerConnectionDelegate?.onicegatheringstatechange) {
902
- this._peerConnectionDelegate.onicegatheringstatechange(event)
903
- }
904
- }
905
-
906
- peerConnection.onnegotiationneeded = (event): void => {
907
- this.logger.debug(`SessionDescriptionHandler.onnegotiationneeded`)
908
- if (this._peerConnectionDelegate?.onnegotiationneeded) {
909
- this._peerConnectionDelegate.onnegotiationneeded(event)
910
- }
911
- }
912
-
913
- peerConnection.onsignalingstatechange = (event): void => {
914
- const newState = peerConnection.signalingState
915
- this.logger.debug(`SessionDescriptionHandler.onsignalingstatechange ${newState}`)
916
- if (this._peerConnectionDelegate?.onsignalingstatechange) {
917
- this._peerConnectionDelegate.onsignalingstatechange(event)
918
- }
919
- }
920
-
921
- peerConnection.onstatsended = (event): void => {
922
- this.logger.debug(`SessionDescriptionHandler.onstatsended`)
923
- if (this._peerConnectionDelegate?.onstatsended) {
924
- this._peerConnectionDelegate.onstatsended(event)
925
- }
926
- }
927
-
928
- peerConnection.ontrack = (event): void => {
929
- const kind = event.track.kind
930
- const enabled = event.track.enabled ? 'enabled' : 'disabled'
931
- this.logger.debug(`SessionDescriptionHandler.ontrack ${kind} ${enabled}`)
932
- this.setRemoteTrack(event.track)
933
- if (this._peerConnectionDelegate?.ontrack) {
934
- this._peerConnectionDelegate.ontrack(event)
935
- }
936
- }
937
- }
938
- }