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,378 +0,0 @@
1
- import { Dialog } from "../dialogs";
2
- import { TransportError } from "../exceptions";
3
- import { Logger, LoggerFactory } from "../log";
4
- import {
5
- C,
6
- IncomingResponseMessage,
7
- OutgoingRequest,
8
- OutgoingRequestDelegate,
9
- OutgoingRequestMessage,
10
- RequestOptions
11
- } from "../messages";
12
- import {
13
- ClientTransaction,
14
- ClientTransactionUser,
15
- NonInviteClientTransaction,
16
- TransactionState
17
- } from "../transactions";
18
- import { Transport } from "../transport";
19
- import { UserAgentCore } from "../user-agent-core";
20
-
21
- type ClientTransactionConstructor = new (
22
- message: OutgoingRequestMessage,
23
- transport: Transport,
24
- user: ClientTransactionUser
25
- ) => ClientTransaction;
26
-
27
- /**
28
- * User Agent Client (UAC).
29
- * @remarks
30
- * A user agent client is a logical entity
31
- * that creates a new request, and then uses the client
32
- * transaction state machinery to send it. The role of UAC lasts
33
- * only for the duration of that transaction. In other words, if
34
- * a piece of software initiates a request, it acts as a UAC for
35
- * the duration of that transaction. If it receives a request
36
- * later, it assumes the role of a user agent server for the
37
- * processing of that transaction.
38
- * https://tools.ietf.org/html/rfc3261#section-6
39
- * @public
40
- */
41
- export class UserAgentClient implements OutgoingRequest {
42
- protected logger: Logger;
43
-
44
- private _transaction: ClientTransaction | undefined;
45
-
46
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
- private credentials: any;
48
- private challenged = false;
49
- private stale = false;
50
-
51
- constructor(
52
- private transactionConstructor: ClientTransactionConstructor,
53
- protected core: UserAgentCore,
54
- public message: OutgoingRequestMessage,
55
- public delegate?: OutgoingRequestDelegate
56
- ) {
57
- this.logger = this.loggerFactory.getLogger("sip.user-agent-client");
58
- this.init();
59
- }
60
-
61
- public dispose(): void {
62
- this.transaction.dispose();
63
- }
64
-
65
- get loggerFactory(): LoggerFactory {
66
- return this.core.loggerFactory;
67
- }
68
-
69
- /** The transaction associated with this request. */
70
- get transaction(): ClientTransaction {
71
- if (!this._transaction) {
72
- throw new Error("Transaction undefined.");
73
- }
74
- return this._transaction;
75
- }
76
-
77
- /**
78
- * Since requests other than INVITE are responded to immediately, sending a
79
- * CANCEL for a non-INVITE request would always create a race condition.
80
- * A CANCEL request SHOULD NOT be sent to cancel a request other than INVITE.
81
- * https://tools.ietf.org/html/rfc3261#section-9.1
82
- * @param options - Cancel options bucket.
83
- */
84
- public cancel(reason?: string, options: RequestOptions = {}): OutgoingRequestMessage {
85
- if (!this.transaction) {
86
- throw new Error("Transaction undefined.");
87
- }
88
- if (!this.message.to) {
89
- throw new Error("To undefined.");
90
- }
91
- if (!this.message.from) {
92
- throw new Error("From undefined.");
93
- }
94
-
95
- // The following procedures are used to construct a CANCEL request. The
96
- // Request-URI, Call-ID, To, the numeric part of CSeq, and From header
97
- // fields in the CANCEL request MUST be identical to those in the
98
- // request being cancelled, including tags. A CANCEL constructed by a
99
- // client MUST have only a single Via header field value matching the
100
- // top Via value in the request being cancelled. Using the same values
101
- // for these header fields allows the CANCEL to be matched with the
102
- // request it cancels (Section 9.2 indicates how such matching occurs).
103
- // However, the method part of the CSeq header field MUST have a value
104
- // of CANCEL. This allows it to be identified and processed as a
105
- // transaction in its own right (See Section 17).
106
- // https://tools.ietf.org/html/rfc3261#section-9.1
107
- const message = this.core.makeOutgoingRequestMessage(
108
- C.CANCEL,
109
- this.message.ruri,
110
- this.message.from.uri,
111
- this.message.to.uri,
112
- {
113
- toTag: this.message.toTag,
114
- fromTag: this.message.fromTag,
115
- callId: this.message.callId,
116
- cseq: this.message.cseq
117
- },
118
- options.extraHeaders
119
- );
120
-
121
- // TODO: Revisit this.
122
- // The CANCEL needs to use the same branch parameter so that
123
- // it matches the INVITE transaction, but this is a hacky way to do this.
124
- // Or at the very least not well documented. If the the branch parameter
125
- // is set on the outgoing request, the transaction will use it.
126
- // Otherwise the transaction will make a new one.
127
- message.branch = this.message.branch;
128
-
129
- if (this.message.headers.Route) {
130
- message.headers.Route = this.message.headers.Route;
131
- }
132
-
133
- if (reason) {
134
- message.setHeader("Reason", reason);
135
- }
136
-
137
- // If no provisional response has been received, the CANCEL request MUST
138
- // NOT be sent; rather, the client MUST wait for the arrival of a
139
- // provisional response before sending the request. If the original
140
- // request has generated a final response, the CANCEL SHOULD NOT be
141
- // sent, as it is an effective no-op, since CANCEL has no effect on
142
- // requests that have already generated a final response.
143
- // https://tools.ietf.org/html/rfc3261#section-9.1
144
- if (this.transaction.state === TransactionState.Proceeding) {
145
- new UserAgentClient(NonInviteClientTransaction, this.core, message);
146
- } else {
147
- this.transaction.addStateChangeListener(
148
- () => {
149
- if (this.transaction && this.transaction.state === TransactionState.Proceeding) {
150
- new UserAgentClient(NonInviteClientTransaction, this.core, message);
151
- }
152
- },
153
- { once: true }
154
- );
155
- }
156
-
157
- return message;
158
- }
159
-
160
- /**
161
- * If a 401 (Unauthorized) or 407 (Proxy Authentication Required)
162
- * response is received, the UAC SHOULD follow the authorization
163
- * procedures of Section 22.2 and Section 22.3 to retry the request with
164
- * credentials.
165
- * https://tools.ietf.org/html/rfc3261#section-8.1.3.5
166
- * 22 Usage of HTTP Authentication
167
- * https://tools.ietf.org/html/rfc3261#section-22
168
- * 22.1 Framework
169
- * https://tools.ietf.org/html/rfc3261#section-22.1
170
- * 22.2 User-to-User Authentication
171
- * https://tools.ietf.org/html/rfc3261#section-22.2
172
- * 22.3 Proxy-to-User Authentication
173
- * https://tools.ietf.org/html/rfc3261#section-22.3
174
- *
175
- * FIXME: This "guard for and retry the request with credentials"
176
- * implementation is not complete and at best minimally passable.
177
- * @param response - The incoming response to guard.
178
- * @param dialog - If defined, the dialog within which the response was received.
179
- * @returns True if the program execution is to continue in the branch in question.
180
- * Otherwise the request is retried with credentials and current request processing must stop.
181
- */
182
- protected authenticationGuard(message: IncomingResponseMessage, dialog?: Dialog): boolean {
183
- const statusCode = message.statusCode;
184
- if (!statusCode) {
185
- throw new Error("Response status code undefined.");
186
- }
187
-
188
- // If a 401 (Unauthorized) or 407 (Proxy Authentication Required)
189
- // response is received, the UAC SHOULD follow the authorization
190
- // procedures of Section 22.2 and Section 22.3 to retry the request with
191
- // credentials.
192
- // https://tools.ietf.org/html/rfc3261#section-8.1.3.5
193
- if (statusCode !== 401 && statusCode !== 407) {
194
- return true;
195
- }
196
-
197
- // Get and parse the appropriate WWW-Authenticate or Proxy-Authenticate header.
198
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
199
- let challenge: any;
200
- let authorizationHeaderName: string;
201
- if (statusCode === 401) {
202
- challenge = message.parseHeader("www-authenticate");
203
- authorizationHeaderName = "authorization";
204
- } else {
205
- challenge = message.parseHeader("proxy-authenticate");
206
- authorizationHeaderName = "proxy-authorization";
207
- }
208
-
209
- // Verify it seems a valid challenge.
210
- if (!challenge) {
211
- this.logger.warn(statusCode + " with wrong or missing challenge, cannot authenticate");
212
- return true;
213
- }
214
-
215
- // Avoid infinite authentications.
216
- if (this.challenged && (this.stale || challenge.stale !== true)) {
217
- this.logger.warn(statusCode + " apparently in authentication loop, cannot authenticate");
218
- return true;
219
- }
220
-
221
- // Get credentials.
222
- if (!this.credentials) {
223
- this.credentials = this.core.configuration.authenticationFactory();
224
- if (!this.credentials) {
225
- this.logger.warn("Unable to obtain credentials, cannot authenticate");
226
- return true;
227
- }
228
- }
229
-
230
- // Verify that the challenge is really valid.
231
- if (!this.credentials.authenticate(this.message, challenge)) {
232
- return true;
233
- }
234
-
235
- this.challenged = true;
236
- if (challenge.stale) {
237
- this.stale = true;
238
- }
239
-
240
- // If response to out of dialog request, assume incrementing the CSeq will suffice.
241
- let cseq = (this.message.cseq += 1);
242
-
243
- // If response to in dialog request, get a valid next CSeq number.
244
- if (dialog && dialog.localSequenceNumber) {
245
- dialog.incrementLocalSequenceNumber();
246
- cseq = this.message.cseq = dialog.localSequenceNumber;
247
- }
248
-
249
- this.message.setHeader("cseq", cseq + " " + this.message.method);
250
- this.message.setHeader(authorizationHeaderName, this.credentials.toString());
251
-
252
- // Calling init (again) will swap out our existing client transaction with a new one.
253
- // FIXME: HACK: An assumption is being made here that there is nothing that needs to
254
- // be cleaned up beyond the client transaction which is being replaced. For example,
255
- // it is assumed that no early dialogs have been created.
256
- this.init();
257
-
258
- return false;
259
- }
260
-
261
- /**
262
- * 8.1.3.1 Transaction Layer Errors
263
- * In some cases, the response returned by the transaction layer will
264
- * not be a SIP message, but rather a transaction layer error. When a
265
- * timeout error is received from the transaction layer, it MUST be
266
- * treated as if a 408 (Request Timeout) status code has been received.
267
- * If a fatal transport error is reported by the transport layer
268
- * (generally, due to fatal ICMP errors in UDP or connection failures in
269
- * TCP), the condition MUST be treated as a 503 (Service Unavailable)
270
- * status code.
271
- * https://tools.ietf.org/html/rfc3261#section-8.1.3.1
272
- */
273
- protected onRequestTimeout(): void {
274
- this.logger.warn("User agent client request timed out. Generating internal 408 Request Timeout.");
275
- const message = new IncomingResponseMessage();
276
- message.statusCode = 408;
277
- message.reasonPhrase = "Request Timeout";
278
- this.receiveResponse(message);
279
- return;
280
- }
281
-
282
- /**
283
- * 8.1.3.1 Transaction Layer Errors
284
- * In some cases, the response returned by the transaction layer will
285
- * not be a SIP message, but rather a transaction layer error. When a
286
- * timeout error is received from the transaction layer, it MUST be
287
- * treated as if a 408 (Request Timeout) status code has been received.
288
- * If a fatal transport error is reported by the transport layer
289
- * (generally, due to fatal ICMP errors in UDP or connection failures in
290
- * TCP), the condition MUST be treated as a 503 (Service Unavailable)
291
- * status code.
292
- * https://tools.ietf.org/html/rfc3261#section-8.1.3.1
293
- * @param error - Transport error
294
- */
295
- protected onTransportError(error: TransportError): void {
296
- this.logger.error(error.message);
297
- this.logger.error("User agent client request transport error. Generating internal 503 Service Unavailable.");
298
- const message = new IncomingResponseMessage();
299
- message.statusCode = 503;
300
- message.reasonPhrase = "Service Unavailable";
301
- this.receiveResponse(message);
302
- }
303
-
304
- /**
305
- * Receive a response from the transaction layer.
306
- * @param message - Incoming response message.
307
- */
308
- protected receiveResponse(message: IncomingResponseMessage): void {
309
- if (!this.authenticationGuard(message)) {
310
- return;
311
- }
312
-
313
- const statusCode = message.statusCode ? message.statusCode.toString() : "";
314
- if (!statusCode) {
315
- throw new Error("Response status code undefined.");
316
- }
317
-
318
- switch (true) {
319
- case /^100$/.test(statusCode):
320
- if (this.delegate && this.delegate.onTrying) {
321
- this.delegate.onTrying({ message });
322
- }
323
- break;
324
- case /^1[0-9]{2}$/.test(statusCode):
325
- if (this.delegate && this.delegate.onProgress) {
326
- this.delegate.onProgress({ message });
327
- }
328
- break;
329
- case /^2[0-9]{2}$/.test(statusCode):
330
- if (this.delegate && this.delegate.onAccept) {
331
- this.delegate.onAccept({ message });
332
- }
333
- break;
334
- case /^3[0-9]{2}$/.test(statusCode):
335
- if (this.delegate && this.delegate.onRedirect) {
336
- this.delegate.onRedirect({ message });
337
- }
338
- break;
339
- case /^[4-6][0-9]{2}$/.test(statusCode):
340
- if (this.delegate && this.delegate.onReject) {
341
- this.delegate.onReject({ message });
342
- }
343
- break;
344
- default:
345
- throw new Error(`Invalid status code ${statusCode}`);
346
- }
347
- }
348
-
349
- private init(): void {
350
- // We are the transaction user.
351
- const user: ClientTransactionUser = {
352
- loggerFactory: this.loggerFactory,
353
- onRequestTimeout: () => this.onRequestTimeout(),
354
- onStateChange: (newState) => {
355
- if (newState === TransactionState.Terminated) {
356
- // Remove the terminated transaction from the core.
357
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
358
- this.core.userAgentClients.delete(userAgentClientId);
359
- // FIXME: HACK: Our transaction may have been swapped out with a new one
360
- // post authentication (see above), so make sure to only to dispose of
361
- // ourselves if this terminating transaction is our current transaction.
362
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
363
- if (transaction === this._transaction) {
364
- this.dispose();
365
- }
366
- }
367
- },
368
- onTransportError: (error) => this.onTransportError(error),
369
- receiveResponse: (message) => this.receiveResponse(message)
370
- };
371
- // Create a new transaction with us as the user.
372
- const transaction = new this.transactionConstructor(this.message, this.core.transport, user);
373
- this._transaction = transaction;
374
- // Add the new transaction to the core.
375
- const userAgentClientId = transaction.id + transaction.request.method;
376
- this.core.userAgentClients.set(userAgentClientId, this);
377
- }
378
- }
@@ -1,276 +0,0 @@
1
- import { TransactionStateError } from "../exceptions";
2
- import { Logger, LoggerFactory } from "../log";
3
- import {
4
- constructOutgoingResponse,
5
- IncomingRequest,
6
- IncomingRequestDelegate,
7
- IncomingRequestMessage,
8
- OutgoingResponse,
9
- ResponseOptions,
10
- URI
11
- } from "../messages";
12
- import { newTag } from "../messages/utils";
13
-
14
- import {
15
- InviteServerTransaction,
16
- NonInviteServerTransaction,
17
- ServerTransaction,
18
- ServerTransactionUser,
19
- TransactionState
20
- } from "../transactions";
21
- import { Transport } from "../transport";
22
- import { UserAgentCore } from "../user-agent-core";
23
-
24
- type ServerTransactionConstructor = new (
25
- message: IncomingRequestMessage,
26
- transport: Transport,
27
- user: ServerTransactionUser
28
- ) => ServerTransaction;
29
-
30
- /**
31
- * User Agent Server (UAS).
32
- * @remarks
33
- * A user agent server is a logical entity
34
- * that generates a response to a SIP request. The response
35
- * accepts, rejects, or redirects the request. This role lasts
36
- * only for the duration of that transaction. In other words, if
37
- * a piece of software responds to a request, it acts as a UAS for
38
- * the duration of that transaction. If it generates a request
39
- * later, it assumes the role of a user agent client for the
40
- * processing of that transaction.
41
- * https://tools.ietf.org/html/rfc3261#section-6
42
- * @public
43
- */
44
- export class UserAgentServer implements IncomingRequest {
45
- protected logger: Logger;
46
- protected toTag: string;
47
-
48
- private _transaction: ServerTransaction | undefined;
49
-
50
- constructor(
51
- private transactionConstructor: ServerTransactionConstructor,
52
- protected core: UserAgentCore,
53
- public message: IncomingRequestMessage,
54
- public delegate?: IncomingRequestDelegate
55
- ) {
56
- this.logger = this.loggerFactory.getLogger("sip.user-agent-server");
57
- this.toTag = message.toTag ? message.toTag : newTag();
58
- this.init();
59
- }
60
-
61
- public dispose(): void {
62
- this.transaction.dispose();
63
- }
64
-
65
- get loggerFactory(): LoggerFactory {
66
- return this.core.loggerFactory;
67
- }
68
-
69
- /** The transaction associated with this request. */
70
- get transaction(): ServerTransaction {
71
- if (!this._transaction) {
72
- throw new Error("Transaction undefined.");
73
- }
74
- return this._transaction;
75
- }
76
-
77
- public accept(options: ResponseOptions = { statusCode: 200 }): OutgoingResponse {
78
- if (!this.acceptable) {
79
- throw new TransactionStateError(`${this.message.method} not acceptable in state ${this.transaction.state}.`);
80
- }
81
- const statusCode = options.statusCode;
82
- if (statusCode < 200 || statusCode > 299) {
83
- throw new TypeError(`Invalid statusCode: ${statusCode}`);
84
- }
85
- const response = this.reply(options);
86
- return response;
87
- }
88
-
89
- public progress(options: ResponseOptions = { statusCode: 180 }): OutgoingResponse {
90
- if (!this.progressable) {
91
- throw new TransactionStateError(`${this.message.method} not progressable in state ${this.transaction.state}.`);
92
- }
93
- const statusCode = options.statusCode;
94
- if (statusCode < 101 || statusCode > 199) {
95
- throw new TypeError(`Invalid statusCode: ${statusCode}`);
96
- }
97
- const response = this.reply(options);
98
- return response;
99
- }
100
-
101
- public redirect(contacts: Array<URI>, options: ResponseOptions = { statusCode: 302 }): OutgoingResponse {
102
- if (!this.redirectable) {
103
- throw new TransactionStateError(`${this.message.method} not redirectable in state ${this.transaction.state}.`);
104
- }
105
- const statusCode = options.statusCode;
106
- if (statusCode < 300 || statusCode > 399) {
107
- throw new TypeError(`Invalid statusCode: ${statusCode}`);
108
- }
109
- const contactHeaders = new Array<string>();
110
- contacts.forEach((contact) => contactHeaders.push(`Contact: ${contact.toString()}`));
111
- options.extraHeaders = (options.extraHeaders || []).concat(contactHeaders);
112
- const response = this.reply(options);
113
- return response;
114
- }
115
-
116
- public reject(options: ResponseOptions = { statusCode: 480 }): OutgoingResponse {
117
- if (!this.rejectable) {
118
- throw new TransactionStateError(`${this.message.method} not rejectable in state ${this.transaction.state}.`);
119
- }
120
- const statusCode = options.statusCode;
121
- if (statusCode < 400 || statusCode > 699) {
122
- throw new TypeError(`Invalid statusCode: ${statusCode}`);
123
- }
124
- const response = this.reply(options);
125
- return response;
126
- }
127
-
128
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
129
- public trying(options?: ResponseOptions): OutgoingResponse {
130
- if (!this.tryingable) {
131
- throw new TransactionStateError(`${this.message.method} not tryingable in state ${this.transaction.state}.`);
132
- }
133
- const response = this.reply({ statusCode: 100 });
134
- return response;
135
- }
136
-
137
- /**
138
- * If the UAS did not find a matching transaction for the CANCEL
139
- * according to the procedure above, it SHOULD respond to the CANCEL
140
- * with a 481 (Call Leg/Transaction Does Not Exist). If the transaction
141
- * for the original request still exists, the behavior of the UAS on
142
- * receiving a CANCEL request depends on whether it has already sent a
143
- * final response for the original request. If it has, the CANCEL
144
- * request has no effect on the processing of the original request, no
145
- * effect on any session state, and no effect on the responses generated
146
- * for the original request. If the UAS has not issued a final response
147
- * for the original request, its behavior depends on the method of the
148
- * original request. If the original request was an INVITE, the UAS
149
- * SHOULD immediately respond to the INVITE with a 487 (Request
150
- * Terminated). A CANCEL request has no impact on the processing of
151
- * transactions with any other method defined in this specification.
152
- * https://tools.ietf.org/html/rfc3261#section-9.2
153
- * @param request - Incoming CANCEL request.
154
- */
155
- public receiveCancel(message: IncomingRequestMessage): void {
156
- // Note: Currently CANCEL is being handled as a special case.
157
- // No UAS is created to handle the CANCEL and the response to
158
- // it CANCEL is being handled statelessly by the user agent core.
159
- // As such, there is currently no way to externally impact the
160
- // response to the a CANCEL request.
161
- if (this.delegate && this.delegate.onCancel) {
162
- this.delegate.onCancel(message);
163
- }
164
- }
165
-
166
- protected get acceptable(): boolean {
167
- if (this.transaction instanceof InviteServerTransaction) {
168
- return (
169
- this.transaction.state === TransactionState.Proceeding || this.transaction.state === TransactionState.Accepted
170
- );
171
- }
172
- if (this.transaction instanceof NonInviteServerTransaction) {
173
- return (
174
- this.transaction.state === TransactionState.Trying || this.transaction.state === TransactionState.Proceeding
175
- );
176
- }
177
- throw new Error("Unknown transaction type.");
178
- }
179
-
180
- protected get progressable(): boolean {
181
- if (this.transaction instanceof InviteServerTransaction) {
182
- return this.transaction.state === TransactionState.Proceeding;
183
- }
184
- if (this.transaction instanceof NonInviteServerTransaction) {
185
- return false; // https://tools.ietf.org/html/rfc4320#section-4.1
186
- }
187
- throw new Error("Unknown transaction type.");
188
- }
189
-
190
- protected get redirectable(): boolean {
191
- if (this.transaction instanceof InviteServerTransaction) {
192
- return this.transaction.state === TransactionState.Proceeding;
193
- }
194
- if (this.transaction instanceof NonInviteServerTransaction) {
195
- return (
196
- this.transaction.state === TransactionState.Trying || this.transaction.state === TransactionState.Proceeding
197
- );
198
- }
199
- throw new Error("Unknown transaction type.");
200
- }
201
-
202
- protected get rejectable(): boolean {
203
- if (this.transaction instanceof InviteServerTransaction) {
204
- return this.transaction.state === TransactionState.Proceeding;
205
- }
206
- if (this.transaction instanceof NonInviteServerTransaction) {
207
- return (
208
- this.transaction.state === TransactionState.Trying || this.transaction.state === TransactionState.Proceeding
209
- );
210
- }
211
- throw new Error("Unknown transaction type.");
212
- }
213
-
214
- protected get tryingable(): boolean {
215
- if (this.transaction instanceof InviteServerTransaction) {
216
- return this.transaction.state === TransactionState.Proceeding;
217
- }
218
- if (this.transaction instanceof NonInviteServerTransaction) {
219
- return this.transaction.state === TransactionState.Trying;
220
- }
221
- throw new Error("Unknown transaction type.");
222
- }
223
-
224
- /**
225
- * When a UAS wishes to construct a response to a request, it follows
226
- * the general procedures detailed in the following subsections.
227
- * Additional behaviors specific to the response code in question, which
228
- * are not detailed in this section, may also be required.
229
- *
230
- * Once all procedures associated with the creation of a response have
231
- * been completed, the UAS hands the response back to the server
232
- * transaction from which it received the request.
233
- * https://tools.ietf.org/html/rfc3261#section-8.2.6
234
- * @param statusCode - Status code to reply with.
235
- * @param options - Reply options bucket.
236
- */
237
- private reply(options: ResponseOptions): OutgoingResponse {
238
- if (!options.toTag && options.statusCode !== 100) {
239
- options.toTag = this.toTag;
240
- }
241
- options.userAgent = options.userAgent || this.core.configuration.userAgentHeaderFieldValue;
242
- options.supported = options.supported || this.core.configuration.supportedOptionTagsResponse;
243
- const response = constructOutgoingResponse(this.message, options);
244
- this.transaction.receiveResponse(options.statusCode, response.message);
245
- return response;
246
- }
247
-
248
- private init(): void {
249
- // We are the transaction user.
250
- const user: ServerTransactionUser = {
251
- loggerFactory: this.loggerFactory,
252
- onStateChange: (newState) => {
253
- if (newState === TransactionState.Terminated) {
254
- // Remove the terminated transaction from the core.
255
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
256
- this.core.userAgentServers.delete(userAgentServerId);
257
- this.dispose();
258
- }
259
- },
260
- onTransportError: (error) => {
261
- this.logger.error(error.message);
262
- if (this.delegate && this.delegate.onTransportError) {
263
- this.delegate.onTransportError(error);
264
- } else {
265
- this.logger.error("User agent server response transport error.");
266
- }
267
- }
268
- };
269
- // Create a new transaction with us as the user.
270
- const transaction = new this.transactionConstructor(this.message, this.core.transport, user);
271
- this._transaction = transaction;
272
- // Add the new transaction to the core.
273
- const userAgentServerId = transaction.id;
274
- this.core.userAgentServers.set(transaction.id, this);
275
- }
276
- }