[SR-Users] Unable to pull enviornment variables

Adarsh Chauhan adarshchauhan at hotmail.com
Tue Sep 21 11:13:36 CEST 2021


Hi Team,

Need some help here.
Want to pull environment variable however kamailio just doesnt pick it.

I exported the environment variable
*export STAGE="dev"*

Then i tried following
1)
*#!defenv DEVSTAGE*
gives error
 0(3809) ERROR: <core> [core/cfg.lex:2085]: pp_define_env(): env variable
not defined [DEVSTAGE]

2)
*#!substdef "/DEVSTAGE/$env(DEVSTAGE)/";*

 0(3962) DEBUG: <core> [core/ppcfg.c:87]: pp_subst_add(): ### added subst
expression: [/DEVSTAGE/$env(DEVSTAGE)/]
 0(3962) DEBUG: <core> [core/cfg.lex:1964]: pp_define(): defining id:
DEVSTAGE
 0(3962) DEBUG: <core> [core/parser/parse_fline.c:249]: parse_first_line():
first line type 1 (request) flags 1
 0(3962) DEBUG: <core> [core/parser/msg_parser.c:677]: parse_msg(): SIP
Request:
 0(3962) DEBUG: <core> [core/parser/msg_parser.c:679]: parse_msg():
 method:  <OPTIONS>
 0(3962) DEBUG: <core> [core/parser/msg_parser.c:681]: parse_msg():  uri:
  <sip:you at kamailio.org>
 0(3962) DEBUG: <core> [core/parser/msg_parser.c:683]: parse_msg():
 version: <SIP/2.0>
 0(3962) DEBUG: <core> [core/parser/parse_hname2.c:293]:
parse_sip_header_name(): parsed header name [Via] type 1
 0(3962) DEBUG: <core> [core/parser/parse_via.c:2639]: parse_via(): end of
header reached, state=2
 0(3962) DEBUG: <core> [core/parser/msg_parser.c:555]: parse_headers(): Via
found, flags=2
 0(3962) DEBUG: <core> [core/parser/msg_parser.c:557]: parse_headers():
this is the first via
 0(3962) DEBUG: <core> [core/pvapi.c:497]: pv_spec_lookup(): PV
<$env(DEVSTAGE)> is not in cache
 0(3962) DEBUG: <core> [core/pvapi.c:335]: pv_cache_add(): PV cache not
initialized, doing it now
 0(3962) DEBUG: <core> [core/pvapi.c:371]: pv_cache_add(): pvar
[$env(DEVSTAGE)] added in cache
 0(3962) DEBUG: <core> [core/cfg.lex:2053]: pp_define_set(): ### setting
define ID [DEVSTAGE] value [<null>] (mode: 1)
 0(3962) DEBUG: <core> [core/ppcfg.c:188]: pp_substdef_add(): ### added
substdef: [DEVSTAGE]=[<null>] (0)
 0(3962) DEBUG: <core> [core/re.c:436]: subst_run(): running. r=1
 0(3962) DEBUG: <core> [core/re.c:504]: subst_str(): no match
 0(3962) DEBUG: <core> [core/re.c:436]: subst_run(): running. r=1
 0(3962) DEBUG: <core> [core/re.c:504]: subst_str(): no match


my end goal is to compare the directive and load modules accordingly.
*#!ifdef DEVSTAGE == "dev"*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20210921/b21e245c/attachment.htm>


More information about the sr-users mailing list