- implements GH #2895
<!-- 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
- [ ] 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 #2895
#### Description
Allows adding additional AMQP-headers in the format header1=value1;header2=value2;...
Remark:
I decided to re-use the definition
`{"kazoo_publish", (cmd_function) kz_amqp_publish_ex, 4, fixup_kz_amqp, fixup_kz_amqp_free, ANY_ROUTE},`
resp. to modify the existing method signature
`int kz_amqp_publish_ex(struct sip_msg* msg, char* exchange, char* routing_key, char* payload, char* _pub_flags)`
to
`int kz_amqp_publish_ex(struct sip_msg* msg, char* exchange, char* routing_key, char* payload, char* _pub_flags)`
as the param _pub_flags is neither described in the docs, nor it was evaluated/used, and thus was useless anyhow.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2925
-- Commit Summary --
* <a href="https://github.com/kamailio/kamailio/pull/2925/commits/0aee8fc2c486f19a20c9…">kazoo: Allow optional AMQP-headers in kazoo_query and kazoo_publish</a>
-- File Changes --
M src/modules/kazoo/doc/kazoo_admin.xml (8)
M src/modules/kazoo/kazoo.c (1)
M src/modules/kazoo/kz_amqp.c (117)
M src/modules/kazoo/kz_amqp.h (11)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2925.patchhttps://github.com/kamailio/kamailio/pull/2925.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/2925
#### 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.