[sr-dev] [kamailio/kamailio] Cannot set alias from substdef/environment (#2310)

Daniel-Constantin Mierla notifications at github.com
Tue May 12 14:30:32 CEST 2020


I just tested with this configuration file:

```
#!KAMAILIO

debug=2
children=2

listen=udp:0.0.0.0:8280

loadmodule "pv.so"
#!substdef "/BASE_HOST/$env(BASE_HOST)/"

alias="BASE_HOST"

loadmodule "jsonrpcs.so"
loadmodule "sl.so"
loadmodule "corex.so"
loadmodule "kex.so"

request_route {
	# ...
	if (uri!=myself) {
		sl_send_reply("403","Not relaying");
		exit;
	}
	sl_send_reply("200", "OK");

	exit;
}
```

Then:

```
export BASE_HOST=lab01.asipto.com
```

Started kamailio and used sipsak to push a request:

```
sipsak -p 127.0.0.1 -r 8280 -s sip:lab01.asipto.com -vvv
```

And I got 200ok, so myself matched, logs showing that as well:

```
1(19850) DEBUG: <core> [core/parser/msg_parser.c:152]: get_hdr_field(): cseq <CSeq>: <1> <OPTIONS>
 1(19850) DEBUG: <core> [core/receive.c:324]: receive_msg(): --- received sip message - request - call-id: [2107224131 at 192.168.178.75] - cseq: [1 OPTIONS]
 1(19850) DEBUG: <core> [core/receive.c:379]: receive_msg(): preparing to run routing scripts...
 1(19850) DEBUG: <core> [core/socket_info.c:646]: grep_sock_info(): checking if host==us: 20==7 && [lab01.asipto.com] == [0.0.0.0]
 1(19850) DEBUG: <core> [core/socket_info.c:649]: grep_sock_info(): checking if port 8280 (advertise 0) matches port 5060
 1(19850) DEBUG: <core> [core/name_alias.h:64]: grep_aliases(): matching (0:lab01.asipto.com:5060) vs. (0:lab01.asipto.com:0)
 1(19850) DEBUG: <core> [core/forward.c:422]: check_self(): host (0:lab01.asipto.com:5060) == me
```

I used master for seend the debug messages, but the alias value is taken in cosideration via the environment variable. Closing this one, if still an issue, reopen and provide the logs with latest master branch.

-- 
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#issuecomment-627312475
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20200512/90df0b63/attachment-0001.html>


More information about the sr-dev mailing list