<!-- 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 -->
- [ ] 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
This PR adds 2 new flags to the mode parameter of the ds_is_from_list function.
Some times the dispatcher configuration can look like this (route attribute is just for exampe, sockname is important here):
70 sip:192.168.1.1:5060;transport=udp 0 1 route=route1;sockname=udp_5060
71 sip:192.168.1.1:5060;transport=udp 0 1 route=route2;sockname=udp_5061
72 sip:192.168.1.1:5060;transport=udp 0 1 route=route3;sockname=udp_5062
73 sip:192.168.1.1:5060;transport=udp 0 1 route=route4;sockname=udp_5063
Here we have one host/port/protocol on the remote side and different ports that we are listening on,
In stock dispatcher version ds_is_from_list(-1,0) will always match first available - 70, but this is not right
for dst ports 5061-5063 (sockets in realality, because we can have different local ip on same port also).
The new mode flag DS_MATCH_SOCKET (8) allow match for dispatcher socket also.
Second flag is DS_MATCH_STRICTEST (16), it allow to match more strictness target in "address/protocol/port/socket" key,
for example:
70 sip:192.168.1.1;transport=udp 0 1 route=route1
71 sip:192.168.1.1:5061;transport=udp 0 1 route=route2
72 sip:192.168.1.1:5062;transport=udp 0 1 route=route3
73 sip:192.168.1.1;transport=udp 0 1 route=route4;socket=udp:192.168.10.10:5063
if packet come from from any port of sip:192.168.1.1;transport=udp except 5061-5062 ds_is_from list will return 70,
if received port also is 5063 the result will be 73, packets from ports 5061-5062 will be matched at 71-72 respectively.
In stock version of ds_is_from_list the result will always be 70.
Note, the DS_MATCH_STRICTEST method can be more compute intensive, because we can potentially traverse all the dispatcher tree.
The behavior of existing flags are not changed.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3699
-- Commit Summary --
* dispatcher: added two new flags to mode parameter of ds_is_from_list function for more strictly matching
-- File Changes --
M src/modules/dispatcher/dispatch.c (112)
M src/modules/dispatcher/dispatch.h (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3699.patchhttps://github.com/kamailio/kamailio/pull/3699.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3699
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3699(a)github.com>
Module: kamailio
Branch: master
Commit: ef29e84929b8ef779341ef63a77e68ca6909705a
URL: https://github.com/kamailio/kamailio/commit/ef29e84929b8ef779341ef63a77e68c…
Author: Elena-Ramona Modroiu <ramona(a)asipto.com>
Committer: Elena-Ramona Modroiu <ramona(a)asipto.com>
Date: 2024-03-11T07:18:17+01:00
http_client: docs for http_client_request() function
---
Modified: src/modules/http_client/doc/http_client_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/ef29e84929b8ef779341ef63a77e68c…
Patch: https://github.com/kamailio/kamailio/commit/ef29e84929b8ef779341ef63a77e68c…
---
diff --git a/src/modules/http_client/doc/http_client_admin.xml b/src/modules/http_client/doc/http_client_admin.xml
index 0e182cc95e3..df9d8c288e5 100644
--- a/src/modules/http_client/doc/http_client_admin.xml
+++ b/src/modules/http_client/doc/http_client_admin.xml
@@ -960,6 +960,30 @@ http_client_get("http://api.com/index.php?r_uri=$(ru{s.escape.param})&f_uri=
switch ($rc) {
...
}
+...
+ </programlisting>
+ </example>
+ </section>
+ <section id="http_client.f.http_client_request">
+ <title>
+ <function moreinfo="none">http_client_request(url, met, body, hdrs, respv)</function>
+ </title>
+ <para>
+ Perform a HTTP request to "url", storing the response body
+ in the "respv" variable. The method of the request is set by "met".
+ The "body" and "hdrs" can be empty strings to skip setting them.
+ The first four parameters can contain variables that are evaluated
+ at runtime. The "respv" has to be the name of a writable variable.
+ </para>
+ <example>
+ <title><function>http_client_request()</function> usage</title>
+ <programlisting format="linespecific">
+...
+http_client_request("GET", "http://api.com/index.php?r_uri=$(ru{s.escape.param})&f_uri=$(fu{s.escap…",
+ "", "X-Token: abc", "$var(result)");
+switch ($rc) {
+ ...
+}
...
</programlisting>
</example>