#### 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
- [ ] 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
Two separate commits per component: TSILO and TM.
Important, this implementation has been tested internally and is in use by us already.
Contributions to both TSILO and TM are made so, that they save full back-compatibility and do not affect existing implementation.
---
TSILO: Add support of a lookup and branch creating by contact
Improvement of the TSILO module, which allows to run a lookup using the provided RURI,
but only to create a new branch for the Contact, which is set in the currently processed REGISTER.
Or optionally a Contact URI value given as a parameter to the function.
If the Contact URI for a lookup, is given as a parameter,
it is possible to provide it as a pseudo-variable.
Hence it is now possible to append new branch(es) for only UAC(s)
getting REGISTERED at the moment of calling 'ts_append_by_contact()'.
Previously it was only possible to call 'ts_append()' and create new branches
for all previously present location records (for this specific URI), which was in some circumstsances undersired.
New script functions introduced:
- ts_append_by_contact(table, ruri [, contact])
New module functions introduced:
- w_ts_append_by_contact2() / ki_ts_append_by_contact()
- w_ts_append_by_contact3 / ki_ts_append_by_contact_uri()
- ts_append_by_contact() / ts_append_by_contact_to()
Backwards compatibility is saved, the new functionality is not overlapping with
the previously existing implementation, hence it only acts when the new script function
ts_append_by_contact() is used.
The documentation has been updated accordingly.
---
TM: API improvement, new function introduced: t_append_branch_by_contact()
New module functions introduced:
- t_append_branch_by_contact()
This commit introduces a possibility of TM's API to append a branch
based on specific location (Contact's URI).
Indeed the 't_append_branch_by_contact()' is a corrected copy of
the 't_append_branches()', which instead takes Contact as a parameter
of str type and takes care to append a branch only for it.
The separate function has been introduced, in order to save full
back-compatibility, and not affect existing implementation.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2931
-- Commit Summary --
* <a href="https://github.com/kamailio/kamailio/pull/2931/commits/6bdb1dbdd9726b1b45c0…">tsilo: Add support of a lookup and branch creating by contact</a>
* <a href="https://github.com/kamailio/kamailio/pull/2931/commits/7d0f21edde6a816a75fd…">tm: API improvement, new function introduced: t_append_branch_by_contact()</a>
-- File Changes --
M src/modules/tm/t_append_branches.c (206)
M src/modules/tm/t_append_branches.h (4)
M src/modules/tm/tm_load.c (1)
M src/modules/tm/tm_load.h (1)
M src/modules/tsilo/doc/tsilo.xml (5)
M src/modules/tsilo/doc/tsilo_admin.xml (54)
M src/modules/tsilo/ts_append.c (116)
M src/modules/tsilo/ts_append.h (2)
M src/modules/tsilo/tsilo.c (269)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2931.patchhttps://github.com/kamailio/kamailio/pull/2931.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2931
Module: kamailio
Branch: master
Commit: c1fd9ebaa0fe0eb7457ea74e8a22444b855af9cd
URL: https://github.com/kamailio/kamailio/commit/c1fd9ebaa0fe0eb7457ea74e8a22444…
Author: Donat Zenichev <dzenichev(a)sipwise.com>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2021-11-19T09:18:55+01:00
tsilo: Merge similar functions in ts_append.c
We need to merge similar functions in ts_append.c implementation
to give less work for maintaining similar code.
Furthermore the purpose of them is quite the same,
but differes just in some details (usage of TM's API).
Merged functions are:
- ts_append() and ts_append_by_contact()
- ts_append_to() and ts_append_by_contact_to()
Now all appending in TSILO happens only through ts_append() / ts_append_to()
An implementation in tsilo.c has been updated accordingly.
Usage.
In case we do not want to append based on specific Contact (location),
the contact parameter being passed to either ts_append() or ts_append_to()
must be set to zero.
In case we do want to append by a specific Contact, then we must
set the Contact parameter of str type beforehand calling ts_append() / ts_append_to().
---
Modified: src/modules/tsilo/ts_append.c
Modified: src/modules/tsilo/ts_append.h
Modified: src/modules/tsilo/tsilo.c
---
Diff: https://github.com/kamailio/kamailio/commit/c1fd9ebaa0fe0eb7457ea74e8a22444…
Patch: https://github.com/kamailio/kamailio/commit/c1fd9ebaa0fe0eb7457ea74e8a22444…
Module: kamailio
Branch: master
Commit: 474649171d3c269e2fcfb00c7b1dbd318a952f51
URL: https://github.com/kamailio/kamailio/commit/474649171d3c269e2fcfb00c7b1dbd3…
Author: Donat Zenichev <dzenichev(a)sipwise.com>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2021-11-19T09:18:55+01:00
tsilo: Be compliant with changes in TM, now only t_append_branches()
Since of changes in TM's module, where 't_append_branches()' and
't_append_branch_by_contact()' have been merged into one function,
we need to edit all the occurences where TM's API is called
in TSILO.
No logic changes.
---
Modified: src/modules/tsilo/ts_append.c
---
Diff: https://github.com/kamailio/kamailio/commit/474649171d3c269e2fcfb00c7b1dbd3…
Patch: https://github.com/kamailio/kamailio/commit/474649171d3c269e2fcfb00c7b1dbd3…
---
diff --git a/src/modules/tsilo/ts_append.c b/src/modules/tsilo/ts_append.c
index 1847ac1c1b..e4967f8167 100644
--- a/src/modules/tsilo/ts_append.c
+++ b/src/modules/tsilo/ts_append.c
@@ -89,6 +89,10 @@ int ts_append_to(struct sip_msg* msg, int tindex, int tlabel, char *table, str *
int ret;
str stable;
+ str contact; /* needed for usage of TM's API, t_append_branches() */
+ contact.s = NULL; /* must be emptied */
+ contact.len = 0;
+
orig_t = _tmb.t_gett();
if(_tmb.t_lookup_ident(&t, tindex, tlabel) < 0)
@@ -129,7 +133,7 @@ int ts_append_to(struct sip_msg* msg, int tindex, int tlabel, char *table, str *
goto done;
}
- ret = _tmb.t_append_branches();
+ ret = _tmb.t_append_branches(&contact);
done:
/* unref the transaction which had been referred by t_lookup_ident() call.
@@ -245,7 +249,7 @@ int ts_append_by_contact_to(struct sip_msg* msg, int tindex, int tlabel, char *t
/* start the transaction only for the desired contact
contact must be of syntax: sip:<user>@<host>:<port> with no parameters list*/
- ret = _tmb.t_append_branch_by_contact(contact);
+ ret = _tmb.t_append_branches(contact);
done:
/* unref the transaction which had been referred by t_lookup_ident() call.
Module: kamailio
Branch: master
Commit: cb1b78e7bc8d61261e429664c6deb8bb1b4b53d0
URL: https://github.com/kamailio/kamailio/commit/cb1b78e7bc8d61261e429664c6deb8b…
Author: Donat Zenichev <dzenichev(a)sipwise.com>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2021-11-19T09:18:55+01:00
tm: merge t_append_branches() and t_append_branch_by_contact()
Because the implementation of the functions
't_append_branches()' and 't_append_branch_by_contact()' is pretty
much the same, it's proposed to merge them into one:
't_append_branches()'
The way how the function acts now depends on if the contact
parameter of str type is given or not (empty or not).
If the contact parameter is given, then only a desired location
is meant for appending. If not found in the location table,
an append will not happen for this AOR.
Otherwise create branches for all existing location records
of this particular AOR. Search for locations is done in the location table.
---
Modified: src/modules/tm/t_append_branches.c
Modified: src/modules/tm/t_append_branches.h
Modified: src/modules/tm/tm_load.c
Modified: src/modules/tm/tm_load.h
---
Diff: https://github.com/kamailio/kamailio/commit/cb1b78e7bc8d61261e429664c6deb8b…
Patch: https://github.com/kamailio/kamailio/commit/cb1b78e7bc8d61261e429664c6deb8b…
Module: kamailio
Branch: master
Commit: f564c0d33974eeaa1833abeb7972f5d207c5663f
URL: https://github.com/kamailio/kamailio/commit/f564c0d33974eeaa1833abeb7972f5d…
Author: Donat Zenichev <dzenichev(a)sipwise.com>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2021-11-19T09:18:55+01:00
tm: API improvement, new function introduced: t_append_branch_by_contact()
New module functions introduced:
- t_append_branch_by_contact()
This commit introduces a possibility of TM's API to append a branch
based on specific location (Contact's URI).
Indeed the 't_append_branch_by_contact()' is a corrected copy of
the 't_append_branches()', which instead takes Contact as a parameter
of str type.
The separate function has been introduced, in order to save full
back-compatibility, and not affect existing implementation.
---
Modified: src/modules/tm/t_append_branches.c
Modified: src/modules/tm/t_append_branches.h
Modified: src/modules/tm/tm_load.c
Modified: src/modules/tm/tm_load.h
---
Diff: https://github.com/kamailio/kamailio/commit/f564c0d33974eeaa1833abeb7972f5d…
Patch: https://github.com/kamailio/kamailio/commit/f564c0d33974eeaa1833abeb7972f5d…