<!-- 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 - [x] Commits are split per component (core, individual modules, libs, utils, ...) - [x] Each component has a single commit (if not, squash them into one commit) - [x] 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 - [x] Small bug fix (non-breaking change which fixes an issue) - [x] 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 - [x] Tested changes locally - [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description This PR adds support for $hfl(name)[] and $hflc(name) for P-Preferred-Identity and P-Asserted-Identity.
Should probably also be documented in https://www.kamailio.org/wikidocs/cookbooks/devel/pseudovariables/#hflname-h...
Any feedback welcome.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3652
-- Commit Summary --
* pv: Add PPI and PAI support to hfl and hflc
-- File Changes --
M src/modules/pv/pv_core.c (104)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3652.patch https://github.com/kamailio/kamailio/pull/3652.diff
Upon quick look, I think it adds only for $hfl, not for $hflc.
@xkaraman pushed 1 commit.
e0b08a955a0d857c31d78c43f5b17cd60a014e08 pv: Add PPI and PAI support to hfl and hflc
You were right. Fixed.
@miconda commented on this pull request.
@@ -2335,6 +2335,110 @@ int pv_get_hfl(sip_msg_t *msg, pv_param_t *param, pv_value_t *res)
return pv_get_null(msg, param, res); }
+ if((tv.flags == 0) && (tv.ri == HDR_PPI_T)) { + if(msg->ppi == NULL) { + LM_WARN("no PPI header\n"); + return pv_get_null(msg, param, res); + } + + if(parse_ppi_header(msg) < 0) { + LM_WARN("failed to parse PPI headers\n"); + return pv_get_null(msg, param, res); + } + + p_id_body_t *ppi_b = (p_id_body_t *)msg->ppi->parsed; + int ppi_header_count = 0; +
Declare the variables at the beginning of the function or at least at the beginning of the block, we try to keep compatibility with old C compilers as much as possible. Also, it makes it coherent with how the function code was written so far.
From coherence point of view of the function and file, it would be good to make the comments between `/* ... */`, not with `//`.
@xkaraman pushed 1 commit.
21caa25f06464b056525fc4bf2fd02a465fbc7a6 pv: Add PPI and PAI support to hfl and hflc
@xkaraman commented on this pull request.
@@ -2335,6 +2335,110 @@ int pv_get_hfl(sip_msg_t *msg, pv_param_t *param, pv_value_t *res)
return pv_get_null(msg, param, res); }
+ if((tv.flags == 0) && (tv.ri == HDR_PPI_T)) { + if(msg->ppi == NULL) { + LM_WARN("no PPI header\n"); + return pv_get_null(msg, param, res); + } + + if(parse_ppi_header(msg) < 0) { + LM_WARN("failed to parse PPI headers\n"); + return pv_get_null(msg, param, res); + } + + p_id_body_t *ppi_b = (p_id_body_t *)msg->ppi->parsed; + int ppi_header_count = 0; +
Done.
@xkaraman pushed 1 commit.
a53ffa24a35431419562835132ca1531994ce7c4 pv: Add PPI and PAI support to hfl and hflc
@xkaraman pushed 1 commit.
116ba54acd7f88a8ceaedbdd949c306fd658ac4c pv: Add PPI and PAI support to hfl and hflc
Thanks!
The wiki documentation for config variables can be updated via PR for:
- https://github.com/kamailio/kamailio-wiki/blob/main/docs/cookbooks/devel/pse...
Merged #3652 into master.
Great! Thanks for merging! You can find the docs PR in https://github.com/kamailio/kamailio-wiki/pull/45.