ue-softphone-sdk 2.2.2 → 2.2.4
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/api/bye.d.ts +16 -0
- package/dist/api/dtmf.d.ts +15 -0
- package/dist/api/emitter.d.ts +88 -0
- package/dist/api/exceptions/content-type-unsupported.d.ts +8 -0
- package/dist/api/exceptions/index.d.ts +5 -0
- package/dist/api/exceptions/request-pending.d.ts +9 -0
- package/dist/api/exceptions/session-description-handler.d.ts +8 -0
- package/dist/api/exceptions/session-terminated.d.ts +8 -0
- package/dist/api/exceptions/state-transition.d.ts +8 -0
- package/dist/api/index.d.ts +58 -0
- package/dist/api/info.d.ts +16 -0
- package/dist/api/invitation-accept-options.d.ts +19 -0
- package/dist/api/invitation-progress-options.d.ts +38 -0
- package/dist/api/invitation-reject-options.d.ts +25 -0
- package/dist/api/invitation.d.ts +179 -0
- package/dist/api/inviter-cancel-options.d.ts +9 -0
- package/dist/api/inviter-invite-options.d.ts +28 -0
- package/dist/api/inviter-options.d.ts +43 -0
- package/dist/api/inviter.d.ts +236 -0
- package/dist/api/message.d.ts +16 -0
- package/dist/api/messager-message-options.d.ts +11 -0
- package/dist/api/messager-options.d.ts +17 -0
- package/dist/api/messager.d.ts +26 -0
- package/dist/api/notification.d.ts +16 -0
- package/dist/api/notifier.d.ts +8 -0
- package/dist/api/publisher-options.d.ts +33 -0
- package/dist/api/publisher-publish-options.d.ts +6 -0
- package/dist/api/publisher-state.d.ts +21 -0
- package/dist/api/publisher-unpublish-options.d.ts +6 -0
- package/dist/api/publisher.d.ts +65 -0
- package/dist/api/referral.d.ts +38 -0
- package/dist/api/registerer-options.d.ts +46 -0
- package/dist/api/registerer-register-options.d.ts +11 -0
- package/dist/api/registerer-state.d.ts +21 -0
- package/dist/api/registerer-unregister-options.d.ts +16 -0
- package/dist/api/registerer.d.ts +144 -0
- package/dist/api/session-bye-options.d.ts +11 -0
- package/dist/api/session-delegate.d.ts +73 -0
- package/dist/api/session-description-handler-factory.d.ts +15 -0
- package/dist/api/session-description-handler.d.ts +74 -0
- package/dist/api/session-info-options.d.ts +11 -0
- package/dist/api/session-invite-options.d.ts +28 -0
- package/dist/api/session-message-options.d.ts +11 -0
- package/dist/api/session-options.d.ts +8 -0
- package/dist/api/session-refer-options.d.ts +14 -0
- package/dist/api/session-state.d.ts +45 -0
- package/dist/api/session.d.ts +359 -0
- package/dist/api/subscriber-options.d.ts +11 -0
- package/dist/api/subscriber-subscribe-options.d.ts +6 -0
- package/dist/api/subscriber.d.ts +94 -0
- package/dist/api/subscription-delegate.d.ts +12 -0
- package/dist/api/subscription-options.d.ts +8 -0
- package/dist/api/subscription-state.d.ts +19 -0
- package/dist/api/subscription-subscribe-options.d.ts +6 -0
- package/dist/api/subscription-unsubscribe-options.d.ts +6 -0
- package/dist/api/subscription.d.ts +84 -0
- package/dist/api/transport-state.d.ts +37 -0
- package/dist/api/transport.d.ts +159 -0
- package/dist/api/user-agent-delegate.d.ts +84 -0
- package/dist/api/user-agent-options.d.ts +253 -0
- package/dist/api/user-agent-state.d.ts +14 -0
- package/dist/api/user-agent.d.ts +200 -0
- package/dist/core/dialogs/dialog-state.d.ts +34 -0
- package/dist/core/dialogs/dialog.d.ts +161 -0
- package/dist/core/dialogs/index.d.ts +4 -0
- package/dist/core/dialogs/session-dialog.d.ts +196 -0
- package/dist/core/dialogs/subscription-dialog.d.ts +120 -0
- package/dist/core/exceptions/exception.d.ts +8 -0
- package/dist/core/exceptions/index.d.ts +3 -0
- package/dist/core/exceptions/transaction-state-error.d.ts +8 -0
- package/dist/core/exceptions/transport-error.d.ts +8 -0
- package/dist/core/index.d.ts +15 -0
- package/dist/core/log/index.d.ts +3 -0
- package/dist/core/log/levels.d.ts +10 -0
- package/dist/core/log/logger-factory.d.ts +21 -0
- package/dist/core/log/logger.d.ts +19 -0
- package/dist/core/messages/body.d.ts +64 -0
- package/dist/core/messages/digest-authentication.d.ts +51 -0
- package/dist/core/messages/incoming-message.d.ts +79 -0
- package/dist/core/messages/incoming-request-message.d.ts +10 -0
- package/dist/core/messages/incoming-request.d.ts +67 -0
- package/dist/core/messages/incoming-response-message.d.ts +10 -0
- package/dist/core/messages/incoming-response.d.ts +12 -0
- package/dist/core/messages/index.d.ts +13 -0
- package/dist/core/messages/md5.d.ts +32 -0
- package/dist/core/messages/methods/ack.d.ts +18 -0
- package/dist/core/messages/methods/bye.d.ts +21 -0
- package/dist/core/messages/methods/cancel.d.ts +21 -0
- package/dist/core/messages/methods/constants.d.ts +20 -0
- package/dist/core/messages/methods/index.d.ts +13 -0
- package/dist/core/messages/methods/info.d.ts +21 -0
- package/dist/core/messages/methods/invite.d.ts +86 -0
- package/dist/core/messages/methods/message.d.ts +21 -0
- package/dist/core/messages/methods/notify.d.ts +21 -0
- package/dist/core/messages/methods/prack.d.ts +21 -0
- package/dist/core/messages/methods/publish.d.ts +21 -0
- package/dist/core/messages/methods/refer.d.ts +21 -0
- package/dist/core/messages/methods/register.d.ts +21 -0
- package/dist/core/messages/methods/subscribe.d.ts +54 -0
- package/dist/core/messages/outgoing-request-message.d.ts +94 -0
- package/dist/core/messages/outgoing-request.d.ts +67 -0
- package/dist/core/messages/outgoing-response.d.ts +42 -0
- package/dist/core/messages/parser.d.ts +14 -0
- package/dist/core/messages/utils.d.ts +24 -0
- package/dist/core/session/index.d.ts +2 -0
- package/dist/core/session/session-delegate.d.ts +70 -0
- package/dist/core/session/session.d.ts +134 -0
- package/dist/core/subscription/index.d.ts +2 -0
- package/dist/core/subscription/subscription-delegate.d.ts +27 -0
- package/dist/core/subscription/subscription.d.ts +55 -0
- package/dist/core/timers.d.ts +20 -0
- package/dist/core/transactions/client-transaction.d.ts +45 -0
- package/dist/core/transactions/index.d.ts +10 -0
- package/dist/core/transactions/invite-client-transaction.d.ts +116 -0
- package/dist/core/transactions/invite-server-transaction.d.ts +127 -0
- package/dist/core/transactions/non-invite-client-transaction.d.ts +69 -0
- package/dist/core/transactions/non-invite-server-transaction.d.ts +57 -0
- package/dist/core/transactions/server-transaction.d.ts +35 -0
- package/dist/core/transactions/transaction-state.d.ts +13 -0
- package/dist/core/transactions/transaction-user.d.ts +72 -0
- package/dist/core/transactions/transaction.d.ts +79 -0
- package/dist/core/transport.d.ts +31 -0
- package/dist/core/user-agent-core/allowed-methods.d.ts +4 -0
- package/dist/core/user-agent-core/index.d.ts +3 -0
- package/dist/core/user-agent-core/user-agent-core-configuration.d.ts +99 -0
- package/dist/core/user-agent-core/user-agent-core-delegate.d.ts +37 -0
- package/dist/core/user-agent-core/user-agent-core.d.ts +179 -0
- package/dist/core/user-agents/bye-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/bye-user-agent-server.d.ts +10 -0
- package/dist/core/user-agents/cancel-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/index.d.ts +26 -0
- package/dist/core/user-agents/info-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/info-user-agent-server.d.ts +10 -0
- package/dist/core/user-agents/invite-user-agent-client.d.ts +35 -0
- package/dist/core/user-agents/invite-user-agent-server.d.ts +77 -0
- package/dist/core/user-agents/message-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/message-user-agent-server.d.ts +10 -0
- package/dist/core/user-agents/notify-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/notify-user-agent-server.d.ts +16 -0
- package/dist/core/user-agents/prack-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/prack-user-agent-server.d.ts +16 -0
- package/dist/core/user-agents/publish-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/re-invite-user-agent-client.d.ts +18 -0
- package/dist/core/user-agents/re-invite-user-agent-server.d.ts +41 -0
- package/dist/core/user-agents/re-subscribe-user-agent-client.d.ts +17 -0
- package/dist/core/user-agents/re-subscribe-user-agent-server.d.ts +10 -0
- package/dist/core/user-agents/refer-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/refer-user-agent-server.d.ts +16 -0
- package/dist/core/user-agents/register-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/register-user-agent-server.d.ts +11 -0
- package/dist/core/user-agents/subscribe-user-agent-client.d.ts +65 -0
- package/dist/core/user-agents/subscribe-user-agent-server.d.ts +11 -0
- package/dist/core/user-agents/user-agent-client.d.ts +103 -0
- package/dist/core/user-agents/user-agent-server.d.ts +79 -0
- package/dist/grammar/grammar.d.ts +26 -0
- package/dist/grammar/index.d.ts +4 -0
- package/dist/grammar/name-addr-header.d.ts +24 -0
- package/dist/grammar/parameters.d.ts +16 -0
- package/dist/grammar/pegjs/dist/grammar.d.ts +50 -0
- package/dist/grammar/uri.d.ts +62 -0
- package/dist/{types/index.d.ts → index.d.ts} +7 -3
- package/dist/main.d.ts +9 -0
- package/dist/new-index.d.ts +199 -0
- package/dist/platform/web/index.d.ts +4 -0
- package/dist/platform/web/modifiers/index.d.ts +5 -0
- package/dist/platform/web/modifiers/modifiers.d.ts +41 -0
- package/dist/platform/web/session-description-handler/index.d.ts +14 -0
- package/dist/platform/web/session-description-handler/media-stream-factory-default.d.ts +6 -0
- package/dist/platform/web/session-description-handler/media-stream-factory.d.ts +6 -0
- package/dist/platform/web/session-description-handler/peer-connection-configuration-default.d.ts +5 -0
- package/dist/platform/web/session-description-handler/peer-connection-delegate.d.ts +63 -0
- package/dist/platform/web/session-description-handler/session-description-handler-configuration.d.ts +16 -0
- package/dist/platform/web/session-description-handler/session-description-handler-factory-default.d.ts +11 -0
- package/dist/platform/web/session-description-handler/session-description-handler-factory-options.d.ts +9 -0
- package/dist/platform/web/session-description-handler/session-description-handler-factory.d.ts +16 -0
- package/dist/platform/web/session-description-handler/session-description-handler-options.d.ts +47 -0
- package/dist/platform/web/session-description-handler/session-description-handler.d.ts +212 -0
- package/dist/platform/web/simple-user/index.d.ts +7 -0
- package/dist/platform/web/simple-user/simple-user-delegate.d.ts +72 -0
- package/dist/platform/web/simple-user/simple-user-options.d.ts +90 -0
- package/dist/platform/web/simple-user/simple-user.d.ts +226 -0
- package/dist/platform/web/transport/index.d.ts +6 -0
- package/dist/platform/web/transport/transport-options.d.ts +30 -0
- package/dist/platform/web/transport/transport.d.ts +125 -0
- package/dist/ue-softphone-sdk.js +2 -1
- package/dist/ue-softphone-sdk.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/webPhoneSdk.d.ts +24 -0
- package/dist/webrtc.d.ts +17 -0
- package/{rollup-new.config.mjs → new-rollup.config.mjs} +1 -1
- package/package.json +6 -6
- package/rollup.config.js +15 -14
- package/src/api/api-extractor.json +358 -0
- package/src/api/bye.ts +27 -0
- package/src/api/dtmf.ts +27 -0
- package/src/api/emitter.ts +110 -0
- package/src/api/exceptions/content-type-unsupported.ts +11 -0
- package/src/api/exceptions/index.ts +5 -0
- package/src/api/exceptions/request-pending.ts +12 -0
- package/src/api/exceptions/session-description-handler.ts +11 -0
- package/src/api/exceptions/session-terminated.ts +11 -0
- package/src/api/exceptions/state-transition.ts +11 -0
- package/src/api/index.ts +58 -0
- package/src/api/info.ts +27 -0
- package/src/api/invitation-accept-options.ts +20 -0
- package/src/api/invitation-progress-options.ts +36 -0
- package/src/api/invitation-reject-options.ts +22 -0
- package/src/api/invitation.ts +816 -0
- package/src/api/inviter-cancel-options.ts +9 -0
- package/src/api/inviter-invite-options.ts +29 -0
- package/src/api/inviter-options.ts +44 -0
- package/src/api/inviter.ts +1126 -0
- package/src/api/message.ts +27 -0
- package/src/api/messager-message-options.ts +12 -0
- package/src/api/messager-options.ts +18 -0
- package/src/api/messager.ts +89 -0
- package/src/api/notification.ts +27 -0
- package/src/api/notifier.ts +7 -0
- package/src/api/publisher-options.ts +34 -0
- package/src/api/publisher-publish-options.ts +6 -0
- package/src/api/publisher-state.ts +21 -0
- package/src/api/publisher-unpublish-options.ts +6 -0
- package/src/api/publisher.ts +418 -0
- package/src/api/referral.ts +89 -0
- package/src/api/registerer-options.ts +55 -0
- package/src/api/registerer-register-options.ts +12 -0
- package/src/api/registerer-state.ts +21 -0
- package/src/api/registerer-unregister-options.ts +17 -0
- package/src/api/registerer.ts +814 -0
- package/src/api/session-bye-options.ts +12 -0
- package/src/api/session-delegate.ts +80 -0
- package/src/api/session-description-handler-factory.ts +16 -0
- package/src/api/session-description-handler.ts +89 -0
- package/src/api/session-info-options.ts +12 -0
- package/src/api/session-invite-options.ts +29 -0
- package/src/api/session-message-options.ts +12 -0
- package/src/api/session-options.ts +8 -0
- package/src/api/session-refer-options.ts +15 -0
- package/src/api/session-state.ts +45 -0
- package/src/api/session.ts +1448 -0
- package/src/api/subscriber-options.ts +12 -0
- package/src/api/subscriber-subscribe-options.ts +6 -0
- package/src/api/subscriber.ts +536 -0
- package/src/api/subscription-delegate.ts +13 -0
- package/src/api/subscription-options.ts +8 -0
- package/src/api/subscription-state.ts +19 -0
- package/src/api/subscription-subscribe-options.ts +6 -0
- package/src/api/subscription-unsubscribe-options.ts +6 -0
- package/src/api/subscription.ts +161 -0
- package/src/api/transport-state.ts +37 -0
- package/src/api/transport.ts +169 -0
- package/src/api/user-agent-delegate.ts +95 -0
- package/src/api/user-agent-options.ts +322 -0
- package/src/api/user-agent-state.ts +14 -0
- package/src/api/user-agent.ts +1014 -0
- package/src/core/api-extractor.json +358 -0
- package/src/core/dialogs/dialog-state.ts +35 -0
- package/src/core/dialogs/dialog.ts +605 -0
- package/src/core/dialogs/index.ts +4 -0
- package/src/core/dialogs/session-dialog.ts +996 -0
- package/src/core/dialogs/subscription-dialog.ts +557 -0
- package/src/core/exceptions/exception.ts +11 -0
- package/src/core/exceptions/index.ts +3 -0
- package/src/core/exceptions/transaction-state-error.ts +11 -0
- package/src/core/exceptions/transport-error.ts +11 -0
- package/src/core/index.ts +19 -0
- package/src/core/log/index.ts +3 -0
- package/src/core/log/levels.ts +10 -0
- package/src/core/log/logger-factory.ts +119 -0
- package/src/core/log/logger.ts +42 -0
- package/src/core/messages/body.ts +171 -0
- package/src/core/messages/digest-authentication.ts +190 -0
- package/src/core/messages/incoming-message.ts +152 -0
- package/src/core/messages/incoming-request-message.ts +14 -0
- package/src/core/messages/incoming-request.ts +75 -0
- package/src/core/messages/incoming-response-message.ts +14 -0
- package/src/core/messages/incoming-response.ts +13 -0
- package/src/core/messages/index.ts +18 -0
- package/src/core/messages/md5.ts +437 -0
- package/src/core/messages/methods/ack.ts +22 -0
- package/src/core/messages/methods/bye.ts +22 -0
- package/src/core/messages/methods/cancel.ts +22 -0
- package/src/core/messages/methods/constants.ts +21 -0
- package/src/core/messages/methods/index.ts +13 -0
- package/src/core/messages/methods/info.ts +22 -0
- package/src/core/messages/methods/invite.ts +104 -0
- package/src/core/messages/methods/message.ts +22 -0
- package/src/core/messages/methods/notify.ts +22 -0
- package/src/core/messages/methods/prack.ts +22 -0
- package/src/core/messages/methods/publish.ts +22 -0
- package/src/core/messages/methods/refer.ts +22 -0
- package/src/core/messages/methods/register.ts +22 -0
- package/src/core/messages/methods/subscribe.ts +59 -0
- package/src/core/messages/outgoing-request-message.ts +299 -0
- package/src/core/messages/outgoing-request.ts +77 -0
- package/src/core/messages/outgoing-response.ts +174 -0
- package/src/core/messages/parser.ts +265 -0
- package/src/core/messages/utils.ts +144 -0
- package/src/core/session/index.ts +2 -0
- package/src/core/session/session-delegate.ts +88 -0
- package/src/core/session/session.ts +158 -0
- package/src/core/subscription/index.ts +2 -0
- package/src/core/subscription/subscription-delegate.ts +30 -0
- package/src/core/subscription/subscription.ts +61 -0
- package/src/core/timers.ts +24 -0
- package/src/core/transactions/client-transaction.ts +78 -0
- package/src/core/transactions/index.ts +10 -0
- package/src/core/transactions/invite-client-transaction.ts +504 -0
- package/src/core/transactions/invite-server-transaction.ts +432 -0
- package/src/core/transactions/non-invite-client-transaction.ts +257 -0
- package/src/core/transactions/non-invite-server-transaction.ts +241 -0
- package/src/core/transactions/server-transaction.ts +47 -0
- package/src/core/transactions/transaction-state.ts +13 -0
- package/src/core/transactions/transaction-user.ts +82 -0
- package/src/core/transactions/transaction.ts +149 -0
- package/src/core/transport.ts +32 -0
- package/src/core/user-agent-core/allowed-methods.ts +19 -0
- package/src/core/user-agent-core/index.ts +3 -0
- package/src/core/user-agent-core/user-agent-core-configuration.ts +111 -0
- package/src/core/user-agent-core/user-agent-core-delegate.ts +50 -0
- package/src/core/user-agent-core/user-agent-core.ts +905 -0
- package/src/core/user-agents/bye-user-agent-client.ts +16 -0
- package/src/core/user-agents/bye-user-agent-server.ts +14 -0
- package/src/core/user-agents/cancel-user-agent-client.ts +14 -0
- package/src/core/user-agents/index.ts +26 -0
- package/src/core/user-agents/info-user-agent-client.ts +15 -0
- package/src/core/user-agents/info-user-agent-server.ts +14 -0
- package/src/core/user-agents/invite-user-agent-client.ts +405 -0
- package/src/core/user-agents/invite-user-agent-server.ts +269 -0
- package/src/core/user-agents/message-user-agent-client.ts +14 -0
- package/src/core/user-agents/message-user-agent-server.ts +14 -0
- package/src/core/user-agents/notify-user-agent-client.ts +15 -0
- package/src/core/user-agents/notify-user-agent-server.ts +30 -0
- package/src/core/user-agents/prack-user-agent-client.ts +16 -0
- package/src/core/user-agents/prack-user-agent-server.ts +37 -0
- package/src/core/user-agents/publish-user-agent-client.ts +14 -0
- package/src/core/user-agents/re-invite-user-agent-client.ts +127 -0
- package/src/core/user-agents/re-invite-user-agent-server.ts +109 -0
- package/src/core/user-agents/re-subscribe-user-agent-client.ts +78 -0
- package/src/core/user-agents/re-subscribe-user-agent-server.ts +14 -0
- package/src/core/user-agents/refer-user-agent-client.ts +15 -0
- package/src/core/user-agents/refer-user-agent-server.ts +30 -0
- package/src/core/user-agents/register-user-agent-client.ts +14 -0
- package/src/core/user-agents/register-user-agent-server.ts +14 -0
- package/src/core/user-agents/subscribe-user-agent-client.ts +341 -0
- package/src/core/user-agents/subscribe-user-agent-server.ts +14 -0
- package/src/core/user-agents/user-agent-client.ts +378 -0
- package/src/core/user-agents/user-agent-server.ts +276 -0
- package/src/grammar/grammar.ts +55 -0
- package/src/grammar/index.ts +4 -0
- package/src/grammar/name-addr-header.ts +58 -0
- package/src/grammar/parameters.ts +45 -0
- package/src/grammar/pegjs/README.md +9 -0
- package/src/grammar/pegjs/dist/grammar.ts +1557 -0
- package/src/grammar/pegjs/src/grammar.pegjs +1009 -0
- package/src/grammar/uri.ts +370 -0
- package/src/index.ts +59 -28
- package/src/lib/socket.io.esm.min.js +7 -0
- package/src/main.ts +26 -0
- package/src/new-index.ts +2478 -0
- package/src/platform/react/README.md +1 -0
- package/src/platform/web/index.ts +4 -0
- package/src/platform/web/modifiers/index.ts +5 -0
- package/src/platform/web/modifiers/modifiers.ts +180 -0
- package/src/platform/web/session-description-handler/api-extractor.json +358 -0
- package/src/platform/web/session-description-handler/index.ts +14 -0
- package/src/platform/web/session-description-handler/media-stream-factory-default.ts +22 -0
- package/src/platform/web/session-description-handler/media-stream-factory.ts +10 -0
- package/src/platform/web/session-description-handler/peer-connection-configuration-default.ts +17 -0
- package/src/platform/web/session-description-handler/peer-connection-delegate.ts +72 -0
- package/src/platform/web/session-description-handler/session-description-handler-configuration.ts +17 -0
- package/src/platform/web/session-description-handler/session-description-handler-factory-default.ts +45 -0
- package/src/platform/web/session-description-handler/session-description-handler-factory-options.ts +10 -0
- package/src/platform/web/session-description-handler/session-description-handler-factory.ts +17 -0
- package/src/platform/web/session-description-handler/session-description-handler-options.ts +56 -0
- package/src/platform/web/session-description-handler/session-description-handler.ts +938 -0
- package/src/platform/web/simple-user/api-extractor.json +358 -0
- package/src/platform/web/simple-user/index.ts +7 -0
- package/src/platform/web/simple-user/simple-user-delegate.ts +82 -0
- package/src/platform/web/simple-user/simple-user-options.ts +102 -0
- package/src/platform/web/simple-user/simple-user.ts +1099 -0
- package/src/platform/web/transport/api-extractor.json +358 -0
- package/src/platform/web/transport/index.ts +6 -0
- package/src/platform/web/transport/transport-options.ts +34 -0
- package/src/platform/web/transport/transport.ts +742 -0
- package/src/version.ts +8 -0
- package/src/webPhoneSdk.ts +67 -0
- package/src/webrtc.ts +318 -0
- package/tsconfig.json +26 -10
- /package/dist/{types/config.d.ts → config.d.ts} +0 -0
package/src/version.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: LiuJing
|
|
3
|
+
* @Date: 2022-03-10 09:45:34
|
|
4
|
+
* @LastEditors: cuixuecheng
|
|
5
|
+
* @LastEditTime: 2023-04-19 14:47:05
|
|
6
|
+
*/
|
|
7
|
+
import UEInitWebRtc from './webrtc'
|
|
8
|
+
interface Options {
|
|
9
|
+
server: string,
|
|
10
|
+
sip: string,
|
|
11
|
+
secret: string,
|
|
12
|
+
onmessage?(event: string): void
|
|
13
|
+
error?(error: string): void
|
|
14
|
+
}
|
|
15
|
+
interface CallConfig {
|
|
16
|
+
autoAnswer: boolean
|
|
17
|
+
}
|
|
18
|
+
export default class WebPhoneSdk {
|
|
19
|
+
private options: Options | undefined
|
|
20
|
+
private static WebrtcObj: any
|
|
21
|
+
public static CallConfig: CallConfig = {
|
|
22
|
+
autoAnswer: false
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public static message: ((arg0: any) => void | undefined) | undefined
|
|
26
|
+
|
|
27
|
+
constructor (options: Options) {
|
|
28
|
+
this.options = options
|
|
29
|
+
WebPhoneSdk.WebrtcObj = new UEInitWebRtc(options)
|
|
30
|
+
WebPhoneSdk.WebrtcObj.message = (message: any) => {
|
|
31
|
+
if (WebPhoneSdk.message) {
|
|
32
|
+
WebPhoneSdk.message(message)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public static accept () {
|
|
38
|
+
if (WebPhoneSdk.WebrtcObj) {
|
|
39
|
+
WebPhoneSdk.WebrtcObj.accept()
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public static sendDTMF (tone: string) {
|
|
44
|
+
if (WebPhoneSdk.WebrtcObj) {
|
|
45
|
+
WebPhoneSdk.WebrtcObj.sendDTMF(tone)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public static unregister () {
|
|
50
|
+
if (WebPhoneSdk.WebrtcObj) {
|
|
51
|
+
WebPhoneSdk.WebrtcObj.ueUnregisterWebrtc()
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public static disconnect(): Promise<void> {
|
|
56
|
+
return WebPhoneSdk.WebrtcObj.disconnect()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
public static connect () {
|
|
61
|
+
return WebPhoneSdk.WebrtcObj.connect()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public static isConnected(): boolean {
|
|
65
|
+
return WebPhoneSdk.WebrtcObj.isConnected();
|
|
66
|
+
}
|
|
67
|
+
}
|
package/src/webrtc.ts
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Invitation,
|
|
3
|
+
Inviter,
|
|
4
|
+
Referral,
|
|
5
|
+
Registerer,
|
|
6
|
+
RegistererOptions,
|
|
7
|
+
Session,
|
|
8
|
+
SessionState,
|
|
9
|
+
UserAgent,
|
|
10
|
+
UserAgentOptions,
|
|
11
|
+
UserAgentDelegate,
|
|
12
|
+
Core,
|
|
13
|
+
Web,
|
|
14
|
+
RegistererRegisterOptions,
|
|
15
|
+
InvitationAcceptOptions,
|
|
16
|
+
UserAgentState
|
|
17
|
+
} from './main'
|
|
18
|
+
|
|
19
|
+
interface Options {
|
|
20
|
+
server: string,
|
|
21
|
+
sip: string,
|
|
22
|
+
secret: string,
|
|
23
|
+
onmessage?(event: string): void
|
|
24
|
+
error?(error: string): void
|
|
25
|
+
}
|
|
26
|
+
// let registerer: any = {}
|
|
27
|
+
// let currentConfig: any = {}
|
|
28
|
+
// let Ginvitation: Invitation
|
|
29
|
+
export default class UEWebrtc {
|
|
30
|
+
private config: Options | undefined
|
|
31
|
+
private registerer: any
|
|
32
|
+
private userAgent: UserAgent | undefined
|
|
33
|
+
public message: ((arg0: any) => void | undefined) | undefined
|
|
34
|
+
private Ginvitation: Invitation | undefined
|
|
35
|
+
constructor (options: any) {
|
|
36
|
+
this.init(options)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private init (config: Options) {
|
|
40
|
+
// 获取HTMLElement
|
|
41
|
+
this.config = config
|
|
42
|
+
const audioElement = getAudio('ueremoteAudio')
|
|
43
|
+
// HTMLElement to 获取HTMLElement
|
|
44
|
+
function getAudio (id: string): HTMLAudioElement {
|
|
45
|
+
const el = document.getElementById(id)
|
|
46
|
+
if (!(el instanceof HTMLAudioElement)) { // 没有音频dom,重新创建一个
|
|
47
|
+
// throw new Error(`Element '${id}' not found or not an audio element.`)
|
|
48
|
+
const audio = new Audio()
|
|
49
|
+
audio.controls = true
|
|
50
|
+
audio.autoplay = true
|
|
51
|
+
audio.id = 'ueremoteAudio'
|
|
52
|
+
audio.style.display = 'none'
|
|
53
|
+
document.body.appendChild(audio)
|
|
54
|
+
return document.getElementById(id) as HTMLAudioElement
|
|
55
|
+
} else {
|
|
56
|
+
return el
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Assign a MediaStream to an HTMLMediaElement and update if tracks change.
|
|
60
|
+
// 媒体流绑定标签
|
|
61
|
+
function assignStream (stream: MediaStream, element: HTMLMediaElement): void {
|
|
62
|
+
// Set element source.
|
|
63
|
+
element.autoplay = true; // Safari does not allow calling .play() from a non user action
|
|
64
|
+
element.srcObject = stream;
|
|
65
|
+
|
|
66
|
+
// Load and start playback of media.
|
|
67
|
+
element.play().catch((error: Error) => {
|
|
68
|
+
console.error('Failed to play media');
|
|
69
|
+
console.error(error);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// If a track is added, load and restart playback of media.
|
|
73
|
+
stream.onaddtrack = (): void => {
|
|
74
|
+
element.load(); // Safari does not work otheriwse
|
|
75
|
+
element.play().catch((error: Error) => {
|
|
76
|
+
console.error('Failed to play remote media on add track');
|
|
77
|
+
console.error(error);
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// If a track is removed, load and restart playback of media.
|
|
82
|
+
stream.onremovetrack = (): void => {
|
|
83
|
+
element.load(); // Safari does not work otheriwse
|
|
84
|
+
element.play().catch((error: Error) => {
|
|
85
|
+
console.error('Failed to play remote media on remove track');
|
|
86
|
+
console.error(error);
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/*
|
|
91
|
+
* Create a user agent
|
|
92
|
+
* 创建用户代理
|
|
93
|
+
*/
|
|
94
|
+
const transportOptions = {
|
|
95
|
+
server: 'wss://' + config.server
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const userAgentDelegate: UserAgentDelegate = {
|
|
99
|
+
onInvite: (invitation: Invitation): void => {
|
|
100
|
+
// console.log('userAgent invitation', invitation)
|
|
101
|
+
this.Ginvitation = invitation
|
|
102
|
+
// An Invitation is a Session
|
|
103
|
+
const incomingSession: Session = invitation
|
|
104
|
+
// Setup incoming session delegate
|
|
105
|
+
incomingSession.delegate = {
|
|
106
|
+
// Handle incoming REFER request.
|
|
107
|
+
onRefer (referral: Referral): void {
|
|
108
|
+
// console.log(referral)
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
this.sendMessage('incomingcall')
|
|
112
|
+
this.Ginvitation._onCancel = (message: any): void => {
|
|
113
|
+
this.sendMessage('cancel')
|
|
114
|
+
}
|
|
115
|
+
// Handle incoming session state changes.
|
|
116
|
+
incomingSession.stateChange.addListener((state: SessionState) => {
|
|
117
|
+
switch (state) {
|
|
118
|
+
case SessionState.Initial:
|
|
119
|
+
break;
|
|
120
|
+
// 会话建立
|
|
121
|
+
case SessionState.Establishing:
|
|
122
|
+
break;
|
|
123
|
+
// 会话已经建立
|
|
124
|
+
case SessionState.Established:
|
|
125
|
+
// eslint-disable-next-line no-case-declarations
|
|
126
|
+
const sessionDescriptionHandler = incomingSession.sessionDescriptionHandler
|
|
127
|
+
if (!sessionDescriptionHandler || !(sessionDescriptionHandler instanceof Web.SessionDescriptionHandler)) {
|
|
128
|
+
throw new Error('Invalid session description handler.');
|
|
129
|
+
}
|
|
130
|
+
if (audioElement) {
|
|
131
|
+
assignStream(sessionDescriptionHandler.remoteMediaStream, audioElement)
|
|
132
|
+
}
|
|
133
|
+
break;
|
|
134
|
+
case SessionState.Terminating:
|
|
135
|
+
break;
|
|
136
|
+
case SessionState.Terminated:
|
|
137
|
+
break;
|
|
138
|
+
default:
|
|
139
|
+
throw new Error('Unknown session state.');
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
const constrainsDefault: MediaStreamConstraints = {
|
|
143
|
+
audio: true,
|
|
144
|
+
video: false
|
|
145
|
+
}
|
|
146
|
+
const options: InvitationAcceptOptions = {
|
|
147
|
+
sessionDescriptionHandlerOptions: {
|
|
148
|
+
constraints: constrainsDefault
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const calltype = this.Ginvitation.incomingInviteRequest.message.headers['X-Calltype'][0].raw
|
|
152
|
+
if (calltype === 'callout') {
|
|
153
|
+
invitation.accept(options)
|
|
154
|
+
.then(() => {
|
|
155
|
+
console.log("接听成功");
|
|
156
|
+
}).catch((error: Error) => {
|
|
157
|
+
console.log("接听失败");
|
|
158
|
+
})
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
onConnect: () => {
|
|
162
|
+
// console.log('onConnect==============')
|
|
163
|
+
},
|
|
164
|
+
onDisconnect: () => {
|
|
165
|
+
// console.log('onDISCONNECT===============')
|
|
166
|
+
},
|
|
167
|
+
onRegisterRequest: () => {
|
|
168
|
+
// console.log('onRegisterRequest===============')
|
|
169
|
+
},
|
|
170
|
+
onRegister: () => {
|
|
171
|
+
// console.log('onRegister=============')
|
|
172
|
+
},
|
|
173
|
+
onMessage: (message: any) => {
|
|
174
|
+
// console.log('onMessage===============')
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const uri = UserAgent.makeURI('sip:' + config.sip + '@' + config.server);
|
|
179
|
+
if (!uri) {
|
|
180
|
+
throw new Error('Failed to create URI');
|
|
181
|
+
}
|
|
182
|
+
const userAgentOptions: UserAgentOptions = {
|
|
183
|
+
logBuiltinEnabled: false,
|
|
184
|
+
delegate: userAgentDelegate,
|
|
185
|
+
displayName: 'webrtc',
|
|
186
|
+
uri,
|
|
187
|
+
transportOptions,
|
|
188
|
+
authorizationUsername: config.sip,
|
|
189
|
+
authorizationHa1: config.secret
|
|
190
|
+
/* ... */
|
|
191
|
+
};
|
|
192
|
+
this.userAgent = new UserAgent(userAgentOptions);
|
|
193
|
+
// console.log(this.userAgent, 'this.userAgent=====')
|
|
194
|
+
const registererOptions: RegistererOptions = {
|
|
195
|
+
expires: 10
|
|
196
|
+
}
|
|
197
|
+
this.registerer = new Registerer(this.userAgent, registererOptions);
|
|
198
|
+
|
|
199
|
+
/***
|
|
200
|
+
* 注册的状态
|
|
201
|
+
*/
|
|
202
|
+
const requestDelegate: Core.OutgoingRequestDelegate = {
|
|
203
|
+
onAccept: (response: Core.IncomingResponse): void => {
|
|
204
|
+
// console.log('onAccept.....', response)
|
|
205
|
+
},
|
|
206
|
+
onProgress: (response: Core.IncomingResponse): void => {
|
|
207
|
+
// console.log('onProgress.....', response)
|
|
208
|
+
},
|
|
209
|
+
onRedirect: (response: Core.IncomingResponse): void => {
|
|
210
|
+
// console.log('onRedirect.....', response)
|
|
211
|
+
},
|
|
212
|
+
onReject: (response: Core.IncomingResponse): void => {
|
|
213
|
+
// console.log('onReject.....', response)
|
|
214
|
+
},
|
|
215
|
+
onTrying: (response: Core.IncomingResponse): void => {
|
|
216
|
+
// console.log('onTrying.....', response)
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const registererRegisterOptions: RegistererRegisterOptions = {
|
|
221
|
+
requestDelegate
|
|
222
|
+
}
|
|
223
|
+
// console.log(registererRegisterOptions, 'registererRegisterOptions===')
|
|
224
|
+
this.registerHandle(registererRegisterOptions)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
private async registerHandle (registererRegisterOptions: RegistererRegisterOptions) {
|
|
228
|
+
await (this.userAgent as UserAgent).start();
|
|
229
|
+
// 注册
|
|
230
|
+
await this.registerer.register(registererRegisterOptions);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
public accept = async (): Promise<void> => {
|
|
234
|
+
const constrainsDefault: MediaStreamConstraints = {
|
|
235
|
+
audio: true,
|
|
236
|
+
video: false
|
|
237
|
+
}
|
|
238
|
+
const options: InvitationAcceptOptions = {
|
|
239
|
+
sessionDescriptionHandlerOptions: {
|
|
240
|
+
constraints: constrainsDefault
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return (this.Ginvitation as Invitation).accept(options)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
public ueUnregisterWebrtc = async (): Promise<boolean | void> => { // 取消注册
|
|
247
|
+
if (!this.registerer) {
|
|
248
|
+
return false
|
|
249
|
+
}
|
|
250
|
+
return this.registerer.unregister({ all: true }).then((res: any) => {
|
|
251
|
+
}).catch((e: any) => {
|
|
252
|
+
})
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
private sendMessage (message: string) {
|
|
256
|
+
if (this.message) {
|
|
257
|
+
this.message(message)
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
public sendDTMF(tone: string): Promise<void> {
|
|
262
|
+
|
|
263
|
+
// As RFC 6086 states, sending DTMF via INFO is not standardized...
|
|
264
|
+
//
|
|
265
|
+
// Companies have been using INFO messages in order to transport
|
|
266
|
+
// Dual-Tone Multi-Frequency (DTMF) tones. All mechanisms are
|
|
267
|
+
// proprietary and have not been standardized.
|
|
268
|
+
// https://tools.ietf.org/html/rfc6086#section-2
|
|
269
|
+
//
|
|
270
|
+
// It is however widely supported based on this draft:
|
|
271
|
+
// https://tools.ietf.org/html/draft-kaplan-dispatch-info-dtmf-package-00
|
|
272
|
+
|
|
273
|
+
// Validate tone
|
|
274
|
+
if (!/^[0-9A-D#*,]$/.exec(tone)) {
|
|
275
|
+
return Promise.reject(new Error("Invalid DTMF tone."));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (!this.Ginvitation) {
|
|
279
|
+
return Promise.reject(new Error("Session does not exist."));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// The UA MUST populate the "application/dtmf-relay" body, as defined
|
|
283
|
+
// earlier, with the button pressed and the duration it was pressed
|
|
284
|
+
// for. Technically, this actually requires the INFO to be generated
|
|
285
|
+
// when the user *releases* the button, however if the user has still
|
|
286
|
+
// not released a button after 5 seconds, which is the maximum duration
|
|
287
|
+
// supported by this mechanism, the UA should generate the INFO at that
|
|
288
|
+
// time.
|
|
289
|
+
// https://tools.ietf.org/html/draft-kaplan-dispatch-info-dtmf-package-00#section-5.3
|
|
290
|
+
const dtmf = tone;
|
|
291
|
+
const duration = 2000;
|
|
292
|
+
const body = {
|
|
293
|
+
contentDisposition: "render",
|
|
294
|
+
contentType: "application/dtmf-relay",
|
|
295
|
+
content: "Signal=" + dtmf + "\r\nDuration=" + duration
|
|
296
|
+
};
|
|
297
|
+
const requestOptions = { body };
|
|
298
|
+
|
|
299
|
+
return this.Ginvitation.info({ requestOptions }).then(() => {
|
|
300
|
+
return;
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
public disconnect() {
|
|
305
|
+
return (this.userAgent as UserAgent).stop()
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
public connect () {
|
|
309
|
+
if ((this.userAgent as UserAgent).state !== UserAgentState.Started) {
|
|
310
|
+
return (this.userAgent as UserAgent).start();
|
|
311
|
+
}
|
|
312
|
+
return (this.userAgent as UserAgent).reconnect();
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
public isConnected(): boolean {
|
|
316
|
+
return (this.userAgent as UserAgent).isConnected();
|
|
317
|
+
}
|
|
318
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compileOnSave": false,
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"outDir": "./dist/"
|
|
5
|
-
"sourceMap": false
|
|
4
|
+
"outDir": "./dist/",// 打包到的目录
|
|
5
|
+
"sourceMap": false,// 是否生成sourceMap(用于浏览器调试)
|
|
6
6
|
"noImplicitAny": false,
|
|
7
7
|
"noUnusedLocals": false,
|
|
8
8
|
"noUnusedParameters": false,
|
|
9
|
-
"declaration": true
|
|
10
|
-
"declarationDir": "dist/types"
|
|
11
|
-
"declarationMap": false
|
|
9
|
+
"declaration": true,// 是否生成声明文件
|
|
10
|
+
"declarationDir": "./dist/types/",// 声明文件打包的位置
|
|
11
|
+
"declarationMap": false,// 是否生成声明文件map文件(便于调试)
|
|
12
12
|
"moduleResolution": "node",
|
|
13
13
|
"module": "esnext",
|
|
14
|
-
"target": "es5"
|
|
14
|
+
"target": "es5",// 转化成的目标语言
|
|
15
15
|
"baseUrl": "./",
|
|
16
|
-
"
|
|
16
|
+
"types": [
|
|
17
|
+
"node"
|
|
18
|
+
],
|
|
19
|
+
"typeRoots": [
|
|
20
|
+
"./node_modules/@types"
|
|
21
|
+
],
|
|
22
|
+
"lib": [
|
|
23
|
+
"dom",
|
|
24
|
+
"es2015"
|
|
25
|
+
],
|
|
26
|
+
"jsx": "react",
|
|
17
27
|
"allowJs": false
|
|
18
28
|
},
|
|
19
|
-
"include": [
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
"include": [
|
|
30
|
+
"src/**/*.ts",
|
|
31
|
+
"typings.d.ts",
|
|
32
|
+
],// 要打包的文件
|
|
33
|
+
"exclude": [
|
|
34
|
+
"node_modules",
|
|
35
|
+
"*.test.ts"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
File without changes
|