Am I misreading, or is this a defined environmental variable named "STAGE" but 
you're evaluating an environmental variable named "DEVSTAGE"?


Ben Kaufman

Sr. VoIP Engineer

P:

E: [email protected]<mailto:[email protected]>

24 hour client support: 855.639.6300<tel:+18556396300>



[image]<https://www.nexvortex.com/>  [image] 
<https://www.facebook.com/nexVortex/>   [image] 
<https://twitter.com/nexvortex/>   [image] 
<https://www.linkedin.com/company/nexvortex-inc/>

NOTE: This e-mail and any attachments are from nexVortex, Inc. and are intended 
solely for the use and review of the individual(s) to whom it is addressed. If 
you believe you received this e-mail in error, please notify the sender 
immediately, delete the e-mail (and any attachment


________________________________
From: sr-users <[email protected]> on behalf of Adarsh 
Chauhan <[email protected]>
Sent: Wednesday, September 22, 2021, 1:04 AM
To: [email protected]
Subject: [SR-Users] Unable to pull enviornment variables

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:[email protected]<mailto:sip%[email protected]>>
 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"

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to