ue-softphone-sdk 2.2.3 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/bye.d.ts +16 -0
- package/dist/api/dtmf.d.ts +15 -0
- package/dist/api/emitter.d.ts +88 -0
- package/dist/api/exceptions/content-type-unsupported.d.ts +8 -0
- package/dist/api/exceptions/index.d.ts +5 -0
- package/dist/api/exceptions/request-pending.d.ts +9 -0
- package/dist/api/exceptions/session-description-handler.d.ts +8 -0
- package/dist/api/exceptions/session-terminated.d.ts +8 -0
- package/dist/api/exceptions/state-transition.d.ts +8 -0
- package/dist/api/index.d.ts +58 -0
- package/dist/api/info.d.ts +16 -0
- package/dist/api/invitation-accept-options.d.ts +19 -0
- package/dist/api/invitation-progress-options.d.ts +38 -0
- package/dist/api/invitation-reject-options.d.ts +25 -0
- package/dist/api/invitation.d.ts +179 -0
- package/dist/api/inviter-cancel-options.d.ts +9 -0
- package/dist/api/inviter-invite-options.d.ts +28 -0
- package/dist/api/inviter-options.d.ts +43 -0
- package/dist/api/inviter.d.ts +236 -0
- package/dist/api/message.d.ts +16 -0
- package/dist/api/messager-message-options.d.ts +11 -0
- package/dist/api/messager-options.d.ts +17 -0
- package/dist/api/messager.d.ts +26 -0
- package/dist/api/notification.d.ts +16 -0
- package/dist/api/notifier.d.ts +8 -0
- package/dist/api/publisher-options.d.ts +33 -0
- package/dist/api/publisher-publish-options.d.ts +6 -0
- package/dist/api/publisher-state.d.ts +21 -0
- package/dist/api/publisher-unpublish-options.d.ts +6 -0
- package/dist/api/publisher.d.ts +65 -0
- package/dist/api/referral.d.ts +38 -0
- package/dist/api/registerer-options.d.ts +46 -0
- package/dist/api/registerer-register-options.d.ts +11 -0
- package/dist/api/registerer-state.d.ts +21 -0
- package/dist/api/registerer-unregister-options.d.ts +16 -0
- package/dist/api/registerer.d.ts +144 -0
- package/dist/api/session-bye-options.d.ts +11 -0
- package/dist/api/session-delegate.d.ts +73 -0
- package/dist/api/session-description-handler-factory.d.ts +15 -0
- package/dist/api/session-description-handler.d.ts +74 -0
- package/dist/api/session-info-options.d.ts +11 -0
- package/dist/api/session-invite-options.d.ts +28 -0
- package/dist/api/session-message-options.d.ts +11 -0
- package/dist/api/session-options.d.ts +8 -0
- package/dist/api/session-refer-options.d.ts +14 -0
- package/dist/api/session-state.d.ts +45 -0
- package/dist/api/session.d.ts +359 -0
- package/dist/api/subscriber-options.d.ts +11 -0
- package/dist/api/subscriber-subscribe-options.d.ts +6 -0
- package/dist/api/subscriber.d.ts +94 -0
- package/dist/api/subscription-delegate.d.ts +12 -0
- package/dist/api/subscription-options.d.ts +8 -0
- package/dist/api/subscription-state.d.ts +19 -0
- package/dist/api/subscription-subscribe-options.d.ts +6 -0
- package/dist/api/subscription-unsubscribe-options.d.ts +6 -0
- package/dist/api/subscription.d.ts +84 -0
- package/dist/api/transport-state.d.ts +37 -0
- package/dist/api/transport.d.ts +159 -0
- package/dist/api/user-agent-delegate.d.ts +84 -0
- package/dist/api/user-agent-options.d.ts +253 -0
- package/dist/api/user-agent-state.d.ts +14 -0
- package/dist/api/user-agent.d.ts +200 -0
- package/dist/core/dialogs/dialog-state.d.ts +34 -0
- package/dist/core/dialogs/dialog.d.ts +161 -0
- package/dist/core/dialogs/index.d.ts +4 -0
- package/dist/core/dialogs/session-dialog.d.ts +196 -0
- package/dist/core/dialogs/subscription-dialog.d.ts +120 -0
- package/dist/core/exceptions/exception.d.ts +8 -0
- package/dist/core/exceptions/index.d.ts +3 -0
- package/dist/core/exceptions/transaction-state-error.d.ts +8 -0
- package/dist/core/exceptions/transport-error.d.ts +8 -0
- package/dist/core/index.d.ts +15 -0
- package/dist/core/log/index.d.ts +3 -0
- package/dist/core/log/levels.d.ts +10 -0
- package/dist/core/log/logger-factory.d.ts +21 -0
- package/dist/core/log/logger.d.ts +19 -0
- package/dist/core/messages/body.d.ts +64 -0
- package/dist/core/messages/digest-authentication.d.ts +51 -0
- package/dist/core/messages/incoming-message.d.ts +79 -0
- package/dist/core/messages/incoming-request-message.d.ts +10 -0
- package/dist/core/messages/incoming-request.d.ts +67 -0
- package/dist/core/messages/incoming-response-message.d.ts +10 -0
- package/dist/core/messages/incoming-response.d.ts +12 -0
- package/dist/core/messages/index.d.ts +13 -0
- package/dist/core/messages/md5.d.ts +32 -0
- package/dist/core/messages/methods/ack.d.ts +18 -0
- package/dist/core/messages/methods/bye.d.ts +21 -0
- package/dist/core/messages/methods/cancel.d.ts +21 -0
- package/dist/core/messages/methods/constants.d.ts +20 -0
- package/dist/core/messages/methods/index.d.ts +13 -0
- package/dist/core/messages/methods/info.d.ts +21 -0
- package/dist/core/messages/methods/invite.d.ts +86 -0
- package/dist/core/messages/methods/message.d.ts +21 -0
- package/dist/core/messages/methods/notify.d.ts +21 -0
- package/dist/core/messages/methods/prack.d.ts +21 -0
- package/dist/core/messages/methods/publish.d.ts +21 -0
- package/dist/core/messages/methods/refer.d.ts +21 -0
- package/dist/core/messages/methods/register.d.ts +21 -0
- package/dist/core/messages/methods/subscribe.d.ts +54 -0
- package/dist/core/messages/outgoing-request-message.d.ts +94 -0
- package/dist/core/messages/outgoing-request.d.ts +67 -0
- package/dist/core/messages/outgoing-response.d.ts +42 -0
- package/dist/core/messages/parser.d.ts +14 -0
- package/dist/core/messages/utils.d.ts +24 -0
- package/dist/core/session/index.d.ts +2 -0
- package/dist/core/session/session-delegate.d.ts +70 -0
- package/dist/core/session/session.d.ts +134 -0
- package/dist/core/subscription/index.d.ts +2 -0
- package/dist/core/subscription/subscription-delegate.d.ts +27 -0
- package/dist/core/subscription/subscription.d.ts +55 -0
- package/dist/core/timers.d.ts +20 -0
- package/dist/core/transactions/client-transaction.d.ts +45 -0
- package/dist/core/transactions/index.d.ts +10 -0
- package/dist/core/transactions/invite-client-transaction.d.ts +116 -0
- package/dist/core/transactions/invite-server-transaction.d.ts +127 -0
- package/dist/core/transactions/non-invite-client-transaction.d.ts +69 -0
- package/dist/core/transactions/non-invite-server-transaction.d.ts +57 -0
- package/dist/core/transactions/server-transaction.d.ts +35 -0
- package/dist/core/transactions/transaction-state.d.ts +13 -0
- package/dist/core/transactions/transaction-user.d.ts +72 -0
- package/dist/core/transactions/transaction.d.ts +79 -0
- package/dist/core/transport.d.ts +31 -0
- package/dist/core/user-agent-core/allowed-methods.d.ts +4 -0
- package/dist/core/user-agent-core/index.d.ts +3 -0
- package/dist/core/user-agent-core/user-agent-core-configuration.d.ts +99 -0
- package/dist/core/user-agent-core/user-agent-core-delegate.d.ts +37 -0
- package/dist/core/user-agent-core/user-agent-core.d.ts +179 -0
- package/dist/core/user-agents/bye-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/bye-user-agent-server.d.ts +10 -0
- package/dist/core/user-agents/cancel-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/index.d.ts +26 -0
- package/dist/core/user-agents/info-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/info-user-agent-server.d.ts +10 -0
- package/dist/core/user-agents/invite-user-agent-client.d.ts +35 -0
- package/dist/core/user-agents/invite-user-agent-server.d.ts +77 -0
- package/dist/core/user-agents/message-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/message-user-agent-server.d.ts +10 -0
- package/dist/core/user-agents/notify-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/notify-user-agent-server.d.ts +16 -0
- package/dist/core/user-agents/prack-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/prack-user-agent-server.d.ts +16 -0
- package/dist/core/user-agents/publish-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/re-invite-user-agent-client.d.ts +18 -0
- package/dist/core/user-agents/re-invite-user-agent-server.d.ts +41 -0
- package/dist/core/user-agents/re-subscribe-user-agent-client.d.ts +17 -0
- package/dist/core/user-agents/re-subscribe-user-agent-server.d.ts +10 -0
- package/dist/core/user-agents/refer-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/refer-user-agent-server.d.ts +16 -0
- package/dist/core/user-agents/register-user-agent-client.d.ts +10 -0
- package/dist/core/user-agents/register-user-agent-server.d.ts +11 -0
- package/dist/core/user-agents/subscribe-user-agent-client.d.ts +65 -0
- package/dist/core/user-agents/subscribe-user-agent-server.d.ts +11 -0
- package/dist/core/user-agents/user-agent-client.d.ts +103 -0
- package/dist/core/user-agents/user-agent-server.d.ts +79 -0
- package/dist/grammar/grammar.d.ts +26 -0
- package/dist/grammar/index.d.ts +4 -0
- package/dist/grammar/name-addr-header.d.ts +24 -0
- package/dist/grammar/parameters.d.ts +16 -0
- package/dist/grammar/pegjs/dist/grammar.d.ts +50 -0
- package/dist/grammar/uri.d.ts +62 -0
- package/dist/{types/index.d.ts → index.d.ts} +7 -3
- package/dist/main.d.ts +9 -0
- package/dist/new-index.d.ts +199 -0
- package/dist/platform/web/index.d.ts +4 -0
- package/dist/platform/web/modifiers/index.d.ts +5 -0
- package/dist/platform/web/modifiers/modifiers.d.ts +41 -0
- package/dist/platform/web/session-description-handler/index.d.ts +14 -0
- package/dist/platform/web/session-description-handler/media-stream-factory-default.d.ts +6 -0
- package/dist/platform/web/session-description-handler/media-stream-factory.d.ts +6 -0
- package/dist/platform/web/session-description-handler/peer-connection-configuration-default.d.ts +5 -0
- package/dist/platform/web/session-description-handler/peer-connection-delegate.d.ts +63 -0
- package/dist/platform/web/session-description-handler/session-description-handler-configuration.d.ts +16 -0
- package/dist/platform/web/session-description-handler/session-description-handler-factory-default.d.ts +11 -0
- package/dist/platform/web/session-description-handler/session-description-handler-factory-options.d.ts +9 -0
- package/dist/platform/web/session-description-handler/session-description-handler-factory.d.ts +16 -0
- package/dist/platform/web/session-description-handler/session-description-handler-options.d.ts +47 -0
- package/dist/platform/web/session-description-handler/session-description-handler.d.ts +212 -0
- package/dist/platform/web/simple-user/index.d.ts +7 -0
- package/dist/platform/web/simple-user/simple-user-delegate.d.ts +72 -0
- package/dist/platform/web/simple-user/simple-user-options.d.ts +90 -0
- package/dist/platform/web/simple-user/simple-user.d.ts +226 -0
- package/dist/platform/web/transport/index.d.ts +6 -0
- package/dist/platform/web/transport/transport-options.d.ts +30 -0
- package/dist/platform/web/transport/transport.d.ts +125 -0
- package/dist/ue-softphone-sdk.js +2 -1
- package/dist/ue-softphone-sdk.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/webPhoneSdk.d.ts +24 -0
- package/dist/webrtc.d.ts +17 -0
- package/{rollup-new.config.mjs → new-rollup.config.mjs} +1 -1
- package/package.json +6 -6
- package/rollup.config.js +15 -14
- package/src/api/api-extractor.json +358 -0
- package/src/api/bye.ts +27 -0
- package/src/api/dtmf.ts +27 -0
- package/src/api/emitter.ts +110 -0
- package/src/api/exceptions/content-type-unsupported.ts +11 -0
- package/src/api/exceptions/index.ts +5 -0
- package/src/api/exceptions/request-pending.ts +12 -0
- package/src/api/exceptions/session-description-handler.ts +11 -0
- package/src/api/exceptions/session-terminated.ts +11 -0
- package/src/api/exceptions/state-transition.ts +11 -0
- package/src/api/index.ts +58 -0
- package/src/api/info.ts +27 -0
- package/src/api/invitation-accept-options.ts +20 -0
- package/src/api/invitation-progress-options.ts +36 -0
- package/src/api/invitation-reject-options.ts +22 -0
- package/src/api/invitation.ts +816 -0
- package/src/api/inviter-cancel-options.ts +9 -0
- package/src/api/inviter-invite-options.ts +29 -0
- package/src/api/inviter-options.ts +44 -0
- package/src/api/inviter.ts +1126 -0
- package/src/api/message.ts +27 -0
- package/src/api/messager-message-options.ts +12 -0
- package/src/api/messager-options.ts +18 -0
- package/src/api/messager.ts +89 -0
- package/src/api/notification.ts +27 -0
- package/src/api/notifier.ts +7 -0
- package/src/api/publisher-options.ts +34 -0
- package/src/api/publisher-publish-options.ts +6 -0
- package/src/api/publisher-state.ts +21 -0
- package/src/api/publisher-unpublish-options.ts +6 -0
- package/src/api/publisher.ts +418 -0
- package/src/api/referral.ts +89 -0
- package/src/api/registerer-options.ts +55 -0
- package/src/api/registerer-register-options.ts +12 -0
- package/src/api/registerer-state.ts +21 -0
- package/src/api/registerer-unregister-options.ts +17 -0
- package/src/api/registerer.ts +814 -0
- package/src/api/session-bye-options.ts +12 -0
- package/src/api/session-delegate.ts +80 -0
- package/src/api/session-description-handler-factory.ts +16 -0
- package/src/api/session-description-handler.ts +89 -0
- package/src/api/session-info-options.ts +12 -0
- package/src/api/session-invite-options.ts +29 -0
- package/src/api/session-message-options.ts +12 -0
- package/src/api/session-options.ts +8 -0
- package/src/api/session-refer-options.ts +15 -0
- package/src/api/session-state.ts +45 -0
- package/src/api/session.ts +1448 -0
- package/src/api/subscriber-options.ts +12 -0
- package/src/api/subscriber-subscribe-options.ts +6 -0
- package/src/api/subscriber.ts +536 -0
- package/src/api/subscription-delegate.ts +13 -0
- package/src/api/subscription-options.ts +8 -0
- package/src/api/subscription-state.ts +19 -0
- package/src/api/subscription-subscribe-options.ts +6 -0
- package/src/api/subscription-unsubscribe-options.ts +6 -0
- package/src/api/subscription.ts +161 -0
- package/src/api/transport-state.ts +37 -0
- package/src/api/transport.ts +169 -0
- package/src/api/user-agent-delegate.ts +95 -0
- package/src/api/user-agent-options.ts +322 -0
- package/src/api/user-agent-state.ts +14 -0
- package/src/api/user-agent.ts +1014 -0
- package/src/core/api-extractor.json +358 -0
- package/src/core/dialogs/dialog-state.ts +35 -0
- package/src/core/dialogs/dialog.ts +605 -0
- package/src/core/dialogs/index.ts +4 -0
- package/src/core/dialogs/session-dialog.ts +996 -0
- package/src/core/dialogs/subscription-dialog.ts +557 -0
- package/src/core/exceptions/exception.ts +11 -0
- package/src/core/exceptions/index.ts +3 -0
- package/src/core/exceptions/transaction-state-error.ts +11 -0
- package/src/core/exceptions/transport-error.ts +11 -0
- package/src/core/index.ts +19 -0
- package/src/core/log/index.ts +3 -0
- package/src/core/log/levels.ts +10 -0
- package/src/core/log/logger-factory.ts +119 -0
- package/src/core/log/logger.ts +42 -0
- package/src/core/messages/body.ts +171 -0
- package/src/core/messages/digest-authentication.ts +190 -0
- package/src/core/messages/incoming-message.ts +152 -0
- package/src/core/messages/incoming-request-message.ts +14 -0
- package/src/core/messages/incoming-request.ts +75 -0
- package/src/core/messages/incoming-response-message.ts +14 -0
- package/src/core/messages/incoming-response.ts +13 -0
- package/src/core/messages/index.ts +18 -0
- package/src/core/messages/md5.ts +437 -0
- package/src/core/messages/methods/ack.ts +22 -0
- package/src/core/messages/methods/bye.ts +22 -0
- package/src/core/messages/methods/cancel.ts +22 -0
- package/src/core/messages/methods/constants.ts +21 -0
- package/src/core/messages/methods/index.ts +13 -0
- package/src/core/messages/methods/info.ts +22 -0
- package/src/core/messages/methods/invite.ts +104 -0
- package/src/core/messages/methods/message.ts +22 -0
- package/src/core/messages/methods/notify.ts +22 -0
- package/src/core/messages/methods/prack.ts +22 -0
- package/src/core/messages/methods/publish.ts +22 -0
- package/src/core/messages/methods/refer.ts +22 -0
- package/src/core/messages/methods/register.ts +22 -0
- package/src/core/messages/methods/subscribe.ts +59 -0
- package/src/core/messages/outgoing-request-message.ts +299 -0
- package/src/core/messages/outgoing-request.ts +77 -0
- package/src/core/messages/outgoing-response.ts +174 -0
- package/src/core/messages/parser.ts +265 -0
- package/src/core/messages/utils.ts +144 -0
- package/src/core/session/index.ts +2 -0
- package/src/core/session/session-delegate.ts +88 -0
- package/src/core/session/session.ts +158 -0
- package/src/core/subscription/index.ts +2 -0
- package/src/core/subscription/subscription-delegate.ts +30 -0
- package/src/core/subscription/subscription.ts +61 -0
- package/src/core/timers.ts +24 -0
- package/src/core/transactions/client-transaction.ts +78 -0
- package/src/core/transactions/index.ts +10 -0
- package/src/core/transactions/invite-client-transaction.ts +504 -0
- package/src/core/transactions/invite-server-transaction.ts +432 -0
- package/src/core/transactions/non-invite-client-transaction.ts +257 -0
- package/src/core/transactions/non-invite-server-transaction.ts +241 -0
- package/src/core/transactions/server-transaction.ts +47 -0
- package/src/core/transactions/transaction-state.ts +13 -0
- package/src/core/transactions/transaction-user.ts +82 -0
- package/src/core/transactions/transaction.ts +149 -0
- package/src/core/transport.ts +32 -0
- package/src/core/user-agent-core/allowed-methods.ts +19 -0
- package/src/core/user-agent-core/index.ts +3 -0
- package/src/core/user-agent-core/user-agent-core-configuration.ts +111 -0
- package/src/core/user-agent-core/user-agent-core-delegate.ts +50 -0
- package/src/core/user-agent-core/user-agent-core.ts +905 -0
- package/src/core/user-agents/bye-user-agent-client.ts +16 -0
- package/src/core/user-agents/bye-user-agent-server.ts +14 -0
- package/src/core/user-agents/cancel-user-agent-client.ts +14 -0
- package/src/core/user-agents/index.ts +26 -0
- package/src/core/user-agents/info-user-agent-client.ts +15 -0
- package/src/core/user-agents/info-user-agent-server.ts +14 -0
- package/src/core/user-agents/invite-user-agent-client.ts +405 -0
- package/src/core/user-agents/invite-user-agent-server.ts +269 -0
- package/src/core/user-agents/message-user-agent-client.ts +14 -0
- package/src/core/user-agents/message-user-agent-server.ts +14 -0
- package/src/core/user-agents/notify-user-agent-client.ts +15 -0
- package/src/core/user-agents/notify-user-agent-server.ts +30 -0
- package/src/core/user-agents/prack-user-agent-client.ts +16 -0
- package/src/core/user-agents/prack-user-agent-server.ts +37 -0
- package/src/core/user-agents/publish-user-agent-client.ts +14 -0
- package/src/core/user-agents/re-invite-user-agent-client.ts +127 -0
- package/src/core/user-agents/re-invite-user-agent-server.ts +109 -0
- package/src/core/user-agents/re-subscribe-user-agent-client.ts +78 -0
- package/src/core/user-agents/re-subscribe-user-agent-server.ts +14 -0
- package/src/core/user-agents/refer-user-agent-client.ts +15 -0
- package/src/core/user-agents/refer-user-agent-server.ts +30 -0
- package/src/core/user-agents/register-user-agent-client.ts +14 -0
- package/src/core/user-agents/register-user-agent-server.ts +14 -0
- package/src/core/user-agents/subscribe-user-agent-client.ts +341 -0
- package/src/core/user-agents/subscribe-user-agent-server.ts +14 -0
- package/src/core/user-agents/user-agent-client.ts +378 -0
- package/src/core/user-agents/user-agent-server.ts +276 -0
- package/src/grammar/grammar.ts +55 -0
- package/src/grammar/index.ts +4 -0
- package/src/grammar/name-addr-header.ts +58 -0
- package/src/grammar/parameters.ts +45 -0
- package/src/grammar/pegjs/README.md +9 -0
- package/src/grammar/pegjs/dist/grammar.ts +1557 -0
- package/src/grammar/pegjs/src/grammar.pegjs +1009 -0
- package/src/grammar/uri.ts +370 -0
- package/src/index.ts +49 -26
- package/src/lib/socket.io.esm.min.js +7 -0
- package/src/main.ts +26 -0
- package/src/new-index.ts +2486 -0
- package/src/platform/react/README.md +1 -0
- package/src/platform/web/index.ts +4 -0
- package/src/platform/web/modifiers/index.ts +5 -0
- package/src/platform/web/modifiers/modifiers.ts +180 -0
- package/src/platform/web/session-description-handler/api-extractor.json +358 -0
- package/src/platform/web/session-description-handler/index.ts +14 -0
- package/src/platform/web/session-description-handler/media-stream-factory-default.ts +22 -0
- package/src/platform/web/session-description-handler/media-stream-factory.ts +10 -0
- package/src/platform/web/session-description-handler/peer-connection-configuration-default.ts +17 -0
- package/src/platform/web/session-description-handler/peer-connection-delegate.ts +72 -0
- package/src/platform/web/session-description-handler/session-description-handler-configuration.ts +17 -0
- package/src/platform/web/session-description-handler/session-description-handler-factory-default.ts +45 -0
- package/src/platform/web/session-description-handler/session-description-handler-factory-options.ts +10 -0
- package/src/platform/web/session-description-handler/session-description-handler-factory.ts +17 -0
- package/src/platform/web/session-description-handler/session-description-handler-options.ts +56 -0
- package/src/platform/web/session-description-handler/session-description-handler.ts +938 -0
- package/src/platform/web/simple-user/api-extractor.json +358 -0
- package/src/platform/web/simple-user/index.ts +7 -0
- package/src/platform/web/simple-user/simple-user-delegate.ts +82 -0
- package/src/platform/web/simple-user/simple-user-options.ts +102 -0
- package/src/platform/web/simple-user/simple-user.ts +1099 -0
- package/src/platform/web/transport/api-extractor.json +358 -0
- package/src/platform/web/transport/index.ts +6 -0
- package/src/platform/web/transport/transport-options.ts +34 -0
- package/src/platform/web/transport/transport.ts +742 -0
- package/src/version.ts +8 -0
- package/src/webPhoneSdk.ts +67 -0
- package/src/webrtc.ts +318 -0
- package/tsconfig.json +26 -10
- /package/dist/{types/config.d.ts → config.d.ts} +0 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { Dialog, SessionDialog } from "../dialogs";
|
|
2
|
+
import { TransactionStateError } from "../exceptions";
|
|
3
|
+
import {
|
|
4
|
+
IncomingInviteRequest,
|
|
5
|
+
IncomingRequestDelegate,
|
|
6
|
+
IncomingRequestMessage,
|
|
7
|
+
OutgoingResponse,
|
|
8
|
+
OutgoingResponseWithSession,
|
|
9
|
+
ResponseOptions,
|
|
10
|
+
URI
|
|
11
|
+
} from "../messages";
|
|
12
|
+
import { SignalingState } from "../session";
|
|
13
|
+
import { InviteServerTransaction } from "../transactions";
|
|
14
|
+
import { UserAgentCore } from "../user-agent-core";
|
|
15
|
+
import { AllowedMethods } from "../user-agent-core/allowed-methods";
|
|
16
|
+
import { UserAgentServer } from "./user-agent-server";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* INVITE UAS.
|
|
20
|
+
* @remarks
|
|
21
|
+
* 13 Initiating a Session
|
|
22
|
+
* https://tools.ietf.org/html/rfc3261#section-13
|
|
23
|
+
* 13.1 Overview
|
|
24
|
+
* https://tools.ietf.org/html/rfc3261#section-13.1
|
|
25
|
+
* 13.3 UAS Processing
|
|
26
|
+
* https://tools.ietf.org/html/rfc3261#section-13.3
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export class InviteUserAgentServer extends UserAgentServer implements IncomingInviteRequest {
|
|
30
|
+
/** The confirmed dialog, if any. */
|
|
31
|
+
private confirmedDialog: SessionDialog | undefined;
|
|
32
|
+
/** The early dialog, if any. */
|
|
33
|
+
private earlyDialog: SessionDialog | undefined;
|
|
34
|
+
|
|
35
|
+
constructor(protected core: UserAgentCore, message: IncomingRequestMessage, delegate?: IncomingRequestDelegate) {
|
|
36
|
+
super(InviteServerTransaction, core, message, delegate);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public dispose(): void {
|
|
40
|
+
if (this.earlyDialog) {
|
|
41
|
+
this.earlyDialog.dispose();
|
|
42
|
+
}
|
|
43
|
+
super.dispose();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 13.3.1.4 The INVITE is Accepted
|
|
48
|
+
* The UAS core generates a 2xx response. This response establishes a
|
|
49
|
+
* dialog, and therefore follows the procedures of Section 12.1.1 in
|
|
50
|
+
* addition to those of Section 8.2.6.
|
|
51
|
+
* https://tools.ietf.org/html/rfc3261#section-13.3.1.4
|
|
52
|
+
* @param options - Accept options bucket.
|
|
53
|
+
*/
|
|
54
|
+
public accept(options: ResponseOptions = { statusCode: 200 }): OutgoingResponseWithSession {
|
|
55
|
+
if (!this.acceptable) {
|
|
56
|
+
throw new TransactionStateError(`${this.message.method} not acceptable in state ${this.transaction.state}.`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// This response establishes a dialog...
|
|
60
|
+
// https://tools.ietf.org/html/rfc3261#section-13.3.1.4
|
|
61
|
+
if (!this.confirmedDialog) {
|
|
62
|
+
if (this.earlyDialog) {
|
|
63
|
+
this.earlyDialog.confirm();
|
|
64
|
+
this.confirmedDialog = this.earlyDialog;
|
|
65
|
+
this.earlyDialog = undefined;
|
|
66
|
+
} else {
|
|
67
|
+
const transaction = this.transaction;
|
|
68
|
+
if (!(transaction instanceof InviteServerTransaction)) {
|
|
69
|
+
throw new Error("Transaction not instance of InviteClientTransaction.");
|
|
70
|
+
}
|
|
71
|
+
const state = Dialog.initialDialogStateForUserAgentServer(this.message, this.toTag);
|
|
72
|
+
this.confirmedDialog = new SessionDialog(transaction, this.core, state);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// When a UAS responds to a request with a response that establishes a
|
|
77
|
+
// dialog (such as a 2xx to INVITE), the UAS MUST copy all Record-Route
|
|
78
|
+
// header field values from the request into the response (including the
|
|
79
|
+
// URIs, URI parameters, and any Record-Route header field parameters,
|
|
80
|
+
// whether they are known or unknown to the UAS) and MUST maintain the
|
|
81
|
+
// order of those values. The UAS MUST add a Contact header field to
|
|
82
|
+
// the response. The Contact header field contains an address where the
|
|
83
|
+
// UAS would like to be contacted for subsequent requests in the dialog
|
|
84
|
+
// (which includes the ACK for a 2xx response in the case of an INVITE).
|
|
85
|
+
// Generally, the host portion of this URI is the IP address or FQDN of
|
|
86
|
+
// the host. The URI provided in the Contact header field MUST be a SIP
|
|
87
|
+
// or SIPS URI. If the request that initiated the dialog contained a
|
|
88
|
+
// SIPS URI in the Request-URI or in the top Record-Route header field
|
|
89
|
+
// value, if there was any, or the Contact header field if there was no
|
|
90
|
+
// Record-Route header field, the Contact header field in the response
|
|
91
|
+
// MUST be a SIPS URI. The URI SHOULD have global scope (that is, the
|
|
92
|
+
// same URI can be used in messages outside this dialog). The same way,
|
|
93
|
+
// the scope of the URI in the Contact header field of the INVITE is not
|
|
94
|
+
// limited to this dialog either. It can therefore be used in messages
|
|
95
|
+
// to the UAC even outside this dialog.
|
|
96
|
+
// https://tools.ietf.org/html/rfc3261#section-12.1.1
|
|
97
|
+
const recordRouteHeader = this.message.getHeaders("record-route").map((header) => `Record-Route: ${header}`);
|
|
98
|
+
const contactHeader = `Contact: ${this.core.configuration.contact.toString()}`;
|
|
99
|
+
|
|
100
|
+
// A 2xx response to an INVITE SHOULD contain the Allow header field and
|
|
101
|
+
// the Supported header field, and MAY contain the Accept header field.
|
|
102
|
+
// Including these header fields allows the UAC to determine the
|
|
103
|
+
// features and extensions supported by the UAS for the duration of the
|
|
104
|
+
// call, without probing.
|
|
105
|
+
// https://tools.ietf.org/html/rfc3261#section-13.3.1.4
|
|
106
|
+
|
|
107
|
+
// FIXME: TODO: This should not be hard coded.
|
|
108
|
+
const allowHeader = "Allow: " + AllowedMethods.toString();
|
|
109
|
+
|
|
110
|
+
// FIXME: TODO: Supported header (see reply())
|
|
111
|
+
|
|
112
|
+
// FIXME: TODO: Accept header
|
|
113
|
+
|
|
114
|
+
// If the INVITE request contained an offer, and the UAS had not yet
|
|
115
|
+
// sent an answer, the 2xx MUST contain an answer. If the INVITE did
|
|
116
|
+
// not contain an offer, the 2xx MUST contain an offer if the UAS had
|
|
117
|
+
// not yet sent an offer.
|
|
118
|
+
// https://tools.ietf.org/html/rfc3261#section-13.3.1.4
|
|
119
|
+
if (!options.body) {
|
|
120
|
+
if (this.confirmedDialog.signalingState === SignalingState.Stable) {
|
|
121
|
+
options.body = this.confirmedDialog.answer; // resend the answer sent in provisional response
|
|
122
|
+
} else if (
|
|
123
|
+
this.confirmedDialog.signalingState === SignalingState.Initial ||
|
|
124
|
+
this.confirmedDialog.signalingState === SignalingState.HaveRemoteOffer
|
|
125
|
+
) {
|
|
126
|
+
throw new Error("Response must have a body.");
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
options.statusCode = options.statusCode || 200;
|
|
131
|
+
options.extraHeaders = options.extraHeaders || [];
|
|
132
|
+
options.extraHeaders = options.extraHeaders.concat(recordRouteHeader);
|
|
133
|
+
options.extraHeaders.push(allowHeader);
|
|
134
|
+
options.extraHeaders.push(contactHeader);
|
|
135
|
+
|
|
136
|
+
const response = super.accept(options);
|
|
137
|
+
const session = this.confirmedDialog;
|
|
138
|
+
const result: OutgoingResponseWithSession = { ...response, session };
|
|
139
|
+
|
|
140
|
+
// Update dialog signaling state
|
|
141
|
+
if (options.body) {
|
|
142
|
+
// Once the UAS has sent or received an answer to the initial
|
|
143
|
+
// offer, it MUST NOT generate subsequent offers in any responses
|
|
144
|
+
// to the initial INVITE. This means that a UAS based on this
|
|
145
|
+
// specification alone can never generate subsequent offers until
|
|
146
|
+
// completion of the initial transaction.
|
|
147
|
+
// https://tools.ietf.org/html/rfc3261#section-13.2.1
|
|
148
|
+
if (this.confirmedDialog.signalingState !== SignalingState.Stable) {
|
|
149
|
+
this.confirmedDialog.signalingStateTransition(options.body);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* 13.3.1.1 Progress
|
|
158
|
+
* If the UAS is not able to answer the invitation immediately, it can
|
|
159
|
+
* choose to indicate some kind of progress to the UAC (for example, an
|
|
160
|
+
* indication that a phone is ringing). This is accomplished with a
|
|
161
|
+
* provisional response between 101 and 199. These provisional
|
|
162
|
+
* responses establish early dialogs and therefore follow the procedures
|
|
163
|
+
* of Section 12.1.1 in addition to those of Section 8.2.6. A UAS MAY
|
|
164
|
+
* send as many provisional responses as it likes. Each of these MUST
|
|
165
|
+
* indicate the same dialog ID. However, these will not be delivered
|
|
166
|
+
* reliably.
|
|
167
|
+
*
|
|
168
|
+
* If the UAS desires an extended period of time to answer the INVITE,
|
|
169
|
+
* it will need to ask for an "extension" in order to prevent proxies
|
|
170
|
+
* from canceling the transaction. A proxy has the option of canceling
|
|
171
|
+
* a transaction when there is a gap of 3 minutes between responses in a
|
|
172
|
+
* transaction. To prevent cancellation, the UAS MUST send a non-100
|
|
173
|
+
* provisional response at every minute, to handle the possibility of
|
|
174
|
+
* lost provisional responses.
|
|
175
|
+
* https://tools.ietf.org/html/rfc3261#section-13.3.1.1
|
|
176
|
+
* @param options - Progress options bucket.
|
|
177
|
+
*/
|
|
178
|
+
public progress(options: ResponseOptions = { statusCode: 180 }): OutgoingResponseWithSession {
|
|
179
|
+
if (!this.progressable) {
|
|
180
|
+
throw new TransactionStateError(`${this.message.method} not progressable in state ${this.transaction.state}.`);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// This response establishes a dialog...
|
|
184
|
+
// https://tools.ietf.org/html/rfc3261#section-13.3.1.4
|
|
185
|
+
if (!this.earlyDialog) {
|
|
186
|
+
const transaction = this.transaction;
|
|
187
|
+
if (!(transaction instanceof InviteServerTransaction)) {
|
|
188
|
+
throw new Error("Transaction not instance of InviteClientTransaction.");
|
|
189
|
+
}
|
|
190
|
+
const state = Dialog.initialDialogStateForUserAgentServer(this.message, this.toTag, true);
|
|
191
|
+
this.earlyDialog = new SessionDialog(transaction, this.core, state);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// When a UAS responds to a request with a response that establishes a
|
|
195
|
+
// dialog (such as a 2xx to INVITE), the UAS MUST copy all Record-Route
|
|
196
|
+
// header field values from the request into the response (including the
|
|
197
|
+
// URIs, URI parameters, and any Record-Route header field parameters,
|
|
198
|
+
// whether they are known or unknown to the UAS) and MUST maintain the
|
|
199
|
+
// order of those values. The UAS MUST add a Contact header field to
|
|
200
|
+
// the response. The Contact header field contains an address where the
|
|
201
|
+
// UAS would like to be contacted for subsequent requests in the dialog
|
|
202
|
+
// (which includes the ACK for a 2xx response in the case of an INVITE).
|
|
203
|
+
// Generally, the host portion of this URI is the IP address or FQDN of
|
|
204
|
+
// the host. The URI provided in the Contact header field MUST be a SIP
|
|
205
|
+
// or SIPS URI. If the request that initiated the dialog contained a
|
|
206
|
+
// SIPS URI in the Request-URI or in the top Record-Route header field
|
|
207
|
+
// value, if there was any, or the Contact header field if there was no
|
|
208
|
+
// Record-Route header field, the Contact header field in the response
|
|
209
|
+
// MUST be a SIPS URI. The URI SHOULD have global scope (that is, the
|
|
210
|
+
// same URI can be used in messages outside this dialog). The same way,
|
|
211
|
+
// the scope of the URI in the Contact header field of the INVITE is not
|
|
212
|
+
// limited to this dialog either. It can therefore be used in messages
|
|
213
|
+
// to the UAC even outside this dialog.
|
|
214
|
+
// https://tools.ietf.org/html/rfc3261#section-12.1.1
|
|
215
|
+
const recordRouteHeader = this.message.getHeaders("record-route").map((header) => `Record-Route: ${header}`);
|
|
216
|
+
const contactHeader = `Contact: ${this.core.configuration.contact}`;
|
|
217
|
+
|
|
218
|
+
options.extraHeaders = options.extraHeaders || [];
|
|
219
|
+
options.extraHeaders = options.extraHeaders.concat(recordRouteHeader);
|
|
220
|
+
options.extraHeaders.push(contactHeader);
|
|
221
|
+
|
|
222
|
+
const response = super.progress(options);
|
|
223
|
+
const session = this.earlyDialog;
|
|
224
|
+
const result: OutgoingResponseWithSession = { ...response, session };
|
|
225
|
+
|
|
226
|
+
// Update dialog signaling state
|
|
227
|
+
if (options.body) {
|
|
228
|
+
// Once the UAS has sent or received an answer to the initial
|
|
229
|
+
// offer, it MUST NOT generate subsequent offers in any responses
|
|
230
|
+
// to the initial INVITE. This means that a UAS based on this
|
|
231
|
+
// specification alone can never generate subsequent offers until
|
|
232
|
+
// completion of the initial transaction.
|
|
233
|
+
// https://tools.ietf.org/html/rfc3261#section-13.2.1
|
|
234
|
+
if (this.earlyDialog.signalingState !== SignalingState.Stable) {
|
|
235
|
+
this.earlyDialog.signalingStateTransition(options.body);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return result;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* 13.3.1.2 The INVITE is Redirected
|
|
244
|
+
* If the UAS decides to redirect the call, a 3xx response is sent. A
|
|
245
|
+
* 300 (Multiple Choices), 301 (Moved Permanently) or 302 (Moved
|
|
246
|
+
* Temporarily) response SHOULD contain a Contact header field
|
|
247
|
+
* containing one or more URIs of new addresses to be tried. The
|
|
248
|
+
* response is passed to the INVITE server transaction, which will deal
|
|
249
|
+
* with its retransmissions.
|
|
250
|
+
* https://tools.ietf.org/html/rfc3261#section-13.3.1.2
|
|
251
|
+
* @param contacts - Contacts to redirect to.
|
|
252
|
+
* @param options - Redirect options bucket.
|
|
253
|
+
*/
|
|
254
|
+
public redirect(contacts: Array<URI>, options: ResponseOptions = { statusCode: 302 }): OutgoingResponse {
|
|
255
|
+
return super.redirect(contacts, options);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* 13.3.1.3 The INVITE is Rejected
|
|
260
|
+
* A common scenario occurs when the callee is currently not willing or
|
|
261
|
+
* able to take additional calls at this end system. A 486 (Busy Here)
|
|
262
|
+
* SHOULD be returned in such a scenario.
|
|
263
|
+
* https://tools.ietf.org/html/rfc3261#section-13.3.1.3
|
|
264
|
+
* @param options - Reject options bucket.
|
|
265
|
+
*/
|
|
266
|
+
public reject(options: ResponseOptions = { statusCode: 486 }): OutgoingResponse {
|
|
267
|
+
return super.reject(options);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OutgoingMessageRequest, 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
|
+
* MESSAGE UAC.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export class MessageUserAgentClient extends UserAgentClient implements OutgoingMessageRequest {
|
|
11
|
+
constructor(core: UserAgentCore, message: OutgoingRequestMessage, delegate?: OutgoingRequestDelegate) {
|
|
12
|
+
super(NonInviteClientTransaction, core, message, delegate);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IncomingMessageRequest, 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
|
+
* MESSAGE UAS.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export class MessageUserAgentServer extends UserAgentServer implements IncomingMessageRequest {
|
|
11
|
+
constructor(core: UserAgentCore, message: IncomingRequestMessage, delegate?: IncomingRequestDelegate) {
|
|
12
|
+
super(NonInviteServerTransaction, core, message, delegate);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SessionDialog } from "../dialogs";
|
|
2
|
+
import { C, OutgoingNotifyRequest, OutgoingRequestDelegate, RequestOptions } from "../messages";
|
|
3
|
+
import { NonInviteClientTransaction } from "../transactions";
|
|
4
|
+
import { UserAgentClient } from "./user-agent-client";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* NOTIFY UAS.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export class NotifyUserAgentClient extends UserAgentClient implements OutgoingNotifyRequest {
|
|
11
|
+
constructor(dialog: SessionDialog, delegate?: OutgoingRequestDelegate, options?: RequestOptions) {
|
|
12
|
+
const message = dialog.createOutgoingRequestMessage(C.NOTIFY, options);
|
|
13
|
+
super(NonInviteClientTransaction, dialog.userAgentCore, message, delegate);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Dialog } from "../dialogs";
|
|
2
|
+
import { IncomingNotifyRequest, 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 instanceOfDialog(object: any): object is Dialog {
|
|
9
|
+
return object.userAgentCore !== undefined;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* NOTIFY UAS.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export class NotifyUserAgentServer extends UserAgentServer implements IncomingNotifyRequest {
|
|
17
|
+
/**
|
|
18
|
+
* NOTIFY UAS constructor.
|
|
19
|
+
* @param dialogOrCore - Dialog for in dialog NOTIFY, UserAgentCore for out of dialog NOTIFY (deprecated).
|
|
20
|
+
* @param message - Incoming NOTIFY request message.
|
|
21
|
+
*/
|
|
22
|
+
constructor(
|
|
23
|
+
dialogOrCore: Dialog | UserAgentCore,
|
|
24
|
+
message: IncomingRequestMessage,
|
|
25
|
+
delegate?: IncomingRequestDelegate
|
|
26
|
+
) {
|
|
27
|
+
const userAgentCore = instanceOfDialog(dialogOrCore) ? dialogOrCore.userAgentCore : dialogOrCore;
|
|
28
|
+
super(NonInviteServerTransaction, userAgentCore, message, delegate);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SessionDialog } from "../dialogs";
|
|
2
|
+
import { C, OutgoingPrackRequest, OutgoingRequestDelegate, RequestOptions } from "../messages";
|
|
3
|
+
import { NonInviteClientTransaction } from "../transactions";
|
|
4
|
+
import { UserAgentClient } from "./user-agent-client";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* PRACK UAC.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export class PrackUserAgentClient extends UserAgentClient implements OutgoingPrackRequest {
|
|
11
|
+
constructor(dialog: SessionDialog, delegate?: OutgoingRequestDelegate, options?: RequestOptions) {
|
|
12
|
+
const message = dialog.createOutgoingRequestMessage(C.PRACK, options);
|
|
13
|
+
super(NonInviteClientTransaction, dialog.userAgentCore, message, delegate);
|
|
14
|
+
dialog.signalingStateTransition(message);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SessionDialog } from "../dialogs";
|
|
2
|
+
import {
|
|
3
|
+
IncomingPrackRequest,
|
|
4
|
+
IncomingRequestDelegate,
|
|
5
|
+
IncomingRequestMessage,
|
|
6
|
+
OutgoingResponse,
|
|
7
|
+
ResponseOptions
|
|
8
|
+
} from "../messages";
|
|
9
|
+
import { NonInviteServerTransaction } from "../transactions";
|
|
10
|
+
import { UserAgentServer } from "./user-agent-server";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* PRACK UAS.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export class PrackUserAgentServer extends UserAgentServer implements IncomingPrackRequest {
|
|
17
|
+
private dialog: SessionDialog;
|
|
18
|
+
|
|
19
|
+
constructor(dialog: SessionDialog, message: IncomingRequestMessage, delegate?: IncomingRequestDelegate) {
|
|
20
|
+
super(NonInviteServerTransaction, dialog.userAgentCore, message, delegate);
|
|
21
|
+
// Update dialog signaling state with offer/answer in body
|
|
22
|
+
dialog.signalingStateTransition(message);
|
|
23
|
+
this.dialog = dialog;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Update the dialog signaling state on a 2xx response.
|
|
28
|
+
* @param options - Options bucket.
|
|
29
|
+
*/
|
|
30
|
+
public accept(options: ResponseOptions = { statusCode: 200 }): OutgoingResponse {
|
|
31
|
+
if (options.body) {
|
|
32
|
+
// Update dialog signaling state with offer/answer in body
|
|
33
|
+
this.dialog.signalingStateTransition(options.body);
|
|
34
|
+
}
|
|
35
|
+
return super.accept(options);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OutgoingPublishRequest, 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
|
+
* PUBLISH UAC.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export class PublishUserAgentClient extends UserAgentClient implements OutgoingPublishRequest {
|
|
11
|
+
constructor(core: UserAgentCore, message: OutgoingRequestMessage, delegate?: OutgoingRequestDelegate) {
|
|
12
|
+
super(NonInviteClientTransaction, core, message, delegate);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { SessionDialog } from "../dialogs";
|
|
2
|
+
import {
|
|
3
|
+
C,
|
|
4
|
+
IncomingResponseMessage,
|
|
5
|
+
OutgoingAckRequest,
|
|
6
|
+
OutgoingInviteRequest,
|
|
7
|
+
OutgoingInviteRequestDelegate,
|
|
8
|
+
OutgoingPrackRequest,
|
|
9
|
+
RequestOptions
|
|
10
|
+
} from "../messages";
|
|
11
|
+
import { InviteClientTransaction } from "../transactions";
|
|
12
|
+
import { UserAgentClient } from "./user-agent-client";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Re-INVITE UAC.
|
|
16
|
+
* @remarks
|
|
17
|
+
* 14 Modifying an Existing Session
|
|
18
|
+
* https://tools.ietf.org/html/rfc3261#section-14
|
|
19
|
+
* 14.1 UAC Behavior
|
|
20
|
+
* https://tools.ietf.org/html/rfc3261#section-14.1
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export class ReInviteUserAgentClient extends UserAgentClient implements OutgoingInviteRequest {
|
|
24
|
+
public delegate: OutgoingInviteRequestDelegate | undefined;
|
|
25
|
+
|
|
26
|
+
private dialog: SessionDialog;
|
|
27
|
+
|
|
28
|
+
constructor(dialog: SessionDialog, delegate?: OutgoingInviteRequestDelegate, options?: RequestOptions) {
|
|
29
|
+
const message = dialog.createOutgoingRequestMessage(C.INVITE, options);
|
|
30
|
+
super(InviteClientTransaction, dialog.userAgentCore, message, delegate);
|
|
31
|
+
this.delegate = delegate;
|
|
32
|
+
dialog.signalingStateTransition(message);
|
|
33
|
+
// FIXME: TODO: next line obviously needs to be improved...
|
|
34
|
+
dialog.reinviteUserAgentClient = this; // let the dialog know re-invite request sent
|
|
35
|
+
this.dialog = dialog;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
protected receiveResponse(message: IncomingResponseMessage): void {
|
|
39
|
+
if (!this.authenticationGuard(message, this.dialog)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const statusCode = message.statusCode ? message.statusCode.toString() : "";
|
|
44
|
+
if (!statusCode) {
|
|
45
|
+
throw new Error("Response status code undefined.");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
switch (true) {
|
|
49
|
+
case /^100$/.test(statusCode):
|
|
50
|
+
if (this.delegate && this.delegate.onTrying) {
|
|
51
|
+
this.delegate.onTrying({ message });
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
case /^1[0-9]{2}$/.test(statusCode):
|
|
55
|
+
if (this.delegate && this.delegate.onProgress) {
|
|
56
|
+
this.delegate.onProgress({
|
|
57
|
+
message,
|
|
58
|
+
session: this.dialog,
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
60
|
+
prack: (options?: RequestOptions): OutgoingPrackRequest => {
|
|
61
|
+
throw new Error("Unimplemented.");
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
break;
|
|
66
|
+
case /^2[0-9]{2}$/.test(statusCode):
|
|
67
|
+
// Update dialog signaling state with offer/answer in body
|
|
68
|
+
this.dialog.signalingStateTransition(message);
|
|
69
|
+
|
|
70
|
+
if (this.delegate && this.delegate.onAccept) {
|
|
71
|
+
this.delegate.onAccept({
|
|
72
|
+
message,
|
|
73
|
+
session: this.dialog,
|
|
74
|
+
ack: (options?: RequestOptions): OutgoingAckRequest => {
|
|
75
|
+
const outgoingAckRequest = this.dialog.ack(options);
|
|
76
|
+
return outgoingAckRequest;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
case /^3[0-9]{2}$/.test(statusCode):
|
|
82
|
+
this.dialog.signalingStateRollback();
|
|
83
|
+
this.dialog.reinviteUserAgentClient = undefined; // ACK was handled by transaction
|
|
84
|
+
|
|
85
|
+
if (this.delegate && this.delegate.onRedirect) {
|
|
86
|
+
this.delegate.onRedirect({ message });
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
case /^[4-6][0-9]{2}$/.test(statusCode):
|
|
90
|
+
this.dialog.signalingStateRollback();
|
|
91
|
+
this.dialog.reinviteUserAgentClient = undefined; // ACK was handled by transaction
|
|
92
|
+
|
|
93
|
+
if (this.delegate && this.delegate.onReject) {
|
|
94
|
+
this.delegate.onReject({ message });
|
|
95
|
+
} else {
|
|
96
|
+
// If a UA receives a non-2xx final response to a re-INVITE, the session
|
|
97
|
+
// parameters MUST remain unchanged, as if no re-INVITE had been issued.
|
|
98
|
+
// Note that, as stated in Section 12.2.1.2, if the non-2xx final
|
|
99
|
+
// response is a 481 (Call/Transaction Does Not Exist), or a 408
|
|
100
|
+
// (Request Timeout), or no response at all is received for the re-
|
|
101
|
+
// INVITE (that is, a timeout is returned by the INVITE client
|
|
102
|
+
// transaction), the UAC will terminate the dialog.
|
|
103
|
+
//
|
|
104
|
+
// If a UAC receives a 491 response to a re-INVITE, it SHOULD start a
|
|
105
|
+
// timer with a value T chosen as follows:
|
|
106
|
+
//
|
|
107
|
+
// 1. If the UAC is the owner of the Call-ID of the dialog ID
|
|
108
|
+
// (meaning it generated the value), T has a randomly chosen value
|
|
109
|
+
// between 2.1 and 4 seconds in units of 10 ms.
|
|
110
|
+
//
|
|
111
|
+
// 2. If the UAC is not the owner of the Call-ID of the dialog ID, T
|
|
112
|
+
// has a randomly chosen value of between 0 and 2 seconds in units
|
|
113
|
+
// of 10 ms.
|
|
114
|
+
//
|
|
115
|
+
// When the timer fires, the UAC SHOULD attempt the re-INVITE once more,
|
|
116
|
+
// if it still desires for that session modification to take place. For
|
|
117
|
+
// example, if the call was already hung up with a BYE, the re-INVITE
|
|
118
|
+
// would not take place.
|
|
119
|
+
// https://tools.ietf.org/html/rfc3261#section-14.1
|
|
120
|
+
// FIXME: TODO: The above.
|
|
121
|
+
}
|
|
122
|
+
break;
|
|
123
|
+
default:
|
|
124
|
+
throw new Error(`Invalid status code ${statusCode}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { SessionDialog } from "../dialogs";
|
|
2
|
+
import {
|
|
3
|
+
IncomingInviteRequest,
|
|
4
|
+
IncomingRequestDelegate,
|
|
5
|
+
IncomingRequestMessage,
|
|
6
|
+
OutgoingResponse,
|
|
7
|
+
OutgoingResponseWithSession,
|
|
8
|
+
ResponseOptions,
|
|
9
|
+
URI
|
|
10
|
+
} from "../messages";
|
|
11
|
+
import { InviteServerTransaction } from "../transactions";
|
|
12
|
+
import { UserAgentServer } from "./user-agent-server";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Re-INVITE UAS.
|
|
16
|
+
* @remarks
|
|
17
|
+
* 14 Modifying an Existing Session
|
|
18
|
+
* https://tools.ietf.org/html/rfc3261#section-14
|
|
19
|
+
* 14.2 UAS Behavior
|
|
20
|
+
* https://tools.ietf.org/html/rfc3261#section-14.2
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export class ReInviteUserAgentServer extends UserAgentServer implements IncomingInviteRequest {
|
|
24
|
+
private dialog: SessionDialog;
|
|
25
|
+
|
|
26
|
+
constructor(dialog: SessionDialog, message: IncomingRequestMessage, delegate?: IncomingRequestDelegate) {
|
|
27
|
+
super(InviteServerTransaction, dialog.userAgentCore, message, delegate);
|
|
28
|
+
dialog.reinviteUserAgentServer = this;
|
|
29
|
+
this.dialog = dialog;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Update the dialog signaling state on a 2xx response.
|
|
34
|
+
* @param options - Options bucket.
|
|
35
|
+
*/
|
|
36
|
+
public accept(options: ResponseOptions = { statusCode: 200 }): OutgoingResponseWithSession {
|
|
37
|
+
// FIXME: The next two lines SHOULD go away, but I suppose it's technically harmless...
|
|
38
|
+
// These are here because some versions of SIP.js prior to 0.13.8 set the route set
|
|
39
|
+
// of all in dialog ACKs based on the Record-Route headers in the associated 2xx
|
|
40
|
+
// response. While this worked for dialog forming 2xx responses, it was technically
|
|
41
|
+
// broken for re-INVITE ACKS as it only worked if the UAS populated the Record-Route
|
|
42
|
+
// headers in the re-INVITE 2xx response (which is not required and a waste of bandwidth
|
|
43
|
+
// as the should be ignored if present in re-INVITE ACKS) and the UAS populated
|
|
44
|
+
// the Record-Route headers with the correct values (would be weird not too, but...).
|
|
45
|
+
// Anyway, for now the technically useless Record-Route headers are being added
|
|
46
|
+
// to maintain "backwards compatibility" with the older broken versions of SIP.js.
|
|
47
|
+
options.extraHeaders = options.extraHeaders || [];
|
|
48
|
+
options.extraHeaders = options.extraHeaders.concat(this.dialog.routeSet.map((route) => `Record-Route: ${route}`));
|
|
49
|
+
|
|
50
|
+
// Send and return the response
|
|
51
|
+
const response = super.accept(options);
|
|
52
|
+
const session = this.dialog;
|
|
53
|
+
const result: OutgoingResponseWithSession = { ...response, session };
|
|
54
|
+
|
|
55
|
+
if (options.body) {
|
|
56
|
+
// Update dialog signaling state with offer/answer in body
|
|
57
|
+
this.dialog.signalingStateTransition(options.body);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Update dialog
|
|
61
|
+
this.dialog.reConfirm();
|
|
62
|
+
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Update the dialog signaling state on a 1xx response.
|
|
68
|
+
* @param options - Progress options bucket.
|
|
69
|
+
*/
|
|
70
|
+
public progress(options: ResponseOptions = { statusCode: 180 }): OutgoingResponseWithSession {
|
|
71
|
+
// Send and return the response
|
|
72
|
+
const response = super.progress(options);
|
|
73
|
+
const session = this.dialog;
|
|
74
|
+
const result: OutgoingResponseWithSession = { ...response, session };
|
|
75
|
+
|
|
76
|
+
// Update dialog signaling state
|
|
77
|
+
if (options.body) {
|
|
78
|
+
this.dialog.signalingStateTransition(options.body);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* TODO: Not Yet Supported
|
|
86
|
+
* @param contacts - Contacts to redirect to.
|
|
87
|
+
* @param options - Redirect options bucket.
|
|
88
|
+
*/
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
90
|
+
public redirect(contacts: Array<URI>, options: ResponseOptions = { statusCode: 302 }): OutgoingResponse {
|
|
91
|
+
this.dialog.signalingStateRollback();
|
|
92
|
+
this.dialog.reinviteUserAgentServer = undefined; // ACK will be handled by transaction
|
|
93
|
+
throw new Error("Unimplemented.");
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 3.1 Background on Re-INVITE Handling by UASs
|
|
98
|
+
* An error response to a re-INVITE has the following semantics. As
|
|
99
|
+
* specified in Section 12.2.2 of RFC 3261 [RFC3261], if a re-INVITE is
|
|
100
|
+
* rejected, no state changes are performed.
|
|
101
|
+
* https://tools.ietf.org/html/rfc6141#section-3.1
|
|
102
|
+
* @param options - Reject options bucket.
|
|
103
|
+
*/
|
|
104
|
+
public reject(options: ResponseOptions = { statusCode: 488 }): OutgoingResponse {
|
|
105
|
+
this.dialog.signalingStateRollback();
|
|
106
|
+
this.dialog.reinviteUserAgentServer = undefined; // ACK will be handled by transaction
|
|
107
|
+
return super.reject(options);
|
|
108
|
+
}
|
|
109
|
+
}
|