Merged
Conversation
Collaborator
|
this one can be merged after 1.0.0 is released |
702d6a2 to
fbc1891
Compare
Collaborator
Author
|
I did a lot of tests with up to 5 instances of routr SIP server running in docker.
|
Collaborator
|
should be possible to merge now ? |
Collaborator
Author
Yes. I will make travis happy first. I recently found the handy tool "make ccheck". ;-) |
A priority field is added to struct account. Default prio is 0.
The function reg_failed() has to use new libre function sipreg_failed() in order to be compatible with Cisco REGISTER keep-alives. It returns true if a REGISTER was not successful. It is not important if the REGISTER had the expires field set positive or zero. For simplicity we use sipreg_registered() now for reg_isok().
After a (re-)REGISTER fails the Cisco fallback REGISTER keep-alives are started if an fbregint was configured. But the failc counter of the new sipreg instance should be greater than zero in order to let sipreg_failed() return true. Then when the first Cisco fallback REGISTER succeeds, failc is reset to zero and sipreg_failed() returns false. Then the upper baresip layer knows that the SIP proxy is available again.
This are periodic un-REGISTER requests (REGISTER with expires=0) in order to test the availability of a SIP-proxy. When sometimes a re-REGISTER of a UA fails, we are able to switch immediately to an available SIP proxy. The new function ua_fallback() starts the periodic un-REGISTER requests.
When module account reads the configuration at startup of baresip only the registrations for accounts with priority zero should be startet. For other accounts with a positive fbregint the Cisco REGISTER keep-alives should be started.
The user may specify a fbregint and prio parameters with command ua_new. If both got positive values, the Cisco REGISTER keep-alives will be started for this account.
The Cisco fallback REGISTER keep-alives are able to detect, if a SIP proxy becomes available again. Then the upper layer may use this information to switch to this SIP proxy if its priority is higher than the current. E.g. to switch back from fallback SIP proxy to the main SIP proxy. This commit adds UA_EVENT_FALLBACK_OK for this purpose and UA_EVENT_FALLBACK_FAIL for completeness.
This is a more intelligent serial registration mode that uses also the response information of the periodic un-REGISTER requests (Cisco REGISTER keep-alives) to decide which UA would be a possible fallback.
Suppose SIP proxy "A" has prio = a and SIP proxy "B" has prio = b and a < b. Further suppose that "A" is not available, so we are registered to "B". When "A" becomes available, we want to switch to proxy "A". This means we start the periodic (re-)REGISTER to "A" and the Cisco REGISTER keep-alives to "B".
d3dea49 to
95fe482
Compare
Collaborator
|
many thanks for your contributions :) |
Collaborator
Author
|
Many thanks for review and merge! :-) |
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.
Consider a setup with one or more main SIP proxies and one or more fallback proxies.
Serial registration mode
Cisco mode
This PR is based on baresip/re#19.