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