Call ID mask with a key similar to topoh insted of swaping with new ID. Call ID masking is dome when a message is received from the upstream and unmasked before sending towords upstream.
<!-- Kamailio Pull Request Template -->
<!-- IMPORTANT: - for detailed contributing guidelines, read: https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md - pull requests must be done to master branch, unless they are backports of fixes from master branch to a stable branch - backports to stable branches must be done with 'git cherry-pick -x ...' - code is contributed under BSD for core and main components (tm, sl, auth, tls) - code is contributed GPLv2 or a compatible license for the other components - GPL code is contributed with OpenSSL licensing exception -->
#### Pre-Submission Checklist <!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply --> <!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above--> <!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list --> - [x] Commit message has the format required by CONTRIBUTING guide - [ ] Commits are split per component (core, individual modules, libs, utils, ...) - [ ] Each component has a single commit (if not, squash them into one commit) - [ ] No commits to README files for modules (changes must be done to docbook files in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change - [ ] Small bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds new functionality) - [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist: <!-- Go over all points below, and after creating the PR, tick the checkboxes that apply --> - [ ] PR should be backported to stable branches - [ ] Tested changes locally - [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description <!-- Describe your changes in detail -->
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3323
-- Commit Summary --
* topos: added Call-ID mask support
-- File Changes --
M src/modules/topos/doc/topos_admin.xml (54) M src/modules/topos/topos_mod.c (13) A src/modules/topos/tps_mask.c (189) A src/modules/topos/tps_mask.h (36) M src/modules/topos/tps_msg.c (174) M src/modules/topos/tps_msg.h (3)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3323.patch https://github.com/kamailio/kamailio/pull/3323.diff
Thanks for the fixed pull request. @miconda probably want to review it. I just noticed two copied files from topoh regarding the call-id masking. Maybe it make sense to discuss if this could be avoided, but there might be no easy solution.
@toharish pushed 1 commit.
8ab2395e37eb5017b1719814eb7da1ef802d8b27 Topos: CallID mask - update comment
Thanks for the fixed pull request. @miconda probably want to review it. I just noticed two copied files from topoh regarding the call-id masking. Maybe it make sense to discuss if this could be avoided, but there might be no easy solution.
It will be hard to replace the CallID in the same data storage of other headers as CallID is used as the key. hence it will be a chicken-egg problem if we replace the callID. Hence I found it better to mask it with a key so that it can be unmasked and used as key. Unlike other headers, Call-ID will not make overhead strings and make the header bigger like via in topoh. Masking and unmasking were already available in Topoh hence it was better to use the same algorithm for masking which will be better during the maintenance process.
The approach to mask call id in topos like is done by topoh could be a good enough compromise for some specific needs. However, I think it would be better to avoid cloning the code from one module to another.
A way for it would be to make topoh work in library mode with a new modparam, in the way that is not registering the internal callback for updating the headers when loaded. Then the functions to encode/decode strings should be made available via inter-module API. Actually the decode function is already exported, as I could spot quickly, for sipcature needs.
@toharish: I can eventually take care of making topoh run in lib mode, then you make use of it and update topos patches. Also, do not make PRs with commented code, if that was useful during the developement/testing, remove them before making the PR -- I see that the bot `github-code-scanning` scans automatically and reported above.
The approach to mask call id in topos like is done by topoh could be a good enough compromise for some specific needs. However, I think it would be better to avoid cloning the code from one module to another.
A way for it would be to make topoh work in library mode with a new modparam, in the way that is not registering the internal callback for updating the headers when loaded. Then the functions to encode/decode strings should be made available via inter-module API. Actually the decode function is already exported, as I could spot quickly, for sipcature needs.
@toharish: I can eventually take care of making topoh run in lib mode, then you make use of it and update topos patches. Also, do not make PRs with commented code, if that was useful during the developement/testing, remove them before making the PR -- I see that the bot `github-code-scanning` scans automatically and reported above.
@miconda thank you for your time, Can I close this PR and open a new PR when you have completed topos as lib mode or wait and make the necessary changes in this PR.
@toharish You can close this PR and create a new one, or "force-push" the new code to the existing PR. Creating a new PR is usually a bit easier. Regarding the library changes for topoh, @miconda needs to comment of course.
Closed #3323.
@toharish: just added the code to topoh module to offer the mask call id function, you have to set its use_mode to 1, then bind from topos to its inter-module api (probably an example is in sipcapture, if not see how register module loads the sl module api).