ue-softphone-sdk 2.2.5 → 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 -2486
- 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,78 +0,0 @@
|
|
|
1
|
-
import { SubscriptionDialog } from "../dialogs";
|
|
2
|
-
import {
|
|
3
|
-
C,
|
|
4
|
-
IncomingResponseMessage,
|
|
5
|
-
OutgoingRequestDelegate,
|
|
6
|
-
OutgoingSubscribeRequest,
|
|
7
|
-
RequestOptions
|
|
8
|
-
} from "../messages";
|
|
9
|
-
import { NonInviteClientTransaction } from "../transactions";
|
|
10
|
-
import { UserAgentClient } from "./user-agent-client";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Re-SUBSCRIBE UAC.
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export class ReSubscribeUserAgentClient extends UserAgentClient implements OutgoingSubscribeRequest {
|
|
17
|
-
private dialog: SubscriptionDialog;
|
|
18
|
-
|
|
19
|
-
constructor(dialog: SubscriptionDialog, delegate?: OutgoingRequestDelegate, options?: RequestOptions) {
|
|
20
|
-
const message = dialog.createOutgoingRequestMessage(C.SUBSCRIBE, options);
|
|
21
|
-
super(NonInviteClientTransaction, dialog.userAgentCore, message, delegate);
|
|
22
|
-
this.dialog = dialog;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public waitNotifyStop(): void {
|
|
26
|
-
// TODO: Placeholder. Not utilized currently.
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Receive a response from the transaction layer.
|
|
32
|
-
* @param message - Incoming response message.
|
|
33
|
-
*/
|
|
34
|
-
protected receiveResponse(message: IncomingResponseMessage): void {
|
|
35
|
-
if (message.statusCode && message.statusCode >= 200 && message.statusCode < 300) {
|
|
36
|
-
// The "Expires" header field in a 200-class response to SUBSCRIBE
|
|
37
|
-
// request indicates the actual duration for which the subscription will
|
|
38
|
-
// remain active (unless refreshed). The received value might be
|
|
39
|
-
// smaller than the value indicated in the SUBSCRIBE request but cannot
|
|
40
|
-
// be larger; see Section 4.2.1 for details.
|
|
41
|
-
// https://tools.ietf.org/html/rfc6665#section-4.1.2.1
|
|
42
|
-
const expires = message.getHeader("Expires");
|
|
43
|
-
if (!expires) {
|
|
44
|
-
this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");
|
|
45
|
-
} else {
|
|
46
|
-
const subscriptionExpiresReceived = Number(expires);
|
|
47
|
-
if (this.dialog.subscriptionExpires > subscriptionExpiresReceived) {
|
|
48
|
-
this.dialog.subscriptionExpires = subscriptionExpiresReceived;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (message.statusCode && message.statusCode >= 400 && message.statusCode < 700) {
|
|
54
|
-
// If a SUBSCRIBE request to refresh a subscription receives a 404, 405,
|
|
55
|
-
// 410, 416, 480-485, 489, 501, or 604 response, the subscriber MUST
|
|
56
|
-
// consider the subscription terminated. (See [RFC5057] for further
|
|
57
|
-
// details and notes about the effect of error codes on dialogs and
|
|
58
|
-
// usages within dialog, such as subscriptions). If the subscriber
|
|
59
|
-
// wishes to re-subscribe to the state, he does so by composing an
|
|
60
|
-
// unrelated initial SUBSCRIBE request with a freshly generated Call-ID
|
|
61
|
-
// and a new, unique "From" tag (see Section 4.1.2.1).
|
|
62
|
-
// https://tools.ietf.org/html/rfc6665#section-4.1.2.2
|
|
63
|
-
const errorCodes = [404, 405, 410, 416, 480, 481, 482, 483, 484, 485, 489, 501, 604];
|
|
64
|
-
if (errorCodes.includes(message.statusCode)) {
|
|
65
|
-
this.dialog.terminate();
|
|
66
|
-
}
|
|
67
|
-
// If a SUBSCRIBE request to refresh a subscription fails with any error
|
|
68
|
-
// code other than those listed above, the original subscription is
|
|
69
|
-
// still considered valid for the duration of the most recently known
|
|
70
|
-
// "Expires" value as negotiated by the most recent successful SUBSCRIBE
|
|
71
|
-
// transaction, or as communicated by a NOTIFY request in its
|
|
72
|
-
// "Subscription-State" header field "expires" parameter.
|
|
73
|
-
// https://tools.ietf.org/html/rfc6665#section-4.1.2.2
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
super.receiveResponse(message);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Dialog } from "../dialogs";
|
|
2
|
-
import { IncomingRequestDelegate, IncomingRequestMessage, IncomingSubscribeRequest } from "../messages";
|
|
3
|
-
import { NonInviteServerTransaction } from "../transactions";
|
|
4
|
-
import { UserAgentServer } from "./user-agent-server";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Re-SUBSCRIBE UAS.
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export class ReSubscribeUserAgentServer extends UserAgentServer implements IncomingSubscribeRequest {
|
|
11
|
-
constructor(dialog: Dialog, message: IncomingRequestMessage, delegate?: IncomingRequestDelegate) {
|
|
12
|
-
super(NonInviteServerTransaction, dialog.userAgentCore, message, delegate);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SessionDialog } from "../dialogs";
|
|
2
|
-
import { C, OutgoingReferRequest, OutgoingRequestDelegate, RequestOptions } from "../messages";
|
|
3
|
-
import { NonInviteClientTransaction } from "../transactions";
|
|
4
|
-
import { UserAgentClient } from "./user-agent-client";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* REFER UAC.
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export class ReferUserAgentClient extends UserAgentClient implements OutgoingReferRequest {
|
|
11
|
-
constructor(dialog: SessionDialog, delegate?: OutgoingRequestDelegate, options?: RequestOptions) {
|
|
12
|
-
const message = dialog.createOutgoingRequestMessage(C.REFER, options);
|
|
13
|
-
super(NonInviteClientTransaction, dialog.userAgentCore, message, delegate);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { SessionDialog } from "../dialogs";
|
|
2
|
-
import { IncomingReferRequest, IncomingRequestDelegate, IncomingRequestMessage } from "../messages";
|
|
3
|
-
import { NonInviteServerTransaction } from "../transactions";
|
|
4
|
-
import { UserAgentCore } from "../user-agent-core";
|
|
5
|
-
import { UserAgentServer } from "./user-agent-server";
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
-
function instanceOfSessionDialog(object: any): object is SessionDialog {
|
|
9
|
-
return object.userAgentCore !== undefined;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* REFER UAS.
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export class ReferUserAgentServer extends UserAgentServer implements IncomingReferRequest {
|
|
17
|
-
/**
|
|
18
|
-
* REFER UAS constructor.
|
|
19
|
-
* @param dialogOrCore - Dialog for in dialog REFER, UserAgentCore for out of dialog REFER.
|
|
20
|
-
* @param message - Incoming REFER request message.
|
|
21
|
-
*/
|
|
22
|
-
constructor(
|
|
23
|
-
dialogOrCore: SessionDialog | UserAgentCore,
|
|
24
|
-
message: IncomingRequestMessage,
|
|
25
|
-
delegate?: IncomingRequestDelegate
|
|
26
|
-
) {
|
|
27
|
-
const userAgentCore = instanceOfSessionDialog(dialogOrCore) ? dialogOrCore.userAgentCore : dialogOrCore;
|
|
28
|
-
super(NonInviteServerTransaction, userAgentCore, message, delegate);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { OutgoingRegisterRequest, OutgoingRequestDelegate, OutgoingRequestMessage } from "../messages";
|
|
2
|
-
import { NonInviteClientTransaction } from "../transactions";
|
|
3
|
-
import { UserAgentCore } from "../user-agent-core";
|
|
4
|
-
import { UserAgentClient } from "./user-agent-client";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* REGISTER UAC.
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export class RegisterUserAgentClient extends UserAgentClient implements OutgoingRegisterRequest {
|
|
11
|
-
constructor(core: UserAgentCore, message: OutgoingRequestMessage, delegate?: OutgoingRequestDelegate) {
|
|
12
|
-
super(NonInviteClientTransaction, core, message, delegate);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IncomingRegisterRequest, IncomingRequestDelegate, IncomingRequestMessage } from "../messages";
|
|
2
|
-
import { NonInviteServerTransaction } from "../transactions";
|
|
3
|
-
import { UserAgentCore } from "../user-agent-core";
|
|
4
|
-
import { UserAgentServer } from "./user-agent-server";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* REGISTER UAS.
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export class RegisterUserAgentServer extends UserAgentServer implements IncomingRegisterRequest {
|
|
11
|
-
constructor(protected core: UserAgentCore, message: IncomingRequestMessage, delegate?: IncomingRequestDelegate) {
|
|
12
|
-
super(NonInviteServerTransaction, core, message, delegate);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import { SubscriptionDialog } from "../dialogs/subscription-dialog";
|
|
2
|
-
import {
|
|
3
|
-
IncomingResponseMessage,
|
|
4
|
-
OutgoingRequestMessage,
|
|
5
|
-
OutgoingSubscribeRequest,
|
|
6
|
-
OutgoingSubscribeRequestDelegate
|
|
7
|
-
} from "../messages";
|
|
8
|
-
import { SubscriptionState } from "../subscription";
|
|
9
|
-
import { Timers } from "../timers";
|
|
10
|
-
import { NonInviteClientTransaction } from "../transactions";
|
|
11
|
-
import { UserAgentCore } from "../user-agent-core";
|
|
12
|
-
import { NotifyUserAgentServer } from "./notify-user-agent-server";
|
|
13
|
-
import { UserAgentClient } from "./user-agent-client";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* SUBSCRIBE UAC.
|
|
17
|
-
* @remarks
|
|
18
|
-
* 4.1. Subscriber Behavior
|
|
19
|
-
* https://tools.ietf.org/html/rfc6665#section-4.1
|
|
20
|
-
*
|
|
21
|
-
* User agent client for installation of a single subscription per SUBSCRIBE request.
|
|
22
|
-
* TODO: Support for installation of multiple subscriptions on forked SUBSCRIBE requests.
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
|
-
export class SubscribeUserAgentClient extends UserAgentClient implements OutgoingSubscribeRequest {
|
|
26
|
-
public delegate: OutgoingSubscribeRequestDelegate | undefined;
|
|
27
|
-
|
|
28
|
-
/** Dialog created upon receiving the first NOTIFY. */
|
|
29
|
-
private dialog: SubscriptionDialog | undefined;
|
|
30
|
-
/** Identifier of this user agent client. */
|
|
31
|
-
private subscriberId: string;
|
|
32
|
-
/** When the subscription expires. Starts as requested expires and updated on 200 and NOTIFY. */
|
|
33
|
-
private subscriptionExpires: number;
|
|
34
|
-
/** The requested expires for the subscription. */
|
|
35
|
-
private subscriptionExpiresRequested: number;
|
|
36
|
-
/** Subscription event being targeted. */
|
|
37
|
-
private subscriptionEvent: string;
|
|
38
|
-
/** Subscription state. */
|
|
39
|
-
private subscriptionState: SubscriptionState;
|
|
40
|
-
/** Timer N Id. */
|
|
41
|
-
private N: number | undefined;
|
|
42
|
-
|
|
43
|
-
constructor(core: UserAgentCore, message: OutgoingRequestMessage, delegate?: OutgoingSubscribeRequestDelegate) {
|
|
44
|
-
// Get event from request message.
|
|
45
|
-
const event = message.getHeader("Event");
|
|
46
|
-
if (!event) {
|
|
47
|
-
throw new Error("Event undefined");
|
|
48
|
-
}
|
|
49
|
-
// Get expires from request message.
|
|
50
|
-
const expires = message.getHeader("Expires");
|
|
51
|
-
if (!expires) {
|
|
52
|
-
throw new Error("Expires undefined");
|
|
53
|
-
}
|
|
54
|
-
super(NonInviteClientTransaction, core, message, delegate);
|
|
55
|
-
this.delegate = delegate;
|
|
56
|
-
|
|
57
|
-
// FIXME: Subscriber id should also be matching on event id.
|
|
58
|
-
this.subscriberId = message.callId + message.fromTag + event;
|
|
59
|
-
this.subscriptionExpiresRequested = this.subscriptionExpires = Number(expires);
|
|
60
|
-
this.subscriptionEvent = event;
|
|
61
|
-
this.subscriptionState = SubscriptionState.NotifyWait;
|
|
62
|
-
|
|
63
|
-
// Start waiting for a NOTIFY we can use to create a subscription.
|
|
64
|
-
this.waitNotifyStart();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Destructor.
|
|
69
|
-
* Note that Timer N may live on waiting for an initial NOTIFY and
|
|
70
|
-
* the delegate may still receive that NOTIFY. If you don't want
|
|
71
|
-
* that behavior then either clear the delegate so the delegate
|
|
72
|
-
* doesn't get called (a 200 will be sent in response to the NOTIFY)
|
|
73
|
-
* or call `waitNotifyStop` which will clear Timer N and remove this
|
|
74
|
-
* UAC from the core (a 481 will be sent in response to the NOTIFY).
|
|
75
|
-
*/
|
|
76
|
-
public dispose(): void {
|
|
77
|
-
super.dispose();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Handle out of dialog NOTIFY associated with SUBSCRIBE request.
|
|
82
|
-
* This is the first NOTIFY received after the SUBSCRIBE request.
|
|
83
|
-
* @param uas - User agent server handling the subscription creating NOTIFY.
|
|
84
|
-
*/
|
|
85
|
-
public onNotify(uas: NotifyUserAgentServer): void {
|
|
86
|
-
// NOTIFY requests are matched to such SUBSCRIBE requests if they
|
|
87
|
-
// contain the same "Call-ID", a "To" header field "tag" parameter that
|
|
88
|
-
// matches the "From" header field "tag" parameter of the SUBSCRIBE
|
|
89
|
-
// request, and the same "Event" header field. Rules for comparisons of
|
|
90
|
-
// the "Event" header fields are described in Section 8.2.1.
|
|
91
|
-
// https://tools.ietf.org/html/rfc6665#section-4.4.1
|
|
92
|
-
const event: string = uas.message.parseHeader("Event").event;
|
|
93
|
-
if (!event || event !== this.subscriptionEvent) {
|
|
94
|
-
this.logger.warn(`Failed to parse event.`);
|
|
95
|
-
uas.reject({ statusCode: 489 });
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// NOTIFY requests MUST contain "Subscription-State" header fields that
|
|
100
|
-
// indicate the status of the subscription.
|
|
101
|
-
// https://tools.ietf.org/html/rfc6665#section-4.1.3
|
|
102
|
-
const subscriptionState = uas.message.parseHeader("Subscription-State");
|
|
103
|
-
if (!subscriptionState || !subscriptionState.state) {
|
|
104
|
-
this.logger.warn("Failed to parse subscription state.");
|
|
105
|
-
uas.reject({ statusCode: 489 });
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
// Validate subscription state.
|
|
109
|
-
const state: string = subscriptionState.state;
|
|
110
|
-
switch (state) {
|
|
111
|
-
case "pending":
|
|
112
|
-
break;
|
|
113
|
-
case "active":
|
|
114
|
-
break;
|
|
115
|
-
case "terminated":
|
|
116
|
-
break;
|
|
117
|
-
default:
|
|
118
|
-
this.logger.warn(`Invalid subscription state ${state}`);
|
|
119
|
-
uas.reject({ statusCode: 489 });
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Dialogs usages are created upon completion of a NOTIFY transaction
|
|
124
|
-
// for a new subscription, unless the NOTIFY request contains a
|
|
125
|
-
// "Subscription-State" of "terminated."
|
|
126
|
-
// https://tools.ietf.org/html/rfc6665#section-4.4.1
|
|
127
|
-
if (state !== "terminated") {
|
|
128
|
-
// The Contact header field MUST be present and contain exactly one SIP
|
|
129
|
-
// or SIPS URI in any request that can result in the establishment of a
|
|
130
|
-
// dialog.
|
|
131
|
-
// https://tools.ietf.org/html/rfc3261#section-8.1.1.8
|
|
132
|
-
const contact = uas.message.parseHeader("contact");
|
|
133
|
-
if (!contact) {
|
|
134
|
-
this.logger.warn("Failed to parse contact.");
|
|
135
|
-
uas.reject({ statusCode: 489 });
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// In accordance with the rules for proxying non-INVITE requests as
|
|
141
|
-
// defined in [RFC3261], successful SUBSCRIBE requests will receive only
|
|
142
|
-
// one 200-class response; however, due to forking, the subscription may
|
|
143
|
-
// have been accepted by multiple nodes. The subscriber MUST therefore
|
|
144
|
-
// be prepared to receive NOTIFY requests with "From:" tags that differ
|
|
145
|
-
// from the "To:" tag received in the SUBSCRIBE 200-class response.
|
|
146
|
-
//
|
|
147
|
-
// If multiple NOTIFY requests are received in different dialogs in
|
|
148
|
-
// response to a single SUBSCRIBE request, each dialog represents a
|
|
149
|
-
// different destination to which the SUBSCRIBE request was forked.
|
|
150
|
-
// Subscriber handling in such situations varies by event package; see
|
|
151
|
-
// Section 5.4.9 for details.
|
|
152
|
-
// https://tools.ietf.org/html/rfc6665#section-4.1.4
|
|
153
|
-
|
|
154
|
-
// Each event package MUST specify whether forked SUBSCRIBE requests are
|
|
155
|
-
// allowed to install multiple subscriptions.
|
|
156
|
-
//
|
|
157
|
-
// If such behavior is not allowed, the first potential dialog-
|
|
158
|
-
// establishing message will create a dialog. All subsequent NOTIFY
|
|
159
|
-
// requests that correspond to the SUBSCRIBE request (i.e., have
|
|
160
|
-
// matching "To", "From", "Call-ID", and "Event" header fields, as well
|
|
161
|
-
// as "From" header field "tag" parameter and "Event" header field "id"
|
|
162
|
-
// parameter) but that do not match the dialog would be rejected with a
|
|
163
|
-
// 481 response. Note that the 200-class response to the SUBSCRIBE
|
|
164
|
-
// request can arrive after a matching NOTIFY request has been received;
|
|
165
|
-
// such responses might not correlate to the same dialog established by
|
|
166
|
-
// the NOTIFY request. Except as required to complete the SUBSCRIBE
|
|
167
|
-
// transaction, such non-matching 200-class responses are ignored.
|
|
168
|
-
//
|
|
169
|
-
// If installing of multiple subscriptions by way of a single forked
|
|
170
|
-
// SUBSCRIBE request is allowed, the subscriber establishes a new dialog
|
|
171
|
-
// towards each notifier by returning a 200-class response to each
|
|
172
|
-
// NOTIFY request. Each dialog is then handled as its own entity and is
|
|
173
|
-
// refreshed independently of the other dialogs.
|
|
174
|
-
//
|
|
175
|
-
// In the case that multiple subscriptions are allowed, the event
|
|
176
|
-
// package MUST specify whether merging of the notifications to form a
|
|
177
|
-
// single state is required, and how such merging is to be performed.
|
|
178
|
-
// Note that it is possible that some event packages may be defined in
|
|
179
|
-
// such a way that each dialog is tied to a mutually exclusive state
|
|
180
|
-
// that is unaffected by the other dialogs; this MUST be clearly stated
|
|
181
|
-
// if it is the case.
|
|
182
|
-
// https://tools.ietf.org/html/rfc6665#section-5.4.9
|
|
183
|
-
|
|
184
|
-
// *** NOTE: This implementation is only for event packages which
|
|
185
|
-
// do not allow forked requests to install multiple subscriptions.
|
|
186
|
-
// As such and in accordance with the specification, we stop waiting
|
|
187
|
-
// and any future NOTIFY requests will be rejected with a 481.
|
|
188
|
-
if (this.dialog) {
|
|
189
|
-
throw new Error("Dialog already created. This implementation only supports install of single subscriptions.");
|
|
190
|
-
}
|
|
191
|
-
this.waitNotifyStop();
|
|
192
|
-
|
|
193
|
-
// Update expires.
|
|
194
|
-
this.subscriptionExpires = subscriptionState.expires
|
|
195
|
-
? Math.min(this.subscriptionExpires, Math.max(subscriptionState.expires, 0))
|
|
196
|
-
: this.subscriptionExpires;
|
|
197
|
-
|
|
198
|
-
// Update subscription state.
|
|
199
|
-
switch (state) {
|
|
200
|
-
case "pending":
|
|
201
|
-
this.subscriptionState = SubscriptionState.Pending;
|
|
202
|
-
break;
|
|
203
|
-
case "active":
|
|
204
|
-
this.subscriptionState = SubscriptionState.Active;
|
|
205
|
-
break;
|
|
206
|
-
case "terminated":
|
|
207
|
-
this.subscriptionState = SubscriptionState.Terminated;
|
|
208
|
-
break;
|
|
209
|
-
default:
|
|
210
|
-
throw new Error(`Unrecognized state ${state}.`);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// Dialogs usages are created upon completion of a NOTIFY transaction
|
|
214
|
-
// for a new subscription, unless the NOTIFY request contains a
|
|
215
|
-
// "Subscription-State" of "terminated."
|
|
216
|
-
// https://tools.ietf.org/html/rfc6665#section-4.4.1
|
|
217
|
-
if (this.subscriptionState !== SubscriptionState.Terminated) {
|
|
218
|
-
// Because the dialog usage is established by the NOTIFY request, the
|
|
219
|
-
// route set at the subscriber is taken from the NOTIFY request itself,
|
|
220
|
-
// as opposed to the route set present in the 200-class response to the
|
|
221
|
-
// SUBSCRIBE request.
|
|
222
|
-
// https://tools.ietf.org/html/rfc6665#section-4.4.1
|
|
223
|
-
const dialogState = SubscriptionDialog.initialDialogStateForSubscription(this.message, uas.message);
|
|
224
|
-
|
|
225
|
-
// Subscription Initiated! :)
|
|
226
|
-
this.dialog = new SubscriptionDialog(
|
|
227
|
-
this.subscriptionEvent,
|
|
228
|
-
this.subscriptionExpires,
|
|
229
|
-
this.subscriptionState,
|
|
230
|
-
this.core,
|
|
231
|
-
dialogState
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// Delegate.
|
|
236
|
-
if (this.delegate && this.delegate.onNotify) {
|
|
237
|
-
const request = uas;
|
|
238
|
-
const subscription = this.dialog;
|
|
239
|
-
this.delegate.onNotify({ request, subscription });
|
|
240
|
-
} else {
|
|
241
|
-
uas.accept();
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
public waitNotifyStart(): void {
|
|
246
|
-
if (!this.N) {
|
|
247
|
-
// Add ourselves to the core's subscriber map.
|
|
248
|
-
// This allows the core to route out of dialog NOTIFY messages to us.
|
|
249
|
-
this.core.subscribers.set(this.subscriberId, this);
|
|
250
|
-
this.N = window.setTimeout(() => this.timerN(), Timers.TIMER_N);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
public waitNotifyStop(): void {
|
|
255
|
-
if (this.N) {
|
|
256
|
-
// Remove ourselves to the core's subscriber map.
|
|
257
|
-
// Any future out of dialog NOTIFY messages will be rejected with a 481.
|
|
258
|
-
this.core.subscribers.delete(this.subscriberId);
|
|
259
|
-
clearTimeout(this.N);
|
|
260
|
-
this.N = undefined;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Receive a response from the transaction layer.
|
|
266
|
-
* @param message - Incoming response message.
|
|
267
|
-
*/
|
|
268
|
-
protected receiveResponse(message: IncomingResponseMessage): void {
|
|
269
|
-
if (!this.authenticationGuard(message)) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
if (message.statusCode && message.statusCode >= 200 && message.statusCode < 300) {
|
|
274
|
-
// The "Expires" header field in a 200-class response to SUBSCRIBE
|
|
275
|
-
// request indicates the actual duration for which the subscription will
|
|
276
|
-
// remain active (unless refreshed). The received value might be
|
|
277
|
-
// smaller than the value indicated in the SUBSCRIBE request but cannot
|
|
278
|
-
// be larger; see Section 4.2.1 for details.
|
|
279
|
-
// https://tools.ietf.org/html/rfc6665#section-4.1.2.1
|
|
280
|
-
|
|
281
|
-
// The "Expires" values present in SUBSCRIBE 200-class responses behave
|
|
282
|
-
// in the same way as they do in REGISTER responses: the server MAY
|
|
283
|
-
// shorten the interval but MUST NOT lengthen it.
|
|
284
|
-
//
|
|
285
|
-
// If the duration specified in a SUBSCRIBE request is unacceptably
|
|
286
|
-
// short, the notifier may be able to send a 423 response, as
|
|
287
|
-
// described earlier in this section.
|
|
288
|
-
//
|
|
289
|
-
// 200-class responses to SUBSCRIBE requests will not generally contain
|
|
290
|
-
// any useful information beyond subscription duration; their primary
|
|
291
|
-
// purpose is to serve as a reliability mechanism. State information
|
|
292
|
-
// will be communicated via a subsequent NOTIFY request from the
|
|
293
|
-
// notifier.
|
|
294
|
-
// https://tools.ietf.org/html/rfc6665#section-4.2.1.1
|
|
295
|
-
const expires = message.getHeader("Expires");
|
|
296
|
-
if (!expires) {
|
|
297
|
-
this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");
|
|
298
|
-
} else {
|
|
299
|
-
const subscriptionExpiresReceived = Number(expires);
|
|
300
|
-
if (subscriptionExpiresReceived > this.subscriptionExpiresRequested) {
|
|
301
|
-
this.logger.warn(
|
|
302
|
-
"Expires header in a 200-class response to SUBSCRIBE with a higher value than the one in the request"
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
if (subscriptionExpiresReceived < this.subscriptionExpires) {
|
|
306
|
-
this.subscriptionExpires = subscriptionExpiresReceived;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
// If a NOTIFY arrived before 200-class response a dialog may have been created.
|
|
310
|
-
// Updated the dialogs expiration only if this indicates earlier expiration.
|
|
311
|
-
if (this.dialog) {
|
|
312
|
-
if (this.dialog.subscriptionExpires > this.subscriptionExpires) {
|
|
313
|
-
this.dialog.subscriptionExpires = this.subscriptionExpires;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
if (message.statusCode && message.statusCode >= 300 && message.statusCode < 700) {
|
|
319
|
-
this.waitNotifyStop(); // No NOTIFY will be sent after a negative final response.
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
super.receiveResponse(message);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* To ensure that subscribers do not wait indefinitely for a
|
|
327
|
-
* subscription to be established, a subscriber starts a Timer N, set to
|
|
328
|
-
* 64*T1, when it sends a SUBSCRIBE request. If this Timer N expires
|
|
329
|
-
* prior to the receipt of a NOTIFY request, the subscriber considers
|
|
330
|
-
* the subscription failed, and cleans up any state associated with the
|
|
331
|
-
* subscription attempt.
|
|
332
|
-
* https://tools.ietf.org/html/rfc6665#section-4.1.2.4
|
|
333
|
-
*/
|
|
334
|
-
private timerN(): void {
|
|
335
|
-
this.logger.warn(`Timer N expired for SUBSCRIBE user agent client. Timed out waiting for NOTIFY.`);
|
|
336
|
-
this.waitNotifyStop();
|
|
337
|
-
if (this.delegate && this.delegate.onNotifyTimeout) {
|
|
338
|
-
this.delegate.onNotifyTimeout();
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IncomingRequestDelegate, IncomingRequestMessage, IncomingSubscribeRequest } from "../messages";
|
|
2
|
-
import { NonInviteServerTransaction } from "../transactions";
|
|
3
|
-
import { UserAgentCore } from "../user-agent-core";
|
|
4
|
-
import { UserAgentServer } from "./user-agent-server";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* SUBSCRIBE UAS.
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export class SubscribeUserAgentServer extends UserAgentServer implements IncomingSubscribeRequest {
|
|
11
|
-
constructor(protected core: UserAgentCore, message: IncomingRequestMessage, delegate?: IncomingRequestDelegate) {
|
|
12
|
-
super(NonInviteServerTransaction, core, message, delegate);
|
|
13
|
-
}
|
|
14
|
-
}
|