fix: Refresh SIP settings on server config change - #216
Merged
Merged
Conversation
NethLink parsed config.production.js only at credential login and cached sipHost and sipPort in the account. When NethVoice reassigned the SIP port, typically after an update, the cached values went stale and the PhoneIsland could no longer register with Janus. The user was left with a permanent connection error banner, and the only way out was to log out and log back in. Autologin now re-reads the server config in both the valid-token and the expired-token path, so restarting the app is enough to pick up a new port. While the app is running, two independent triggers detect a change and reload the PhoneIsland: the socket reconnection that follows a server restart, and the webrtc_down alert raised on every failed registration. The reload is deferred to the end of an active call so that a call in progress is never dropped. Also drop PhoneIslandController.reconnect() and its RECONNECT_PHONE_ISLAND event, which had no callers.
Collaborator
|
Verified. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NethLink parsed
config.production.jsonly at credential login and cachedsipHostandsipPortin the account. When NethVoice reassigned the SIP port, typically after an update, those cached values went stale and the PhoneIsland could no longer register with Janus. The user was left with a permanent connection error banner and the only workaround was to log out and log back in. Restarting the app was not enough, because autologin reused the saved account as-is whenever the JWT was still valid.Two changes fix this:
webrtc_downalert, raised on every failed registration, which acts as a safety net when the config endpoint comes back after the socket. Config checks from the second trigger are debounced to 10 seconds.The reload is deferred to the end of an active call, so a call in progress is never dropped. A failed config fetch is swallowed and the cached values are kept, so a server that is still restarting can never break autologin.
Also removes
PhoneIslandController.reconnect(), itsRECONNECT_PHONE_ISLANDevent and the matching renderer listener, which had no callers.How to test
Run the app with
DEV=true npm run dev. Main process logs go to stdout.On the NS8 node, replacing
nethvoice1and20027with the instance values:A touches only the container writable layer. Do not edit
ASTERISK_SIP_PORTinstead: the SIP proxy dispatcher targets it.server SIP config changedat startup, then the error bannerreloading PhoneIsland, banner; C clears it in ~10s with no clicksreload deferred to call end, one reload on hangupAll four verified against a live NethVoice instance.