ue-softphone-sdk 4.0.0 → 4.0.2

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 +2 -2
  2. package/dist/ue-softphone-sdk.js +2 -2
  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,997 +0,0 @@
1
- // @ts-nocheck
2
- import { Logger } from '../log'
3
- import {
4
- Body,
5
- C,
6
- getBody,
7
- IncomingRequestMessage,
8
- IncomingResponseMessage,
9
- isBody,
10
- NameAddrHeader,
11
- OutgoingAckRequest,
12
- OutgoingByeRequest,
13
- OutgoingInfoRequest,
14
- OutgoingInviteRequest,
15
- OutgoingInviteRequestDelegate,
16
- OutgoingMessageRequest,
17
- OutgoingNotifyRequest,
18
- OutgoingPrackRequest,
19
- OutgoingReferRequest,
20
- OutgoingRequestDelegate,
21
- OutgoingRequestMessage,
22
- RequestOptions
23
- } from '../messages'
24
- import { Session, SessionDelegate, SessionState, SignalingState } from '../session'
25
- import { Timers } from '../timers'
26
- import { InviteClientTransaction, InviteServerTransaction, TransactionState } from '../transactions'
27
- import { UserAgentCore } from '../user-agent-core'
28
- import { ByeUserAgentClient } from '../user-agents/bye-user-agent-client'
29
- import { ByeUserAgentServer } from '../user-agents/bye-user-agent-server'
30
- import { InfoUserAgentClient } from '../user-agents/info-user-agent-client'
31
- import { InfoUserAgentServer } from '../user-agents/info-user-agent-server'
32
- import { MessageUserAgentClient } from '../user-agents/message-user-agent-client'
33
- import { MessageUserAgentServer } from '../user-agents/message-user-agent-server'
34
- import { NotifyUserAgentClient } from '../user-agents/notify-user-agent-client'
35
- import { NotifyUserAgentServer } from '../user-agents/notify-user-agent-server'
36
- import { PrackUserAgentClient } from '../user-agents/prack-user-agent-client'
37
- import { PrackUserAgentServer } from '../user-agents/prack-user-agent-server'
38
- import { ReInviteUserAgentClient } from '../user-agents/re-invite-user-agent-client'
39
- import { ReInviteUserAgentServer } from '../user-agents/re-invite-user-agent-server'
40
- import { ReferUserAgentClient } from '../user-agents/refer-user-agent-client'
41
- import { ReferUserAgentServer } from '../user-agents/refer-user-agent-server'
42
- import { Dialog } from './dialog'
43
- import { DialogState } from './dialog-state'
44
-
45
- /**
46
- * Session Dialog.
47
- * @public
48
- */
49
- export class SessionDialog extends Dialog implements Session {
50
- public delegate: SessionDelegate | undefined
51
-
52
- public reinviteUserAgentClient: ReInviteUserAgentClient | undefined
53
- public reinviteUserAgentServer: ReInviteUserAgentServer | undefined
54
-
55
- /** The state of the offer/answer exchange. */
56
- private _signalingState: SignalingState = SignalingState.Initial
57
- /** The current offer. Undefined unless signaling state HaveLocalOffer, HaveRemoteOffer, or Stable. */
58
- private _offer: Body | undefined
59
- /** The current answer. Undefined unless signaling state Stable. */
60
- private _answer: Body | undefined
61
- /** The rollback offer. Undefined unless signaling state HaveLocalOffer or HaveRemoteOffer. */
62
- private _rollbackOffer: Body | undefined
63
- /** The rollback answer. Undefined unless signaling state HaveLocalOffer or HaveRemoteOffer. */
64
- private _rollbackAnswer: Body | undefined
65
-
66
- /** True if waiting for an ACK to the initial transaction 2xx (UAS only). */
67
- private ackWait = false
68
- /** True if processing an ACK to the initial transaction 2xx (UAS only). */
69
- private ackProcessing = false
70
- /** Retransmission timer for 2xx response which confirmed the dialog. */
71
- private invite2xxTimer: number | undefined
72
- /** The rseq of the last reliable response. */
73
- private rseq: number | undefined
74
-
75
- private logger: Logger
76
-
77
- constructor(
78
- private initialTransaction: InviteClientTransaction | InviteServerTransaction,
79
- core: UserAgentCore,
80
- state: DialogState,
81
- delegate?: SessionDelegate
82
- ) {
83
- super(core, state)
84
- this.delegate = delegate
85
- if (initialTransaction instanceof InviteServerTransaction) {
86
- // If we're created by an invite server transaction, we're
87
- // going to be waiting for an ACK if are to be confirmed.
88
- this.ackWait = true
89
- }
90
- // If we're confirmed upon creation start the retransmitting whatever
91
- // the 2xx final response was that confirmed us into existence.
92
- if (!this.early) {
93
- this.start2xxRetransmissionTimer()
94
- }
95
- this.signalingStateTransition(initialTransaction.request)
96
- this.logger = core.loggerFactory.getLogger('sip.invite-dialog')
97
- this.logger.log(`INVITE dialog ${this.id} constructed`)
98
- }
99
-
100
- public dispose(): void {
101
- super.dispose()
102
- this._signalingState = SignalingState.Closed
103
- this._offer = undefined
104
- this._answer = undefined
105
- if (this.invite2xxTimer) {
106
- clearTimeout(this.invite2xxTimer)
107
- this.invite2xxTimer = undefined
108
- }
109
-
110
- // The UAS MUST still respond to any pending requests received for that
111
- // dialog. It is RECOMMENDED that a 487 (Request Terminated) response
112
- // be generated to those pending requests.
113
- // https://tools.ietf.org/html/rfc3261#section-15.1.2
114
-
115
- // TODO:
116
- // this.userAgentServers.forEach((uas) => uas.reply(487));
117
-
118
- this.logger.log(`INVITE dialog ${this.id} destroyed`)
119
- }
120
-
121
- // FIXME: Need real state machine
122
- get sessionState(): SessionState {
123
- if (this.early) {
124
- return SessionState.Early
125
- } else if (this.ackWait) {
126
- return SessionState.AckWait
127
- } else if (this._signalingState === SignalingState.Closed) {
128
- return SessionState.Terminated
129
- } else {
130
- return SessionState.Confirmed
131
- }
132
- }
133
-
134
- /** The state of the offer/answer exchange. */
135
- get signalingState(): SignalingState {
136
- return this._signalingState
137
- }
138
-
139
- /** The current offer. Undefined unless signaling state HaveLocalOffer, HaveRemoteOffer, of Stable. */
140
- get offer(): Body | undefined {
141
- return this._offer
142
- }
143
-
144
- /** The current answer. Undefined unless signaling state Stable. */
145
- get answer(): Body | undefined {
146
- return this._answer
147
- }
148
-
149
- /** Confirm the dialog. Only matters if dialog is currently early. */
150
- public confirm(): void {
151
- // When we're confirmed start the retransmitting whatever
152
- // the 2xx final response that may have confirmed us.
153
- if (this.early) {
154
- this.start2xxRetransmissionTimer()
155
- }
156
- super.confirm()
157
- }
158
-
159
- /** Re-confirm the dialog. Only matters if handling re-INVITE request. */
160
- public reConfirm(): void {
161
- // When we're confirmed start the retransmitting whatever
162
- // the 2xx final response that may have confirmed us.
163
- if (this.reinviteUserAgentServer) {
164
- this.startReInvite2xxRetransmissionTimer()
165
- }
166
- }
167
-
168
- /**
169
- * The UAC core MUST generate an ACK request for each 2xx received from
170
- * the transaction layer. The header fields of the ACK are constructed
171
- * in the same way as for any request sent within a dialog (see Section
172
- * 12) with the exception of the CSeq and the header fields related to
173
- * authentication. The sequence number of the CSeq header field MUST be
174
- * the same as the INVITE being acknowledged, but the CSeq method MUST
175
- * be ACK. The ACK MUST contain the same credentials as the INVITE. If
176
- * the 2xx contains an offer (based on the rules above), the ACK MUST
177
- * carry an answer in its body. If the offer in the 2xx response is not
178
- * acceptable, the UAC core MUST generate a valid answer in the ACK and
179
- * then send a BYE immediately.
180
- * https://tools.ietf.org/html/rfc3261#section-13.2.2.4
181
- * @param options - ACK options bucket.
182
- */
183
- public ack(options: RequestOptions = {}): OutgoingAckRequest {
184
- this.logger.log(`INVITE dialog ${this.id} sending ACK request`)
185
- let transaction: InviteClientTransaction
186
- if (this.reinviteUserAgentClient) {
187
- // We're sending ACK for a re-INVITE
188
- if (!(this.reinviteUserAgentClient.transaction instanceof InviteClientTransaction)) {
189
- throw new Error('Transaction not instance of InviteClientTransaction.')
190
- }
191
- transaction = this.reinviteUserAgentClient.transaction
192
- this.reinviteUserAgentClient = undefined
193
- } else {
194
- // We're sending ACK for the initial INVITE
195
- if (!(this.initialTransaction instanceof InviteClientTransaction)) {
196
- throw new Error('Initial transaction not instance of InviteClientTransaction.')
197
- }
198
- transaction = this.initialTransaction
199
- }
200
- const message = this.createOutgoingRequestMessage(C.ACK, {
201
- cseq: transaction.request.cseq, // ACK cseq is INVITE cseq
202
- extraHeaders: options.extraHeaders,
203
- body: options.body
204
- })
205
- transaction.ackResponse(message) // See InviteClientTransaction for details.
206
- this.signalingStateTransition(message)
207
- return { message }
208
- }
209
-
210
- /**
211
- * Terminating a Session
212
- *
213
- * This section describes the procedures for terminating a session
214
- * established by SIP. The state of the session and the state of the
215
- * dialog are very closely related. When a session is initiated with an
216
- * INVITE, each 1xx or 2xx response from a distinct UAS creates a
217
- * dialog, and if that response completes the offer/answer exchange, it
218
- * also creates a session. As a result, each session is "associated"
219
- * with a single dialog - the one which resulted in its creation. If an
220
- * initial INVITE generates a non-2xx final response, that terminates
221
- * all sessions (if any) and all dialogs (if any) that were created
222
- * through responses to the request. By virtue of completing the
223
- * transaction, a non-2xx final response also prevents further sessions
224
- * from being created as a result of the INVITE. The BYE request is
225
- * used to terminate a specific session or attempted session. In this
226
- * case, the specific session is the one with the peer UA on the other
227
- * side of the dialog. When a BYE is received on a dialog, any session
228
- * associated with that dialog SHOULD terminate. A UA MUST NOT send a
229
- * BYE outside of a dialog. The caller's UA MAY send a BYE for either
230
- * confirmed or early dialogs, and the callee's UA MAY send a BYE on
231
- * confirmed dialogs, but MUST NOT send a BYE on early dialogs.
232
- *
233
- * However, the callee's UA MUST NOT send a BYE on a confirmed dialog
234
- * until it has received an ACK for its 2xx response or until the server
235
- * transaction times out. If no SIP extensions have defined other
236
- * application layer states associated with the dialog, the BYE also
237
- * terminates the dialog.
238
- *
239
- * https://tools.ietf.org/html/rfc3261#section-15
240
- * FIXME: Make these proper Exceptions...
241
- * @param options - BYE options bucket.
242
- * @returns
243
- * Throws `Error` if callee's UA attempts a BYE on an early dialog.
244
- * Throws `Error` if callee's UA attempts a BYE on a confirmed dialog
245
- * while it's waiting on the ACK for its 2xx response.
246
- */
247
- public bye(delegate?: OutgoingRequestDelegate, options?: RequestOptions): OutgoingByeRequest {
248
- this.logger.log(`INVITE dialog ${this.id} sending BYE request`)
249
-
250
- // The caller's UA MAY send a BYE for either
251
- // confirmed or early dialogs, and the callee's UA MAY send a BYE on
252
- // confirmed dialogs, but MUST NOT send a BYE on early dialogs.
253
- //
254
- // However, the callee's UA MUST NOT send a BYE on a confirmed dialog
255
- // until it has received an ACK for its 2xx response or until the server
256
- // transaction times out.
257
- // https://tools.ietf.org/html/rfc3261#section-15
258
- if (this.initialTransaction instanceof InviteServerTransaction) {
259
- if (this.early) {
260
- // FIXME: TODO: This should throw a proper exception.
261
- throw new Error('UAS MUST NOT send a BYE on early dialogs.')
262
- }
263
- if (this.ackWait && this.initialTransaction.state !== TransactionState.Terminated) {
264
- // FIXME: TODO: This should throw a proper exception.
265
- throw new Error(
266
- 'UAS MUST NOT send a BYE on a confirmed dialog ' +
267
- 'until it has received an ACK for its 2xx response ' +
268
- 'or until the server transaction times out.'
269
- )
270
- }
271
- }
272
-
273
- // A BYE request is constructed as would any other request within a
274
- // dialog, as described in Section 12.
275
- //
276
- // Once the BYE is constructed, the UAC core creates a new non-INVITE
277
- // client transaction, and passes it the BYE request. The UAC MUST
278
- // consider the session terminated (and therefore stop sending or
279
- // listening for media) as soon as the BYE request is passed to the
280
- // client transaction. If the response for the BYE is a 481
281
- // (Call/Transaction Does Not Exist) or a 408 (Request Timeout) or no
282
- // response at all is received for the BYE (that is, a timeout is
283
- // returned by the client transaction), the UAC MUST consider the
284
- // session and the dialog terminated.
285
- // https://tools.ietf.org/html/rfc3261#section-15.1.1
286
- return new ByeUserAgentClient(this, delegate, options)
287
- }
288
-
289
- /**
290
- * An INFO request can be associated with an Info Package (see
291
- * Section 5), or associated with a legacy INFO usage (see Section 2).
292
- *
293
- * The construction of the INFO request is the same as any other
294
- * non-target refresh request within an existing invite dialog usage as
295
- * described in Section 12.2 of RFC 3261.
296
- * https://tools.ietf.org/html/rfc6086#section-4.2.1
297
- * @param options - Options bucket.
298
- */
299
- public info(delegate?: OutgoingRequestDelegate, options?: RequestOptions): OutgoingInfoRequest {
300
- this.logger.log(`INVITE dialog ${this.id} sending INFO request`)
301
- if (this.early) {
302
- // FIXME: TODO: This should throw a proper exception.
303
- throw new Error('Dialog not confirmed.')
304
- }
305
- return new InfoUserAgentClient(this, delegate, options)
306
- }
307
-
308
- /**
309
- * Modifying an Existing Session
310
- *
311
- * A successful INVITE request (see Section 13) establishes both a
312
- * dialog between two user agents and a session using the offer-answer
313
- * model. Section 12 explains how to modify an existing dialog using a
314
- * target refresh request (for example, changing the remote target URI
315
- * of the dialog). This section describes how to modify the actual
316
- * session. This modification can involve changing addresses or ports,
317
- * adding a media stream, deleting a media stream, and so on. This is
318
- * accomplished by sending a new INVITE request within the same dialog
319
- * that established the session. An INVITE request sent within an
320
- * existing dialog is known as a re-INVITE.
321
- *
322
- * Note that a single re-INVITE can modify the dialog and the
323
- * parameters of the session at the same time.
324
- *
325
- * Either the caller or callee can modify an existing session.
326
- * https://tools.ietf.org/html/rfc3261#section-14
327
- * @param options - Options bucket
328
- */
329
- public invite(delegate?: OutgoingInviteRequestDelegate, options?: RequestOptions): OutgoingInviteRequest {
330
- this.logger.log(`INVITE dialog ${this.id} sending INVITE request`)
331
- if (this.early) {
332
- // FIXME: TODO: This should throw a proper exception.
333
- throw new Error('Dialog not confirmed.')
334
- }
335
-
336
- // Note that a UAC MUST NOT initiate a new INVITE transaction within a
337
- // dialog while another INVITE transaction is in progress in either
338
- // direction.
339
- //
340
- // 1. If there is an ongoing INVITE client transaction, the TU MUST
341
- // wait until the transaction reaches the completed or terminated
342
- // state before initiating the new INVITE.
343
- //
344
- // 2. If there is an ongoing INVITE server transaction, the TU MUST
345
- // wait until the transaction reaches the confirmed or terminated
346
- // state before initiating the new INVITE.
347
- //
348
- // However, a UA MAY initiate a regular transaction while an INVITE
349
- // transaction is in progress. A UA MAY also initiate an INVITE
350
- // transaction while a regular transaction is in progress.
351
- // https://tools.ietf.org/html/rfc3261#section-14.1
352
- if (this.reinviteUserAgentClient) {
353
- // FIXME: TODO: This should throw a proper exception.
354
- throw new Error('There is an ongoing re-INVITE client transaction.')
355
- }
356
- if (this.reinviteUserAgentServer) {
357
- // FIXME: TODO: This should throw a proper exception.
358
- throw new Error('There is an ongoing re-INVITE server transaction.')
359
- }
360
- return new ReInviteUserAgentClient(this, delegate, options)
361
- }
362
-
363
- /**
364
- * A UAC MAY associate a MESSAGE request with an existing dialog. If a
365
- * MESSAGE request is sent within a dialog, it is "associated" with any
366
- * media session or sessions associated with that dialog.
367
- * https://tools.ietf.org/html/rfc3428#section-4
368
- * @param options - Options bucket.
369
- */
370
- public message(delegate: OutgoingRequestDelegate, options?: RequestOptions): OutgoingMessageRequest {
371
- this.logger.log(`INVITE dialog ${this.id} sending MESSAGE request`)
372
- if (this.early) {
373
- // FIXME: TODO: This should throw a proper exception.
374
- throw new Error('Dialog not confirmed.')
375
- }
376
- const message = this.createOutgoingRequestMessage(C.MESSAGE, options)
377
- return new MessageUserAgentClient(this.core, message, delegate)
378
- }
379
-
380
- /**
381
- * The NOTIFY mechanism defined in [2] MUST be used to inform the agent
382
- * sending the REFER of the status of the reference.
383
- * https://tools.ietf.org/html/rfc3515#section-2.4.4
384
- * @param options - Options bucket.
385
- */
386
- public notify(delegate?: OutgoingRequestDelegate, options?: RequestOptions): OutgoingNotifyRequest {
387
- this.logger.log(`INVITE dialog ${this.id} sending NOTIFY request`)
388
- if (this.early) {
389
- // FIXME: TODO: This should throw a proper exception.
390
- throw new Error('Dialog not confirmed.')
391
- }
392
- return new NotifyUserAgentClient(this, delegate, options)
393
- }
394
-
395
- /**
396
- * Assuming the response is to be transmitted reliably, the UAC MUST
397
- * create a new request with method PRACK. This request is sent within
398
- * the dialog associated with the provisional response (indeed, the
399
- * provisional response may have created the dialog). PRACK requests
400
- * MAY contain bodies, which are interpreted according to their type and
401
- * disposition.
402
- * https://tools.ietf.org/html/rfc3262#section-4
403
- * @param options - Options bucket.
404
- */
405
- public prack(delegate?: OutgoingRequestDelegate, options?: RequestOptions): OutgoingPrackRequest {
406
- this.logger.log(`INVITE dialog ${this.id} sending PRACK request`)
407
- return new PrackUserAgentClient(this, delegate, options)
408
- }
409
-
410
- /**
411
- * REFER is a SIP request and is constructed as defined in [1]. A REFER
412
- * request MUST contain exactly one Refer-To header field value.
413
- * https://tools.ietf.org/html/rfc3515#section-2.4.1
414
- * @param options - Options bucket.
415
- */
416
- public refer(delegate?: OutgoingRequestDelegate, options?: RequestOptions): OutgoingReferRequest {
417
- this.logger.log(`INVITE dialog ${this.id} sending REFER request`)
418
- if (this.early) {
419
- // FIXME: TODO: This should throw a proper exception.
420
- throw new Error('Dialog not confirmed.')
421
- }
422
- // FIXME: TODO: Validate Refer-To header field value.
423
- return new ReferUserAgentClient(this, delegate, options)
424
- }
425
-
426
- /**
427
- * Requests sent within a dialog, as any other requests, are atomic. If
428
- * a particular request is accepted by the UAS, all the state changes
429
- * associated with it are performed. If the request is rejected, none
430
- * of the state changes are performed.
431
- * https://tools.ietf.org/html/rfc3261#section-12.2.2
432
- * @param message - Incoming request message within this dialog.
433
- */
434
- public receiveRequest(message: IncomingRequestMessage): void {
435
- this.logger.log(`INVITE dialog ${this.id} received ${message.method} request`)
436
-
437
- // Response retransmissions cease when an ACK request for the
438
- // response is received. This is independent of whatever transport
439
- // protocols are used to send the response.
440
- // https://tools.ietf.org/html/rfc6026#section-8.1
441
- if (message.method === C.ACK) {
442
- // If ackWait is true, then this is the ACK to the initial INVITE,
443
- // otherwise this is an ACK to an in dialog INVITE. In either case,
444
- // guard to make sure the sequence number of the ACK matches the INVITE.
445
- if (this.ackWait) {
446
- if (this.initialTransaction instanceof InviteClientTransaction) {
447
- this.logger.warn(`INVITE dialog ${this.id} received unexpected ${message.method} request, dropping.`)
448
- return
449
- }
450
- if (this.initialTransaction.request.cseq !== message.cseq) {
451
- this.logger.warn(`INVITE dialog ${this.id} received unexpected ${message.method} request, dropping.`)
452
- return
453
- }
454
- // Update before the delegate has a chance to handle the
455
- // message as delegate may callback into this dialog.
456
- this.ackWait = false
457
- } else {
458
- if (!this.reinviteUserAgentServer) {
459
- this.logger.warn(`INVITE dialog ${this.id} received unexpected ${message.method} request, dropping.`)
460
- return
461
- }
462
- if (this.reinviteUserAgentServer.transaction.request.cseq !== message.cseq) {
463
- this.logger.warn(`INVITE dialog ${this.id} received unexpected ${message.method} request, dropping.`)
464
- return
465
- }
466
- this.reinviteUserAgentServer = undefined
467
- }
468
- this.signalingStateTransition(message)
469
- if (this.delegate && this.delegate.onAck) {
470
- const promiseOrVoid = this.delegate.onAck({ message })
471
- if (promiseOrVoid instanceof Promise) {
472
- this.ackProcessing = true // make sure this is always reset to false
473
- promiseOrVoid.then(() => (this.ackProcessing = false)).catch(() => (this.ackProcessing = false))
474
- }
475
- }
476
- return
477
- }
478
-
479
- // Request within a dialog out of sequence guard.
480
- // https://tools.ietf.org/html/rfc3261#section-12.2.2
481
- if (!this.sequenceGuard(message)) {
482
- this.logger.log(`INVITE dialog ${this.id} rejected out of order ${message.method} request.`)
483
- return
484
- }
485
-
486
- // Request within a dialog common processing.
487
- // https://tools.ietf.org/html/rfc3261#section-12.2.2
488
- super.receiveRequest(message)
489
-
490
- // Handle various INVITE related cross-over, glare and race conditions
491
- if (message.method === C.INVITE) {
492
- // Hopefully this message is helpful...
493
- const warning = (): void => {
494
- const reason = this.ackWait ? 'waiting for initial ACK' : 'processing initial ACK'
495
- this.logger.warn(`INVITE dialog ${this.id} received re-INVITE while ${reason}`)
496
- let msg = 'RFC 5407 suggests the following to avoid this race condition... '
497
- msg += ' Note: Implementation issues are outside the scope of this document,'
498
- msg += ' but the following tip is provided for avoiding race conditions of'
499
- msg += ' this type. The caller can delay sending re-INVITE F6 for some period'
500
- msg += ' of time (2 seconds, perhaps), after which the caller can reasonably'
501
- msg += ' assume that its ACK has been received. Implementors can decouple the'
502
- msg += ' actions of the user (e.g., pressing the hold button) from the actions'
503
- msg += ' of the protocol (the sending of re-INVITE F6), so that the UA can'
504
- msg += " behave like this. In this case, it is the implementor's choice as to"
505
- msg += ' how long to wait. In most cases, such an implementation may be'
506
- msg += ' useful to prevent the type of race condition shown in this section.'
507
- msg += ' This document expresses no preference about whether or not they'
508
- msg += ' should wait for an ACK to be delivered. After considering the impact'
509
- msg += ' on user experience, implementors should decide whether or not to wait'
510
- msg += ' for a while, because the user experience depends on the'
511
- msg += ' implementation and has no direct bearing on protocol behavior.'
512
- this.logger.warn(msg)
513
- return // drop re-INVITE request message
514
- }
515
-
516
- // A UAS that receives a second INVITE before it sends the final
517
- // response to a first INVITE with a lower CSeq sequence number on the
518
- // same dialog MUST return a 500 (Server Internal Error) response to the
519
- // second INVITE and MUST include a Retry-After header field with a
520
- // randomly chosen value of between 0 and 10 seconds.
521
- // https://tools.ietf.org/html/rfc3261#section-14.2
522
- const retryAfter = Math.floor(Math.random() * 10) + 1
523
- const extraHeaders = [`Retry-After: ${retryAfter}`]
524
-
525
- // There may be ONLY ONE offer/answer negotiation in progress for a
526
- // single dialog at any point in time. Section 4 explains how to ensure
527
- // this.
528
- // https://tools.ietf.org/html/rfc6337#section-2.2
529
- if (this.ackProcessing) {
530
- // UAS-IsI: While an INVITE server transaction is incomplete or ACK
531
- // transaction associated with an offer/answer is incomplete,
532
- // a UA must reject another INVITE request with a 500
533
- // response.
534
- // https://tools.ietf.org/html/rfc6337#section-4.3
535
- this.core.replyStateless(message, { statusCode: 500, extraHeaders })
536
- warning()
537
- return
538
- }
539
-
540
- // 3.1.4. Callee Receives re-INVITE (Established State) While in the
541
- // Moratorium State (Case 1)
542
- // https://tools.ietf.org/html/rfc5407#section-3.1.4
543
- // 3.1.5. Callee Receives re-INVITE (Established State) While in the
544
- // Moratorium State (Case 2)
545
- // https://tools.ietf.org/html/rfc5407#section-3.1.5
546
- if (this.ackWait && this.signalingState !== SignalingState.Stable) {
547
- // This scenario is basically the same as that of Section 3.1.4, but
548
- // differs in sending an offer in the 200 and an answer in the ACK. In
549
- // contrast to the previous case, the offer in the 200 (F3) and the
550
- // offer in the re-INVITE (F6) collide with each other.
551
- //
552
- // Bob sends a 491 to the re-INVITE (F6) since he is not able to
553
- // properly handle a new request until he receives an answer. (Note:
554
- // 500 with a Retry-After header may be returned if the 491 response is
555
- // understood to indicate request collision. However, 491 is
556
- // recommended here because 500 applies to so many cases that it is
557
- // difficult to determine what the real problem was.)
558
- // https://tools.ietf.org/html/rfc5407#section-3.1.5
559
-
560
- // UAS-IsI: While an INVITE server transaction is incomplete or ACK
561
- // transaction associated with an offer/answer is incomplete,
562
- // a UA must reject another INVITE request with a 500
563
- // response.
564
- // https://tools.ietf.org/html/rfc6337#section-4.3
565
- this.core.replyStateless(message, { statusCode: 500, extraHeaders })
566
- warning()
567
- return
568
- }
569
-
570
- // A UAS that receives a second INVITE before it sends the final
571
- // response to a first INVITE with a lower CSeq sequence number on the
572
- // same dialog MUST return a 500 (Server Internal Error) response to the
573
- // second INVITE and MUST include a Retry-After header field with a
574
- // randomly chosen value of between 0 and 10 seconds.
575
- // https://tools.ietf.org/html/rfc3261#section-14.2
576
- if (this.reinviteUserAgentServer) {
577
- this.core.replyStateless(message, { statusCode: 500, extraHeaders })
578
- return
579
- }
580
-
581
- // A UAS that receives an INVITE on a dialog while an INVITE it had sent
582
- // on that dialog is in progress MUST return a 491 (Request Pending)
583
- // response to the received INVITE.
584
- // https://tools.ietf.org/html/rfc3261#section-14.2
585
- if (this.reinviteUserAgentClient) {
586
- this.core.replyStateless(message, { statusCode: 491 })
587
- return
588
- }
589
- }
590
-
591
- // Requests within a dialog MAY contain Record-Route and Contact header
592
- // fields. However, these requests do not cause the dialog's route set
593
- // to be modified, although they may modify the remote target URI.
594
- // Specifically, requests that are not target refresh requests do not
595
- // modify the dialog's remote target URI, and requests that are target
596
- // refresh requests do. For dialogs that have been established with an
597
- // INVITE, the only target refresh request defined is re-INVITE (see
598
- // Section 14). Other extensions may define different target refresh
599
- // requests for dialogs established in other ways.
600
- //
601
- // Note that an ACK is NOT a target refresh request.
602
- //
603
- // Target refresh requests only update the dialog's remote target URI,
604
- // and not the route set formed from the Record-Route. Updating the
605
- // latter would introduce severe backwards compatibility problems with
606
- // RFC 2543-compliant systems.
607
- // https://tools.ietf.org/html/rfc3261#section-15
608
- if (message.method === C.INVITE) {
609
- // FIXME: parser needs to be typed...
610
- const contact = message.parseHeader('contact')
611
- if (!contact) {
612
- // TODO: Review to make sure this will never happen
613
- throw new Error('Contact undefined.')
614
- }
615
- if (!(contact instanceof NameAddrHeader)) {
616
- throw new Error('Contact not instance of NameAddrHeader.')
617
- }
618
- this.dialogState.remoteTarget = contact.uri
619
- }
620
-
621
- // Switch on method and then delegate.
622
- switch (message.method) {
623
- case C.BYE:
624
- // A UAS core receiving a BYE request for an existing dialog MUST follow
625
- // the procedures of Section 12.2.2 to process the request. Once done,
626
- // the UAS SHOULD terminate the session (and therefore stop sending and
627
- // listening for media). The only case where it can elect not to are
628
- // multicast sessions, where participation is possible even if the other
629
- // participant in the dialog has terminated its involvement in the
630
- // session. Whether or not it ends its participation on the session,
631
- // the UAS core MUST generate a 2xx response to the BYE, and MUST pass
632
- // that to the server transaction for transmission.
633
- //
634
- // The UAS MUST still respond to any pending requests received for that
635
- // dialog. It is RECOMMENDED that a 487 (Request Terminated) response
636
- // be generated to those pending requests.
637
- // https://tools.ietf.org/html/rfc3261#section-15.1.2
638
- {
639
- const uas = new ByeUserAgentServer(this, message)
640
- this.delegate && this.delegate.onBye ? this.delegate.onBye(uas) : uas.accept()
641
- this.dispose()
642
- }
643
- break
644
- case C.INFO:
645
- // If a UA receives an INFO request associated with an Info Package that
646
- // the UA has not indicated willingness to receive, the UA MUST send a
647
- // 469 (Bad Info Package) response (see Section 11.6), which contains a
648
- // Recv-Info header field with Info Packages for which the UA is willing
649
- // to receive INFO requests.
650
- {
651
- const uas = new InfoUserAgentServer(this, message)
652
- this.delegate && this.delegate.onInfo
653
- ? this.delegate.onInfo(uas)
654
- : uas.reject({
655
- statusCode: 469,
656
- extraHeaders: ['Recv-Info:']
657
- })
658
- }
659
- break
660
- case C.INVITE:
661
- // If the new session description is not acceptable, the UAS can reject
662
- // it by returning a 488 (Not Acceptable Here) response for the re-
663
- // INVITE. This response SHOULD include a Warning header field.
664
- // https://tools.ietf.org/html/rfc3261#section-14.2
665
- {
666
- const uas = new ReInviteUserAgentServer(this, message)
667
- this.signalingStateTransition(message)
668
- this.delegate && this.delegate.onInvite ? this.delegate.onInvite(uas) : uas.reject({ statusCode: 488 }) // TODO: Warning header field.
669
- }
670
- break
671
- case C.MESSAGE:
672
- {
673
- const uas = new MessageUserAgentServer(this.core, message)
674
- this.delegate && this.delegate.onMessage ? this.delegate.onMessage(uas) : uas.accept()
675
- }
676
- break
677
- case C.NOTIFY:
678
- // https://tools.ietf.org/html/rfc3515#section-2.4.4
679
- {
680
- const uas = new NotifyUserAgentServer(this, message)
681
- this.delegate && this.delegate.onNotify ? this.delegate.onNotify(uas) : uas.accept()
682
- }
683
- break
684
- case C.PRACK:
685
- // https://tools.ietf.org/html/rfc3262#section-4
686
- {
687
- const uas = new PrackUserAgentServer(this, message)
688
- this.delegate && this.delegate.onPrack ? this.delegate.onPrack(uas) : uas.accept()
689
- }
690
- break
691
- case C.REFER:
692
- // https://tools.ietf.org/html/rfc3515#section-2.4.2
693
- {
694
- const uas = new ReferUserAgentServer(this, message)
695
- this.delegate && this.delegate.onRefer ? this.delegate.onRefer(uas) : uas.reject()
696
- }
697
- break
698
- default:
699
- {
700
- this.logger.log(`INVITE dialog ${this.id} received unimplemented ${message.method} request`)
701
- this.core.replyStateless(message, { statusCode: 501 })
702
- }
703
- break
704
- }
705
- }
706
-
707
- /**
708
- * Guard against out of order reliable provisional responses and retransmissions.
709
- * Returns false if the response should be discarded, otherwise true.
710
- * @param message - Incoming response message within this dialog.
711
- */
712
- public reliableSequenceGuard(message: IncomingResponseMessage): boolean {
713
- const statusCode = message.statusCode
714
- if (!statusCode) {
715
- throw new Error('Status code undefined')
716
- }
717
-
718
- if (statusCode > 100 && statusCode < 200) {
719
- // If a provisional response is received for an initial request, and
720
- // that response contains a Require header field containing the option
721
- // tag 100rel, the response is to be sent reliably. If the response is
722
- // a 100 (Trying) (as opposed to 101 to 199), this option tag MUST be
723
- // ignored, and the procedures below MUST NOT be used.
724
- // https://tools.ietf.org/html/rfc3262#section-4
725
- const requireHeader = message.getHeader('require')
726
- const rseqHeader = message.getHeader('rseq')
727
- const rseq = requireHeader && requireHeader.includes('100rel') && rseqHeader ? Number(rseqHeader) : undefined
728
- if (rseq) {
729
- // Handling of subsequent reliable provisional responses for the same
730
- // initial request follows the same rules as above, with the following
731
- // difference: reliable provisional responses are guaranteed to be in
732
- // order. As a result, if the UAC receives another reliable provisional
733
- // response to the same request, and its RSeq value is not one higher
734
- // than the value of the sequence number, that response MUST NOT be
735
- // acknowledged with a PRACK, and MUST NOT be processed further by the
736
- // UAC. An implementation MAY discard the response, or MAY cache the
737
- // response in the hopes of receiving the missing responses.
738
- // https://tools.ietf.org/html/rfc3262#section-4
739
- if (this.rseq && this.rseq + 1 !== rseq) {
740
- return false
741
- }
742
-
743
- // Once a reliable provisional response is received, retransmissions of
744
- // that response MUST be discarded. A response is a retransmission when
745
- // its dialog ID, CSeq, and RSeq match the original response. The UAC
746
- // MUST maintain a sequence number that indicates the most recently
747
- // received in-order reliable provisional response for the initial
748
- // request. This sequence number MUST be maintained until a final
749
- // response is received for the initial request. Its value MUST be
750
- // initialized to the RSeq header field in the first reliable
751
- // provisional response received for the initial request.
752
- // https://tools.ietf.org/html/rfc3262#section-4
753
- this.rseq = this.rseq ? this.rseq + 1 : rseq
754
- }
755
- }
756
-
757
- return true
758
- }
759
-
760
- /**
761
- * If not in a stable signaling state, rollback to prior stable signaling state.
762
- */
763
- public signalingStateRollback(): void {
764
- if (
765
- this._signalingState === SignalingState.HaveLocalOffer ||
766
- this.signalingState === SignalingState.HaveRemoteOffer
767
- ) {
768
- if (this._rollbackOffer && this._rollbackAnswer) {
769
- this._signalingState = SignalingState.Stable
770
- this._offer = this._rollbackOffer
771
- this._answer = this._rollbackAnswer
772
- }
773
- }
774
- }
775
-
776
- /**
777
- * Update the signaling state of the dialog.
778
- * @param message - The message to base the update off of.
779
- */
780
- public signalingStateTransition(
781
- message: IncomingRequestMessage | IncomingResponseMessage | OutgoingRequestMessage | Body
782
- ): void {
783
- const body = getBody(message)
784
-
785
- // No body, no session. No, woman, no cry.
786
- if (!body || body.contentDisposition !== 'session') {
787
- return
788
- }
789
-
790
- // We've got an existing offer and answer which we may wish to rollback to
791
- if (this._signalingState === SignalingState.Stable) {
792
- this._rollbackOffer = this._offer
793
- this._rollbackAnswer = this._answer
794
- }
795
-
796
- // We're in UAS role, receiving incoming request with session description
797
- if (message instanceof IncomingRequestMessage) {
798
- switch (this._signalingState) {
799
- case SignalingState.Initial:
800
- case SignalingState.Stable:
801
- this._signalingState = SignalingState.HaveRemoteOffer
802
- this._offer = body
803
- this._answer = undefined
804
- break
805
- case SignalingState.HaveLocalOffer:
806
- this._signalingState = SignalingState.Stable
807
- this._answer = body
808
- break
809
- case SignalingState.HaveRemoteOffer:
810
- // You cannot make a new offer while one is in progress.
811
- // https://tools.ietf.org/html/rfc3261#section-13.2.1
812
- // FIXME: What to do here?
813
- break
814
- case SignalingState.Closed:
815
- break
816
- default:
817
- throw new Error('Unexpected signaling state.')
818
- }
819
- }
820
-
821
- // We're in UAC role, receiving incoming response with session description
822
- if (message instanceof IncomingResponseMessage) {
823
- switch (this._signalingState) {
824
- case SignalingState.Initial:
825
- case SignalingState.Stable:
826
- this._signalingState = SignalingState.HaveRemoteOffer
827
- this._offer = body
828
- this._answer = undefined
829
- break
830
- case SignalingState.HaveLocalOffer:
831
- this._signalingState = SignalingState.Stable
832
- this._answer = body
833
- break
834
- case SignalingState.HaveRemoteOffer:
835
- // You cannot make a new offer while one is in progress.
836
- // https://tools.ietf.org/html/rfc3261#section-13.2.1
837
- // FIXME: What to do here?
838
- break
839
- case SignalingState.Closed:
840
- break
841
- default:
842
- throw new Error('Unexpected signaling state.')
843
- }
844
- }
845
-
846
- // We're in UAC role, sending outgoing request with session description
847
- if (message instanceof OutgoingRequestMessage) {
848
- switch (this._signalingState) {
849
- case SignalingState.Initial:
850
- case SignalingState.Stable:
851
- this._signalingState = SignalingState.HaveLocalOffer
852
- this._offer = body
853
- this._answer = undefined
854
- break
855
- case SignalingState.HaveLocalOffer:
856
- // You cannot make a new offer while one is in progress.
857
- // https://tools.ietf.org/html/rfc3261#section-13.2.1
858
- // FIXME: What to do here?
859
- break
860
- case SignalingState.HaveRemoteOffer:
861
- this._signalingState = SignalingState.Stable
862
- this._answer = body
863
- break
864
- case SignalingState.Closed:
865
- break
866
- default:
867
- throw new Error('Unexpected signaling state.')
868
- }
869
- }
870
-
871
- // We're in UAS role, sending outgoing response with session description
872
- if (isBody(message)) {
873
- switch (this._signalingState) {
874
- case SignalingState.Initial:
875
- case SignalingState.Stable:
876
- this._signalingState = SignalingState.HaveLocalOffer
877
- this._offer = body
878
- this._answer = undefined
879
- break
880
- case SignalingState.HaveLocalOffer:
881
- // You cannot make a new offer while one is in progress.
882
- // https://tools.ietf.org/html/rfc3261#section-13.2.1
883
- // FIXME: What to do here?
884
- break
885
- case SignalingState.HaveRemoteOffer:
886
- this._signalingState = SignalingState.Stable
887
- this._answer = body
888
- break
889
- case SignalingState.Closed:
890
- break
891
- default:
892
- throw new Error('Unexpected signaling state.')
893
- }
894
- }
895
- }
896
-
897
- private start2xxRetransmissionTimer(): void {
898
- if (this.initialTransaction instanceof InviteServerTransaction) {
899
- const transaction = this.initialTransaction
900
-
901
- // Once the response has been constructed, it is passed to the INVITE
902
- // server transaction. In order to ensure reliable end-to-end
903
- // transport of the response, it is necessary to periodically pass
904
- // the response directly to the transport until the ACK arrives. The
905
- // 2xx response is passed to the transport with an interval that
906
- // starts at T1 seconds and doubles for each retransmission until it
907
- // reaches T2 seconds (T1 and T2 are defined in Section 17).
908
- // Response retransmissions cease when an ACK request for the
909
- // response is received. This is independent of whatever transport
910
- // protocols are used to send the response.
911
- // https://tools.ietf.org/html/rfc6026#section-8.1
912
- let timeout = Timers.T1
913
- const retransmission = (): void => {
914
- if (!this.ackWait) {
915
- this.invite2xxTimer = undefined
916
- return
917
- }
918
- this.logger.log('No ACK for 2xx response received, attempting retransmission')
919
- transaction.retransmitAcceptedResponse()
920
- timeout = Math.min(timeout * 2, Timers.T2)
921
- this.invite2xxTimer = setTimeout(retransmission, timeout)
922
- }
923
- this.invite2xxTimer = setTimeout(retransmission, timeout)
924
-
925
- // If the server retransmits the 2xx response for 64*T1 seconds without
926
- // receiving an ACK, the dialog is confirmed, but the session SHOULD be
927
- // terminated. This is accomplished with a BYE, as described in Section 15.
928
- // https://tools.ietf.org/html/rfc3261#section-13.3.1.4
929
- const stateChanged = (): void => {
930
- if (transaction.state === TransactionState.Terminated) {
931
- transaction.removeStateChangeListener(stateChanged)
932
- if (this.invite2xxTimer) {
933
- clearTimeout(this.invite2xxTimer)
934
- this.invite2xxTimer = undefined
935
- }
936
- if (this.ackWait) {
937
- if (this.delegate && this.delegate.onAckTimeout) {
938
- this.delegate.onAckTimeout()
939
- } else {
940
- this.bye()
941
- }
942
- }
943
- }
944
- }
945
- transaction.addStateChangeListener(stateChanged)
946
- }
947
- }
948
-
949
- // FIXME: Refactor
950
- private startReInvite2xxRetransmissionTimer(): void {
951
- if (this.reinviteUserAgentServer && this.reinviteUserAgentServer.transaction instanceof InviteServerTransaction) {
952
- const transaction = this.reinviteUserAgentServer.transaction
953
-
954
- // Once the response has been constructed, it is passed to the INVITE
955
- // server transaction. In order to ensure reliable end-to-end
956
- // transport of the response, it is necessary to periodically pass
957
- // the response directly to the transport until the ACK arrives. The
958
- // 2xx response is passed to the transport with an interval that
959
- // starts at T1 seconds and doubles for each retransmission until it
960
- // reaches T2 seconds (T1 and T2 are defined in Section 17).
961
- // Response retransmissions cease when an ACK request for the
962
- // response is received. This is independent of whatever transport
963
- // protocols are used to send the response.
964
- // https://tools.ietf.org/html/rfc6026#section-8.1
965
- let timeout = Timers.T1
966
- const retransmission = (): void => {
967
- if (!this.reinviteUserAgentServer) {
968
- this.invite2xxTimer = undefined
969
- return
970
- }
971
- this.logger.log('No ACK for 2xx response received, attempting retransmission')
972
- transaction.retransmitAcceptedResponse()
973
- timeout = Math.min(timeout * 2, Timers.T2)
974
- this.invite2xxTimer = setTimeout(retransmission, timeout)
975
- }
976
- this.invite2xxTimer = setTimeout(retransmission, timeout)
977
-
978
- // If the server retransmits the 2xx response for 64*T1 seconds without
979
- // receiving an ACK, the dialog is confirmed, but the session SHOULD be
980
- // terminated. This is accomplished with a BYE, as described in Section 15.
981
- // https://tools.ietf.org/html/rfc3261#section-13.3.1.4
982
- const stateChanged = (): void => {
983
- if (transaction.state === TransactionState.Terminated) {
984
- transaction.removeStateChangeListener(stateChanged)
985
- if (this.invite2xxTimer) {
986
- clearTimeout(this.invite2xxTimer)
987
- this.invite2xxTimer = undefined
988
- }
989
- if (this.reinviteUserAgentServer) {
990
- // FIXME: TODO: What to do here
991
- }
992
- }
993
- }
994
- transaction.addStateChangeListener(stateChanged)
995
- }
996
- }
997
- }