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
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import { TransportError } from "../exceptions";
|
|
2
|
-
import { IncomingRequestMessage } from "../messages";
|
|
3
|
-
import { Timers } from "../timers";
|
|
4
|
-
import { Transport } from "../transport";
|
|
5
|
-
import { ServerTransaction } from "./server-transaction";
|
|
6
|
-
import { TransactionState } from "./transaction-state";
|
|
7
|
-
import { ServerTransactionUser } from "./transaction-user";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Non-INVITE Server Transaction.
|
|
11
|
-
* @remarks
|
|
12
|
-
* https://tools.ietf.org/html/rfc3261#section-17.2.2
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export class NonInviteServerTransaction extends ServerTransaction {
|
|
16
|
-
private lastResponse: string | undefined;
|
|
17
|
-
private J: number | undefined;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Constructor.
|
|
21
|
-
* After construction the transaction will be in the "trying": state and the transaction
|
|
22
|
-
* `id` will equal the branch parameter set in the Via header of the incoming request.
|
|
23
|
-
* https://tools.ietf.org/html/rfc3261#section-17.2.2
|
|
24
|
-
* @param request - Incoming Non-INVITE request from the transport.
|
|
25
|
-
* @param transport - The transport.
|
|
26
|
-
* @param user - The transaction user.
|
|
27
|
-
*/
|
|
28
|
-
constructor(request: IncomingRequestMessage, transport: Transport, user: ServerTransactionUser) {
|
|
29
|
-
super(request, transport, user, TransactionState.Trying, "sip.transaction.nist");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Destructor.
|
|
34
|
-
*/
|
|
35
|
-
public dispose(): void {
|
|
36
|
-
if (this.J) {
|
|
37
|
-
clearTimeout(this.J);
|
|
38
|
-
this.J = undefined;
|
|
39
|
-
}
|
|
40
|
-
super.dispose();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** Transaction kind. Deprecated. */
|
|
44
|
-
get kind(): string {
|
|
45
|
-
return "nist";
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Receive requests from transport matching this transaction.
|
|
50
|
-
* @param request - Request matching this transaction.
|
|
51
|
-
*/
|
|
52
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
53
|
-
public receiveRequest(request: IncomingRequestMessage): void {
|
|
54
|
-
switch (this.state) {
|
|
55
|
-
case TransactionState.Trying:
|
|
56
|
-
// Once in the "Trying" state, any further request retransmissions are discarded.
|
|
57
|
-
// https://tools.ietf.org/html/rfc3261#section-17.2.2
|
|
58
|
-
break;
|
|
59
|
-
case TransactionState.Proceeding:
|
|
60
|
-
// If a retransmission of the request is received while in the "Proceeding" state,
|
|
61
|
-
// the most recently sent provisional response MUST be passed to the transport layer for retransmission.
|
|
62
|
-
// https://tools.ietf.org/html/rfc3261#section-17.2.2
|
|
63
|
-
if (!this.lastResponse) {
|
|
64
|
-
throw new Error("Last response undefined.");
|
|
65
|
-
}
|
|
66
|
-
this.send(this.lastResponse).catch((error: TransportError) => {
|
|
67
|
-
this.logTransportError(error, "Failed to send retransmission of provisional response.");
|
|
68
|
-
});
|
|
69
|
-
break;
|
|
70
|
-
case TransactionState.Completed:
|
|
71
|
-
// While in the "Completed" state, the server transaction MUST pass the final response to the transport
|
|
72
|
-
// layer for retransmission whenever a retransmission of the request is received. Any other final responses
|
|
73
|
-
// passed by the TU to the server transaction MUST be discarded while in the "Completed" state.
|
|
74
|
-
// https://tools.ietf.org/html/rfc3261#section-17.2.2
|
|
75
|
-
if (!this.lastResponse) {
|
|
76
|
-
throw new Error("Last response undefined.");
|
|
77
|
-
}
|
|
78
|
-
this.send(this.lastResponse).catch((error: TransportError) => {
|
|
79
|
-
this.logTransportError(error, "Failed to send retransmission of final response.");
|
|
80
|
-
});
|
|
81
|
-
break;
|
|
82
|
-
case TransactionState.Terminated:
|
|
83
|
-
break;
|
|
84
|
-
default:
|
|
85
|
-
throw new Error(`Invalid state ${this.state}`);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Receive responses from TU for this transaction.
|
|
91
|
-
* @param statusCode - Status code of response. 101-199 not allowed per RFC 4320.
|
|
92
|
-
* @param response - Response to send.
|
|
93
|
-
*/
|
|
94
|
-
public receiveResponse(statusCode: number, response: string): void {
|
|
95
|
-
if (statusCode < 100 || statusCode > 699) {
|
|
96
|
-
throw new Error(`Invalid status code ${statusCode}`);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// An SIP element MUST NOT send any provisional response with a
|
|
100
|
-
// Status-Code other than 100 to a non-INVITE request.
|
|
101
|
-
// An SIP element MUST NOT respond to a non-INVITE request with a
|
|
102
|
-
// Status-Code of 100 over any unreliable transport, such as UDP,
|
|
103
|
-
// before the amount of time it takes a client transaction's Timer E to be reset to T2.
|
|
104
|
-
// An SIP element MAY respond to a non-INVITE request with a
|
|
105
|
-
// Status-Code of 100 over a reliable transport at any time.
|
|
106
|
-
// https://tools.ietf.org/html/rfc4320#section-4.1
|
|
107
|
-
if (statusCode > 100 && statusCode <= 199) {
|
|
108
|
-
throw new Error("Provisional response other than 100 not allowed.");
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
switch (this.state) {
|
|
112
|
-
case TransactionState.Trying:
|
|
113
|
-
// While in the "Trying" state, if the TU passes a provisional response
|
|
114
|
-
// to the server transaction, the server transaction MUST enter the "Proceeding" state.
|
|
115
|
-
// The response MUST be passed to the transport layer for transmission.
|
|
116
|
-
// https://tools.ietf.org/html/rfc3261#section-17.2.2
|
|
117
|
-
this.lastResponse = response;
|
|
118
|
-
if (statusCode >= 100 && statusCode < 200) {
|
|
119
|
-
this.stateTransition(TransactionState.Proceeding);
|
|
120
|
-
this.send(response).catch((error: TransportError) => {
|
|
121
|
-
this.logTransportError(error, "Failed to send provisional response.");
|
|
122
|
-
});
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
if (statusCode >= 200 && statusCode <= 699) {
|
|
126
|
-
this.stateTransition(TransactionState.Completed);
|
|
127
|
-
this.send(response).catch((error: TransportError) => {
|
|
128
|
-
this.logTransportError(error, "Failed to send final response.");
|
|
129
|
-
});
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
break;
|
|
133
|
-
case TransactionState.Proceeding:
|
|
134
|
-
// Any further provisional responses that are received from the TU while
|
|
135
|
-
// in the "Proceeding" state MUST be passed to the transport layer for transmission.
|
|
136
|
-
// If the TU passes a final response (status codes 200-699) to the server while in
|
|
137
|
-
// the "Proceeding" state, the transaction MUST enter the "Completed" state, and
|
|
138
|
-
// the response MUST be passed to the transport layer for transmission.
|
|
139
|
-
// https://tools.ietf.org/html/rfc3261#section-17.2.2
|
|
140
|
-
this.lastResponse = response;
|
|
141
|
-
if (statusCode >= 200 && statusCode <= 699) {
|
|
142
|
-
this.stateTransition(TransactionState.Completed);
|
|
143
|
-
this.send(response).catch((error: TransportError) => {
|
|
144
|
-
this.logTransportError(error, "Failed to send final response.");
|
|
145
|
-
});
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
break;
|
|
149
|
-
case TransactionState.Completed:
|
|
150
|
-
// Any other final responses passed by the TU to the server
|
|
151
|
-
// transaction MUST be discarded while in the "Completed" state.
|
|
152
|
-
// https://tools.ietf.org/html/rfc3261#section-17.2.2
|
|
153
|
-
return;
|
|
154
|
-
case TransactionState.Terminated:
|
|
155
|
-
break;
|
|
156
|
-
default:
|
|
157
|
-
throw new Error(`Invalid state ${this.state}`);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const message = `Non-INVITE server transaction received unexpected ${statusCode} response from TU while in state ${this.state}.`;
|
|
161
|
-
this.logger.error(message);
|
|
162
|
-
throw new Error(message);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* First, the procedures in [4] are followed, which attempt to deliver the response to a backup.
|
|
167
|
-
* If those should all fail, based on the definition of failure in [4], the server transaction SHOULD
|
|
168
|
-
* inform the TU that a failure has occurred, and SHOULD transition to the terminated state.
|
|
169
|
-
* https://tools.ietf.org/html/rfc3261#section-17.2.4
|
|
170
|
-
*/
|
|
171
|
-
protected onTransportError(error: Error): void {
|
|
172
|
-
if (this.user.onTransportError) {
|
|
173
|
-
this.user.onTransportError(error);
|
|
174
|
-
}
|
|
175
|
-
this.stateTransition(TransactionState.Terminated, true);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/** For logging. */
|
|
179
|
-
protected typeToString(): string {
|
|
180
|
-
return "non-INVITE server transaction";
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
private stateTransition(newState: TransactionState, dueToTransportError = false): void {
|
|
184
|
-
// Assert valid state transitions.
|
|
185
|
-
const invalidStateTransition = (): void => {
|
|
186
|
-
throw new Error(`Invalid state transition from ${this.state} to ${newState}`);
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
switch (newState) {
|
|
190
|
-
case TransactionState.Trying:
|
|
191
|
-
invalidStateTransition();
|
|
192
|
-
break;
|
|
193
|
-
case TransactionState.Proceeding:
|
|
194
|
-
if (this.state !== TransactionState.Trying) {
|
|
195
|
-
invalidStateTransition();
|
|
196
|
-
}
|
|
197
|
-
break;
|
|
198
|
-
case TransactionState.Completed:
|
|
199
|
-
if (this.state !== TransactionState.Trying && this.state !== TransactionState.Proceeding) {
|
|
200
|
-
invalidStateTransition();
|
|
201
|
-
}
|
|
202
|
-
break;
|
|
203
|
-
case TransactionState.Terminated:
|
|
204
|
-
if (this.state !== TransactionState.Proceeding && this.state !== TransactionState.Completed) {
|
|
205
|
-
if (!dueToTransportError) {
|
|
206
|
-
invalidStateTransition();
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
break;
|
|
210
|
-
default:
|
|
211
|
-
invalidStateTransition();
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// When the server transaction enters the "Completed" state, it MUST set Timer J to fire
|
|
215
|
-
// in 64*T1 seconds for unreliable transports, and zero seconds for reliable transports.
|
|
216
|
-
// https://tools.ietf.org/html/rfc3261#section-17.2.2
|
|
217
|
-
if (newState === TransactionState.Completed) {
|
|
218
|
-
this.J = window.setTimeout(() => this.timerJ(), Timers.TIMER_J);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// The server transaction MUST be destroyed the instant it enters the "Terminated" state.
|
|
222
|
-
// https://tools.ietf.org/html/rfc3261#section-17.2.2
|
|
223
|
-
if (newState === TransactionState.Terminated) {
|
|
224
|
-
this.dispose();
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
this.setState(newState);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* The server transaction remains in this state until Timer J fires,
|
|
232
|
-
* at which point it MUST transition to the "Terminated" state.
|
|
233
|
-
* https://tools.ietf.org/html/rfc3261#section-17.2.2
|
|
234
|
-
*/
|
|
235
|
-
private timerJ(): void {
|
|
236
|
-
this.logger.debug(`Timer J expired for NON-INVITE server transaction ${this.id}.`);
|
|
237
|
-
if (this.state === TransactionState.Completed) {
|
|
238
|
-
this.stateTransition(TransactionState.Terminated);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { IncomingRequestMessage } from "../messages";
|
|
2
|
-
import { Transport } from "../transport";
|
|
3
|
-
import { Transaction } from "./transaction";
|
|
4
|
-
import { TransactionState } from "./transaction-state";
|
|
5
|
-
import { ServerTransactionUser } from "./transaction-user";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Server Transaction.
|
|
9
|
-
* @remarks
|
|
10
|
-
* The server transaction is responsible for the delivery of requests to
|
|
11
|
-
* the TU and the reliable transmission of responses. It accomplishes
|
|
12
|
-
* this through a state machine. Server transactions are created by the
|
|
13
|
-
* core when a request is received, and transaction handling is desired
|
|
14
|
-
* for that request (this is not always the case).
|
|
15
|
-
* https://tools.ietf.org/html/rfc3261#section-17.2
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
export abstract class ServerTransaction extends Transaction {
|
|
19
|
-
protected constructor(
|
|
20
|
-
private _request: IncomingRequestMessage,
|
|
21
|
-
transport: Transport,
|
|
22
|
-
protected user: ServerTransactionUser,
|
|
23
|
-
state: TransactionState,
|
|
24
|
-
loggerCategory: string
|
|
25
|
-
) {
|
|
26
|
-
super(transport, user, _request.viaBranch, state, loggerCategory);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** The incoming request the transaction handling. */
|
|
30
|
-
get request(): IncomingRequestMessage {
|
|
31
|
-
return this._request;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Receive incoming requests from the transport which match this transaction.
|
|
36
|
-
* @param request - The incoming request.
|
|
37
|
-
*/
|
|
38
|
-
public abstract receiveRequest(request: IncomingRequestMessage): void;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Receive outgoing responses to this request from the transaction user.
|
|
42
|
-
* Responses will be delivered to the transport as necessary.
|
|
43
|
-
* @param statusCode - Response status code.
|
|
44
|
-
* @param response - Response.
|
|
45
|
-
*/
|
|
46
|
-
public abstract receiveResponse(statusCode: number, response: string): void;
|
|
47
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transaction state.
|
|
3
|
-
* @public
|
|
4
|
-
*/
|
|
5
|
-
export enum TransactionState {
|
|
6
|
-
Accepted = "Accepted",
|
|
7
|
-
Calling = "Calling",
|
|
8
|
-
Completed = "Completed",
|
|
9
|
-
Confirmed = "Confirmed",
|
|
10
|
-
Proceeding = "Proceeding",
|
|
11
|
-
Terminated = "Terminated",
|
|
12
|
-
Trying = "Trying"
|
|
13
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-empty-interface */
|
|
2
|
-
import { TransportError } from "../exceptions";
|
|
3
|
-
import { LoggerFactory } from "../log";
|
|
4
|
-
import { IncomingResponseMessage } from "../messages";
|
|
5
|
-
import { TransactionState } from "./transaction-state";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Transaction User (TU).
|
|
9
|
-
* @remarks
|
|
10
|
-
* The layer of protocol processing that resides above the transaction layer.
|
|
11
|
-
* Transaction users include the UAC core, UAS core, and proxy core.
|
|
12
|
-
* https://tools.ietf.org/html/rfc3261#section-5
|
|
13
|
-
* https://tools.ietf.org/html/rfc3261#section-6
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export interface TransactionUser {
|
|
17
|
-
/**
|
|
18
|
-
* Logger factory.
|
|
19
|
-
*/
|
|
20
|
-
loggerFactory: LoggerFactory;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Callback for notification of transaction state changes.
|
|
24
|
-
*
|
|
25
|
-
* Not called when transaction is constructed, so there is
|
|
26
|
-
* no notification of entering the initial transaction state.
|
|
27
|
-
* Otherwise, called once for each transaction state change.
|
|
28
|
-
* State changes adhere to the following RFCs.
|
|
29
|
-
* https://tools.ietf.org/html/rfc3261#section-17
|
|
30
|
-
* https://tools.ietf.org/html/rfc6026
|
|
31
|
-
*/
|
|
32
|
-
onStateChange?: (newState: TransactionState) => void;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Callback for notification of a transport error.
|
|
36
|
-
*
|
|
37
|
-
* If a fatal transport error is reported by the transport layer
|
|
38
|
-
* (generally, due to fatal ICMP errors in UDP or connection failures in
|
|
39
|
-
* TCP), the condition MUST be treated as a 503 (Service Unavailable)
|
|
40
|
-
* status code.
|
|
41
|
-
* https://tools.ietf.org/html/rfc3261#section-8.1.3.1
|
|
42
|
-
* https://tools.ietf.org/html/rfc3261#section-17.1.4
|
|
43
|
-
* https://tools.ietf.org/html/rfc3261#section-17.2.4
|
|
44
|
-
* https://tools.ietf.org/html/rfc6026
|
|
45
|
-
*/
|
|
46
|
-
onTransportError?: (error: TransportError) => void;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* UAC Core Transaction User.
|
|
51
|
-
* @public
|
|
52
|
-
*/
|
|
53
|
-
export interface ClientTransactionUser extends TransactionUser {
|
|
54
|
-
/**
|
|
55
|
-
* Callback for request timeout error.
|
|
56
|
-
*
|
|
57
|
-
* When a timeout error is received from the transaction layer, it MUST be
|
|
58
|
-
* treated as if a 408 (Request Timeout) status code has been received.
|
|
59
|
-
* https://tools.ietf.org/html/rfc3261#section-8.1.3.1
|
|
60
|
-
* TU MUST be informed of a timeout.
|
|
61
|
-
* https://tools.ietf.org/html/rfc3261#section-17.1.2.2
|
|
62
|
-
*/
|
|
63
|
-
onRequestTimeout?: () => void;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Callback for delegation of valid response handling.
|
|
67
|
-
*
|
|
68
|
-
* Valid responses are passed up to the TU from the client transaction.
|
|
69
|
-
* https://tools.ietf.org/html/rfc3261#section-17.1
|
|
70
|
-
*/
|
|
71
|
-
receiveResponse?: (response: IncomingResponseMessage) => void;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* UAS Core Transaction User.
|
|
76
|
-
* @public
|
|
77
|
-
*/
|
|
78
|
-
export interface ServerTransactionUser extends TransactionUser {
|
|
79
|
-
/**
|
|
80
|
-
* For completeness. Same as `TransactionUser` at this point.
|
|
81
|
-
*/
|
|
82
|
-
}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { TransportError } from "../exceptions";
|
|
2
|
-
import { Logger } from "../log";
|
|
3
|
-
import { Transport } from "../transport";
|
|
4
|
-
import { TransactionState } from "./transaction-state";
|
|
5
|
-
import { TransactionUser } from "./transaction-user";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Transaction.
|
|
9
|
-
* @remarks
|
|
10
|
-
* SIP is a transactional protocol: interactions between components take
|
|
11
|
-
* place in a series of independent message exchanges. Specifically, a
|
|
12
|
-
* SIP transaction consists of a single request and any responses to
|
|
13
|
-
* that request, which include zero or more provisional responses and
|
|
14
|
-
* one or more final responses. In the case of a transaction where the
|
|
15
|
-
* request was an INVITE (known as an INVITE transaction), the
|
|
16
|
-
* transaction also includes the ACK only if the final response was not
|
|
17
|
-
* a 2xx response. If the response was a 2xx, the ACK is not considered
|
|
18
|
-
* part of the transaction.
|
|
19
|
-
* https://tools.ietf.org/html/rfc3261#section-17
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
export abstract class Transaction {
|
|
23
|
-
protected logger: Logger;
|
|
24
|
-
|
|
25
|
-
private listeners = new Array<() => void>();
|
|
26
|
-
|
|
27
|
-
protected constructor(
|
|
28
|
-
private _transport: Transport,
|
|
29
|
-
private _user: TransactionUser,
|
|
30
|
-
private _id: string,
|
|
31
|
-
private _state: TransactionState,
|
|
32
|
-
loggerCategory: string
|
|
33
|
-
) {
|
|
34
|
-
this.logger = _user.loggerFactory.getLogger(loggerCategory, _id);
|
|
35
|
-
this.logger.debug(`Constructing ${this.typeToString()} with id ${this.id}.`);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Destructor.
|
|
40
|
-
* Once the transaction is in the "terminated" state, it is destroyed
|
|
41
|
-
* immediately and there is no need to call `dispose`. However, if a
|
|
42
|
-
* transaction needs to be ended prematurely, the transaction user may
|
|
43
|
-
* do so by calling this method (for example, perhaps the UA is shutting down).
|
|
44
|
-
* No state transition will occur upon calling this method, all outstanding
|
|
45
|
-
* transmission timers will be cancelled, and use of the transaction after
|
|
46
|
-
* calling `dispose` is undefined.
|
|
47
|
-
*/
|
|
48
|
-
public dispose(): void {
|
|
49
|
-
this.logger.debug(`Destroyed ${this.typeToString()} with id ${this.id}.`);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** Transaction id. */
|
|
53
|
-
get id(): string {
|
|
54
|
-
return this._id;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** Transaction kind. Deprecated. */
|
|
58
|
-
get kind(): string {
|
|
59
|
-
throw new Error("Invalid kind.");
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/** Transaction state. */
|
|
63
|
-
get state(): TransactionState {
|
|
64
|
-
return this._state;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/** Transaction transport. */
|
|
68
|
-
get transport(): Transport {
|
|
69
|
-
return this._transport;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Sets up a function that will be called whenever the transaction state changes.
|
|
74
|
-
* @param listener - Callback function.
|
|
75
|
-
* @param options - An options object that specifies characteristics about the listener.
|
|
76
|
-
* If once true, indicates that the listener should be invoked at most once after being added.
|
|
77
|
-
* If once true, the listener would be automatically removed when invoked.
|
|
78
|
-
*/
|
|
79
|
-
public addStateChangeListener(listener: () => void, options?: { once?: boolean }): void {
|
|
80
|
-
const onceWrapper = (): void => {
|
|
81
|
-
this.removeStateChangeListener(onceWrapper);
|
|
82
|
-
listener();
|
|
83
|
-
};
|
|
84
|
-
options?.once === true ? this.listeners.push(onceWrapper) : this.listeners.push(listener);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* This is currently public so tests may spy on it.
|
|
89
|
-
* @internal
|
|
90
|
-
*/
|
|
91
|
-
public notifyStateChangeListeners(): void {
|
|
92
|
-
this.listeners.slice().forEach((listener) => listener());
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Removes a listener previously registered with addStateListener.
|
|
97
|
-
* @param listener - Callback function.
|
|
98
|
-
*/
|
|
99
|
-
public removeStateChangeListener(listener: () => void): void {
|
|
100
|
-
this.listeners = this.listeners.filter((l) => l !== listener);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
protected logTransportError(error: TransportError, message: string): void {
|
|
104
|
-
this.logger.error(error.message);
|
|
105
|
-
this.logger.error(`Transport error occurred in ${this.typeToString()} with id ${this.id}.`);
|
|
106
|
-
this.logger.error(message);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Pass message to transport for transmission. If transport fails,
|
|
111
|
-
* the transaction user is notified by callback to onTransportError().
|
|
112
|
-
* @returns
|
|
113
|
-
* Rejects with `TransportError` if transport fails.
|
|
114
|
-
*/
|
|
115
|
-
protected send(message: string): Promise<void> {
|
|
116
|
-
return this.transport.send(message).catch((error) => {
|
|
117
|
-
// If the transport rejects, it SHOULD reject with a TransportError.
|
|
118
|
-
// But the transport may be external code, so we are careful
|
|
119
|
-
// make sure we convert it to a TransportError if need be.
|
|
120
|
-
if (error instanceof TransportError) {
|
|
121
|
-
this.onTransportError(error);
|
|
122
|
-
throw error;
|
|
123
|
-
}
|
|
124
|
-
let transportError: TransportError;
|
|
125
|
-
if (error && typeof error.message === "string") {
|
|
126
|
-
transportError = new TransportError(error.message);
|
|
127
|
-
} else {
|
|
128
|
-
transportError = new TransportError();
|
|
129
|
-
}
|
|
130
|
-
this.onTransportError(transportError);
|
|
131
|
-
throw transportError;
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
protected setState(state: TransactionState): void {
|
|
136
|
-
this.logger.debug(`State change to "${state}" on ${this.typeToString()} with id ${this.id}.`);
|
|
137
|
-
this._state = state;
|
|
138
|
-
if (this._user.onStateChange) {
|
|
139
|
-
this._user.onStateChange(state);
|
|
140
|
-
}
|
|
141
|
-
this.notifyStateChangeListeners();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
protected typeToString(): string {
|
|
145
|
-
return "UnknownType";
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
protected abstract onTransportError(error: TransportError): void;
|
|
149
|
-
}
|
package/src/core/transport.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transport layer interface expected by the user agent core.
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* The transport layer is responsible for the actual transmission of
|
|
6
|
-
* requests and responses over network transports. This includes
|
|
7
|
-
* determination of the connection to use for a request or response in
|
|
8
|
-
* the case of connection-oriented transports.
|
|
9
|
-
* https://tools.ietf.org/html/rfc3261#section-18
|
|
10
|
-
*
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
export interface Transport {
|
|
14
|
-
/**
|
|
15
|
-
* The transport protocol.
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* Formatted as defined for the Via header sent-protocol transport.
|
|
19
|
-
* https://tools.ietf.org/html/rfc3261#section-20.42
|
|
20
|
-
*/
|
|
21
|
-
readonly protocol: string;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Send a message.
|
|
25
|
-
*
|
|
26
|
-
* @remarks
|
|
27
|
-
* Resolves once message is sent. Otherwise rejects with an Error.
|
|
28
|
-
*
|
|
29
|
-
* @param message - Message to send.
|
|
30
|
-
*/
|
|
31
|
-
send(message: string): Promise<void>;
|
|
32
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { C } from "../messages";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* FIXME: TODO: Should be configurable/variable.
|
|
5
|
-
*/
|
|
6
|
-
export const AllowedMethods = [
|
|
7
|
-
C.ACK,
|
|
8
|
-
C.BYE,
|
|
9
|
-
C.CANCEL,
|
|
10
|
-
C.INFO,
|
|
11
|
-
C.INVITE,
|
|
12
|
-
C.MESSAGE,
|
|
13
|
-
C.NOTIFY,
|
|
14
|
-
C.OPTIONS,
|
|
15
|
-
C.PRACK, // FIXME: Only if 100rel Supported
|
|
16
|
-
C.REFER,
|
|
17
|
-
C.REGISTER,
|
|
18
|
-
C.SUBSCRIBE
|
|
19
|
-
];
|