#### Pre-Submission Checklist - [x] Commit message has the format required by CONTRIBUTING guide - [ ] 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 - [ ] 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 - [x] Related to issue #2308
#### Description add support for trimming an already existing alias parameter when calling `set_contact_alias()`
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2390
-- Commit Summary --
* nathelper: add optional set_contact_alias([trim]) parameter
-- File Changes --
M src/core/dset.c (85) M src/core/dset.h (1) M src/modules/nathelper/doc/nathelper_admin.xml (12) M src/modules/nathelper/nathelper.c (37)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2390.patch https://github.com/kamailio/kamailio/pull/2390.diff
@miconda commented on this pull request.
@@ -704,10 +707,12 @@ static int fix_nated_contact_f(struct sip_msg *msg, char *str1, char *str2)
* Replaces ip:port pair in the Contact: field with the source address * of the packet. */ -static int set_contact_alias(struct sip_msg *msg) +static int set_contact_alias(struct sip_msg *msg, int trim)
By changing the signature of `set_contact_alias()` you broke the kemi export of it.
@eschmidbauer pushed 1 commit.
988a666e85b01f52966e6cb28932efea1578e0cc nathelper: add optional set_contact_alias([trim]) parameter
@eschmidbauer commented on this pull request.
@@ -704,10 +707,12 @@ static int fix_nated_contact_f(struct sip_msg *msg, char *str1, char *str2)
* Replaces ip:port pair in the Contact: field with the source address * of the packet. */ -static int set_contact_alias(struct sip_msg *msg) +static int set_contact_alias(struct sip_msg *msg, int trim)
By changing the signature of `set_contact_alias()` you broke the kemi export of it.
sorry i haven't worked with the kemi export code yet. i pushed another commit which i _think_ fixes it
Not really fixing it, because now set_contact_alias() from kemi require a parameter always, so existing kemi deployement will be broken on upgrade. A new function can be exported to kemi (e.g., set_contact_alias_trim()) and the old one should stay the same. So practically a new wrapper function has to be created to cope with the two cases.
@eschmidbauer pushed 1 commit.
95b7786489648e1b4690b823e0c1e52196d31a57 nathelper: add optional set_contact_alias([trim]) parameter
Not really fixing it, because now set_contact_alias() from kemi require a parameter always, so existing kemi deployement will be broken on upgrade. A new function can be exported to kemi (e.g., set_contact_alias_trim()) and the old one should stay the same. So practically a new wrapper function has to be created to cope with the two cases.
thanks for the guidance on that. i think latest commit takes care of it correctly.
@eschmidbauer pushed 1 commit.
adc58d15186c8ac1fd71f85b9844f72914946246 nathelper: add optional set_contact_alias([trim]) parameter
Pretty much, I would only suggest to use `ki_` prefix for the kemi functions, like the other wraperss which have a specific prefix for exports to kemi (e.g., the last three in the kemi exports structure).
@eschmidbauer pushed 1 commit.
3c02c11d66c95102698ee52187952bd98a51510c nathelper: add optional set_contact_alias([trim]) parameter
If nobody else will have opinions against, then I will merge this PR before branching 5.4
Merged #2390 into master.