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
package/src/index.ts DELETED
@@ -1,2473 +0,0 @@
1
- /*
2
- * @Author: cuixuecheng
3
- * @Date: 2023-02-21 18:40:21
4
- * @LastEditors: Wangtao
5
- * @LastEditTime: 2024-01-18 17:39:44
6
- * @Description:
7
- */
8
-
9
- // @ts-ignore: Unreachable code error
10
- /**package.json 版本号 */
11
- // @ts-ignore: Unreachable code error
12
- // import { Parameters } from './grammar/parameters.js'
13
- import io from "./lib/socket.io.esm.min.js";
14
- import { AUDIO_FORBIDDEN, DENIED, NOT_OPEN_AUDIO } from "./config";
15
- // import { UeWebrtc } from "ue-webrtc";
16
- import UeWebrtc from "./webrtc/webrtc";
17
-
18
- import { Base64 } from "js-base64";
19
- import md5 from "js-md5";
20
- import { JSEncrypt } from "jsencrypt";
21
-
22
- type DebugType = "trace" | "debug" | "log" | "warn" | "error" | "all";
23
- type ExtenType = "PSTN" | "SIP" | "WEBRTC";
24
-
25
- interface AudioInfo {
26
- notOpenAudioMsg: string;
27
- notOpenAudioCode: number;
28
- notOpenAudioMsgEn: string;
29
- forbiddenAudioMsg: string;
30
- forbiddenAudioCode: number;
31
- forbiddenAudioMsgEn: string;
32
- }
33
- interface InitOptions {
34
- accountId?: string;
35
- agentNumber?: string;
36
- accountName?: string; //新增加参数用户名称
37
- password?: string;
38
- loginType?: ExtenType;
39
- debug?: DebugType | DebugType[] | boolean;
40
- success?: Function;
41
- error?: Function;
42
- server?: string;
43
- audioInfo?: AudioInfo; // 麦克风相关提示
44
- // dependencies?: any;
45
- // loginStatus?: string;
46
- // signAuth?: any;
47
- // hasMonitor?: boolean;
48
- // sdkMonitorType?: any;
49
- // isStrongHint?: Boolean; // 是否强提示
50
- isOpenNetwork?: boolean; // 是否开启网络检测
51
-
52
- pushHangupStatistics?: boolean;
53
- pushCallinRingStatistics?: boolean;
54
- isOpenCallQueue?: boolean; //是否开启呼叫队列推送
55
- openNlsTranslation?: boolean; //是否开启电话条监听实时转译
56
- }
57
- interface SocketMonitorOptions {
58
- transport: String;
59
- logintoken: String;
60
- sessionid: String;
61
- sdkMonitorUrl: String;
62
- sdkMonitorType?: any;
63
- }
64
- // interface SocketOptions {
65
- // namespace: String;
66
- // phoneBarSdkIp: String;
67
- // phoneBarSdkPort: String;
68
- // sdkUrl: String;
69
- // }
70
-
71
- interface OnCallEventParams {
72
- success?: Function;
73
- message?: Function;
74
- error?: Function;
75
- event?: Function;
76
- }
77
-
78
-
79
- interface DialoutParams {
80
- agentNumber?: String;
81
- accountId: String;
82
- agentId: String;
83
- loginType?: String;
84
- customerNumber: String;
85
- agentTimeout?: String;
86
- customerTimeout?: String;
87
- agentDisNumber?: String;
88
- customerDisNumber?: String;
89
- extras?: any;
90
- success?: Function;
91
- fail?: Function;
92
- numberGroupId?: String;
93
- numberGroupName?: String;
94
- // group?: string;
95
- // groupRule?: Number;
96
- // groupareaCode?: String;
97
- // encryptionAlgorithm?: String;
98
- // encryptionFields?: String;
99
- }
100
-
101
- interface HangupParams {
102
- success?: Function;
103
- fail?: Function;
104
- }
105
-
106
- interface HoldOrUnHoldParams {
107
- type: String;
108
- success?: Function;
109
- fail?: Function;
110
- }
111
-
112
- interface MuteOrUnMuteParams {
113
- type: String;
114
- direction: String;
115
- success?: Function;
116
- fail?: Function;
117
- }
118
- interface TransferParams {
119
- type: String;
120
- number: String;
121
- agentNumber?: String;
122
- success?: Function;
123
- fail?: Function;
124
- }
125
-
126
- interface UpdateLoginTypeParams {
127
- loginType: ExtenType;
128
- loginNumber?: String;
129
- success?: Function;
130
- fail?: Function;
131
- }
132
-
133
- interface GetAgentPhoneBarParams {
134
- success?: Function;
135
- fail?: Function;
136
- }
137
- interface GetQueueOnlineAgentsParams {
138
- success?: Function;
139
- fail?: Function;
140
- }
141
- interface getIvrListParams {
142
- success?: Function;
143
- fail?: Function;
144
- types: string[];
145
- }
146
-
147
- interface AgentOnlineParams {
148
- success?: Function;
149
- fail?: Function;
150
- loginType?: String;
151
- loginStatus?: String;
152
- }
153
-
154
- interface AgentOfflineParams {
155
- success?: Function;
156
- fail?: Function;
157
- toAnswerOffline?: String;
158
- }
159
-
160
- interface UpdateAgentStatusParams {
161
- stateNumber: String;
162
- success?: Function;
163
- fail?: Function;
164
- }
165
- interface consultParams {
166
- mode: String;
167
- number: String;
168
- agentNumber: String;
169
- success?: Function;
170
- fail?: Function;
171
- }
172
- interface cancleConsultParams {
173
- success?: Function;
174
- fail?: Function;
175
- }
176
- interface stopConsultParams {
177
- success?: Function;
178
- fail?: Function;
179
- }
180
- interface resumeConsultParams {
181
- success?: Function;
182
- fail?: Function;
183
- }
184
- interface consultTransferParams {
185
- success?: Function;
186
- fail?: Function;
187
- }
188
-
189
- interface threeWayCallParams {
190
- success?: Function;
191
- fail?: Function;
192
- }
193
-
194
- interface satisfactionParams {
195
- type: String;
196
- success?: Function;
197
- fail?: Function;
198
- }
199
- interface meetingParams {
200
- number: String;
201
- success?: Function;
202
- fail?: Function;
203
- }
204
- interface listenParams {
205
- agentNumber: String;
206
- success?: Function;
207
- fail?: Function;
208
- }
209
- interface lootParams {
210
- agentNumber: String;
211
- success?: Function;
212
- fail?: Function;
213
- }
214
- interface whisperParams {
215
- agentNumber: String;
216
- success?: Function;
217
- fail?: Function;
218
- }
219
- interface forcedHangupParams {
220
- agentNumber: String;
221
- success?: Function;
222
- fail?: Function;
223
- }
224
- interface signinParams {
225
- agentNumber: String;
226
- loginType: String;
227
- success?: Function;
228
- fail?: Function;
229
- }
230
- interface signoutParams {
231
- agentNumber: String;
232
- success?: Function;
233
- fail?: Function;
234
- }
235
- interface breakinParams {
236
- agentNumber: String;
237
- success?: Function;
238
- fail?: Function;
239
- }
240
-
241
- interface networkMonitoringParams {
242
- requestState: boolean,
243
- delay: number
244
- }
245
- const networkMonitoringConfig: networkMonitoringParams = {
246
- requestState: false,
247
- delay: 0
248
- };
249
-
250
- export default class ueSoftphone {
251
- static ueTimer: any; // 监控里面的定时器
252
- static loginToken: String | undefined;
253
- static agentInfo: any;
254
- static initOptions: InitOptions;
255
- static webPhone: any;
256
- static callApiUrl: String = "https://app.useasy.cn/api";
257
- static agentextras: any;
258
- static Socketinstance: any = null;
259
- static AudioTask: any = null
260
- static MonitorSocketinstance: any = null;
261
- static UserConfig: any = null
262
- static noop(): void {}
263
- static debug: (msg: any) => void;
264
- static log: (msg: any) => void;
265
- static warn: (msg: any) => void;
266
- static error: (msg: any) => void;
267
- static trace: (msg: any) => void;
268
- static newWebSocket: (server: string, proto: any) => any;
269
- static request: (server: string, proto: any) => any;
270
-
271
- private attachEventCallbacks: any;
272
-
273
- private attachMonitorEventCallbacks: any;
274
-
275
- private attachNlsTranslationEventCallbacks: any;
276
-
277
- constructor(options: InitOptions = {}) {
278
- options.error = typeof options.error == "function" ? options.error : ueSoftphone.noop;
279
- options.success = typeof options.success == "function" ? options.success : ueSoftphone.noop;
280
-
281
- if ((options.accountName === null || options.accountName === undefined|| options.accountName === '')&&(options.accountId === null || options.accountId === undefined|| options.accountId === '')) {
282
- options.error({message: "Invalid accountId or Invalid accountName"});
283
- return
284
- }
285
-
286
- if ((options.accountName === null || options.accountName === undefined|| options.accountName === '')&&(options.agentNumber === null || options.agentNumber === undefined|| options.accountId === '')) {
287
- options.error({ message: "Invalid agentNumber or Invalid accountName" });
288
- return;
289
- }
290
-
291
- if (options.password === null || options.password === undefined) {
292
- options.error({message: "Invalid password"});
293
- return
294
- }
295
-
296
- if (options.loginType === null || options.loginType === undefined) {
297
- options.loginType = "PSTN";
298
- }
299
-
300
- if (options.pushHangupStatistics === null || options.pushHangupStatistics === undefined) {
301
- options.pushHangupStatistics = false;
302
- }
303
-
304
- if (options.pushCallinRingStatistics === null || options.pushCallinRingStatistics === undefined) {
305
- options.pushCallinRingStatistics = false;
306
- }
307
-
308
- this.init(options);
309
- }
310
- private init(options: InitOptions = {}) {
311
- ueSoftphone.trace = ueSoftphone.noop;
312
- ueSoftphone.debug = ueSoftphone.noop;
313
- ueSoftphone.log = ueSoftphone.noop;
314
- ueSoftphone.warn = ueSoftphone.noop;
315
- ueSoftphone.error = ueSoftphone.noop;
316
- if (options.debug === true || options.debug === "all") {
317
- // Enable all debugging levels
318
- ueSoftphone.trace = console.trace.bind(console);
319
- ueSoftphone.debug = console.debug.bind(console);
320
- ueSoftphone.log = console.log.bind(console);
321
- ueSoftphone.warn = console.warn.bind(console);
322
- ueSoftphone.error = console.error.bind(console);
323
- } else if (Array.isArray(options.debug)) {
324
- for (var i in options.debug) {
325
- var d = options.debug[i];
326
- switch (d) {
327
- case "trace":
328
- ueSoftphone.trace = console.trace.bind(console);
329
- break;
330
- case "debug":
331
- ueSoftphone.debug = console.debug.bind(console);
332
- break;
333
- case "log":
334
- ueSoftphone.log = console.log.bind(console);
335
- break;
336
- case "warn":
337
- ueSoftphone.warn = console.warn.bind(console);
338
- break;
339
- case "error":
340
- ueSoftphone.error = console.error.bind(console);
341
- break;
342
- default:
343
- console.error(
344
- "Unknown debugging option '" +
345
- d +
346
- "' (supported: 'trace', 'debug', 'log', warn', 'error')"
347
- );
348
- break;
349
- }
350
- }
351
- }
352
- ueSoftphone.log("Initializing library");
353
-
354
- const usedDependencies =
355
- // options.dependencies ||
356
- ueSoftphone.useDefaultDependencies({
357
- WebSocket: ueWebsocket
358
- });
359
-
360
- ueSoftphone.newWebSocket = usedDependencies.newWebSocket;
361
- ueSoftphone.request = usedDependencies.request;
362
- this.login(options);
363
- }
364
-
365
- private async login(options: InitOptions) {
366
- console.log(options,"options");
367
- ueSoftphone.UserConfig = options
368
- const server = options.server || ueSoftphone.callApiUrl;
369
- // 新增加参数 accountName 如果有loginName就使用它没有的话还是原逻辑
370
- const loginName = options.accountName?options.accountName:options.agentNumber + "@" + options.accountId;
371
- const loginType = options.loginType;
372
- // const signAuth = options.signAuth;
373
- // const hasMonitor = options.hasMonitor || false; // 是否需要监控,若需要则会挂监控socket,并事件回吐给客户
374
-
375
- const isOpenNetwork = options.isOpenNetwork || false; // 是否开启网络检测,若需要则会挂监控网络状态,并将值回吐给客户
376
- const isOpenCallQueue = options.isOpenCallQueue || false; // 是否开启呼叫队列推送,若需要则会挂呼叫队列socket,并将事件回吐给客户
377
- const openNlsTranslation = options.openNlsTranslation || false; // 是否开启电话条监听实时转译,若需要则会挂呼叫队列socket,并将事件回吐给客户
378
- let actionData = {
379
- loginName: loginName,
380
- loginType: loginType,
381
- loginChannel: "SDK",
382
- // signAuth: signAuth,
383
- password: ""
384
- };
385
- // const isStrongHint = typeof options.isStrongHint === "boolean" ? options.isStrongHint : true;
386
- const isStrongHint = true;
387
- let audioObj;
388
- if (loginType === "WEBRTC") {
389
- try {
390
- audioObj = (await this.openMediaAudio("请打开麦克风权限!", isStrongHint)) || {};
391
- } catch (error) {
392
- console.log(error);
393
- console.log('授权失败================================')
394
- }
395
- }
396
- if (options.password) {
397
- actionData.password = options.password as string; //md5(options.password as string)
398
- }
399
- // 登录前会获取pk密钥,进行加密之后,=》 login(loginToken等) =》loginInfo(user,account等)
400
- ueSoftphone.request(server + "/platform/public/loginPre", {
401
- verb: "GET",
402
- success: (preInfo: any) => {
403
- if (preInfo && preInfo.success && preInfo.data) {
404
- // 获取密码加密公钥
405
- const PUBLIC_KEY = decodeURIComponent(Base64.decode(preInfo.data.pk));
406
- const encryptor = new JSEncrypt();
407
- encryptor.setPublicKey(PUBLIC_KEY);
408
- const md5Password = md5(actionData.password);
409
- const rsaPassword: any = encryptor.encrypt(md5Password);
410
- actionData.password = rsaPassword;
411
- ueSoftphone.request(server + "/platform/public/login", {
412
- verb: "POST",
413
- body: actionData,
414
- success: (res: any) => {
415
- if (res.success) {
416
- ueSoftphone.request(server + "/platform/action/loginInfo", {
417
- verb: "GET",
418
- loginToken: res.data.loginToken,
419
- sessionId: res.data.sessionId,
420
- success: (loginInfo: any) => {
421
- if (loginInfo.success) {
422
- if (loginInfo.data.agent) {
423
- ueSoftphone.agentInfo = loginInfo.data.agent;
424
- ueSoftphone.loginToken = loginInfo.data.loginToken;
425
- ueSoftphone.initOptions = {
426
- ...options,
427
- audioInfo: audioObj
428
- };
429
- }
430
- // if (hasMonitor) { // 需要监控,挂载监控
431
- // this.initMonitorAttachEvent(loginInfo.data.pushServer, loginInfo.data.agent)
432
- // }
433
-
434
- this.initAttachEvent(
435
- server,
436
- loginType,
437
- loginInfo.data.pushServer,
438
- loginInfo.data.agent,
439
- options.success
440
- );
441
-
442
- // 是否开启网络检测
443
- if(isOpenNetwork) {
444
- this.initnNetworkMonitoring(loginInfo.data.pushServer,'')
445
- }
446
-
447
- // 是否开启呼叫队列推送(开启呼叫队列或者开启电话条监听都会开启)
448
- if(isOpenCallQueue||openNlsTranslation) {
449
- // 呼叫队列推送
450
- this.initAgentQueue(
451
- server,
452
- loginType,
453
- loginInfo.data.pushServer,
454
- loginInfo.data.agent,
455
- options.success
456
- );
457
- }
458
- if(isOpenCallQueue){
459
- // 初始化获取呼叫队列数据
460
- this.initQueue(server);
461
- }
462
-
463
- if (loginType === "WEBRTC") {
464
- this.getWebrtcInfo(server, options);
465
- }
466
- // 登录成功移除互踢标志
467
- window.sessionStorage.removeItem("kickoff");
468
- } else {
469
- (options.error as Function)({
470
- ...loginInfo,
471
- ...audioObj
472
- });
473
- }
474
- },
475
- error: (error: any) => {
476
- (options.error as Function)({
477
- error,
478
- ...audioObj
479
- });
480
- }
481
- });
482
- } else {
483
- (options.error as Function)({
484
- ...res,
485
- ...audioObj
486
- });
487
- }
488
- },
489
- error: (error: any) => {
490
- (options.error as Function)({
491
- error,
492
- ...audioObj
493
- });
494
- }
495
- });
496
- } else {
497
- (options.error as Function)({
498
- ...preInfo,
499
- ...audioObj
500
- });
501
- }
502
- },
503
- error: (error: any) => {
504
- (options.error as Function)({
505
- error,
506
- ...audioObj
507
- });
508
- }
509
- });
510
- }
511
- static createEventHandle(callbacks: any = {}) {
512
- callbacks.success =
513
- typeof callbacks.success == "function" ? callbacks.success : ueSoftphone.noop;
514
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : ueSoftphone.noop;
515
- callbacks.message =
516
- typeof callbacks.message == "function" ? callbacks.message : ueSoftphone.noop;
517
- callbacks.event = typeof callbacks.event == "function" ? callbacks.event : ueSoftphone.noop;
518
- callbacks.server =
519
- callbacks.serve === null || callbacks.serve === undefined
520
- ? "ws://152.136.72.209:3201/phoneBarGateway"
521
- : callbacks.serve;
522
-
523
- if (callbacks.SocketOptions === null || callbacks.SocketOptions === undefined) {
524
- callbacks.SocketOptions = {};
525
- ueSoftphone.error({ message: "login response error!" });
526
- }
527
- this.Socketinstance = ueSoftphone.newWebSocket(callbacks.server, callbacks.SocketOptions);
528
- this.Socketinstance.on("connect", () => {
529
- callbacks.success("connect event serve success!");
530
- callbacks.suc();
531
- // (ueSoftphone.initOptions.success as Function)({
532
- // agentNumber: ueSoftphone.agentInfo.agentNumber,
533
- // agentName: ueSoftphone.agentInfo.agentName,
534
- // mobile: ueSoftphone.agentInfo.mobile,
535
- // sipNumber: ueSoftphone.agentInfo.sipNumber,
536
- // loginStatus: ueSoftphone.agentInfo.loginStatus,
537
- // loginType: ueSoftphone.agentInfo.loginType,
538
- // restTime: ueSoftphone.agentInfo.restTime,
539
- // toAnswerOffline: ueSoftphone.agentInfo.toAnswerOffline || '0',
540
- // ...(ueSoftphone.initOptions.audioInfo || {})
541
- // })
542
- });
543
-
544
- this.Socketinstance.on("error", (error: string, fn: Function) => {
545
- callbacks.error({
546
- type: "socketError",
547
- error: error
548
- });
549
- if (fn && typeof fn === "function") {
550
- fn("error");
551
- }
552
- });
553
-
554
- this.Socketinstance.on("message", (event: any, fn: Function) => {
555
- callbacks.message({
556
- subtype: event.subType,
557
- data: event.data
558
- });
559
-
560
- if (ueSoftphone.initOptions.loginType === "WEBRTC") {
561
- if (event.data && event.data.callType && event.data.callType === 'callin' && event.data.eventType && event.data.eventType ==='ring') {
562
- if (!ueSoftphone.AudioTask) {
563
- ueSoftphone.AudioTask = new AudioTask('https://softphone.useasy.cn/ring.wav');
564
- }
565
- ueSoftphone.AudioTask.ringAudioPlay()
566
- } else {
567
- if (ueSoftphone.AudioTask) {
568
- ueSoftphone.AudioTask.ringAudioPause()
569
- }
570
- }
571
- }
572
- if (fn && typeof fn === "function") {
573
- fn("success");
574
- }
575
- });
576
-
577
- this.Socketinstance.on("event", (event: any) => {
578
- // 互踢逻辑
579
- if (event.subType === "KICK_OFF") {
580
- // 收到互踢消息设置标志,用于断网重连时使用
581
- window.sessionStorage.setItem('kickoff', 'true')
582
- if (event.data.kickoff === true) {
583
- this.Socketinstance.disconnect();
584
- ueSoftphone.loginToken = 'KICK_OFF'
585
- try {
586
- ueSoftphone.webPhone.disconnect();
587
- console.log(event,"互踢")
588
- } catch (error) {}
589
- callbacks.event({
590
- message: "坐席账户在其他地方登录",
591
- data: event
592
- });
593
- }
594
- }
595
- });
596
- }
597
-
598
- // 若是webrtc的方式,会获取webrtc相关信息,注册地址,注册密码等。
599
- private getWebrtcInfo = (server: any, options: any) => {
600
- ueSoftphone.request(server + "/call/api/sip/webrtc/config/query", {
601
- verb: "GET",
602
- loginToken: ueSoftphone.loginToken,
603
- sessionId: ueSoftphone.agentInfo._id,
604
- success: (webrtcInfo: any) => {
605
- if (webrtcInfo.success && webrtcInfo.data) {
606
- ueSoftphone.agentextras = webrtcInfo.data;
607
- ueSoftphone.initWebrtcEvent(webrtcInfo.data);
608
- } else {
609
- (options.error as Function)({
610
- ...webrtcInfo
611
- });
612
- }
613
- },
614
- error: (error: any) => {
615
- (options.error as Function)({
616
- error
617
- });
618
- }
619
- });
620
- };
621
- // 监控事件回调
622
- // private initMonitorAttachEvent = (options: SocketMonitorOptions, userOptions: any) => {
623
- // console.log("initMonitorAttachEvent", options,userOptions);
624
-
625
- // if (this.attachMonitorEventCallbacks) {
626
- // this.attachMonitorEventCallbacks.serve = options.sdkMonitorUrl;
627
- // // this.attachMonitorEventCallbacks.sdkMonitorType =
628
- // // ueSoftphone.initOptions.sdkMonitorType || [];
629
- // this.attachMonitorEventCallbacks.SocketOptions = {
630
- // query: {
631
- // 电话条事件回调
632
- private initAttachEvent = (
633
- server: any,
634
- loginType: string,
635
- options: any,
636
- userOptions: any,
637
- suc: any
638
- ) => {
639
- if (this.attachEventCallbacks) {
640
- // 每次创建链接的时候,要获取最新的ws token
641
- ueSoftphone.request(server + "/platform/action/refreshWsToken", {
642
- verb: "GET",
643
- loginToken: ueSoftphone.loginToken,
644
- sessionId: ueSoftphone.agentInfo._id,
645
- success: (res: any) => {
646
- if (res && res.data) {
647
- let serverUrl = "";
648
- options.forEach((item: any) => {
649
- if (item.id === "KF") {
650
- serverUrl = item.url;
651
- }
652
- });
653
- this.attachEventCallbacks.serve = serverUrl;
654
- this.attachEventCallbacks.SocketOptions = {
655
- query: {
656
- accountId: userOptions.accountId,
657
- agentNumber: userOptions.agentNumber,
658
- agentId: userOptions._id,
659
- token: res.data.wsToken,
660
- wsExtra: JSON.stringify({
661
- loginType: loginType,
662
- channelType: "SDK",
663
- ability: ["call"]
664
- }),
665
- timestamp: res.data.timestamp,
666
- clientType: 1,
667
- pushHangupStatistics: ueSoftphone.initOptions.pushHangupStatistics || false,
668
- pushCallinRingStatistics: ueSoftphone.initOptions.pushCallinRingStatistics || false
669
- },
670
- reconnectionDelay: 3000,
671
- "force new connection": true,
672
- transports: ["websocket"],
673
- timeout: 5000
674
- };
675
- this.attachEventCallbacks.suc = suc;
676
- ueSoftphone.createEventHandle(this.attachEventCallbacks);
677
- }
678
- },
679
- error: (error: any) => {
680
- (options.error as Function)({
681
- error
682
- });
683
- }
684
- });
685
- }
686
- };
687
-
688
- // 网络监测监听
689
- private attachNetworkCallbacks: any = {
690
- message: ueSoftphone.noop,
691
- error: ueSoftphone.noop,
692
- success: ueSoftphone.noop
693
- };
694
- private initnNetworkMonitoring = (pushServer, callbacks:any) => {
695
- let currentUrl = ''
696
- pushServer.forEach((item) => {
697
- if (item.id === 'MONITOR') {
698
- let protocol = document.location.protocol
699
- if (protocol === 'file:') {
700
- protocol = 'https:'
701
- }
702
- currentUrl = protocol + '//' + item.url
703
- }
704
- })
705
- this.attachNetworkCallbacks.success()
706
- this.attachNetworkCallbacks.message({
707
- delay: 100
708
- })
709
- setInterval(() => {
710
- // if (networkMonitoringConfig.requestState) {
711
- // return
712
- // }
713
- const startTime = new Date().getTime()
714
- networkMonitoringConfig.requestState = true
715
- ueSoftphone.request(currentUrl + "/ready", {
716
- method: "GET",
717
- success: (res: any) => {
718
- if (res.success) {
719
- const endTime = new Date().getTime()
720
- networkMonitoringConfig.delay = (endTime - startTime) / 2
721
- this.attachNetworkCallbacks.message({
722
- delay: networkMonitoringConfig.delay
723
- })
724
- } else {
725
- this.attachNetworkCallbacks.error()
726
- networkMonitoringConfig.delay = 500
727
- networkMonitoringConfig.requestState = false
728
- }
729
- },
730
- error: (error: any) => {
731
- this.attachNetworkCallbacks.error()
732
- networkMonitoringConfig.delay = 500
733
- networkMonitoringConfig.requestState = false
734
- }
735
- });
736
- }, 10000)
737
- }
738
-
739
- public listenCallNetork = (callbacks: OnCallEventParams) => {
740
- if (callbacks) {
741
- this.attachNetworkCallbacks.message = callbacks.message && typeof callbacks.message == "function" ? callbacks.message : ueSoftphone.noop;
742
- this.attachNetworkCallbacks.success = callbacks.success && typeof callbacks.success == "function" ? callbacks.success : ueSoftphone.noop;
743
- this.attachNetworkCallbacks.error = callbacks.error && typeof callbacks.error == "function" ? callbacks.error : ueSoftphone.noop;
744
- }
745
- };
746
-
747
- // 呼叫队列
748
- private initAgentQueue = (
749
- server: any,
750
- loginType: string,
751
- options: any,
752
- userOptions: any,
753
- suc: any
754
- ) => {
755
- if (this.attachMonitorEventCallbacks||this.attachNlsTranslationEventCallbacks) {
756
- // 每次创建链接的时候,要获取最新的ws token
757
- ueSoftphone.request(server + "/platform/action/refreshWsToken", {
758
- verb: "GET",
759
- loginToken: ueSoftphone.loginToken,
760
- sessionId: ueSoftphone.agentInfo._id,
761
- success: (res: any) => {
762
- if (res && res.data) {
763
- let serverUrl = "";
764
- options.forEach((item: any) => {
765
- if (item.id === "MONITOR") {
766
- serverUrl = item.url;
767
- }
768
- });
769
- if(this.attachMonitorEventCallbacks&&ueSoftphone.UserConfig.isOpenCallQueue){
770
- this.attachMonitorEventCallbacks.serve = serverUrl;
771
- this.attachMonitorEventCallbacks.SocketOptions = {
772
- query: {
773
- accountId: userOptions.accountId,
774
- agentNumber: userOptions.agentNumber,
775
- agentId: userOptions._id,
776
- token: res.data.wsToken,
777
- wsExtra: JSON.stringify({
778
- loginType: loginType,
779
- channelType: "SDK",
780
- ability: ["call"]
781
- }),
782
- timestamp: res.data.timestamp,
783
- clientType: 3
784
- },
785
- reconnectionDelay: 3000,
786
- "force new connection": true,
787
- transports: ["websocket"],
788
- timeout: 5000
789
- };
790
- this.attachMonitorEventCallbacks.suc = suc;
791
- ueSoftphone.createQueueMonitorEventHandle(this.attachMonitorEventCallbacks);
792
- }
793
- if(this.attachNlsTranslationEventCallbacks&&ueSoftphone.UserConfig.openNlsTranslation){
794
- this.attachNlsTranslationEventCallbacks.serve = serverUrl;
795
- this.attachNlsTranslationEventCallbacks.SocketOptions = {
796
- query: {
797
- accountId: userOptions.accountId,
798
- agentNumber: userOptions.agentNumber,
799
- agentId: userOptions._id,
800
- token: res.data.wsToken,
801
- wsExtra: JSON.stringify({
802
- loginType: loginType,
803
- channelType: "SDK",
804
- ability: ["call"]
805
- }),
806
- timestamp: res.data.timestamp,
807
- clientType: 3
808
- },
809
- reconnectionDelay: 3000,
810
- "force new connection": true,
811
- transports: ["websocket"],
812
- timeout: 5000
813
- };
814
- this.attachNlsTranslationEventCallbacks.suc = suc;
815
- ueSoftphone.createopenNlsTransEventHandle(this.attachNlsTranslationEventCallbacks);
816
- }
817
- }
818
- },
819
- error: (error: any) => {
820
- console.log('失败',error);
821
- (options.error as Function)({
822
- error
823
- });
824
- }
825
- });
826
- }
827
- };
828
- // 初始化获取呼叫队列数据
829
- private initQueue = (
830
- server: any
831
- ) => {
832
- ueSoftphone.request(server + "/call/monitor/agent/queue/query", {
833
- verb: "POST",
834
- body: {
835
- accountId: ueSoftphone.agentInfo.accountId,
836
- agentId: ueSoftphone.agentInfo._id
837
- },
838
- success: (res: any) => {
839
- if (res && res.data) {
840
- this.attachMonitorEventCallbacks.message(res)
841
- }else{
842
- this.attachMonitorEventCallbacks.error(res)
843
- }
844
- },
845
- error: (error: any) => {
846
- this.attachMonitorEventCallbacks.error(error)
847
- }
848
- })
849
- }
850
- // 更新呼叫队列socket消息推送
851
- static createQueueMonitorEventHandle(callbacks: any = {}) {
852
- callbacks.success =
853
- typeof callbacks.success == "function" ? callbacks.success : ueSoftphone.noop;
854
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : ueSoftphone.noop;
855
- callbacks.message =
856
- typeof callbacks.message == "function" ? callbacks.message : ueSoftphone.noop;
857
- callbacks.server =
858
- callbacks.serve === null || callbacks.serve === undefined
859
- ? "ue-dev1.useasy.cn"
860
- : callbacks.serve;
861
-
862
- if (callbacks.SocketOptions === null || callbacks.SocketOptions === undefined) {
863
- callbacks.SocketOptions = {};
864
- ueSoftphone.error({ message: "login response error!" });
865
- }
866
- if(this.MonitorSocketinstance===null){
867
- this.MonitorSocketinstance = ueSoftphone.newWebSocket(
868
- callbacks.server,
869
- callbacks.SocketOptions
870
- )
871
- }
872
-
873
- this.MonitorSocketinstance.on("connect", () => {
874
- callbacks.success("connect event serve success!");
875
- callbacks.suc();
876
- ueSoftphone.log("监控connect========");
877
- });
878
- this.MonitorSocketinstance.on("error", (error: string, fn: Function) => {
879
- callbacks.error({
880
- type: "socketError",
881
- error: error
882
- });
883
- if (fn && typeof fn === "function") {
884
- fn("error");
885
- }
886
- });
887
-
888
- this.MonitorSocketinstance.on("event", (event, m) => {
889
- // 互踢逻辑
890
- if (event.subType === "KICK_OFF") {
891
- // 收到互踢消息设置标志,用于断网重连时使用
892
- window.sessionStorage.setItem('kickoff', 'true')
893
- if (event.data.kickoff === true) {
894
- this.MonitorSocketinstance.disconnect();
895
- try {
896
- ueSoftphone.webPhone.disconnect();
897
- } catch (error) {}
898
- callbacks.message({
899
- message: "坐席账户在其他地方登录",
900
- data: event
901
- });
902
- }
903
- }
904
- callbacks.message(event);
905
- });
906
-
907
- this.MonitorSocketinstance.on("call", (event, m) => {
908
- if(event.subType=='queue'&&ueSoftphone.UserConfig.isOpenCallQueue){
909
- callbacks.message({
910
- subtype: event.subType,
911
- data: event.data
912
- });
913
- }
914
- });
915
-
916
- // if (callbacks.sdkMonitorType) {
917
- // const sdkMonitorTypeArr = callbacks.sdkMonitorType || [];
918
- // if (Array.isArray(sdkMonitorTypeArr)) {
919
- // clearInterval(ueSoftphone.ueTimer);
920
- // ueSoftphone.ueTimer = window.setInterval(() => {
921
- // // category: summary: 概览数据, agent: 座席监控, queue: 技能组监控, trunkNumber: 服务号监控
922
- // sdkMonitorTypeArr.forEach((item) => {
923
- // this.MonitorSocketinstance.emit("monitor", "bizMonitor", { category: item });
924
- // });
925
- // }, 3000);
926
- // }
927
- // }
928
- }
929
- // 更新转译socket消息推送
930
- static createopenNlsTransEventHandle(callbacks: any = {}) {
931
- callbacks.success =
932
- typeof callbacks.success == "function" ? callbacks.success : ueSoftphone.noop;
933
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : ueSoftphone.noop;
934
- callbacks.message =
935
- typeof callbacks.message == "function" ? callbacks.message : ueSoftphone.noop;
936
- callbacks.server =
937
- callbacks.serve === null || callbacks.serve === undefined
938
- ? "ue-dev1.useasy.cn"
939
- : callbacks.serve;
940
-
941
- if (callbacks.SocketOptions === null || callbacks.SocketOptions === undefined) {
942
- callbacks.SocketOptions = {};
943
- ueSoftphone.error({ message: "login response error!" });
944
- }
945
- if(this.MonitorSocketinstance===null){
946
- this.MonitorSocketinstance = ueSoftphone.newWebSocket(
947
- callbacks.server,
948
- callbacks.SocketOptions
949
- )
950
- }
951
-
952
- this.MonitorSocketinstance.on("connect", () => {
953
- callbacks.success("转译connect event serve success!");
954
- callbacks.suc();
955
- ueSoftphone.log("转译监控connect========");
956
- });
957
- this.MonitorSocketinstance.on("error", (error: string, fn: Function) => {
958
- callbacks.error({
959
- type: "socketError",
960
- error: error
961
- });
962
- if (fn && typeof fn === "function") {
963
- fn("error");
964
- }
965
- });
966
-
967
- this.MonitorSocketinstance.on("event", (event, m) => {
968
- // 互踢逻辑
969
- if (event.subType === "KICK_OFF") {
970
- // 收到互踢消息设置标志,用于断网重连时使用
971
- window.sessionStorage.setItem('kickoff', 'true')
972
- if (event.data.kickoff === true) {
973
- this.MonitorSocketinstance.disconnect();
974
- try {
975
- ueSoftphone.webPhone.disconnect();
976
- } catch (error) {}
977
- callbacks.message({
978
- message: "坐席账户在其他地方登录",
979
- data: event
980
- });
981
- }
982
- }
983
- callbacks.message(event);
984
- });
985
-
986
- this.MonitorSocketinstance.on("call", (event, m) => {
987
- // 转译
988
- if(event.subType=='translation'&&ueSoftphone.UserConfig.openNlsTranslation){
989
- callbacks.message({
990
- subtype: event.subType,
991
- data: event.data
992
- });
993
- }
994
- });
995
- }
996
- // 对外暴露监听呼叫队列socket方法
997
- public listenCallQueueEvent = (callbacks: any) => {
998
- // 若客户对接的demo中无attachMonitorEventCallbacks回调,则无法接收到监控的事件回吐
999
- this.attachMonitorEventCallbacks = callbacks;
1000
- };
1001
-
1002
- // 电话条监听实时转译socket事件
1003
- public listenTranslationEvent = (callbacks: any) => {
1004
- // 若客户对接的demo中无attachNlsTranslationEventCallbacks回调,则无法接收到监控的事件回吐
1005
- this.attachNlsTranslationEventCallbacks = callbacks;
1006
- };
1007
-
1008
- static useDefaultDependencies(deps: any) {
1009
- const f = (deps && deps.fetch) || fetch;
1010
- const p = (deps && deps.Promise) || Promise;
1011
- const socketCls = (deps && deps.WebSocket) || WebSocket;
1012
- return {
1013
- newWebSocket(server: string, proto: any) {
1014
- return new socketCls(server, proto);
1015
- },
1016
- // 封装公共请求
1017
- request(url: string, options: any) {
1018
- const fetchOptions: any = {
1019
- method: options.verb,
1020
- cache: "no-cache",
1021
- headers: {
1022
- "Content-Type": "application/json",
1023
- loginToken: options.loginToken || "",
1024
- sessionId: options.sessionId || "",
1025
- clienttype: 0
1026
- }
1027
- };
1028
- if (options.encryptionFields) {
1029
- // 如果参数中有加密字段,header中需要新增加密字段,下面uexxx可能要修改
1030
- fetchOptions.headers["ue-encryption-algorithm"] = options.encryptionAlgorithm || "aes";
1031
- fetchOptions.headers["ue-encryption-fields"] = options.encryptionFields;
1032
- }
1033
- if (options.withCredentials !== undefined) {
1034
- fetchOptions.credentials =
1035
- options.withCredentials === true
1036
- ? "include"
1037
- : options.withCredentials
1038
- ? options.withCredentials
1039
- : "omit";
1040
- }
1041
- if (options.body !== undefined) {
1042
- fetchOptions.body = JSON.stringify(options.body);
1043
- }
1044
-
1045
- let fetching = f(url, fetchOptions).catch(function (error: any) {
1046
- return p.reject({
1047
- message: "Probably a network error, is the gateway down?",
1048
- error: error
1049
- });
1050
- });
1051
-
1052
- if (options.timeout !== undefined) {
1053
- var timeout = new p((resolve: Function, reject: Function) => {
1054
- var timerId = window.setTimeout(function () {
1055
- clearTimeout(timerId);
1056
- options.error({ message: "Request timed out", timeout: options.timeout });
1057
- return reject({ message: "Request timed out", timeout: options.timeout });
1058
- }, options.timeout);
1059
- });
1060
- fetching = p.race([fetching, timeout]);
1061
- }
1062
-
1063
- fetching
1064
- .then(function (response: any) {
1065
- if (response.ok) {
1066
- if (typeof options.success === typeof ueSoftphone.noop) {
1067
- return response
1068
- .json()
1069
- .then(function (parsed: any) {
1070
- options.success(parsed);
1071
- })
1072
- .catch(function (error: any) {
1073
- options.error({
1074
- message: "Failed to parse response body",
1075
- error: error,
1076
- response: response
1077
- });
1078
- return p.reject({
1079
- message: "Failed to parse response body",
1080
- error: error,
1081
- response: response
1082
- });
1083
- });
1084
- }
1085
- } else {
1086
- options.error({ message: "API call failed", response: response });
1087
- return p.reject({ message: "API call failed", response: response });
1088
- }
1089
- })
1090
- .catch(function (error: any) {
1091
- if (typeof options.error === typeof ueSoftphone.noop) {
1092
- options.error(error.message || "<< internal error >>", error);
1093
- }
1094
- });
1095
- return fetching;
1096
- }
1097
- };
1098
- }
1099
-
1100
- // webrtc事件回调
1101
- private static initWebrtcEvent = async (extras: any) => {
1102
- ueSoftphone.webPhone = new UeWebrtc({
1103
- server: extras.wssUrl,
1104
- sip: extras.sip,
1105
- secret: extras.password
1106
- });
1107
- // Connect to server
1108
- await this.webPhone.connect();
1109
-
1110
- // Register to receive inbound calls
1111
- this.webPhone.register();
1112
- };
1113
- // 若是webrtc的模式,会检测权限,弹窗让客户授权
1114
- private openMediaAudio = (failMsg: string, hasAlert: boolean) => {
1115
- const { mediaDevices, getUserMedia, webkitGetUserMedia, mozGetUserMedia, msGetUserMedia } =
1116
- navigator as any;
1117
- const userMedia: any = (
1118
- getUserMedia ||
1119
- webkitGetUserMedia ||
1120
- mozGetUserMedia ||
1121
- msGetUserMedia
1122
- ).bind(navigator);
1123
- if (mediaDevices) {
1124
- return navigator.mediaDevices
1125
- .getUserMedia({
1126
- audio: true
1127
- })
1128
- .catch((err) => {
1129
- const isForbidden = err.message.includes(DENIED);
1130
- if (!hasAlert) {
1131
- return isForbidden ? AUDIO_FORBIDDEN : NOT_OPEN_AUDIO;
1132
- }
1133
- isForbidden && alert(AUDIO_FORBIDDEN.forbiddenAudioMsg);
1134
- failMsg && !isForbidden && alert(failMsg);
1135
- return isForbidden ? AUDIO_FORBIDDEN : NOT_OPEN_AUDIO;
1136
- });
1137
- }
1138
- return new Promise((resolve, reject) => {
1139
- if (userMedia) {
1140
- userMedia(
1141
- { audio: true },
1142
- function onSuccess(stream) {
1143
- resolve(true);
1144
- },
1145
- function onError(error) {
1146
- if (hasAlert) {
1147
- failMsg && alert(failMsg);
1148
- }
1149
- reject(NOT_OPEN_AUDIO);
1150
- }
1151
- );
1152
- } else {
1153
- reject(NOT_OPEN_AUDIO);
1154
- }
1155
- });
1156
- };
1157
-
1158
- public listenCallEvent = (callbacks: OnCallEventParams) => {
1159
- // 若客户对接的demo中无attachEventCallbacks回调,则无法接收到电话条的事件回吐
1160
- this.attachEventCallbacks = callbacks;
1161
- };
1162
-
1163
- public get agent() {
1164
- return this._agentApi();
1165
- }
1166
-
1167
- public get webrtc() {
1168
- return this._webPhoneApi();
1169
- }
1170
-
1171
- public get call() {
1172
- return this._callApi();
1173
- }
1174
-
1175
- // public get monitorApi() {
1176
- // return this._monitorApi();
1177
- // }
1178
-
1179
- private _callApi = () => {
1180
- let encryptionAlgorithm;
1181
- let encryptionFields;
1182
- const _this = this;
1183
- return {
1184
- // 外呼
1185
- async callout(params: DialoutParams) {
1186
- params.success =
1187
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1188
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1189
- if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1190
- params.fail({
1191
- success: false,
1192
- message: "initialization not complete!"
1193
- });
1194
- return;
1195
- }
1196
- if (ueSoftphone.loginToken === 'KICK_OFF') {
1197
- params.fail({
1198
- success: false,
1199
- message: "您的座席账号正在别处登录,当前页面电话条已退出。"
1200
- });
1201
- return;
1202
- }
1203
- // if (params.encryptionAlgorithm) {
1204
- // encryptionAlgorithm = params.encryptionAlgorithm;
1205
- // }
1206
- // if (params.encryptionFields) {
1207
- // encryptionFields = params.encryptionFields;
1208
- // }
1209
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1210
- params.fail({
1211
- success: false,
1212
- message: "initialization not complete!"
1213
- });
1214
- return;
1215
- }
1216
-
1217
- if (params.customerNumber === null || params.customerNumber === undefined) {
1218
- params.fail({
1219
- success: false,
1220
- message: "Parameter customerNumber is required!"
1221
- });
1222
- return;
1223
- }
1224
- if (ueSoftphone.initOptions.loginType === "WEBRTC") {
1225
- try {
1226
- await navigator.mediaDevices.getUserMedia({ audio: true })
1227
- } catch (error) {
1228
- params.fail({
1229
- success: false,
1230
- message: "无麦克风权限!"
1231
- });
1232
- return;
1233
- }
1234
- }
1235
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1236
- const query: DialoutParams = {
1237
- customerNumber: params.customerNumber,
1238
- agentNumber: ueSoftphone.agentInfo.agentNumber,
1239
- accountId: ueSoftphone.agentInfo.accountId,
1240
- agentId: ueSoftphone.agentInfo._id,
1241
- loginType:
1242
- params.loginType || ueSoftphone.agentInfo.loginType || ueSoftphone.initOptions.loginType
1243
- };
1244
- if (params.agentTimeout) {
1245
- query.agentTimeout = params.agentTimeout;
1246
- }
1247
- if (params.customerTimeout) {
1248
- query.customerTimeout = params.customerTimeout;
1249
- }
1250
- if (params.agentDisNumber) {
1251
- query.agentDisNumber = params.agentDisNumber;
1252
- }
1253
- if (params.customerDisNumber) {
1254
- query.customerDisNumber = params.customerDisNumber;
1255
- }
1256
- if (params.extras) {
1257
- query.extras = params.extras;
1258
- }
1259
- // if (params.group) {
1260
- // query.group = params.group;
1261
- // }
1262
- // if (params.groupRule) {
1263
- // query.groupRule = params.groupRule;
1264
- // }
1265
- // if (params.groupareaCode) {
1266
- // query.groupareaCode = params.groupareaCode;
1267
- // }
1268
- if (params.numberGroupId) {
1269
- query.numberGroupId = params.numberGroupId
1270
- }
1271
-
1272
- if (params.numberGroupName) {
1273
- query.numberGroupName = params.numberGroupName
1274
- }
1275
-
1276
- const options = ueSoftphone.initOptions;
1277
- const isStrongHint = true;
1278
- // typeof options.isStrongHint === "boolean" ? options.isStrongHint : true;
1279
- let audioObj;
1280
- if (options.loginType === "WEBRTC") {
1281
- try {
1282
- audioObj = (await _this.openMediaAudio("请打开麦克风权限!", isStrongHint)) || {};
1283
- } catch (error) {
1284
- console.log(error);
1285
- }
1286
- }
1287
- ueSoftphone.request(server + "/call/api/call/call/out", {
1288
- verb: "POST",
1289
- body: query,
1290
- loginToken: ueSoftphone.loginToken,
1291
- sessionId: ueSoftphone.agentInfo._id,
1292
- encryptionAlgorithm,
1293
- encryptionFields,
1294
- success: (res: any) => {
1295
- if (res.success) {
1296
- (params.success as Function)({
1297
- success: true,
1298
- message: "callout success",
1299
- ...audioObj,
1300
- ...res.data
1301
- });
1302
- } else {
1303
- (params.fail as Function)({
1304
- success: false,
1305
- message: res.message,
1306
- code: res.code,
1307
- ...audioObj
1308
- });
1309
- }
1310
- }
1311
- });
1312
- },
1313
- // 挂机
1314
- hangup(params: HangupParams) {
1315
- params.success =
1316
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1317
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1318
-
1319
- if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1320
- params.fail({
1321
- success: false,
1322
- message: "initialization not complete!"
1323
- });
1324
- return;
1325
- }
1326
-
1327
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1328
- params.fail({
1329
- success: false,
1330
- message: "initialization not complete!"
1331
- });
1332
- return;
1333
- }
1334
-
1335
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1336
-
1337
- ueSoftphone.request(server + "/call/api/call/hangup", {
1338
- verb: "POST",
1339
- body: {},
1340
- loginToken: ueSoftphone.loginToken,
1341
- sessionId: ueSoftphone.agentInfo._id,
1342
- accountId: ueSoftphone.agentInfo.accountId,
1343
- encryptionAlgorithm,
1344
- encryptionFields,
1345
- success: (res: any) => {
1346
- if (res.success) {
1347
- (params.success as Function)({
1348
- success: true,
1349
- message: "hangup success",
1350
- // res.data是null,抛出去异常,导致无法挂断
1351
- // data: res.data.response.data
1352
- data: res
1353
- });
1354
- } else {
1355
- (params.fail as Function)({
1356
- success: false,
1357
- message: res.message,
1358
- code: res.code
1359
- });
1360
- }
1361
- }
1362
- });
1363
- },
1364
- // 保持/取消保持
1365
- holdOrUnHold(params: HoldOrUnHoldParams) {
1366
- //保持 取消保持
1367
- params.success =
1368
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1369
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1370
- if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1371
- params.fail({
1372
- success: false,
1373
- message: "initialization not complete!"
1374
- });
1375
- return;
1376
- }
1377
-
1378
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1379
- params.fail({
1380
- success: false,
1381
- message: "initialization not complete!"
1382
- });
1383
- return;
1384
- }
1385
-
1386
- if (params.type === null || params.type === undefined) {
1387
- params.fail({
1388
- success: false,
1389
- message: "Parameter type is required!"
1390
- });
1391
- return;
1392
- }
1393
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1394
- const query: HoldOrUnHoldParams = {
1395
- type: params.type
1396
- };
1397
- ueSoftphone.request(server + "/call/api/call/hold", {
1398
- verb: "POST",
1399
- body: query,
1400
- loginToken: ueSoftphone.loginToken,
1401
- sessionId: ueSoftphone.agentInfo._id,
1402
- accountId: ueSoftphone.agentInfo.accountId,
1403
- encryptionAlgorithm,
1404
- encryptionFields,
1405
- success: (res: any) => {
1406
- if (res.success) {
1407
- (params.success as Function)({
1408
- success: true,
1409
- message: "holdOrUnHold success"
1410
- });
1411
- } else {
1412
- (params.fail as Function)({
1413
- success: false,
1414
- message: res.message,
1415
- code: res.code
1416
- });
1417
- }
1418
- }
1419
- });
1420
- },
1421
- // 静音/取消静音
1422
- muteOrUnMute(params: MuteOrUnMuteParams) {
1423
- //静音 取消静音
1424
- params.success =
1425
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1426
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1427
- if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1428
- params.fail({
1429
- success: false,
1430
- message: "initialization not complete!"
1431
- });
1432
- return;
1433
- }
1434
-
1435
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1436
- params.fail({
1437
- success: false,
1438
- message: "initialization not complete!"
1439
- });
1440
- return;
1441
- }
1442
-
1443
- if (params.type === null || params.type === undefined) {
1444
- params.fail({
1445
- success: false,
1446
- message: "Parameter type is required!"
1447
- });
1448
- return;
1449
- }
1450
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1451
- const query: MuteOrUnMuteParams = {
1452
- type: params.type,
1453
- direction: params.direction || "all"
1454
- };
1455
- ueSoftphone.request(server + "/call/api/call/mute", {
1456
- verb: "POST",
1457
- body: query,
1458
- loginToken: ueSoftphone.loginToken,
1459
- sessionId: ueSoftphone.agentInfo._id,
1460
- accountId: ueSoftphone.agentInfo.accountId,
1461
- encryptionAlgorithm,
1462
- encryptionFields,
1463
- success: (res: any) => {
1464
- if (res.success) {
1465
- (params.success as Function)({
1466
- success: true,
1467
- message: "muteOrUnMute success"
1468
- });
1469
- } else {
1470
- (params.fail as Function)({
1471
- success: false,
1472
- message: res.message,
1473
- code: res.code
1474
- });
1475
- }
1476
- }
1477
- });
1478
- },
1479
- // 转接
1480
- transfer(params: TransferParams) {
1481
- params.success =
1482
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1483
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1484
-
1485
- if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1486
- params.fail({
1487
- success: false,
1488
- message: "initialization not complete!"
1489
- });
1490
- return;
1491
- }
1492
-
1493
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1494
- params.fail({
1495
- success: false,
1496
- message: "initialization not complete!"
1497
- });
1498
- return;
1499
- }
1500
- if (params.type === null || params.type === undefined) {
1501
- params.fail({
1502
- success: false,
1503
- message: "Parameter type is required!"
1504
- });
1505
- return;
1506
- } else if (params.number === null || params.number === undefined) {
1507
- params.fail({
1508
- success: false,
1509
- message: "Parameter number is required!"
1510
- });
1511
- return;
1512
- }
1513
-
1514
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1515
-
1516
- ueSoftphone.request(server + "/call/api/call/transfer", {
1517
- verb: "POST",
1518
- body: params,
1519
- loginToken: ueSoftphone.loginToken,
1520
- sessionId: ueSoftphone.agentInfo._id,
1521
- accountId: ueSoftphone.agentInfo.accountId,
1522
- encryptionAlgorithm,
1523
- encryptionFields,
1524
- success: (res: any) => {
1525
- if (res.success) {
1526
- (params.success as Function)({
1527
- success: true,
1528
- message: "transfer success",
1529
- data: res.data.response.data
1530
- });
1531
- } else {
1532
- (params.fail as Function)({
1533
- success: false,
1534
- message: res.message,
1535
- code: res.code
1536
- });
1537
- }
1538
- }
1539
- });
1540
- },
1541
- // 咨询
1542
- consult(params: consultParams) {
1543
- params.success =
1544
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1545
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1546
-
1547
- if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1548
- params.fail({
1549
- success: false,
1550
- message: "initialization not complete!"
1551
- });
1552
- return;
1553
- }
1554
-
1555
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1556
- params.fail({
1557
- success: false,
1558
- message: "initialization not complete!"
1559
- });
1560
- return;
1561
- }
1562
-
1563
- if (params.mode === null || params.mode === undefined) {
1564
- params.fail({
1565
- success: false,
1566
- message: "Parameter mode is required!"
1567
- });
1568
- return;
1569
- } else if (params.number === null || params.number === undefined) {
1570
- params.fail({
1571
- success: false,
1572
- message: "Parameter number is required!"
1573
- });
1574
- return;
1575
- }
1576
-
1577
- params.agentNumber = ueSoftphone.agentInfo.agentNumber
1578
-
1579
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1580
- ueSoftphone.request(server + "/call/api/call/consult", {
1581
- verb: "POST",
1582
- body: params,
1583
- loginToken: ueSoftphone.loginToken,
1584
- sessionId: ueSoftphone.agentInfo._id,
1585
- accountId: ueSoftphone.agentInfo.accountId,
1586
- encryptionAlgorithm,
1587
- encryptionFields,
1588
- success: (res: any) => {
1589
- if (res.success) {
1590
- (params.success as Function)({
1591
- success: true,
1592
- message: "consult success",
1593
- data: res.data.response.data
1594
- });
1595
- } else {
1596
- (params.fail as Function)({
1597
- success: false,
1598
- message: res.message,
1599
- code: res.code
1600
- });
1601
- }
1602
- }
1603
- });
1604
- },
1605
- // 取消咨询
1606
- cancelconsult(params: cancleConsultParams) {
1607
- params.success =
1608
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1609
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1610
-
1611
- if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1612
- params.fail({
1613
- success: false,
1614
- message: "initialization not complete!"
1615
- });
1616
- return;
1617
- }
1618
-
1619
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1620
- params.fail({
1621
- success: false,
1622
- message: "initialization not complete!"
1623
- });
1624
- return;
1625
- }
1626
-
1627
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1628
-
1629
- ueSoftphone.request(server + "/call/api/call/consult/cancel", {
1630
- verb: "POST",
1631
- body: params,
1632
- loginToken: ueSoftphone.loginToken,
1633
- sessionId: ueSoftphone.agentInfo._id,
1634
- accountId: ueSoftphone.agentInfo.accountId,
1635
- encryptionAlgorithm,
1636
- encryptionFields,
1637
- success: (res: any) => {
1638
- if (res.success) {
1639
- (params.success as Function)({
1640
- success: true,
1641
- message: "cancelconsult success",
1642
- data: res.data.response.data
1643
- });
1644
- } else {
1645
- (params.fail as Function)({
1646
- success: false,
1647
- message: res.message,
1648
- code: res.code
1649
- });
1650
- }
1651
- }
1652
- });
1653
- },
1654
- // 结束咨询
1655
- endConsult(params: stopConsultParams) {
1656
- params.success =
1657
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1658
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1659
-
1660
- if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1661
- params.fail({
1662
- success: false,
1663
- message: "initialization not complete!"
1664
- });
1665
- return;
1666
- }
1667
-
1668
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1669
- params.fail({
1670
- success: false,
1671
- message: "initialization not complete!"
1672
- });
1673
- return;
1674
- }
1675
-
1676
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1677
-
1678
- ueSoftphone.request(server + "/call/api/call/consult/stop", {
1679
- verb: "POST",
1680
- body: params,
1681
- loginToken: ueSoftphone.loginToken,
1682
- sessionId: ueSoftphone.agentInfo._id,
1683
- accountId: ueSoftphone.agentInfo.accountId,
1684
- encryptionAlgorithm,
1685
- encryptionFields,
1686
- success: (res: any) => {
1687
- if (res.success) {
1688
- (params.success as Function)({
1689
- success: true,
1690
- message: "endConsult success",
1691
- data: res.data.response.data
1692
- });
1693
- } else {
1694
- (params.fail as Function)({
1695
- success: false,
1696
- message: res.message,
1697
- code: res.code
1698
- });
1699
- }
1700
- }
1701
- });
1702
- },
1703
- // 咨询接回
1704
- callbackConsult(params: resumeConsultParams) {
1705
- params.success =
1706
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1707
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1708
-
1709
- if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1710
- params.fail({
1711
- success: false,
1712
- message: "initialization not complete!"
1713
- });
1714
- return;
1715
- }
1716
-
1717
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1718
- params.fail({
1719
- success: false,
1720
- message: "initialization not complete!"
1721
- });
1722
- return;
1723
- }
1724
-
1725
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1726
-
1727
- ueSoftphone.request(server + "/call/api/call/consult/resume", {
1728
- verb: "POST",
1729
- body: params,
1730
- loginToken: ueSoftphone.loginToken,
1731
- sessionId: ueSoftphone.agentInfo._id,
1732
- accountId: ueSoftphone.agentInfo.accountId,
1733
- encryptionAlgorithm,
1734
- encryptionFields,
1735
- success: (res: any) => {
1736
- if (res.success) {
1737
- (params.success as Function)({
1738
- success: true,
1739
- message: "resumeConsult success",
1740
- data: res.data.response.data
1741
- });
1742
- } else {
1743
- (params.fail as Function)({
1744
- success: false,
1745
- message: res.message,
1746
- code: res.code
1747
- });
1748
- }
1749
- }
1750
- });
1751
- },
1752
- // 咨询转接
1753
- consultTransfer(params: consultTransferParams) {
1754
- params.success =
1755
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1756
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1757
-
1758
- if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1759
- params.fail({
1760
- success: false,
1761
- message: "initialization not complete!"
1762
- });
1763
- return;
1764
- }
1765
-
1766
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1767
- params.fail({
1768
- success: false,
1769
- message: "initialization not complete!"
1770
- });
1771
- return;
1772
- }
1773
-
1774
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1775
-
1776
- ueSoftphone.request(server + "/call/api/call/consult/transfer", {
1777
- verb: "POST",
1778
- body: params,
1779
- loginToken: ueSoftphone.loginToken,
1780
- sessionId: ueSoftphone.agentInfo._id,
1781
- accountId: ueSoftphone.agentInfo.accountId,
1782
- encryptionAlgorithm,
1783
- encryptionFields,
1784
- success: (res: any) => {
1785
- if (res.success) {
1786
- (params.success as Function)({
1787
- success: true,
1788
- message: "consultTransfer success",
1789
- data: res.data.response.data
1790
- });
1791
- } else {
1792
- (params.fail as Function)({
1793
- success: false,
1794
- message: res.message,
1795
- code: res.code
1796
- });
1797
- }
1798
- }
1799
- });
1800
- },
1801
- // 三方
1802
- threeWayCall(params: threeWayCallParams) {
1803
- params.success =
1804
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1805
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1806
-
1807
- if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1808
- params.fail({
1809
- success: false,
1810
- message: "initialization not complete!"
1811
- });
1812
- return;
1813
- }
1814
-
1815
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1816
- params.fail({
1817
- success: false,
1818
- message: "initialization not complete!"
1819
- });
1820
- return;
1821
- }
1822
-
1823
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1824
-
1825
- ueSoftphone.request(server + "/call/api/call/threeway", {
1826
- verb: "POST",
1827
- body: params,
1828
- loginToken: ueSoftphone.loginToken,
1829
- sessionId: ueSoftphone.agentInfo._id,
1830
- accountId: ueSoftphone.agentInfo.accountId,
1831
- encryptionAlgorithm,
1832
- encryptionFields,
1833
- success: (res: any) => {
1834
- if (res.success) {
1835
- (params.success as Function)({
1836
- success: true,
1837
- message: "threeWayCall success",
1838
- data: res.data.response.data
1839
- });
1840
- } else {
1841
- (params.fail as Function)({
1842
- success: false,
1843
- message: res.message,
1844
- code: res.code
1845
- });
1846
- }
1847
- }
1848
- });
1849
- },
1850
- // 转满意度
1851
- evaluate(params: satisfactionParams) {
1852
- params.success =
1853
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1854
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1855
-
1856
- if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1857
- params.fail({
1858
- success: false,
1859
- message: "initialization not complete!"
1860
- });
1861
- return;
1862
- }
1863
-
1864
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1865
- params.fail({
1866
- success: false,
1867
- message: "initialization not complete!"
1868
- });
1869
- return;
1870
- }
1871
- if (params.type === null || params.type === undefined) {
1872
- params.fail({
1873
- success: false,
1874
- message: "Parameter type is required!"
1875
- });
1876
- return;
1877
- }
1878
-
1879
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1880
-
1881
- ueSoftphone.request(server + "/call/api/call/evaluate", {
1882
- verb: "POST",
1883
- body: params,
1884
- loginToken: ueSoftphone.loginToken,
1885
- sessionId: ueSoftphone.agentInfo._id,
1886
- accountId: ueSoftphone.agentInfo.accountId,
1887
- encryptionAlgorithm,
1888
- encryptionFields,
1889
- success: (res: any) => {
1890
- if (res.success) {
1891
- (params.success as Function)({
1892
- success: true,
1893
- message: "evaluate success",
1894
- data: res.data.response.data
1895
- });
1896
- } else {
1897
- (params.fail as Function)({
1898
- success: false,
1899
- message: res.message,
1900
- code: res.code
1901
- });
1902
- }
1903
- }
1904
- });
1905
- },
1906
- meeting(params: meetingParams) {
1907
- params.success =
1908
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1909
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1910
-
1911
- if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
1912
- params.fail({
1913
- success: false,
1914
- message: "initialization not complete!"
1915
- });
1916
- return;
1917
- }
1918
-
1919
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1920
- params.fail({
1921
- success: false,
1922
- message: "initialization not complete!"
1923
- });
1924
- return;
1925
- }
1926
- if (params.number === null || params.number === undefined) {
1927
- params.fail({
1928
- success: false,
1929
- message: "Parameter number is required!"
1930
- });
1931
- return;
1932
- }
1933
-
1934
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
1935
-
1936
- ueSoftphone.request(server + "/call/api/call/meeting", {
1937
- verb: "POST",
1938
- body: {
1939
- meetingType: "phone",
1940
- number: params.number
1941
- },
1942
- loginToken: ueSoftphone.loginToken,
1943
- sessionId: ueSoftphone.agentInfo._id,
1944
- accountId: ueSoftphone.agentInfo.accountId,
1945
- encryptionAlgorithm,
1946
- encryptionFields,
1947
- success: (res: any) => {
1948
- if (res.success) {
1949
- (params.success as Function)({
1950
- success: true,
1951
- message: "meeting success",
1952
- data: res.data.response.data
1953
- });
1954
- } else {
1955
- (params.fail as Function)({
1956
- success: false,
1957
- message: res.message,
1958
- code: res.code
1959
- });
1960
- }
1961
- }
1962
- });
1963
- }
1964
- };
1965
- };
1966
-
1967
- private _agentApi = () => {
1968
- const that = this;
1969
- return {
1970
- // 切换接听方式
1971
- async switchLoginType(params: UpdateLoginTypeParams) {
1972
- let loginNumber: any = null;
1973
- params.success =
1974
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
1975
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
1976
- if (params.loginType === null || params.loginType === undefined) {
1977
- params.fail({
1978
- success: false,
1979
- message: "Parameter loginType is required!"
1980
- });
1981
- return;
1982
- }
1983
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
1984
- params.fail({
1985
- success: false,
1986
- message: "initialization not complete!"
1987
- });
1988
- return;
1989
- }
1990
- if (params.loginNumber !== null && params.loginNumber !== undefined) {
1991
- loginNumber = params.loginNumber;
1992
- }
1993
- if (params.loginType === "PSTN") {
1994
- loginNumber = loginNumber ? loginNumber : ueSoftphone.agentInfo.mobile;
1995
- if (!loginNumber) {
1996
- alert("请给座席绑定手机号,或者传入号码参数!");
1997
- params.fail({
1998
- success: false,
1999
- message: "Please bind your mobile number"
2000
- });
2001
- return;
2002
- }
2003
- }
2004
- if (params.loginType === "SIP") {
2005
- loginNumber = loginNumber ? loginNumber : ueSoftphone.agentInfo.sipNumber;
2006
- }
2007
- if (params.loginType === "WEBRTC") {
2008
- loginNumber = ueSoftphone.agentInfo.webrtcSipNumber;
2009
- }
2010
-
2011
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2012
- const query: UpdateLoginTypeParams = {
2013
- loginType: params.loginType,
2014
- loginNumber: loginNumber
2015
- };
2016
- const options = ueSoftphone.initOptions;
2017
- let audioObj;
2018
- const isStrongHint = true;
2019
- // typeof options.isStrongHint === "boolean" ? options.isStrongHint : true;
2020
- if (params.loginType === "WEBRTC") {
2021
- try {
2022
- audioObj = (await that.openMediaAudio("请打开麦克风权限!", isStrongHint)) || {};
2023
- } catch (error) {
2024
- console.log(error);
2025
- }
2026
- }
2027
- ueSoftphone.request(server + "/call/api/agent/v1/login-type/change", {
2028
- verb: "POST",
2029
- body: query,
2030
- loginToken: ueSoftphone.loginToken,
2031
- sessionId: ueSoftphone.agentInfo._id,
2032
- accountId: ueSoftphone.agentInfo.accountId,
2033
- success: async (res: any) => {
2034
- if (res.success) {
2035
- (params.success as Function)({
2036
- success: true,
2037
- message: "updateLoginType success",
2038
- ...audioObj
2039
- });
2040
- ueSoftphone.agentInfo.loginType = params.loginType;
2041
- ueSoftphone.initOptions.loginType= params.loginType;
2042
- if (params.loginType === "WEBRTC") {
2043
- that._webPhoneApi().connect();
2044
- } else if (params.loginType === "PSTN") {
2045
- await ueSoftphone.request(server + "/platform/action/updateCallConfig", {
2046
- verb: "POST",
2047
- body: { agentCallConfig: {}, mobile: params.loginNumber! },
2048
- loginToken: ueSoftphone.loginToken,
2049
- sessionId: ueSoftphone.agentInfo._id,
2050
- accountId: ueSoftphone.agentInfo.accountId
2051
- });
2052
- that._webPhoneApi().disconnect();
2053
- } else {
2054
- that._webPhoneApi().disconnect();
2055
- }
2056
- } else {
2057
- (params.fail as Function)({
2058
- success: false,
2059
- message: res.message,
2060
- code: res.code,
2061
- ...audioObj
2062
- });
2063
- }
2064
- }
2065
- });
2066
- },
2067
- // 获取电话条的所有状态
2068
- findPhoneBarList(params: GetAgentPhoneBarParams) {
2069
- params.success =
2070
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
2071
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
2072
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
2073
- params.fail({
2074
- success: false,
2075
- message: "initialization not complete!"
2076
- });
2077
- return;
2078
- }
2079
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2080
- ueSoftphone.request(server + "/call/api/phone/bar/all", {
2081
- verb: "GET",
2082
- loginToken: ueSoftphone.loginToken,
2083
- sessionId: ueSoftphone.agentInfo._id,
2084
- accountId: ueSoftphone.agentInfo.accountId,
2085
- success: (res: any) => {
2086
- if (res.success) {
2087
- let dataList: any = [];
2088
- res.data.forEach((event: { name: any; number: any }) => {
2089
- const resEvent = { name: event.name, number: event.number };
2090
- dataList.push(resEvent);
2091
- });
2092
- (params.success as Function)({
2093
- success: true,
2094
- data: dataList
2095
- });
2096
- } else {
2097
- (params.fail as Function)({
2098
- success: false,
2099
- message: res.message,
2100
- code: res.code
2101
- });
2102
- }
2103
- }
2104
- });
2105
- },
2106
-
2107
- // 更新座席的电话条状态
2108
- switchPhoneBar(params: UpdateAgentStatusParams) {
2109
- params.success =
2110
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
2111
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
2112
- if (params.stateNumber === null || params.stateNumber === undefined) {
2113
- params.fail({
2114
- success: false,
2115
- message: "Parameter stateNumber is required!"
2116
- });
2117
- return;
2118
- }
2119
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
2120
- params.fail({
2121
- success: false,
2122
- message: "initialization not complete!"
2123
- });
2124
- return;
2125
- }
2126
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2127
- const query = {
2128
- stateNumber: params.stateNumber,
2129
- accountId: ueSoftphone.agentInfo.accountId,
2130
- agentNumber: ueSoftphone.agentInfo.agentNumber
2131
- };
2132
- ueSoftphone.request(server + "/call/api/agent/status/switch", {
2133
- verb: "POST",
2134
- body: query,
2135
- loginToken: ueSoftphone.loginToken,
2136
- sessionId: ueSoftphone.agentInfo._id,
2137
- success: (res: any) => {
2138
- if (res.success) {
2139
- (params.success as Function)({
2140
- success: true
2141
- });
2142
- } else {
2143
- (params.fail as Function)({
2144
- success: false,
2145
- message: res.message,
2146
- code: res.code
2147
- });
2148
- }
2149
- }
2150
- });
2151
- },
2152
- // 退出登录
2153
- logout(params: AgentOfflineParams) {
2154
- params.success =
2155
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
2156
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
2157
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
2158
- params.fail({
2159
- success: false,
2160
- message: "initialization not complete!"
2161
- });
2162
- return;
2163
- }
2164
- if (params.toAnswerOffline === null || params.toAnswerOffline === undefined) {
2165
- params.toAnswerOffline = "0";
2166
- }
2167
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2168
- const query = {
2169
- toAnswerOffline: params.toAnswerOffline
2170
- };
2171
- ueSoftphone.request(server + "/call/api/sdk/agent/logout", {
2172
- verb: "POST",
2173
- body: query,
2174
- loginToken: ueSoftphone.loginToken,
2175
- sessionId: ueSoftphone.agentInfo._id,
2176
- accountId: ueSoftphone.agentInfo.accountId,
2177
- success: (res: any) => {
2178
- if (res.success) {
2179
- if (params) {
2180
- ueSoftphone.Socketinstance.disconnect();
2181
- if((ueSoftphone.UserConfig.isOpenCallQueue||ueSoftphone.UserConfig.openNlsTranslation)&&ueSoftphone.MonitorSocketinstance){
2182
- ueSoftphone.MonitorSocketinstance.disconnect();
2183
- }
2184
- if (ueSoftphone.UserConfig.loginType === "WEBRTC") {
2185
- // 退出登录设置标志,用于断网重连时使用
2186
- window.sessionStorage.setItem('kickoff', 'true')
2187
- ueSoftphone.webPhone.disconnect();
2188
- }
2189
- (params.success as Function)({
2190
- success: true
2191
- });
2192
- }
2193
- } else {
2194
- if (params) {
2195
- (params.fail as Function)({
2196
- success: false,
2197
- message: res.message,
2198
- code: res.code
2199
- });
2200
- }
2201
- }
2202
- }
2203
- });
2204
- },
2205
- // 获取技能组中空闲的座席(用于转接和咨询)
2206
- findIdleAgentsForQueue(params: GetQueueOnlineAgentsParams) {
2207
- params.success =
2208
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
2209
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
2210
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
2211
- params.fail({
2212
- success: false,
2213
- message: "initialization not complete!"
2214
- });
2215
- return;
2216
- }
2217
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2218
- ueSoftphone.request(server + "/call/api/queue/acountFreeAgent/find", {
2219
- verb: "POST",
2220
- body: {},
2221
- loginToken: ueSoftphone.loginToken,
2222
- sessionId: ueSoftphone.agentInfo._id,
2223
- accountId: ueSoftphone.agentInfo.accountId,
2224
- success: (res: any) => {
2225
- if (res.success) {
2226
- if (params) {
2227
- (params.success as Function)({
2228
- success: true,
2229
- dataList: res.data || []
2230
- });
2231
- }
2232
- } else {
2233
- if (params) {
2234
- (params.fail as Function)({
2235
- success: false,
2236
- message: res.message,
2237
- code: res.code
2238
- });
2239
- }
2240
- }
2241
- }
2242
- });
2243
- },
2244
- // 切换sip接听方式的时候,拉取当前可绑定的sip号列表
2245
- getAvailableSipNumberList(params: any) {
2246
- params.success =
2247
- params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
2248
- params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
2249
- if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
2250
- params.fail({
2251
- success: false,
2252
- message: "initialization not complete!"
2253
- });
2254
- return;
2255
- }
2256
- const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2257
- ueSoftphone.request(server + "/call/api/sip/avaliable/query", {
2258
- verb: "POST",
2259
- body: {},
2260
- loginToken: ueSoftphone.loginToken,
2261
- sessionId: ueSoftphone.agentInfo._id,
2262
- success: (res: any) => {
2263
- if (res.success && res.data) {
2264
- let dataList: any = [];
2265
- res.data.forEach((event: { id: any; number: any }) => {
2266
- const resEvent = {
2267
- number: event.id,
2268
- numberName: event.number
2269
- };
2270
- dataList.push(resEvent);
2271
- });
2272
- (params.success as Function)({
2273
- success: true,
2274
- data: dataList
2275
- });
2276
- } else {
2277
- (params.fail as Function)({
2278
- success: false,
2279
- message: res.message,
2280
- code: res.code
2281
- });
2282
- }
2283
- }
2284
- });
2285
- }
2286
- // // 设置离线接听(手机和sip话机方式可行)
2287
- // setAnswerOffline(params: AgentOfflineParams) {
2288
- // params.success =
2289
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
2290
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
2291
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
2292
- // params.fail({
2293
- // success: false,
2294
- // message: "initialization not complete!"
2295
- // });
2296
- // return;
2297
- // }
2298
- // if (params.toAnswerOffline === null || params.toAnswerOffline === undefined) {
2299
- // params.toAnswerOffline = "1";
2300
- // }
2301
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2302
- // const query = {
2303
- // toAnswerOffline: params.toAnswerOffline
2304
- // };
2305
- // ueSoftphone.request(server + "/call/sdk/v1/call/offline/answer", {
2306
- // verb: "POST",
2307
- // body: query,
2308
- // loginToken: ueSoftphone.loginToken,
2309
- // sessionId: ueSoftphone.agentInfo._id,
2310
- // accountId: ueSoftphone.agentInfo.accountId,
2311
- // success: (res: any) => {
2312
- // if (res.success) {
2313
- // if (params) {
2314
- // (params.success as Function)({
2315
- // success: true,
2316
- // toAnswerOffline: params.toAnswerOffline
2317
- // });
2318
- // }
2319
- // } else {
2320
- // if (params) {
2321
- // (params.fail as Function)({
2322
- // success: false,
2323
- // message: res.message,
2324
- // code: res.code
2325
- // });
2326
- // }
2327
- // }
2328
- // }
2329
- // });
2330
- // },
2331
- // // 获取IVR语音导航列表(用于转IVR的时候可选择转哪个ivr)
2332
- // getIvrList(params: getIvrListParams) {
2333
- // params.success =
2334
- // params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
2335
- // params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
2336
- // if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
2337
- // params.fail({
2338
- // success: false,
2339
- // message: "initialization not complete!"
2340
- // });
2341
- // return;
2342
- // }
2343
- // if (params.types === null || params.types === undefined) {
2344
- // params.fail({
2345
- // success: false,
2346
- // message: "Parameter types is required!"
2347
- // });
2348
- // return;
2349
- // }
2350
- // const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
2351
- // ueSoftphone.request(server + "/call/sdk/v1/call/general/query", {
2352
- // verb: "POST",
2353
- // body: params,
2354
- // loginToken: ueSoftphone.loginToken,
2355
- // sessionId: ueSoftphone.agentInfo._id,
2356
- // accountId: ueSoftphone.agentInfo.accountId,
2357
- // success: (res: any) => {
2358
- // if (res.success) {
2359
- // if (params) {
2360
- // (params.success as Function)({
2361
- // success: true,
2362
- // dataList: res.data || []
2363
- // });
2364
- // }
2365
- // } else {
2366
- // if (params) {
2367
- // (params.fail as Function)({
2368
- // success: false,
2369
- // message: res.message,
2370
- // code: res.code
2371
- // });
2372
- // }
2373
- // }
2374
- // }
2375
- // });
2376
- // }
2377
- };
2378
- };
2379
- public _webPhoneApi = () => {
2380
- return {
2381
- // 接听
2382
- accept() {
2383
- ueSoftphone.webPhone.accept();
2384
- },
2385
- // 注册设备,链接webrtc
2386
- connect() {
2387
- if (!ueSoftphone.webPhone || !this.isConnected()) {
2388
- ueSoftphone.initWebrtcEvent(ueSoftphone.agentextras);
2389
- }
2390
- },
2391
- // 注销设备,跟webrtc断开链接
2392
- disconnect() {
2393
- if (ueSoftphone.webPhone && this.isConnected()) {
2394
- ueSoftphone.webPhone.disconnect();
2395
- }
2396
- },
2397
- // 检测设备是否有链接上
2398
- isConnected() {
2399
- return ueSoftphone.webPhone.isConnected();
2400
- },
2401
- // 发送DTMF 可与demo中的软电话拨号盘结合使用
2402
- sendDTMF(tone: string) {
2403
- ueSoftphone.webPhone.sendDTMF(tone);
2404
- }
2405
- };
2406
- };
2407
- }
2408
-
2409
- class ueWebsocket {
2410
- private ws: any;
2411
- constructor(server: string, proto: any) {
2412
- delete proto.path;
2413
- delete proto.hostname;
2414
- delete proto.port;
2415
- //@ts-ignore
2416
- this.ws = io.connect(`wss://${server}`, proto);
2417
- }
2418
- public on(type: string, callback: Function) {
2419
- if (type === "connect") {
2420
- this.ws.on(type, callback);
2421
- }
2422
- if (type === "error") {
2423
- this.ws.on("connect_error", callback);
2424
- this.ws.on("error", callback);
2425
- this.ws.on("disconnect", callback);
2426
- this.ws.on("reconnect_failed", callback);
2427
- }
2428
-
2429
- if (type === "message") {
2430
- this.ws.on("call", callback);
2431
- }
2432
-
2433
- if (type === "event") {
2434
- this.ws.on("event", callback);
2435
- }
2436
- if (type === "call") {
2437
- this.ws.on("call", callback);
2438
- }
2439
- }
2440
- public emit(type: string, params: any, callback: Function) {
2441
- this.ws.emit(type, params, callback);
2442
- }
2443
- public disconnect() {
2444
- this.ws.disconnect();
2445
- }
2446
- }
2447
-
2448
- class AudioTask {
2449
- ringAudioRunning: boolean
2450
- private ringAudio: HTMLAudioElement
2451
-
2452
- constructor(ringingUrl) {
2453
- this.ringAudio = new Audio(ringingUrl)
2454
- this.ringAudio.loop = true
2455
- this.ringAudioRunning = false
2456
- }
2457
-
2458
- async ringAudioPlay(): Promise<void> {
2459
- if (this.ringAudioRunning) {
2460
- return
2461
- } else {
2462
- await this.ringAudio.play()
2463
- this.ringAudioRunning = true
2464
- }
2465
- }
2466
-
2467
- async ringAudioPause(): Promise<void> {
2468
- if (!this.ringAudio.paused) {
2469
- await this.ringAudio.pause()
2470
- this.ringAudioRunning = false
2471
- }
2472
- }
2473
- }