permissions: introduce func allow_register_include_port()
#3846
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.
Pre-Submission Checklist
in
doc/
subfolder, the README file is autogenerated)Type Of Change
Checklist:
Description
Introduce new function:
allow_register_include_port()
to be able to check the whole Contact header including port.Example, register.deny content is:
If the Contact is: "Contact: sip:testuser1004@192.168.0.101:5062" then this will check the Contact hf including port of it.
Otherwise if usual
allow_register()
function is used, then only the "testuser1004@192.168.0.101" will be taken into account, which will lead the regex to be failing and letting the check to pass through.The func
allow_register_include_port()
works similarly asallow_register()
except it checks Contact's port.A separate function was created in order to not complicate things by introducing one more parameter to the
existing function
allow_register()
, which already takes a variable amount of parameters, so 1 or 2 parameters(depending on if it is a "basename" or "allow-file, deny-file").
Documentation updated accordingly.
Additionally, "Register File Format" section has been added to the doc (to provide allow/deny file examples).
Full backwards compatibility is kept in place,
no need for users of the module to change anything in their configuration or kamailio script itself.