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