<p></p>
<h3>Description</h3>
<p>I tried to set the <code>alias</code> configuration option using an ID set by <code>#!substdef</code> but this leads to <code>grep_sock_info()</code> to fail, falling back to <code>corex_check_self()</code> and failing altogether finally.</p>
<h3>Troubleshooting</h3>
<h4>Reproduction</h4>
<p>The basic setup given <code>BASE_HOST=example.org</code>:</p>
<pre><code>#!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;
}
</code></pre>
<p>With this, any properly authenticated <code>REGISTER</code> call leads to a <code>403 Not Relaying</code>.</p>
<p>However, this works perfectly fine if I use a static value instead:</p>
<pre><code>alias=example.org
</code></pre>
<h4>Log Messages</h4>
<pre><code>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
</code></pre>
<p>Output with the static value:</p>
<pre><code>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
</code></pre>
<h3>Possible Solutions</h3>
<p>Right now I need to work around this issue by including a separate <code>kamailio-aliases.cfg</code> file which must then be provided in each environment.</p>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<pre><code>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

</code></pre>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>

<p>Using the Docker image <code>kamailio/kamailio:5.3.3-xenial</code>. Info from the Docker host:</p>
<pre><code># 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
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2310">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZIJJIC4V4HGZWIHCBLRPF6XVANCNFSM4MVSIDMQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZOFXN5L75TNF4VUDVDRPF6XVA5CNFSM4MVSIDM2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4JC4DO5A.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2310",
"url": "https://github.com/kamailio/kamailio/issues/2310",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>