### 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