I found a way to use env var in kamailio.cfg. Here is a code to use MY_IP
environment variable,

# This will create MY_IP define with value from environment variable
#!defenv MY_IP

# MY_IP will be replaced with the value from MY_IP define
listen=udp:0.0.0.0:5060 advertise MY_IP:5060

Best Regards,
Pavan Kumar


On Thu, May 2, 2024 at 10:21 AM Pavan Kumar <[email protected]> wrote:

> Thanks, I'll look into it. :)
>
> On Mon, Apr 29, 2024 at 12:03 PM Olle E. Johansson <[email protected]> wrote:
>
>>
>>
>> On 28 Apr 2024, at 10:57, Pavan Kumar via sr-users <
>> [email protected]> wrote:
>>
>> Hi everyone,
>>
>> I am trying to assign environment variable as follows
>>
>> listen=udp:0.0.0.0:5060 advertise $env(MY_IP):5060
>>
>> Looks like using the environment variable as above is an invalid
>> configuration.
>>
>> Is there a way to use IP from env var to advertise. Even better, is there
>> a way to use result in a stun query as an advertised address?
>>
>>
>> The config variables (called pseudo-variables in documentation) can only
>> be used in the routing scripts, not in the core parameters section.
>>
>> There is a way to add defines for substitution on the command line and
>> use them though. Check the documentation in the core cookbook on how to use
>> defines and the command line help for more information.
>>
>> /O
>>
>
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:

Reply via email to