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,505 +0,0 @@
1
- // @ts-nocheck
2
- import { TransportError } from '../exceptions'
3
-
4
- import { IncomingResponseMessage, OutgoingRequestMessage } from '../messages'
5
- import { Timers } from '../timers'
6
- import { Transport } from '../transport'
7
- import { ClientTransaction } from './client-transaction'
8
- import { TransactionState } from './transaction-state'
9
- import { ClientTransactionUser } from './transaction-user'
10
-
11
- /**
12
- * INVITE Client Transaction.
13
- * @remarks
14
- * The INVITE transaction consists of a three-way handshake. The client
15
- * transaction sends an INVITE, the server transaction sends responses,
16
- * and the client transaction sends an ACK.
17
- * https://tools.ietf.org/html/rfc3261#section-17.1.1
18
- * @public
19
- */
20
- export class InviteClientTransaction extends ClientTransaction {
21
- private B: number | undefined
22
- private D: number | undefined
23
- private M: number | undefined
24
-
25
- /**
26
- * Map of 2xx to-tag to ACK.
27
- * If value is not undefined, value is the ACK which was sent.
28
- * If key exists but value is undefined, a 2xx was received but the ACK not yet sent.
29
- * Otherwise, a 2xx was not (yet) received for this transaction.
30
- */
31
- private ackRetransmissionCache: Map<string, OutgoingRequestMessage | undefined> = new Map()
32
-
33
- /**
34
- * Constructor.
35
- * Upon construction, the outgoing request's Via header is updated by calling `setViaHeader`.
36
- * Then `toString` is called on the outgoing request and the message is sent via the transport.
37
- * After construction the transaction will be in the "calling" state and the transaction id
38
- * will equal the branch parameter set in the Via header of the outgoing request.
39
- * https://tools.ietf.org/html/rfc3261#section-17.1.1
40
- * @param request - The outgoing INVITE request.
41
- * @param transport - The transport.
42
- * @param user - The transaction user.
43
- */
44
- constructor(request: OutgoingRequestMessage, transport: Transport, user: ClientTransactionUser) {
45
- super(request, transport, user, TransactionState.Calling, 'sip.transaction.ict')
46
- // FIXME: Timer A for unreliable transport not implemented
47
- //
48
- // If an unreliable transport is being used, the client transaction
49
- // MUST start timer A with a value of T1. If a reliable transport is being used,
50
- // the client transaction SHOULD NOT start timer A (Timer A controls request retransmissions).
51
- // For any transport, the client transaction MUST start timer B with a value
52
- // of 64*T1 seconds (Timer B controls transaction timeouts).
53
- // https://tools.ietf.org/html/rfc3261#section-17.1.1.2
54
- //
55
- // While not spelled out in the RFC, Timer B is the maximum amount of time that a sender
56
- // will wait for an INVITE message to be acknowledged (a SIP response message is received).
57
- // So Timer B should be cleared when the transaction state proceeds from "Calling".
58
- this.B = setTimeout(() => this.timerB(), Timers.TIMER_B)
59
- this.send(request.toString()).catch((error: TransportError) => {
60
- this.logTransportError(error, 'Failed to send initial outgoing request.')
61
- })
62
- }
63
-
64
- /**
65
- * Destructor.
66
- */
67
- public dispose(): void {
68
- if (this.B) {
69
- clearTimeout(this.B)
70
- this.B = undefined
71
- }
72
- if (this.D) {
73
- clearTimeout(this.D)
74
- this.D = undefined
75
- }
76
- if (this.M) {
77
- clearTimeout(this.M)
78
- this.M = undefined
79
- }
80
- super.dispose()
81
- }
82
-
83
- /** Transaction kind. Deprecated. */
84
- get kind(): string {
85
- return 'ict'
86
- }
87
-
88
- /**
89
- * ACK a 2xx final response.
90
- *
91
- * The transaction includes the ACK only if the final response was not a 2xx response (the
92
- * transaction will generate and send the ACK to the transport automagically). If the
93
- * final response was a 2xx, the ACK is not considered part of the transaction (the
94
- * transaction user needs to generate and send the ACK).
95
- *
96
- * This library is not strictly RFC compliant with regard to ACK handling for 2xx final
97
- * responses. Specifically, retransmissions of ACKs to a 2xx final responses is handled
98
- * by the transaction layer (instead of the UAC core). The "standard" approach is for
99
- * the UAC core to receive all 2xx responses and manage sending ACK retransmissions to
100
- * the transport directly. Herein the transaction layer manages sending ACKs to 2xx responses
101
- * and any retransmissions of those ACKs as needed.
102
- *
103
- * @param ack - The outgoing ACK request.
104
- */
105
- public ackResponse(ack: OutgoingRequestMessage): void {
106
- const toTag = ack.toTag
107
- if (!toTag) {
108
- throw new Error('To tag undefined.')
109
- }
110
- const id = 'z9hG4bK' + Math.floor(Math.random() * 10000000)
111
- ack.setViaHeader(id, this.transport.protocol)
112
- this.ackRetransmissionCache.set(toTag, ack) // Add to ACK retransmission cache
113
- this.send(ack.toString()).catch((error: TransportError) => {
114
- this.logTransportError(error, 'Failed to send ACK to 2xx response.')
115
- })
116
- }
117
-
118
- /**
119
- * Handler for incoming responses from the transport which match this transaction.
120
- * @param response - The incoming response.
121
- */
122
- public receiveResponse(response: IncomingResponseMessage): void {
123
- const statusCode = response.statusCode
124
- if (!statusCode || statusCode < 100 || statusCode > 699) {
125
- throw new Error(`Invalid status code ${statusCode}`)
126
- }
127
-
128
- switch (this.state) {
129
- case TransactionState.Calling:
130
- // If the client transaction receives a provisional response while in
131
- // the "Calling" state, it transitions to the "Proceeding" state. In the
132
- // "Proceeding" state, the client transaction SHOULD NOT retransmit the
133
- // request any longer. Furthermore, the provisional response MUST be
134
- // passed to the TU. Any further provisional responses MUST be passed
135
- // up to the TU while in the "Proceeding" state.
136
- // https://tools.ietf.org/html/rfc3261#section-17.1.1.2
137
- if (statusCode >= 100 && statusCode <= 199) {
138
- this.stateTransition(TransactionState.Proceeding)
139
- if (this.user.receiveResponse) {
140
- this.user.receiveResponse(response)
141
- }
142
- return
143
- }
144
- // When a 2xx response is received while in either the "Calling" or
145
- // "Proceeding" states, the client transaction MUST transition to
146
- // the "Accepted" state... The 2xx response MUST be passed up to the TU.
147
- // The client transaction MUST NOT generate an ACK to the 2xx response -- its
148
- // handling is delegated to the TU. A UAC core will send an ACK to
149
- // the 2xx response using a new transaction.
150
- // https://tools.ietf.org/html/rfc6026#section-8.4
151
- if (statusCode >= 200 && statusCode <= 299) {
152
- this.ackRetransmissionCache.set(response.toTag, undefined) // Prime the ACK cache
153
- this.stateTransition(TransactionState.Accepted)
154
- if (this.user.receiveResponse) {
155
- this.user.receiveResponse(response)
156
- }
157
- return
158
- }
159
- // When in either the "Calling" or "Proceeding" states, reception of
160
- // a response with status code from 300-699 MUST cause the client
161
- // transaction to transition to "Completed". The client transaction
162
- // MUST pass the received response up to the TU, and the client
163
- // transaction MUST generate an ACK request, even if the transport is
164
- // reliable (guidelines for constructing the ACK from the response
165
- // are given in Section 17.1.1.3), and then pass the ACK to the
166
- // transport layer for transmission. The ACK MUST be sent to the
167
- // same address, port, and transport to which the original request was sent.
168
- // https://tools.ietf.org/html/rfc6026#section-8.4
169
- if (statusCode >= 300 && statusCode <= 699) {
170
- this.stateTransition(TransactionState.Completed)
171
- this.ack(response)
172
- if (this.user.receiveResponse) {
173
- this.user.receiveResponse(response)
174
- }
175
- return
176
- }
177
- break
178
- case TransactionState.Proceeding:
179
- // In the "Proceeding" state, the client transaction SHOULD NOT retransmit the
180
- // request any longer. Furthermore, the provisional response MUST be
181
- // passed to the TU. Any further provisional responses MUST be passed
182
- // up to the TU while in the "Proceeding" state.
183
- // https://tools.ietf.org/html/rfc3261#section-17.1.1.2
184
- if (statusCode >= 100 && statusCode <= 199) {
185
- if (this.user.receiveResponse) {
186
- this.user.receiveResponse(response)
187
- }
188
- return
189
- }
190
- // When a 2xx response is received while in either the "Calling" or "Proceeding" states,
191
- // the client transaction MUST transition to the "Accepted" state...
192
- // The 2xx response MUST be passed up to the TU. The client
193
- // transaction MUST NOT generate an ACK to the 2xx response -- its
194
- // handling is delegated to the TU. A UAC core will send an ACK to
195
- // the 2xx response using a new transaction.
196
- // https://tools.ietf.org/html/rfc6026#section-8.4
197
- if (statusCode >= 200 && statusCode <= 299) {
198
- this.ackRetransmissionCache.set(response.toTag, undefined) // Prime the ACK cache
199
- this.stateTransition(TransactionState.Accepted)
200
- if (this.user.receiveResponse) {
201
- this.user.receiveResponse(response)
202
- }
203
- return
204
- }
205
- // When in either the "Calling" or "Proceeding" states, reception of
206
- // a response with status code from 300-699 MUST cause the client
207
- // transaction to transition to "Completed". The client transaction
208
- // MUST pass the received response up to the TU, and the client
209
- // transaction MUST generate an ACK request, even if the transport is
210
- // reliable (guidelines for constructing the ACK from the response
211
- // are given in Section 17.1.1.3), and then pass the ACK to the
212
- // transport layer for transmission. The ACK MUST be sent to the
213
- // same address, port, and transport to which the original request was sent.
214
- // https://tools.ietf.org/html/rfc6026#section-8.4
215
- if (statusCode >= 300 && statusCode <= 699) {
216
- this.stateTransition(TransactionState.Completed)
217
- this.ack(response)
218
- if (this.user.receiveResponse) {
219
- this.user.receiveResponse(response)
220
- }
221
- return
222
- }
223
- break
224
- case TransactionState.Accepted:
225
- // The purpose of the "Accepted" state is to allow the client
226
- // transaction to continue to exist to receive, and pass to the TU,
227
- // any retransmissions of the 2xx response and any additional 2xx
228
- // responses from other branches of the INVITE if it forked
229
- // downstream. Timer M reflects the amount of time that the
230
- // transaction user will wait for such messages.
231
- //
232
- // Any 2xx responses that match this client transaction and that are
233
- // received while in the "Accepted" state MUST be passed up to the
234
- // TU. The client transaction MUST NOT generate an ACK to the 2xx
235
- // response. The client transaction takes no further action.
236
- // https://tools.ietf.org/html/rfc6026#section-8.4
237
- if (statusCode >= 200 && statusCode <= 299) {
238
- // NOTE: This implementation herein is intentionally not RFC compliant.
239
- // While the first 2xx response for a given branch is passed up to the TU,
240
- // retransmissions of 2xx responses are absorbed and the ACK associated
241
- // with the original response is resent. This approach is taken because
242
- // our current transaction users are not currently in a good position to
243
- // deal with 2xx retransmission. This SHOULD NOT cause any compliance issues - ;)
244
- //
245
- // If we don't have a cache hit, pass the response to the TU.
246
- if (!this.ackRetransmissionCache.has(response.toTag)) {
247
- this.ackRetransmissionCache.set(response.toTag, undefined) // Prime the ACK cache
248
- if (this.user.receiveResponse) {
249
- this.user.receiveResponse(response)
250
- }
251
- return
252
- }
253
- // If we have a cache hit, try pulling the ACK from cache and retransmitting it.
254
- const ack = this.ackRetransmissionCache.get(response.toTag)
255
- if (ack) {
256
- this.send(ack.toString()).catch((error: TransportError) => {
257
- this.logTransportError(error, 'Failed to send retransmission of ACK to 2xx response.')
258
- })
259
- return
260
- }
261
- // If an ACK was not found in cache then we have received a retransmitted 2xx
262
- // response before the TU responded to the original response (we don't have an ACK yet).
263
- // So discard this response under the assumption that the TU will eventually
264
- // get us a ACK for the original response.
265
- return
266
- }
267
- break
268
- case TransactionState.Completed:
269
- // Any retransmissions of a response with status code 300-699 that
270
- // are received while in the "Completed" state MUST cause the ACK to
271
- // be re-passed to the transport layer for retransmission, but the
272
- // newly received response MUST NOT be passed up to the TU.
273
- // https://tools.ietf.org/html/rfc6026#section-8.4
274
- if (statusCode >= 300 && statusCode <= 699) {
275
- this.ack(response)
276
- return
277
- }
278
- break
279
- case TransactionState.Terminated:
280
- break
281
- default:
282
- throw new Error(`Invalid state ${this.state}`)
283
- }
284
-
285
- // Any response received that does not match an existing client
286
- // transaction state machine is simply dropped. (Implementations are,
287
- // of course, free to log or do other implementation-specific things
288
- // with such responses, but the implementer should be sure to consider
289
- // the impact of large numbers of malicious stray responses.)
290
- // https://tools.ietf.org/html/rfc6026#section-7.2
291
- const message = `Received unexpected ${statusCode} response while in state ${this.state}.`
292
- this.logger.warn(message)
293
- return
294
- }
295
-
296
- /**
297
- * The client transaction SHOULD inform the TU that a transport failure
298
- * has occurred, and the client transaction SHOULD transition directly
299
- * to the "Terminated" state. The TU will handle the failover
300
- * mechanisms described in [4].
301
- * https://tools.ietf.org/html/rfc3261#section-17.1.4
302
- * @param error - The error.
303
- */
304
- protected onTransportError(error: TransportError): void {
305
- if (this.user.onTransportError) {
306
- this.user.onTransportError(error)
307
- }
308
- this.stateTransition(TransactionState.Terminated, true)
309
- }
310
-
311
- /** For logging. */
312
- protected typeToString(): string {
313
- return 'INVITE client transaction'
314
- }
315
-
316
- private ack(response: IncomingResponseMessage): void {
317
- // The ACK request constructed by the client transaction MUST contain
318
- // values for the Call-ID, From, and Request-URI that are equal to the
319
- // values of those header fields in the request passed to the transport
320
- // by the client transaction (call this the "original request"). The To
321
- // header field in the ACK MUST equal the To header field in the
322
- // response being acknowledged, and therefore will usually differ from
323
- // the To header field in the original request by the addition of the
324
- // tag parameter. The ACK MUST contain a single Via header field, and
325
- // this MUST be equal to the top Via header field of the original
326
- // request. The CSeq header field in the ACK MUST contain the same
327
- // value for the sequence number as was present in the original request,
328
- // but the method parameter MUST be equal to "ACK".
329
- //
330
- // If the INVITE request whose response is being acknowledged had Route
331
- // header fields, those header fields MUST appear in the ACK. This is
332
- // to ensure that the ACK can be routed properly through any downstream
333
- // stateless proxies.
334
- // https://tools.ietf.org/html/rfc3261#section-17.1.1.3
335
- const ruri = this.request.ruri
336
- const callId = this.request.callId
337
- const cseq = this.request.cseq
338
- const from = this.request.getHeader('from')
339
- const to = response.getHeader('to')
340
- const via = this.request.getHeader('via')
341
- const route = this.request.getHeader('route')
342
- if (!from) {
343
- throw new Error('From undefined.')
344
- }
345
- if (!to) {
346
- throw new Error('To undefined.')
347
- }
348
- if (!via) {
349
- throw new Error('Via undefined.')
350
- }
351
-
352
- let ack = `ACK ${ruri} SIP/2.0\r\n`
353
- if (route) {
354
- ack += `Route: ${route}\r\n`
355
- }
356
- ack += `Via: ${via}\r\n`
357
- ack += `To: ${to}\r\n`
358
- ack += `From: ${from}\r\n`
359
- ack += `Call-ID: ${callId}\r\n`
360
- ack += `CSeq: ${cseq} ACK\r\n`
361
- ack += `Max-Forwards: 70\r\n`
362
- ack += `Content-Length: 0\r\n\r\n`
363
-
364
- // TOOO: "User-Agent" header
365
-
366
- this.send(ack).catch((error: TransportError) => {
367
- this.logTransportError(error, 'Failed to send ACK to non-2xx response.')
368
- })
369
- return
370
- }
371
-
372
- /**
373
- * Execute a state transition.
374
- * @param newState - New state.
375
- */
376
- private stateTransition(newState: TransactionState, dueToTransportError = false): void {
377
- // Assert valid state transitions.
378
- const invalidStateTransition = (): void => {
379
- throw new Error(`Invalid state transition from ${this.state} to ${newState}`)
380
- }
381
-
382
- switch (newState) {
383
- case TransactionState.Calling:
384
- invalidStateTransition()
385
- break
386
- case TransactionState.Proceeding:
387
- if (this.state !== TransactionState.Calling) {
388
- invalidStateTransition()
389
- }
390
- break
391
- case TransactionState.Accepted:
392
- case TransactionState.Completed:
393
- if (this.state !== TransactionState.Calling && this.state !== TransactionState.Proceeding) {
394
- invalidStateTransition()
395
- }
396
- break
397
- case TransactionState.Terminated:
398
- if (
399
- this.state !== TransactionState.Calling &&
400
- this.state !== TransactionState.Accepted &&
401
- this.state !== TransactionState.Completed
402
- ) {
403
- if (!dueToTransportError) {
404
- invalidStateTransition()
405
- }
406
- }
407
- break
408
- default:
409
- invalidStateTransition()
410
- }
411
-
412
- // While not spelled out in the RFC, Timer B is the maximum amount of time that a sender
413
- // will wait for an INVITE message to be acknowledged (a SIP response message is received).
414
- // So Timer B should be cleared when the transaction state proceeds from "Calling".
415
- if (this.B) {
416
- clearTimeout(this.B)
417
- this.B = undefined
418
- }
419
-
420
- if (newState === TransactionState.Proceeding) {
421
- // Timers have no effect on "Proceeding" state.
422
- // In the "Proceeding" state, the client transaction
423
- // SHOULD NOT retransmit the request any longer.
424
- // https://tools.ietf.org/html/rfc3261#section-17.1.1.2
425
- }
426
-
427
- // The client transaction MUST start Timer D when it enters the "Completed" state
428
- // for any reason, with a value of at least 32 seconds for unreliable transports,
429
- // and a value of zero seconds for reliable transports.
430
- // https://tools.ietf.org/html/rfc6026#section-8.4
431
- if (newState === TransactionState.Completed) {
432
- this.D = setTimeout(() => this.timerD(), Timers.TIMER_D)
433
- }
434
-
435
- // The client transaction MUST transition to the "Accepted" state,
436
- // and Timer M MUST be started with a value of 64*T1.
437
- // https://tools.ietf.org/html/rfc6026#section-8.4
438
- if (newState === TransactionState.Accepted) {
439
- this.M = setTimeout(() => this.timerM(), Timers.TIMER_M)
440
- }
441
-
442
- // Once the transaction is in the "Terminated" state, it MUST be destroyed immediately.
443
- // https://tools.ietf.org/html/rfc6026#section-8.7
444
- if (newState === TransactionState.Terminated) {
445
- this.dispose()
446
- }
447
-
448
- // Update state.
449
- this.setState(newState)
450
- }
451
-
452
- /**
453
- * When timer A fires, the client transaction MUST retransmit the
454
- * request by passing it to the transport layer, and MUST reset the
455
- * timer with a value of 2*T1.
456
- * When timer A fires 2*T1 seconds later, the request MUST be
457
- * retransmitted again (assuming the client transaction is still in this
458
- * state). This process MUST continue so that the request is
459
- * retransmitted with intervals that double after each transmission.
460
- * These retransmissions SHOULD only be done while the client
461
- * transaction is in the "Calling" state.
462
- * https://tools.ietf.org/html/rfc3261#section-17.1.1.2
463
- */
464
- private timerA(): void {
465
- // TODO
466
- }
467
-
468
- /**
469
- * If the client transaction is still in the "Calling" state when timer
470
- * B fires, the client transaction SHOULD inform the TU that a timeout
471
- * has occurred. The client transaction MUST NOT generate an ACK.
472
- * https://tools.ietf.org/html/rfc3261#section-17.1.1.2
473
- */
474
- private timerB(): void {
475
- this.logger.debug(`Timer B expired for INVITE client transaction ${this.id}.`)
476
- if (this.state === TransactionState.Calling) {
477
- this.onRequestTimeout()
478
- this.stateTransition(TransactionState.Terminated)
479
- }
480
- }
481
-
482
- /**
483
- * If Timer D fires while the client transaction is in the "Completed" state,
484
- * the client transaction MUST move to the "Terminated" state.
485
- * https://tools.ietf.org/html/rfc6026#section-8.4
486
- */
487
- private timerD(): void {
488
- this.logger.debug(`Timer D expired for INVITE client transaction ${this.id}.`)
489
- if (this.state === TransactionState.Completed) {
490
- this.stateTransition(TransactionState.Terminated)
491
- }
492
- }
493
-
494
- /**
495
- * If Timer M fires while the client transaction is in the "Accepted"
496
- * state, the client transaction MUST move to the "Terminated" state.
497
- * https://tools.ietf.org/html/rfc6026#section-8.4
498
- */
499
- private timerM(): void {
500
- this.logger.debug(`Timer M expired for INVITE client transaction ${this.id}.`)
501
- if (this.state === TransactionState.Accepted) {
502
- this.stateTransition(TransactionState.Terminated)
503
- }
504
- }
505
- }