<!-- 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
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
Fixed attrs parameters handling i rpc 'add' command.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2339
-- Commit Summary --
* dispatcher: rework attrs parameter in rpc 'add' command
-- File Changes --
M src/modules/dispatcher/dispatch.c (4)
M src/modules/dispatcher/dispatcher.c (10)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2339.patchhttps://github.com/kamailio/kamailio/pull/2339.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/2339
Hi Folks,
Just found another simple use case of the dispatcher latency stats.
Just shraing this idea of a feature I want to contribute.
When using dispatcher algorithm 8:
“8” - select destination sorted by priority attribute value (serial
forking ordered by priority).
If the gateway as the attribute, the priority becomes the estimated latency.
cc-priority
- The dispatcher would automatically prioritize the closest one.
- If a gateway is becoming unresponsive it will automatically become de
prioritize.
Consider this real life scenario where you have gateways in East and West
Coast
Example
URI: sip:28.71.19.140
FLAGS: AP
PRIORITY: 10
ATTRS: {
BODY: cc_priority=1
}
LATENCY: {
AVG: 84.001000
STD: 0.062000
EST: 84.001000 (high == low priority)
MAX: 93
TIMEOUT: 0
URI: sip:28.71.16.140
FLAGS: AP
PRIORITY: 10
ATTRS: {
BODY: cc_priority=1
}
LATENCY: {
AVG: 29.110000
STD: 2.383000
EST: 31.999000 (low == high priority)
MAX: 1499
TIMEOUT: 1
Another major improvement to all of this would be to gather stats on INVITE
<> 100 to have a very accurate latency estimation even if the gateway does
not support SIP OPTIONS pings
### Description
I tried to set the `alias` configuration option using an ID set by `#!substdef` but this leads to `grep_sock_info()` to fail, falling back to `corex_check_self()` and failing altogether finally.
### Troubleshooting
#### Reproduction
The basic setup given `BASE_HOST=example.org`:
```
#!substdef "/BASE_HOST/$env(BASE_HOST)/"
alias="BASE_HOST"
listen=tcp:0.0.0.0:80
route[AUTH] {
# ...
if (from_uri!=myself && uri!=myself) {
sl_send_reply("403","Not relaying");
exit;
}
return;
}
```
With this, any properly authenticated `REGISTER` call leads to a `403 Not Relaying`.
However, this works perfectly fine if I use a static value instead:
```
alias=example.org
```
#### Log Messages
```
kamailio_1 | 12(17) DEBUG: <core> [core/socket_info.c:628]: grep_sock_info(): checking if host==us: 11==7 && [example.org] == [0.0.0.0]
kamailio_1 | 12(17) DEBUG: <core> [core/socket_info.c:635]: grep_sock_info(): checking if port 80 (advertise 0) matches port 5060
kamailio_1 | 12(17) DEBUG: <core> [core/forward.c:412]: check_self(): host != me
kamailio_1 | 12(17) DEBUG: corex [corex_lib.c:200]: corex_check_self(): check self for: 0:example.org:5060
kamailio_1 | 12(17) DEBUG: corex [corex_lib.c:227]: corex_check_self(): no match found
kamailio_1 | 12(17) DEBUG: <core> [core/socket_info.c:628]: grep_sock_info(): checking if host==us: 11==7 && [example.org] == [0.0.0.0]
kamailio_1 | 12(17) DEBUG: <core> [core/socket_info.c:635]: grep_sock_info(): checking if port 80 (advertise 0) matches port 5060
kamailio_1 | 12(17) DEBUG: <core> [core/forward.c:412]: check_self(): host != me
kamailio_1 | 12(17) DEBUG: corex [corex_lib.c:200]: corex_check_self(): check self for: 0:example.org:5060
kamailio_1 | 12(17) DEBUG: corex [corex_lib.c:227]: corex_check_self(): no match found
```
Output with the static value:
```
kamailio_1 | 11(16) DEBUG: <core> [core/socket_info.c:628]: grep_sock_info(): checking if host==us: 11==7 && [example.org] == [0.0.0.0]
kamailio_1 | 11(16) DEBUG: <core> [core/socket_info.c:635]: grep_sock_info(): checking if port 80 (advertise 0) matches port 5060
kamailio_1 | 11(16) DEBUG: <core> [core/socket_info.c:628]: grep_sock_info(): checking if host==us: 11==7 && [example.org] == [0.0.0.0]
kamailio_1 | 11(16) DEBUG: <core> [core/socket_info.c:635]: grep_sock_info(): checking if port 80 (advertise 0) matches port 5060
```
### Possible Solutions
Right now I need to work around this issue by including a separate `kamailio-aliases.cfg` file which must then be provided in each environment.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.3.3 (x86_64/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 5.3.1
```
* **Operating System**:
<!--
Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...;
Kernel details (output of `uname -a`)
-->
Using the Docker image `kamailio/kamailio:5.3.3-xenial`. Info from the Docker host:
```
# uname -a
Linux ubuntu-s-1vcpu-1gb-fra1-01-sip 4.4.0-177-generic #207-Ubuntu SMP Mon Mar 16 01:16:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
```
--
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/issues/2310