Hello all,
Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is "It is a simplified alternative of using #!substdef with $env(NAME) in the replacement part." But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement?
I'm aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I'm just trying to understand the usage of the #!defenv feature.
#!KAMAILIO ## Tested in 5.5.2 loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
#!defenv HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Ben Kaufman
Hello,
#!substdef does not set the value inside quoted string, it replaces inside a string value, so it does not put quotes around replacement part. So it does it it is written in the docs. There is #!substdefs witch can create a define with quoted value.
Note that defines are standalone-token replacement, you can define an ID to a number, to a keyword (e.g., src_ip), to a quoted string or even a multi-line script snippet, like:
#!define IDLOOP $var(i) = 0; \ while($var(i)<5) { \ xlog("++++ $var(i)\n"); \ $var(i) = $var(i) + 1; \ }
See the core cookbook for more details.
Anyhow, as using env variable values as quoted string is useful and setting them with quotes might look odd, I added #!defenvs:
* https://www.kamailio.org/wiki/cookbooks/devel/core#defenvs
Cheers, Daniel
On 30.11.21 22:40, Ben Kaufman wrote:
Hello all,
Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is “It is a simplified alternative of using *#!substdef* with *$env(NAME)* in the replacement part.” But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement?
I’m aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I’m just trying to understand the usage of the #!defenv feature.
#!KAMAILIO
## Tested in 5.5.2
loadmodule "xlog"
loadmodule "pv"
loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
#!defenv HOME
request_route{
forward();
}
event_route[evrexec:timer] {
xlog("L_N", "HOME: " + HOME + "\n");
}
*Ben Kaufman*
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Thank you :)
A follow up question would be on the usability of the #!defenv (and probably #!defenvs) usability with #!ifdef. In the scenario below, if the environmental variable WITH_DEBUGGER is not defined, then Kamailio will fail to start, thus the #!ifdef is somewhat limited. It makes sense for scenarios where someone might toggle the setting editing the config file, but it would be very convenient to toggle the environmental variable instead, particularly in containerized environments. Any thoughts on how best to control this?
#!defenv WITH_DEBUGGER
#!ifdef WITH_DEBUGGER loadmodule "debugger" . . . #!endif
Ben Kaufman
From: Daniel-Constantin Mierla miconda@gmail.com Sent: Monday, December 6, 2021 3:55 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org; Ben Kaufman bkaufman@nexvortex.com Subject: Re: [SR-Users] Unquoted values from #!defenv
Hello,
#!substdef does not set the value inside quoted string, it replaces inside a string value, so it does not put quotes around replacement part. So it does it it is written in the docs. There is #!substdefs witch can create a define with quoted value.
Note that defines are standalone-token replacement, you can define an ID to a number, to a keyword (e.g., src_ip), to a quoted string or even a multi-line script snippet, like:
#!define IDLOOP $var(i) = 0; \ while($var(i)<5) { \ xlog("++++ $var(i)\n"); \ $var(i) = $var(i) + 1; \ }
See the core cookbook for more details.
Anyhow, as using env variable values as quoted string is useful and setting them with quotes might look odd, I added #!defenvs:
* https://www.kamailio.org/wiki/cookbooks/devel/core#defenvshttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2Fdevel%2Fcore%23defenvs&data=04%7C01%7Cbkaufman%40nexvortex.com%7C6028b5b0b93344af8d0308d9b89e8a04%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637743813349298668%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=Q2j9FAXfUTB2uNwKhu5OeEmQanN7xmMGDYb9JBJw6JY%3D&reserved=0
Cheers, Daniel On 30.11.21 22:40, Ben Kaufman wrote: Hello all,
Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is "It is a simplified alternative of using #!substdef with $env(NAME) in the replacement part." But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement?
I'm aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I'm just trying to understand the usage of the #!defenv feature.
#!KAMAILIO ## Tested in 5.5.2 loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
#!defenv HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Ben Kaufman
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40nexvortex.com%7C6028b5b0b93344af8d0308d9b89e8a04%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637743813349298668%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=sg%2Bvyol603800duARWt2cyAY2zyk8b7RwtDdqxQvkVI%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40nexvortex.com%7C6028b5b0b93344af8d0308d9b89e8a04%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637743813349298668%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=fC7l4GXE37%2FlnU3VEEFYtDfh3Paz7qngOegogfTYPfo%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40nexvortex.com%7C6028b5b0b93344af8d0308d9b89e8a04%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637743813349298668%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=YwgDc3er7OybfRCfku6xVEz9d3JF%2BVI9fm9obQc5JyY%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40nexvortex.com%7C6028b5b0b93344af8d0308d9b89e8a04%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637743813349298668%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=%2FEHm83D99ywCJaMbJfzBqFRFMbbIyLd5etfUpLWmTF4%3D&reserved=0
The current behaviour targets the use of existing values from the environment variables. If you need other kind of features, you can propose pull requests. Or you can eventually have a start script that sets defines with -A cli parameter based on env variables.
Cheers, Daniel
On 06.12.21 21:56, Ben Kaufman wrote:
Thank you :)
A follow up question would be on the usability of the #!defenv (and probably #!defenvs) usability with #!ifdef. In the scenario below, if the environmental variable WITH_DEBUGGER is not defined, then Kamailio will fail to start, thus the #!ifdef is somewhat limited. It makes sense for scenarios where someone might toggle the setting editing the config file, but it would be very convenient to toggle the environmental variable instead, particularly in containerized environments. Any thoughts on how best to control this?
#!defenv WITH_DEBUGGER
#!ifdef WITH_DEBUGGER
loadmodule "debugger"
. . .
#!endif
*Ben Kaufman*
*From:* Daniel-Constantin Mierla miconda@gmail.com *Sent:* Monday, December 6, 2021 3:55 AM *To:* Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org; Ben Kaufman bkaufman@nexvortex.com *Subject:* Re: [SR-Users] Unquoted values from #!defenv
Hello,
#!substdef does not set the value inside quoted string, it replaces inside a string value, so it does not put quotes around replacement part. So it does it it is written in the docs. There is #!substdefs witch can create a define with quoted value.
Note that defines are standalone-token replacement, you can define an ID to a number, to a keyword (e.g., src_ip), to a quoted string or even a multi-line script snippet, like:
#!define IDLOOP $var(i) = 0; \ while($var(i)<5) { \ xlog("++++ $var(i)\n"); \ $var(i) = $var(i) + 1; \ }
See the core cookbook for more details.
Anyhow, as using env variable values as quoted string is useful and setting them with quotes might look odd, I added #!defenvs:
* https://www.kamailio.org/wiki/cookbooks/devel/core#defenvs https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2Fdevel%2Fcore%23defenvs&data=04%7C01%7Cbkaufman%40nexvortex.com%7C6028b5b0b93344af8d0308d9b89e8a04%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637743813349298668%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=Q2j9FAXfUTB2uNwKhu5OeEmQanN7xmMGDYb9JBJw6JY%3D&reserved=0
Cheers, Daniel
On 30.11.21 22:40, Ben Kaufman wrote:
Hello all, Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is “It is a simplified alternative of using *#!substdef* with *$env(NAME)* in the replacement part.” But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement? I’m aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I’m just trying to understand the usage of the #!defenv feature. #!KAMAILIO ## Tested in 5.5.2 loadmodule "xlog" loadmodule "pv" loadmodule "evrexec" modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;") #!defenv HOME request_route{ forward(); } event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); } *Ben Kaufman* __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions * sr-users@lists.kamailio.org 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 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40nexvortex.com%7C6028b5b0b93344af8d0308d9b89e8a04%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637743813349298668%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=sg%2Bvyol603800duARWt2cyAY2zyk8b7RwtDdqxQvkVI%3D&reserved=0>
-- Daniel-Constantin Mierla -- www.asipto.com https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40nexvortex.com%7C6028b5b0b93344af8d0308d9b89e8a04%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637743813349298668%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=TSsHgbu0R21zntLh04F9ygSsdMhf2IFMu0gsQH0QdLE%3D&reserved=0 www.twitter.com/miconda https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40nexvortex.com%7C6028b5b0b93344af8d0308d9b89e8a04%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637743813349298668%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=fC7l4GXE37%2FlnU3VEEFYtDfh3Paz7qngOegogfTYPfo%3D&reserved=0 -- www.linkedin.com/in/miconda https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40nexvortex.com%7C6028b5b0b93344af8d0308d9b89e8a04%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637743813349298668%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=YwgDc3er7OybfRCfku6xVEz9d3JF%2BVI9fm9obQc5JyY%3D&reserved=0 Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40nexvortex.com%7C6028b5b0b93344af8d0308d9b89e8a04%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637743813349298668%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=%2FEHm83D99ywCJaMbJfzBqFRFMbbIyLd5etfUpLWmTF4%3D&reserved=0
Thank you. I've been using -A to set values thus far as CMD arguments to the container's ENTRYPOINT. If submitting a pull request, would it be preferrable to allow #!defenv/#!defenvs to accept undefined values, or to add new keywords like #!ifdefenv/#!ifdefenvs ?
Ben Kaufman
From: Daniel-Constantin Mierla miconda@gmail.com Sent: Tuesday, December 7, 2021 2:22 AM To: Ben Kaufman bkaufman@bcmone.com; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: Re: [SR-Users] Unquoted values from #!defenv
The current behaviour targets the use of existing values from the environment variables. If you need other kind of features, you can propose pull requests. Or you can eventually have a start script that sets defines with -A cli parameter based on env variables.
Cheers, Daniel On 06.12.21 21:56, Ben Kaufman wrote: Thank you :)
A follow up question would be on the usability of the #!defenv (and probably #!defenvs) usability with #!ifdef. In the scenario below, if the environmental variable WITH_DEBUGGER is not defined, then Kamailio will fail to start, thus the #!ifdef is somewhat limited. It makes sense for scenarios where someone might toggle the setting editing the config file, but it would be very convenient to toggle the environmental variable instead, particularly in containerized environments. Any thoughts on how best to control this?
#!defenv WITH_DEBUGGER
#!ifdef WITH_DEBUGGER loadmodule "debugger" . . . #!endif
Ben Kaufman
From: Daniel-Constantin Mierla miconda@gmail.commailto:miconda@gmail.com Sent: Monday, December 6, 2021 3:55 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org; Ben Kaufman bkaufman@nexvortex.commailto:bkaufman@nexvortex.com Subject: Re: [SR-Users] Unquoted values from #!defenv
Hello,
#!substdef does not set the value inside quoted string, it replaces inside a string value, so it does not put quotes around replacement part. So it does it it is written in the docs. There is #!substdefs witch can create a define with quoted value.
Note that defines are standalone-token replacement, you can define an ID to a number, to a keyword (e.g., src_ip), to a quoted string or even a multi-line script snippet, like:
#!define IDLOOP $var(i) = 0; \ while($var(i)<5) { \ xlog("++++ $var(i)\n"); \ $var(i) = $var(i) + 1; \ }
See the core cookbook for more details.
Anyhow, as using env variable values as quoted string is useful and setting them with quotes might look odd, I added #!defenvs:
* https://www.kamailio.org/wiki/cookbooks/devel/core#defenvshttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2Fdevel%2Fcore%23defenvs&data=04%7C01%7Cbkaufman%40bcmone.com%7Cbe35f30c00944bc8f2fe08d9b95a962b%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744621006480569%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=5B%2FgzQZTVhvrCUWvrRh5YkFkKnX%2BGTA1Wy2M2L1nFQ4%3D&reserved=0
Cheers, Daniel On 30.11.21 22:40, Ben Kaufman wrote: Hello all,
Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is "It is a simplified alternative of using #!substdef with $env(NAME) in the replacement part." But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement?
I'm aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I'm just trying to understand the usage of the #!defenv feature.
#!KAMAILIO ## Tested in 5.5.2 loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
#!defenv HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Ben Kaufman
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7Cbe35f30c00944bc8f2fe08d9b95a962b%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744621006480569%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=DKXdl%2BamQ56gwczinuP30QdCzA%2Bu9w%2BrznJ6CDU4j54%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cbe35f30c00944bc8f2fe08d9b95a962b%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744621006500482%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=fqzs23JnsKFc5dhry%2F9OX%2BWLBAb93aF0blIPjMhp5Fw%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cbe35f30c00944bc8f2fe08d9b95a962b%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744621006500482%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=amTtFC19Fmdp%2FaLJ0M2csgXP6dspTBcWX9ecjwX6C6c%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cbe35f30c00944bc8f2fe08d9b95a962b%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744621006510433%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=YKnoSY1hWoHV%2B%2F%2Fu2dyxiuHPTjMFsWKdkP%2BEJyyqtH4%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cbe35f30c00944bc8f2fe08d9b95a962b%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744621006520395%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=M90CGK7fa0FLI1x9XiHn0pdRgW5zgOWweh5%2F2rsVtn4%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cbe35f30c00944bc8f2fe08d9b95a962b%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744621006520395%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=KSGCqQTyNzjugyxycScxlAmn6dy414Xj2XiEcozSQng%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cbe35f30c00944bc8f2fe08d9b95a962b%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744621006530350%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=HxYGUiXlv6FAnKX9K6N3DmtBY%2FuIQ7s5MTd7QG1Ozz0%3D&reserved=0
Daniel,
Is the #!defenvs feature still a work in progress? I wrote a change to add #!defenvn and #!defenvns to allow for undefined environmental variables, and noticed that the string quoting on #!defenvs doesn't do anything except log the quoting mode in /src/core/ pp_define_set(). Ben Kaufman Sr. VoIP Engineer P: E: bkaufman@bcmone.commailto:bkaufman@bcmone.com 24 hour client support: 855.639.6300tel:+18556396300
From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Ben Kaufman Sent: Tuesday, December 7, 2021 9:12 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: Re: [SR-Users] Unquoted values from #!defenv
Thank you. I've been using -A to set values thus far as CMD arguments to the container's ENTRYPOINT. If submitting a pull request, would it be preferrable to allow #!defenv/#!defenvs to accept undefined values, or to add new keywords like #!ifdefenv/#!ifdefenvs ?
Ben Kaufman
From: Daniel-Constantin Mierla <miconda@gmail.commailto:miconda@gmail.com> Sent: Tuesday, December 7, 2021 2:22 AM To: Ben Kaufman <bkaufman@bcmone.commailto:bkaufman@bcmone.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Subject: Re: [SR-Users] Unquoted values from #!defenv
The current behaviour targets the use of existing values from the environment variables. If you need other kind of features, you can propose pull requests. Or you can eventually have a start script that sets defines with -A cli parameter based on env variables.
Cheers, Daniel On 06.12.21 21:56, Ben Kaufman wrote: Thank you :)
A follow up question would be on the usability of the #!defenv (and probably #!defenvs) usability with #!ifdef. In the scenario below, if the environmental variable WITH_DEBUGGER is not defined, then Kamailio will fail to start, thus the #!ifdef is somewhat limited. It makes sense for scenarios where someone might toggle the setting editing the config file, but it would be very convenient to toggle the environmental variable instead, particularly in containerized environments. Any thoughts on how best to control this?
#!defenv WITH_DEBUGGER
#!ifdef WITH_DEBUGGER loadmodule "debugger" . . . #!endif
Ben Kaufman
From: Daniel-Constantin Mierla miconda@gmail.commailto:miconda@gmail.com Sent: Monday, December 6, 2021 3:55 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org; Ben Kaufman bkaufman@nexvortex.commailto:bkaufman@nexvortex.com Subject: Re: [SR-Users] Unquoted values from #!defenv
Hello,
#!substdef does not set the value inside quoted string, it replaces inside a string value, so it does not put quotes around replacement part. So it does it it is written in the docs. There is #!substdefs witch can create a define with quoted value.
Note that defines are standalone-token replacement, you can define an ID to a number, to a keyword (e.g., src_ip), to a quoted string or even a multi-line script snippet, like:
#!define IDLOOP $var(i) = 0; \ while($var(i)<5) { \ xlog("++++ $var(i)\n"); \ $var(i) = $var(i) + 1; \ }
See the core cookbook for more details.
Anyhow, as using env variable values as quoted string is useful and setting them with quotes might look odd, I added #!defenvs:
* https://www.kamailio.org/wiki/cookbooks/devel/core#defenvshttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2Fdevel%2Fcore%23defenvs&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075326626%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=nIrsUUO%2Bn8zUzUxCfm9T%2BqLC6HzHPIxDTS80bKGq95w%3D&reserved=0
Cheers, Daniel On 30.11.21 22:40, Ben Kaufman wrote: Hello all,
Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is "It is a simplified alternative of using #!substdef with $env(NAME) in the replacement part." But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement?
I'm aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I'm just trying to understand the usage of the #!defenv feature.
#!KAMAILIO ## Tested in 5.5.2 loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
#!defenv HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Ben Kaufman
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075336581%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=tl%2Fk0oCQduWOvBdvH0C2qrxw6I7yXIedBiS8Hf7%2B1f0%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075336581%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=QdFDXyCLTvKg9Us3eTMPknGYNfEnmDsvu4%2FGuSbb0aE%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075346539%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=y70uIREpgVVhHUbroEgWJDt1wLSvEhcOVEamALZQZ%2FY%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075346539%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=djC3bOEHvHDsIhlYvTQclAF8UmvMmoChVQebVESpRyE%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075356493%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=kPowGpbkXXlkChx6hkjBnLgOWOlFYUQe4%2Fyx7l7mfrk%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075366462%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=kpktAHVWC7m6pVL9tXQMA2D4DaomCkja7%2FDrzS4xX8s%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075366462%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ji3uac4U67Gsdj4%2BOpYPWR762fo1qlPNVtrADJDBCMY%3D&reserved=0
I expected the quoted mode parameter does the work -- I will check and push the update.
Regarding support for undefined env values, maybe add something like #!trydefenv, because I find #!defenv useful at is it, to be used when the env variable must be set for proper working of kamailio (e.g., DB url) and fail to start if not set.
Cheers, Daniel
On 08.12.21 17:17, Ben Kaufman wrote:
Daniel,
Is the #!defenvs feature still a work in progress? I wrote a change to add #!defenvn and #!defenvns to allow for undefined environmental variables, and noticed that the string quoting on #!defenvs doesn’t do anything except log the quoting mode in /src/core/ pp_define_set().
*Ben Kaufman*
/Sr. VoIP Engineer/
P:
E: bkaufman@bcmone.com
24 hour client support: 855.639.6300 tel:+18556396300
*From:* sr-users sr-users-bounces@lists.kamailio.org *On Behalf Of *Ben Kaufman *Sent:* Tuesday, December 7, 2021 9:12 AM *To:* Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org *Subject:* Re: [SR-Users] Unquoted values from #!defenv
Thank you. I’ve been using -A to set values thus far as CMD arguments to the container’s ENTRYPOINT. If submitting a pull request, would it be preferrable to allow #!defenv/#!defenvs to accept undefined values, or to add new keywords like #!ifdefenv/#!ifdefenvs ?
*Ben Kaufman*
*From:* Daniel-Constantin Mierla miconda@gmail.com *Sent:* Tuesday, December 7, 2021 2:22 AM *To:* Ben Kaufman bkaufman@bcmone.com; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org *Subject:* Re: [SR-Users] Unquoted values from #!defenv
The current behaviour targets the use of existing values from the environment variables. If you need other kind of features, you can propose pull requests. Or you can eventually have a start script that sets defines with -A cli parameter based on env variables.
Cheers, Daniel
On 06.12.21 21:56, Ben Kaufman wrote:
Thank you :) A follow up question would be on the usability of the #!defenv (and probably #!defenvs) usability with #!ifdef. In the scenario below, if the environmental variable WITH_DEBUGGER is not defined, then Kamailio will fail to start, thus the #!ifdef is somewhat limited. It makes sense for scenarios where someone might toggle the setting editing the config file, but it would be very convenient to toggle the environmental variable instead, particularly in containerized environments. Any thoughts on how best to control this? #!defenv WITH_DEBUGGER #!ifdef WITH_DEBUGGER loadmodule "debugger" . . . #!endif *Ben Kaufman* *From:* Daniel-Constantin Mierla <miconda@gmail.com> <mailto:miconda@gmail.com> *Sent:* Monday, December 6, 2021 3:55 AM *To:* Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org> <mailto:sr-users@lists.kamailio.org>; Ben Kaufman <bkaufman@nexvortex.com> <mailto:bkaufman@nexvortex.com> *Subject:* Re: [SR-Users] Unquoted values from #!defenv Hello, #!substdef does not set the value inside quoted string, it replaces inside a string value, so it does not put quotes around replacement part. So it does it it is written in the docs. There is #!substdefs witch can create a define with quoted value. Note that defines are standalone-token replacement, you can define an ID to a number, to a keyword (e.g., src_ip), to a quoted string or even a multi-line script snippet, like: #!define IDLOOP $var(i) = 0; \ while($var(i)<5) { \ xlog("++++ $var(i)\n"); \ $var(i) = $var(i) + 1; \ } See the core cookbook for more details. Anyhow, as using env variable values as quoted string is useful and setting them with quotes might look odd, I added #!defenvs: * https://www.kamailio.org/wiki/cookbooks/devel/core#defenvs <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2Fdevel%2Fcore%23defenvs&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075326626%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=nIrsUUO%2Bn8zUzUxCfm9T%2BqLC6HzHPIxDTS80bKGq95w%3D&reserved=0> Cheers, Daniel On 30.11.21 22:40, Ben Kaufman wrote: Hello all, Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is “It is a simplified alternative of using *#!substdef* with *$env(NAME)* in the replacement part.” But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement? I’m aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I’m just trying to understand the usage of the #!defenv feature. #!KAMAILIO ## Tested in 5.5.2 loadmodule "xlog" loadmodule "pv" loadmodule "evrexec" modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;") #!defenv HOME request_route{ forward(); } event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); } *Ben Kaufman* __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions * sr-users@lists.kamailio.org 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 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075336581%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=tl%2Fk0oCQduWOvBdvH0C2qrxw6I7yXIedBiS8Hf7%2B1f0%3D&reserved=0> -- Daniel-Constantin Mierla -- www.asipto.com <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075336581%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=CFCz9vV5ZCrh1S%2FY7sKBCQnQThMy1H0IdTutAz8Hpxo%3D&reserved=0> www.twitter.com/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075336581%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=QdFDXyCLTvKg9Us3eTMPknGYNfEnmDsvu4%2FGuSbb0aE%3D&reserved=0> -- www.linkedin.com/in/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075346539%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=y70uIREpgVVhHUbroEgWJDt1wLSvEhcOVEamALZQZ%2FY%3D&reserved=0> Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075346539%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=djC3bOEHvHDsIhlYvTQclAF8UmvMmoChVQebVESpRyE%3D&reserved=0>
-- Daniel-Constantin Mierla -- www.asipto.com https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075356493%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=uV38pnwyW4qvqgBhUvb2MMBQCgFSOpR4Kvf7jtunJJc%3D&reserved=0 www.twitter.com/miconda https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075356493%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=kPowGpbkXXlkChx6hkjBnLgOWOlFYUQe4%2Fyx7l7mfrk%3D&reserved=0 -- www.linkedin.com/in/miconda https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075366462%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=kpktAHVWC7m6pVL9tXQMA2D4DaomCkja7%2FDrzS4xX8s%3D&reserved=0 Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075366462%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ji3uac4U67Gsdj4%2BOpYPWR762fo1qlPNVtrADJDBCMY%3D&reserved=0
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
I pushed the code to enclose the value in between quotes. Can you test and see if works now?
Cheers, Daniel
On 08.12.21 19:07, Daniel-Constantin Mierla wrote:
I expected the quoted mode parameter does the work -- I will check and push the update.
Regarding support for undefined env values, maybe add something like #!trydefenv, because I find #!defenv useful at is it, to be used when the env variable must be set for proper working of kamailio (e.g., DB url) and fail to start if not set.
Cheers, Daniel
On 08.12.21 17:17, Ben Kaufman wrote:
Daniel,
Is the #!defenvs feature still a work in progress? I wrote a change to add #!defenvn and #!defenvns to allow for undefined environmental variables, and noticed that the string quoting on #!defenvs doesn’t do anything except log the quoting mode in /src/core/ pp_define_set().
*Ben Kaufman*
/Sr. VoIP Engineer/
P:
E: bkaufman@bcmone.com
24 hour client support: 855.639.6300 tel:+18556396300
*From:* sr-users sr-users-bounces@lists.kamailio.org *On Behalf Of *Ben Kaufman *Sent:* Tuesday, December 7, 2021 9:12 AM *To:* Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org *Subject:* Re: [SR-Users] Unquoted values from #!defenv
Thank you. I’ve been using -A to set values thus far as CMD arguments to the container’s ENTRYPOINT. If submitting a pull request, would it be preferrable to allow #!defenv/#!defenvs to accept undefined values, or to add new keywords like #!ifdefenv/#!ifdefenvs ?
*Ben Kaufman*
*From:* Daniel-Constantin Mierla miconda@gmail.com *Sent:* Tuesday, December 7, 2021 2:22 AM *To:* Ben Kaufman bkaufman@bcmone.com; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org *Subject:* Re: [SR-Users] Unquoted values from #!defenv
The current behaviour targets the use of existing values from the environment variables. If you need other kind of features, you can propose pull requests. Or you can eventually have a start script that sets defines with -A cli parameter based on env variables.
Cheers, Daniel
On 06.12.21 21:56, Ben Kaufman wrote:
Thank you :) A follow up question would be on the usability of the #!defenv (and probably #!defenvs) usability with #!ifdef. In the scenario below, if the environmental variable WITH_DEBUGGER is not defined, then Kamailio will fail to start, thus the #!ifdef is somewhat limited. It makes sense for scenarios where someone might toggle the setting editing the config file, but it would be very convenient to toggle the environmental variable instead, particularly in containerized environments. Any thoughts on how best to control this? #!defenv WITH_DEBUGGER #!ifdef WITH_DEBUGGER loadmodule "debugger" . . . #!endif *Ben Kaufman* *From:* Daniel-Constantin Mierla <miconda@gmail.com> <mailto:miconda@gmail.com> *Sent:* Monday, December 6, 2021 3:55 AM *To:* Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org> <mailto:sr-users@lists.kamailio.org>; Ben Kaufman <bkaufman@nexvortex.com> <mailto:bkaufman@nexvortex.com> *Subject:* Re: [SR-Users] Unquoted values from #!defenv Hello, #!substdef does not set the value inside quoted string, it replaces inside a string value, so it does not put quotes around replacement part. So it does it it is written in the docs. There is #!substdefs witch can create a define with quoted value. Note that defines are standalone-token replacement, you can define an ID to a number, to a keyword (e.g., src_ip), to a quoted string or even a multi-line script snippet, like: #!define IDLOOP $var(i) = 0; \ while($var(i)<5) { \ xlog("++++ $var(i)\n"); \ $var(i) = $var(i) + 1; \ } See the core cookbook for more details. Anyhow, as using env variable values as quoted string is useful and setting them with quotes might look odd, I added #!defenvs: * https://www.kamailio.org/wiki/cookbooks/devel/core#defenvs <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2Fdevel%2Fcore%23defenvs&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075326626%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=nIrsUUO%2Bn8zUzUxCfm9T%2BqLC6HzHPIxDTS80bKGq95w%3D&reserved=0> Cheers, Daniel On 30.11.21 22:40, Ben Kaufman wrote: Hello all, Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is “It is a simplified alternative of using *#!substdef* with *$env(NAME)* in the replacement part.” But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement? I’m aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I’m just trying to understand the usage of the #!defenv feature. #!KAMAILIO ## Tested in 5.5.2 loadmodule "xlog" loadmodule "pv" loadmodule "evrexec" modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;") #!defenv HOME request_route{ forward(); } event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); } *Ben Kaufman* __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions * sr-users@lists.kamailio.org 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 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075336581%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=tl%2Fk0oCQduWOvBdvH0C2qrxw6I7yXIedBiS8Hf7%2B1f0%3D&reserved=0> -- Daniel-Constantin Mierla -- www.asipto.com <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075336581%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=CFCz9vV5ZCrh1S%2FY7sKBCQnQThMy1H0IdTutAz8Hpxo%3D&reserved=0> www.twitter.com/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075336581%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=QdFDXyCLTvKg9Us3eTMPknGYNfEnmDsvu4%2FGuSbb0aE%3D&reserved=0> -- www.linkedin.com/in/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075346539%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=y70uIREpgVVhHUbroEgWJDt1wLSvEhcOVEamALZQZ%2FY%3D&reserved=0> Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075346539%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=djC3bOEHvHDsIhlYvTQclAF8UmvMmoChVQebVESpRyE%3D&reserved=0>
-- Daniel-Constantin Mierla -- www.asipto.com https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075356493%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=uV38pnwyW4qvqgBhUvb2MMBQCgFSOpR4Kvf7jtunJJc%3D&reserved=0 www.twitter.com/miconda https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075356493%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=kPowGpbkXXlkChx6hkjBnLgOWOlFYUQe4%2Fyx7l7mfrk%3D&reserved=0 -- www.linkedin.com/in/miconda https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075366462%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=kpktAHVWC7m6pVL9tXQMA2D4DaomCkja7%2FDrzS4xX8s%3D&reserved=0 Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C1aca7b0156bf4d96bc9508d9b9941bbd%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637744868075366462%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ji3uac4U67Gsdj4%2BOpYPWR762fo1qlPNVtrADJDBCMY%3D&reserved=0
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone)
Thank you. It's tested and working with this simple config:
#!KAMAILIO
loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
#!defenv HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Regards,
Kaufman
From: Daniel-Constantin Mierla miconda@gmail.com Sent: Thursday, December 9, 2021 3:55 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org; Ben Kaufman bkaufman@bcmone.com Subject: Re: [SR-Users] Unquoted values from #!defenv
I pushed the code to enclose the value in between quotes. Can you test and see if works now?
Cheers, Daniel On 08.12.21 19:07, Daniel-Constantin Mierla wrote:
I expected the quoted mode parameter does the work -- I will check and push the update.
Regarding support for undefined env values, maybe add something like #!trydefenv, because I find #!defenv useful at is it, to be used when the env variable must be set for proper working of kamailio (e.g., DB url) and fail to start if not set.
Cheers, Daniel On 08.12.21 17:17, Ben Kaufman wrote: Daniel,
Is the #!defenvs feature still a work in progress? I wrote a change to add #!defenvn and #!defenvns to allow for undefined environmental variables, and noticed that the string quoting on #!defenvs doesn't do anything except log the quoting mode in /src/core/ pp_define_set(). Ben Kaufman Sr. VoIP Engineer P: E: bkaufman@bcmone.commailto:bkaufman@bcmone.com 24 hour client support: 855.639.6300tel:+18556396300
From: sr-users sr-users-bounces@lists.kamailio.orgmailto:sr-users-bounces@lists.kamailio.org On Behalf Of Ben Kaufman Sent: Tuesday, December 7, 2021 9:12 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org Subject: Re: [SR-Users] Unquoted values from #!defenv
Thank you. I've been using -A to set values thus far as CMD arguments to the container's ENTRYPOINT. If submitting a pull request, would it be preferrable to allow #!defenv/#!defenvs to accept undefined values, or to add new keywords like #!ifdefenv/#!ifdefenvs ?
Ben Kaufman
From: Daniel-Constantin Mierla <miconda@gmail.commailto:miconda@gmail.com> Sent: Tuesday, December 7, 2021 2:22 AM To: Ben Kaufman <bkaufman@bcmone.commailto:bkaufman@bcmone.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Subject: Re: [SR-Users] Unquoted values from #!defenv
The current behaviour targets the use of existing values from the environment variables. If you need other kind of features, you can propose pull requests. Or you can eventually have a start script that sets defines with -A cli parameter based on env variables.
Cheers, Daniel On 06.12.21 21:56, Ben Kaufman wrote: Thank you :)
A follow up question would be on the usability of the #!defenv (and probably #!defenvs) usability with #!ifdef. In the scenario below, if the environmental variable WITH_DEBUGGER is not defined, then Kamailio will fail to start, thus the #!ifdef is somewhat limited. It makes sense for scenarios where someone might toggle the setting editing the config file, but it would be very convenient to toggle the environmental variable instead, particularly in containerized environments. Any thoughts on how best to control this?
#!defenv WITH_DEBUGGER
#!ifdef WITH_DEBUGGER loadmodule "debugger" . . . #!endif
Ben Kaufman
From: Daniel-Constantin Mierla miconda@gmail.commailto:miconda@gmail.com Sent: Monday, December 6, 2021 3:55 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org; Ben Kaufman bkaufman@nexvortex.commailto:bkaufman@nexvortex.com Subject: Re: [SR-Users] Unquoted values from #!defenv
Hello,
#!substdef does not set the value inside quoted string, it replaces inside a string value, so it does not put quotes around replacement part. So it does it it is written in the docs. There is #!substdefs witch can create a define with quoted value.
Note that defines are standalone-token replacement, you can define an ID to a number, to a keyword (e.g., src_ip), to a quoted string or even a multi-line script snippet, like:
#!define IDLOOP $var(i) = 0; \ while($var(i)<5) { \ xlog("++++ $var(i)\n"); \ $var(i) = $var(i) + 1; \ }
See the core cookbook for more details.
Anyhow, as using env variable values as quoted string is useful and setting them with quotes might look odd, I added #!defenvs:
* https://www.kamailio.org/wiki/cookbooks/devel/core#defenvshttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2Fdevel%2Fcore%23defenvs&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128674863%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=9d81Vu%2FH5XERc4ct6lzKWQYFfAqTM4gocdKD85cXclw%3D&reserved=0
Cheers, Daniel On 30.11.21 22:40, Ben Kaufman wrote: Hello all,
Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is "It is a simplified alternative of using #!substdef with $env(NAME) in the replacement part." But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement?
I'm aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I'm just trying to understand the usage of the #!defenv feature.
#!KAMAILIO ## Tested in 5.5.2 loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
#!defenv HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Ben Kaufman
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128674863%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=1aEln9FgnvaQXsr1Wss%2FaQ%2BnswpBHq4MIroBz6qlV2o%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128684825%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=PbG5llNVBXnJc8Fcc7E%2FXpadFK2mjZWxFs0kvSgyhUk%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128694783%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=er8O94mouFO4m5OHcf3TTRHGfUFuG3%2F2B%2BFEVrc53%2Bc%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128694783%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=DeEDkZgUBe3n2TGaABFc%2B55%2FuS2fth7N9tAAxeiSFNo%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128704733%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=4LaE%2F36uF6DzVCe%2BhuYu5Zg5IMz69d4nPwSeY8teofk%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128704733%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dKYae0ykIvom2lMaONUAZqhp8x3L%2Fz%2F4uZi4vhXBE1g%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128714689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=rBuNGZ%2FTI9B00kQY2Y0CwG3NJXR%2BVDyB0eOWZ9nWs1w%3D&reserved=0
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128714689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=zU1iJ%2B2upS0T3Na1NTFKs%2BOpG3zdBekfoP%2B76jLq%2BLI%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128724644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=j12CODvcrVP3pgFUfvGF%2F7yFz3w4VYKVBjMFiP8nfLA%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128724644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ha2jvz9MJg3lXB5SIk0za7AaqybhEtSPrLBV9YzfiNk%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128734601%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=8WhFiOVmFPvJWGNKt%2Brx7tMyiDQAEKQberi3X8fzQFw%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128744557%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=cIoP6XrSx967nOstB2bPihL7wFfuDSzjXwGfg505Sy4%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128744557%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=x1xJQspvFwZL367XcM75INoWIOwgn8DWRPtlskzbB5g%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128754515%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=o6Iy%2BLubXZTQi6NcWHC4yL81cUhp2lNfSEr3OarZVo8%3D&reserved=0
It does appear that #!devenvs subsequently has problems if the environmental variable is already quoted, though. I'll put together an example and open a ticket for it.
From: Ben Kaufman Sent: Thursday, December 9, 2021 8:57 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: RE: [SR-Users] Unquoted values from #!defenv
Thank you. It's tested and working with this simple config:
#!KAMAILIO
loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
#!defenv HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Regards,
Kaufman
From: Daniel-Constantin Mierla <miconda@gmail.commailto:miconda@gmail.com> Sent: Thursday, December 9, 2021 3:55 AM To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org>; Ben Kaufman <bkaufman@bcmone.commailto:bkaufman@bcmone.com> Subject: Re: [SR-Users] Unquoted values from #!defenv
I pushed the code to enclose the value in between quotes. Can you test and see if works now?
Cheers, Daniel On 08.12.21 19:07, Daniel-Constantin Mierla wrote:
I expected the quoted mode parameter does the work -- I will check and push the update.
Regarding support for undefined env values, maybe add something like #!trydefenv, because I find #!defenv useful at is it, to be used when the env variable must be set for proper working of kamailio (e.g., DB url) and fail to start if not set.
Cheers, Daniel On 08.12.21 17:17, Ben Kaufman wrote: Daniel,
Is the #!defenvs feature still a work in progress? I wrote a change to add #!defenvn and #!defenvns to allow for undefined environmental variables, and noticed that the string quoting on #!defenvs doesn't do anything except log the quoting mode in /src/core/ pp_define_set(). Ben Kaufman Sr. VoIP Engineer P: E: bkaufman@bcmone.commailto:bkaufman@bcmone.com 24 hour client support: 855.639.6300tel:+18556396300
From: sr-users sr-users-bounces@lists.kamailio.orgmailto:sr-users-bounces@lists.kamailio.org On Behalf Of Ben Kaufman Sent: Tuesday, December 7, 2021 9:12 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org Subject: Re: [SR-Users] Unquoted values from #!defenv
Thank you. I've been using -A to set values thus far as CMD arguments to the container's ENTRYPOINT. If submitting a pull request, would it be preferrable to allow #!defenv/#!defenvs to accept undefined values, or to add new keywords like #!ifdefenv/#!ifdefenvs ?
Ben Kaufman
From: Daniel-Constantin Mierla <miconda@gmail.commailto:miconda@gmail.com> Sent: Tuesday, December 7, 2021 2:22 AM To: Ben Kaufman <bkaufman@bcmone.commailto:bkaufman@bcmone.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Subject: Re: [SR-Users] Unquoted values from #!defenv
The current behaviour targets the use of existing values from the environment variables. If you need other kind of features, you can propose pull requests. Or you can eventually have a start script that sets defines with -A cli parameter based on env variables.
Cheers, Daniel On 06.12.21 21:56, Ben Kaufman wrote: Thank you :)
A follow up question would be on the usability of the #!defenv (and probably #!defenvs) usability with #!ifdef. In the scenario below, if the environmental variable WITH_DEBUGGER is not defined, then Kamailio will fail to start, thus the #!ifdef is somewhat limited. It makes sense for scenarios where someone might toggle the setting editing the config file, but it would be very convenient to toggle the environmental variable instead, particularly in containerized environments. Any thoughts on how best to control this?
#!defenv WITH_DEBUGGER
#!ifdef WITH_DEBUGGER loadmodule "debugger" . . . #!endif
Ben Kaufman
From: Daniel-Constantin Mierla miconda@gmail.commailto:miconda@gmail.com Sent: Monday, December 6, 2021 3:55 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org; Ben Kaufman bkaufman@nexvortex.commailto:bkaufman@nexvortex.com Subject: Re: [SR-Users] Unquoted values from #!defenv
Hello,
#!substdef does not set the value inside quoted string, it replaces inside a string value, so it does not put quotes around replacement part. So it does it it is written in the docs. There is #!substdefs witch can create a define with quoted value.
Note that defines are standalone-token replacement, you can define an ID to a number, to a keyword (e.g., src_ip), to a quoted string or even a multi-line script snippet, like:
#!define IDLOOP $var(i) = 0; \ while($var(i)<5) { \ xlog("++++ $var(i)\n"); \ $var(i) = $var(i) + 1; \ }
See the core cookbook for more details.
Anyhow, as using env variable values as quoted string is useful and setting them with quotes might look odd, I added #!defenvs:
* https://www.kamailio.org/wiki/cookbooks/devel/core#defenvshttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2Fdevel%2Fcore%23defenvs&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128674863%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=9d81Vu%2FH5XERc4ct6lzKWQYFfAqTM4gocdKD85cXclw%3D&reserved=0
Cheers, Daniel On 30.11.21 22:40, Ben Kaufman wrote: Hello all,
Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is "It is a simplified alternative of using #!substdef with $env(NAME) in the replacement part." But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement?
I'm aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I'm just trying to understand the usage of the #!defenv feature.
#!KAMAILIO ## Tested in 5.5.2 loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
#!defenv HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Ben Kaufman
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128674863%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=1aEln9FgnvaQXsr1Wss%2FaQ%2BnswpBHq4MIroBz6qlV2o%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128684825%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=PbG5llNVBXnJc8Fcc7E%2FXpadFK2mjZWxFs0kvSgyhUk%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128694783%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=er8O94mouFO4m5OHcf3TTRHGfUFuG3%2F2B%2BFEVrc53%2Bc%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128694783%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=DeEDkZgUBe3n2TGaABFc%2B55%2FuS2fth7N9tAAxeiSFNo%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128704733%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=4LaE%2F36uF6DzVCe%2BhuYu5Zg5IMz69d4nPwSeY8teofk%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128704733%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dKYae0ykIvom2lMaONUAZqhp8x3L%2Fz%2F4uZi4vhXBE1g%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128714689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=rBuNGZ%2FTI9B00kQY2Y0CwG3NJXR%2BVDyB0eOWZ9nWs1w%3D&reserved=0
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128714689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=zU1iJ%2B2upS0T3Na1NTFKs%2BOpG3zdBekfoP%2B76jLq%2BLI%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128724644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=j12CODvcrVP3pgFUfvGF%2F7yFz3w4VYKVBjMFiP8nfLA%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128724644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ha2jvz9MJg3lXB5SIk0za7AaqybhEtSPrLBV9YzfiNk%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128734601%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=8WhFiOVmFPvJWGNKt%2Brx7tMyiDQAEKQberi3X8fzQFw%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128744557%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=cIoP6XrSx967nOstB2bPihL7wFfuDSzjXwGfg505Sy4%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128744557%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=x1xJQspvFwZL367XcM75INoWIOwgn8DWRPtlskzbB5g%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128754515%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=o6Iy%2BLubXZTQi6NcWHC4yL81cUhp2lNfSEr3OarZVo8%3D&reserved=0
If the value is already quoted, then #!devenv should be used, that's the reason there are two variants to take it as it is or surround with quotes.
Cheers, Daniel
On 09.12.21 17:50, Ben Kaufman wrote:
It does appear that #!devenvs subsequently has problems if the environmental variable is already quoted, though. I’ll put together an example and open a ticket for it.
*From:* Ben Kaufman *Sent:* Thursday, December 9, 2021 8:57 AM *To:* Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org *Subject:* RE: [SR-Users] Unquoted values from #!defenv
Thank you. It’s tested and working with this simple config:
#!KAMAILIO
loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
#!defenv HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Regards,
Kaufman
*From:* Daniel-Constantin Mierla miconda@gmail.com *Sent:* Thursday, December 9, 2021 3:55 AM *To:* Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org; Ben Kaufman bkaufman@bcmone.com *Subject:* Re: [SR-Users] Unquoted values from #!defenv
I pushed the code to enclose the value in between quotes. Can you test and see if works now?
Cheers, Daniel
On 08.12.21 19:07, Daniel-Constantin Mierla wrote:
I expected the quoted mode parameter does the work -- I will check and push the update. Regarding support for undefined env values, maybe add something like #!trydefenv, because I find #!defenv useful at is it, to be used when the env variable must be set for proper working of kamailio (e.g., DB url) and fail to start if not set. Cheers, Daniel On 08.12.21 17:17, Ben Kaufman wrote: Daniel, Is the #!defenvs feature still a work in progress? I wrote a change to add #!defenvn and #!defenvns to allow for undefined environmental variables, and noticed that the string quoting on #!defenvs doesn’t do anything except log the quoting mode in /src/core/ pp_define_set(). *Ben Kaufman* /Sr. VoIP Engineer/ P: E: bkaufman@bcmone.com 24 hour client support: 855.639.6300 <tel:+18556396300> *From:* sr-users <sr-users-bounces@lists.kamailio.org> <mailto:sr-users-bounces@lists.kamailio.org> *On Behalf Of *Ben Kaufman *Sent:* Tuesday, December 7, 2021 9:12 AM *To:* Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org> <mailto:sr-users@lists.kamailio.org> *Subject:* Re: [SR-Users] Unquoted values from #!defenv Thank you. I’ve been using -A to set values thus far as CMD arguments to the container’s ENTRYPOINT. If submitting a pull request, would it be preferrable to allow #!defenv/#!defenvs to accept undefined values, or to add new keywords like #!ifdefenv/#!ifdefenvs ? *Ben Kaufman* *From:* Daniel-Constantin Mierla <miconda@gmail.com> *Sent:* Tuesday, December 7, 2021 2:22 AM *To:* Ben Kaufman <bkaufman@bcmone.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org> *Subject:* Re: [SR-Users] Unquoted values from #!defenv The current behaviour targets the use of existing values from the environment variables. If you need other kind of features, you can propose pull requests. Or you can eventually have a start script that sets defines with -A cli parameter based on env variables. Cheers, Daniel On 06.12.21 21:56, Ben Kaufman wrote: Thank you :) A follow up question would be on the usability of the #!defenv (and probably #!defenvs) usability with #!ifdef. In the scenario below, if the environmental variable WITH_DEBUGGER is not defined, then Kamailio will fail to start, thus the #!ifdef is somewhat limited. It makes sense for scenarios where someone might toggle the setting editing the config file, but it would be very convenient to toggle the environmental variable instead, particularly in containerized environments. Any thoughts on how best to control this? #!defenv WITH_DEBUGGER #!ifdef WITH_DEBUGGER loadmodule "debugger" . . . #!endif *Ben Kaufman* *From:* Daniel-Constantin Mierla <miconda@gmail.com> <mailto:miconda@gmail.com> *Sent:* Monday, December 6, 2021 3:55 AM *To:* Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org> <mailto:sr-users@lists.kamailio.org>; Ben Kaufman <bkaufman@nexvortex.com> <mailto:bkaufman@nexvortex.com> *Subject:* Re: [SR-Users] Unquoted values from #!defenv Hello, #!substdef does not set the value inside quoted string, it replaces inside a string value, so it does not put quotes around replacement part. So it does it it is written in the docs. There is #!substdefs witch can create a define with quoted value. Note that defines are standalone-token replacement, you can define an ID to a number, to a keyword (e.g., src_ip), to a quoted string or even a multi-line script snippet, like: #!define IDLOOP $var(i) = 0; \ while($var(i)<5) { \ xlog("++++ $var(i)\n"); \ $var(i) = $var(i) + 1; \ } See the core cookbook for more details. Anyhow, as using env variable values as quoted string is useful and setting them with quotes might look odd, I added #!defenvs: * https://www.kamailio.org/wiki/cookbooks/devel/core#defenvs <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2Fdevel%2Fcore%23defenvs&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128674863%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=9d81Vu%2FH5XERc4ct6lzKWQYFfAqTM4gocdKD85cXclw%3D&reserved=0> Cheers, Daniel On 30.11.21 22:40, Ben Kaufman wrote: Hello all, Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is “It is a simplified alternative of using *#!substdef* with *$env(NAME)* in the replacement part.” But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement? I’m aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I’m just trying to understand the usage of the #!defenv feature. #!KAMAILIO ## Tested in 5.5.2 loadmodule "xlog" loadmodule "pv" loadmodule "evrexec" modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;") #!defenv HOME request_route{ forward(); } event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); } *Ben Kaufman* __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions * sr-users@lists.kamailio.org 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 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128674863%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=1aEln9FgnvaQXsr1Wss%2FaQ%2BnswpBHq4MIroBz6qlV2o%3D&reserved=0> -- Daniel-Constantin Mierla -- www.asipto.com <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128684825%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=eR5%2B8tdi0htF1nwYGGza6q2XPwgEboDtDa0ZJElgEvw%3D&reserved=0> www.twitter.com/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128684825%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=PbG5llNVBXnJc8Fcc7E%2FXpadFK2mjZWxFs0kvSgyhUk%3D&reserved=0> -- www.linkedin.com/in/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128694783%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=er8O94mouFO4m5OHcf3TTRHGfUFuG3%2F2B%2BFEVrc53%2Bc%3D&reserved=0> Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128694783%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=DeEDkZgUBe3n2TGaABFc%2B55%2FuS2fth7N9tAAxeiSFNo%3D&reserved=0> -- Daniel-Constantin Mierla -- www.asipto.com <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128704733%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=VkMzsj6pd0pfEtfY2BxfyOTTyUX%2BxPPY0Np2rV5oXGE%3D&reserved=0> www.twitter.com/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128704733%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=4LaE%2F36uF6DzVCe%2BhuYu5Zg5IMz69d4nPwSeY8teofk%3D&reserved=0> -- www.linkedin.com/in/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128704733%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dKYae0ykIvom2lMaONUAZqhp8x3L%2Fz%2F4uZi4vhXBE1g%3D&reserved=0> Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128714689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=rBuNGZ%2FTI9B00kQY2Y0CwG3NJXR%2BVDyB0eOWZ9nWs1w%3D&reserved=0> __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions * sr-users@lists.kamailio.org 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 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128714689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=zU1iJ%2B2upS0T3Na1NTFKs%2BOpG3zdBekfoP%2B76jLq%2BLI%3D&reserved=0> -- Daniel-Constantin Mierla -- www.asipto.com <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128724644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=hcUogqm2%2BFuUZOI5pF6c14V4YiosZfPEOA7kx96G46w%3D&reserved=0> www.twitter.com/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128724644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=j12CODvcrVP3pgFUfvGF%2F7yFz3w4VYKVBjMFiP8nfLA%3D&reserved=0> -- www.linkedin.com/in/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128724644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ha2jvz9MJg3lXB5SIk0za7AaqybhEtSPrLBV9YzfiNk%3D&reserved=0> Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128734601%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=8WhFiOVmFPvJWGNKt%2Brx7tMyiDQAEKQberi3X8fzQFw%3D&reserved=0>
-- Daniel-Constantin Mierla -- www.asipto.com https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128734601%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=I%2FVyekNXiGlr%2FBMAC0qP%2BEwcEuch5Qp5h1wWdfzrgDg%3D&reserved=0 www.twitter.com/miconda https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128744557%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=cIoP6XrSx967nOstB2bPihL7wFfuDSzjXwGfg505Sy4%3D&reserved=0 -- www.linkedin.com/in/miconda https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128744557%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=x1xJQspvFwZL367XcM75INoWIOwgn8DWRPtlskzbB5g%3D&reserved=0 Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128754515%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=o6Iy%2BLubXZTQi6NcWHC4yL81cUhp2lNfSEr3OarZVo8%3D&reserved=0
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
The example snippet you gave is with #!devenv, not with #!devenvs. Is it what you tested in this case?
Cheers, Daniel
On 09.12.21 15:57, Ben Kaufman wrote:
Thank you. It’s tested and working with this simple config:
#!KAMAILIO
loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
c HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Regards,
Kaufman
*From:* Daniel-Constantin Mierla miconda@gmail.com *Sent:* Thursday, December 9, 2021 3:55 AM *To:* Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org; Ben Kaufman bkaufman@bcmone.com *Subject:* Re: [SR-Users] Unquoted values from #!defenv
I pushed the code to enclose the value in between quotes. Can you test and see if works now?
Cheers, Daniel
On 08.12.21 19:07, Daniel-Constantin Mierla wrote:
I expected the quoted mode parameter does the work -- I will check and push the update. Regarding support for undefined env values, maybe add something like #!trydefenv, because I find #!defenv useful at is it, to be used when the env variable must be set for proper working of kamailio (e.g., DB url) and fail to start if not set. Cheers, Daniel On 08.12.21 17:17, Ben Kaufman wrote: Daniel, Is the #!defenvs feature still a work in progress? I wrote a change to add #!defenvn and #!defenvns to allow for undefined environmental variables, and noticed that the string quoting on #!defenvs doesn’t do anything except log the quoting mode in /src/core/ pp_define_set(). *Ben Kaufman* /Sr. VoIP Engineer/ P: E: bkaufman@bcmone.com 24 hour client support: 855.639.6300 <tel:+18556396300> *From:* sr-users <sr-users-bounces@lists.kamailio.org> <mailto:sr-users-bounces@lists.kamailio.org> *On Behalf Of *Ben Kaufman *Sent:* Tuesday, December 7, 2021 9:12 AM *To:* Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org> <mailto:sr-users@lists.kamailio.org> *Subject:* Re: [SR-Users] Unquoted values from #!defenv Thank you. I’ve been using -A to set values thus far as CMD arguments to the container’s ENTRYPOINT. If submitting a pull request, would it be preferrable to allow #!defenv/#!defenvs to accept undefined values, or to add new keywords like #!ifdefenv/#!ifdefenvs ? *Ben Kaufman* *From:* Daniel-Constantin Mierla <miconda@gmail.com> *Sent:* Tuesday, December 7, 2021 2:22 AM *To:* Ben Kaufman <bkaufman@bcmone.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org> *Subject:* Re: [SR-Users] Unquoted values from #!defenv The current behaviour targets the use of existing values from the environment variables. If you need other kind of features, you can propose pull requests. Or you can eventually have a start script that sets defines with -A cli parameter based on env variables. Cheers, Daniel On 06.12.21 21:56, Ben Kaufman wrote: Thank you :) A follow up question would be on the usability of the #!defenv (and probably #!defenvs) usability with #!ifdef. In the scenario below, if the environmental variable WITH_DEBUGGER is not defined, then Kamailio will fail to start, thus the #!ifdef is somewhat limited. It makes sense for scenarios where someone might toggle the setting editing the config file, but it would be very convenient to toggle the environmental variable instead, particularly in containerized environments. Any thoughts on how best to control this? #!defenv WITH_DEBUGGER #!ifdef WITH_DEBUGGER loadmodule "debugger" . . . #!endif *Ben Kaufman* *From:* Daniel-Constantin Mierla <miconda@gmail.com> <mailto:miconda@gmail.com> *Sent:* Monday, December 6, 2021 3:55 AM *To:* Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org> <mailto:sr-users@lists.kamailio.org>; Ben Kaufman <bkaufman@nexvortex.com> <mailto:bkaufman@nexvortex.com> *Subject:* Re: [SR-Users] Unquoted values from #!defenv Hello, #!substdef does not set the value inside quoted string, it replaces inside a string value, so it does not put quotes around replacement part. So it does it it is written in the docs. There is #!substdefs witch can create a define with quoted value. Note that defines are standalone-token replacement, you can define an ID to a number, to a keyword (e.g., src_ip), to a quoted string or even a multi-line script snippet, like: #!define IDLOOP $var(i) = 0; \ while($var(i)<5) { \ xlog("++++ $var(i)\n"); \ $var(i) = $var(i) + 1; \ } See the core cookbook for more details. Anyhow, as using env variable values as quoted string is useful and setting them with quotes might look odd, I added #!defenvs: * https://www.kamailio.org/wiki/cookbooks/devel/core#defenvs <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2Fdevel%2Fcore%23defenvs&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128674863%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=9d81Vu%2FH5XERc4ct6lzKWQYFfAqTM4gocdKD85cXclw%3D&reserved=0> Cheers, Daniel On 30.11.21 22:40, Ben Kaufman wrote: Hello all, Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is “It is a simplified alternative of using *#!substdef* with *$env(NAME)* in the replacement part.” But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement? I’m aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I’m just trying to understand the usage of the #!defenv feature. #!KAMAILIO ## Tested in 5.5.2 loadmodule "xlog" loadmodule "pv" loadmodule "evrexec" modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;") #!defenv HOME request_route{ forward(); } event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); } *Ben Kaufman* __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions * sr-users@lists.kamailio.org 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 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128674863%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=1aEln9FgnvaQXsr1Wss%2FaQ%2BnswpBHq4MIroBz6qlV2o%3D&reserved=0> -- Daniel-Constantin Mierla -- www.asipto.com <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128684825%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=eR5%2B8tdi0htF1nwYGGza6q2XPwgEboDtDa0ZJElgEvw%3D&reserved=0> www.twitter.com/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128684825%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=PbG5llNVBXnJc8Fcc7E%2FXpadFK2mjZWxFs0kvSgyhUk%3D&reserved=0> -- www.linkedin.com/in/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128694783%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=er8O94mouFO4m5OHcf3TTRHGfUFuG3%2F2B%2BFEVrc53%2Bc%3D&reserved=0> Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128694783%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=DeEDkZgUBe3n2TGaABFc%2B55%2FuS2fth7N9tAAxeiSFNo%3D&reserved=0> -- Daniel-Constantin Mierla -- www.asipto.com <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128704733%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=VkMzsj6pd0pfEtfY2BxfyOTTyUX%2BxPPY0Np2rV5oXGE%3D&reserved=0> www.twitter.com/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128704733%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=4LaE%2F36uF6DzVCe%2BhuYu5Zg5IMz69d4nPwSeY8teofk%3D&reserved=0> -- www.linkedin.com/in/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128704733%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dKYae0ykIvom2lMaONUAZqhp8x3L%2Fz%2F4uZi4vhXBE1g%3D&reserved=0> Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128714689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=rBuNGZ%2FTI9B00kQY2Y0CwG3NJXR%2BVDyB0eOWZ9nWs1w%3D&reserved=0> __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions * sr-users@lists.kamailio.org 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 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128714689%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=zU1iJ%2B2upS0T3Na1NTFKs%2BOpG3zdBekfoP%2B76jLq%2BLI%3D&reserved=0> -- Daniel-Constantin Mierla -- www.asipto.com <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128724644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=hcUogqm2%2BFuUZOI5pF6c14V4YiosZfPEOA7kx96G46w%3D&reserved=0> www.twitter.com/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128724644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=j12CODvcrVP3pgFUfvGF%2F7yFz3w4VYKVBjMFiP8nfLA%3D&reserved=0> -- www.linkedin.com/in/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128724644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ha2jvz9MJg3lXB5SIk0za7AaqybhEtSPrLBV9YzfiNk%3D&reserved=0> Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128734601%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=8WhFiOVmFPvJWGNKt%2Brx7tMyiDQAEKQberi3X8fzQFw%3D&reserved=0>
-- Daniel-Constantin Mierla -- www.asipto.com https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128734601%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=I%2FVyekNXiGlr%2FBMAC0qP%2BEwcEuch5Qp5h1wWdfzrgDg%3D&reserved=0 www.twitter.com/miconda https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128744557%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=cIoP6XrSx967nOstB2bPihL7wFfuDSzjXwGfg505Sy4%3D&reserved=0 -- www.linkedin.com/in/miconda https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128744557%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=x1xJQspvFwZL367XcM75INoWIOwgn8DWRPtlskzbB5g%3D&reserved=0 Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C7f2519a79bfe44fe14b108d9baf9fcfc%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746405128754515%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=o6Iy%2BLubXZTQi6NcWHC4yL81cUhp2lNfSEr3OarZVo8%3D&reserved=0
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Sorry, I noticed the file discrepancy after sending the email. I did make sure to retest with #!defenvs and it does work.
With regards to quoted/unquoted envvars, I'm not expecting that a quoted environmental variable would do anything with the quotes, but right now, Kamailio will fail to start when using #!defenvs with a quoted variable. If I set:
export FOO= ""bar""
and use:
#!defenvs FOO
Kamailio will fail to start. I would expect it to have literal quotes in the string.
Ben Kaufman Sr. VoIP Engineer P: E: bkaufman@bcmone.commailto:bkaufman@bcmone.com 24 hour client support: 855.639.6300tel:+18556396300
From: Daniel-Constantin Mierla miconda@gmail.com Sent: Thursday, December 9, 2021 11:02 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org; Ben Kaufman bkaufman@bcmone.com Subject: Re: [SR-Users] Unquoted values from #!defenv
The example snippet you gave is with #!devenv, not with #!devenvs. Is it what you tested in this case?
Cheers, Daniel On 09.12.21 15:57, Ben Kaufman wrote: Thank you. It's tested and working with this simple config:
#!KAMAILIO
loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
c HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Regards,
Kaufman
From: Daniel-Constantin Mierla miconda@gmail.commailto:miconda@gmail.com Sent: Thursday, December 9, 2021 3:55 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org; Ben Kaufman bkaufman@bcmone.commailto:bkaufman@bcmone.com Subject: Re: [SR-Users] Unquoted values from #!defenv
I pushed the code to enclose the value in between quotes. Can you test and see if works now?
Cheers, Daniel On 08.12.21 19:07, Daniel-Constantin Mierla wrote:
I expected the quoted mode parameter does the work -- I will check and push the update.
Regarding support for undefined env values, maybe add something like #!trydefenv, because I find #!defenv useful at is it, to be used when the env variable must be set for proper working of kamailio (e.g., DB url) and fail to start if not set.
Cheers, Daniel On 08.12.21 17:17, Ben Kaufman wrote: Daniel,
Is the #!defenvs feature still a work in progress? I wrote a change to add #!defenvn and #!defenvns to allow for undefined environmental variables, and noticed that the string quoting on #!defenvs doesn't do anything except log the quoting mode in /src/core/ pp_define_set(). Ben Kaufman Sr. VoIP Engineer P: E: bkaufman@bcmone.commailto:bkaufman@bcmone.com 24 hour client support: 855.639.6300tel:+18556396300
From: sr-users sr-users-bounces@lists.kamailio.orgmailto:sr-users-bounces@lists.kamailio.org On Behalf Of Ben Kaufman Sent: Tuesday, December 7, 2021 9:12 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org Subject: Re: [SR-Users] Unquoted values from #!defenv
Thank you. I've been using -A to set values thus far as CMD arguments to the container's ENTRYPOINT. If submitting a pull request, would it be preferrable to allow #!defenv/#!defenvs to accept undefined values, or to add new keywords like #!ifdefenv/#!ifdefenvs ?
Ben Kaufman
From: Daniel-Constantin Mierla <miconda@gmail.commailto:miconda@gmail.com> Sent: Tuesday, December 7, 2021 2:22 AM To: Ben Kaufman <bkaufman@bcmone.commailto:bkaufman@bcmone.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Subject: Re: [SR-Users] Unquoted values from #!defenv
The current behaviour targets the use of existing values from the environment variables. If you need other kind of features, you can propose pull requests. Or you can eventually have a start script that sets defines with -A cli parameter based on env variables.
Cheers, Daniel On 06.12.21 21:56, Ben Kaufman wrote: Thank you :)
A follow up question would be on the usability of the #!defenv (and probably #!defenvs) usability with #!ifdef. In the scenario below, if the environmental variable WITH_DEBUGGER is not defined, then Kamailio will fail to start, thus the #!ifdef is somewhat limited. It makes sense for scenarios where someone might toggle the setting editing the config file, but it would be very convenient to toggle the environmental variable instead, particularly in containerized environments. Any thoughts on how best to control this?
#!defenv WITH_DEBUGGER
#!ifdef WITH_DEBUGGER loadmodule "debugger" . . . #!endif
Ben Kaufman
From: Daniel-Constantin Mierla miconda@gmail.commailto:miconda@gmail.com Sent: Monday, December 6, 2021 3:55 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org; Ben Kaufman bkaufman@nexvortex.commailto:bkaufman@nexvortex.com Subject: Re: [SR-Users] Unquoted values from #!defenv
Hello,
#!substdef does not set the value inside quoted string, it replaces inside a string value, so it does not put quotes around replacement part. So it does it it is written in the docs. There is #!substdefs witch can create a define with quoted value.
Note that defines are standalone-token replacement, you can define an ID to a number, to a keyword (e.g., src_ip), to a quoted string or even a multi-line script snippet, like:
#!define IDLOOP $var(i) = 0; \ while($var(i)<5) { \ xlog("++++ $var(i)\n"); \ $var(i) = $var(i) + 1; \ }
See the core cookbook for more details.
Anyhow, as using env variable values as quoted string is useful and setting them with quotes might look odd, I added #!defenvs:
* https://www.kamailio.org/wiki/cookbooks/devel/core#defenvshttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2Fdevel%2Fcore%23defenvs&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990886102%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=rzHyN6OflNNZgm1%2BnXypY01FK1VzlvMnQlOLrWJKOsQ%3D&reserved=0
Cheers, Daniel On 30.11.21 22:40, Ben Kaufman wrote: Hello all,
Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is "It is a simplified alternative of using #!substdef with $env(NAME) in the replacement part." But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement?
I'm aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I'm just trying to understand the usage of the #!defenv feature.
#!KAMAILIO ## Tested in 5.5.2 loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
#!defenv HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Ben Kaufman
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990886102%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=2NWUk3x3DCLxvb4OlaEJ8GzLrhHiWpUTVxRDca1dj%2Bk%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990896055%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=IP0%2F2k1ZMggRrbWxv3UTktcdzG0eJwazc21%2BKwgKWyM%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990906011%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dhO6eU%2Bj5WF0Vbnj%2BwfCmxncnIdhTKv4GW0ObmQ9E%2Fw%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990906011%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=kgyYXUBFZNWfxWw%2BvpEpHTGte72Y8L4rjdBGTXT59K8%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990915967%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=r1zg8PV6pOBnLBurftA4W3tXgcxmZqpGLmQTJP8Yn7w%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990915967%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=q7r01%2BF74BubqDi2XTUgX9DamSLXTaLcac%2FzvrlwY9s%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990925922%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=PkAex7o15U23zww3%2BAF4fHCK65L7KzmU9w%2Bx0M5o0RA%3D&reserved=0
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990925922%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=7ZgHLhOOBDLuCkj9pnX9PQgQh9Wenm0S0QXwfrQzJDo%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990935880%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=vph2821YA8T1rveeJyho1yZaPDuWvQ6Kc8G7m%2BC6P2Q%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990935880%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ZCh%2BwrYRRCQNRYbiY9ZwQfCXpIDboKstzohxF%2BX3h2Y%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990945838%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2FtRwCARMqZa07vuRFmvC0KgDio53Icch4IR4w77ku%2Bc%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990955800%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=6HqpCa53LJlAIGp%2FoUNzEjlh2CCLo7jlusfkmMjkqOw%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990955800%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=bm9GbJPDtqSLFPwBXWUYbfTUyj9H8hGeSJw3FnZRlvs%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990965750%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ehw6onALMvWGPIEjq4HQZxrP4muNE4r0ntazRtTtAIk%3D&reserved=0
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990965750%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=XJtCHNvDc354q25irJ6DYFUoSPPw%2FtC8nXPc0GZu3NM%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990975711%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=zTwUcRryqHHXpjH1AHfW747nOAZsFQfAqjse00GyoTc%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990975711%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=kBfvIpDAi6%2Fo7p%2ByC0tbz1AOrw4Ku2PdFp9JNOs9QkU%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990975711%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=JZMpIU65eFPz%2Bm53rjO7JXSuSFfLNfupZOGPM2%2BvJ28%3D&reserved=0
#!defines are preprocessor directives, think about them like copy+paste and then config interpreter tries to understand the config content.
As one example in the wiki, the value of a define can be even a script snippet -- see the define of IDLOOP:
* https://www.kamailio.org/wiki/cookbooks/5.5.x/core#define
Your example fails because it results in copying and surrounding the value with quotes, so the interpreter sees:
""bar""
practically, it is empty string followed by token 'bar' and followed by another empty string.
It is the expected behaviour, similar to what happens in C with #define macros. One must know what sets in the value and use the appropriate pre-processor directive.
Cheers, Daniel
On 09.12.21 18:13, Ben Kaufman wrote:
Sorry, I noticed the file discrepancy after sending the email. I did make sure to retest with #!defenvs and it does work.
With regards to quoted/unquoted envvars, I’m not expecting that a quoted environmental variable would do anything with the quotes, but right now, Kamailio will fail to start when using #!defenvs with a quoted variable. If I set:
export FOO= ""bar""
and use:
#!defenvs FOO
Kamailio will fail to start. I would expect it to have literal quotes in the string.
*Ben Kaufman*
/Sr. VoIP Engineer/
P:
E: bkaufman@bcmone.com
24 hour client support: 855.639.6300 tel:+18556396300
*From:* Daniel-Constantin Mierla miconda@gmail.com *Sent:* Thursday, December 9, 2021 11:02 AM *To:* Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org; Ben Kaufman bkaufman@bcmone.com *Subject:* Re: [SR-Users] Unquoted values from #!defenv
The example snippet you gave is with #!devenv, not with #!devenvs. Is it what you tested in this case?
Cheers, Daniel
On 09.12.21 15:57, Ben Kaufman wrote:
Thank you. It’s tested and working with this simple config: #!KAMAILIO loadmodule "xlog" loadmodule "pv" loadmodule "evrexec" modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;") c HOME request_route{ forward(); } event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); } Regards, Kaufman *From:* Daniel-Constantin Mierla <miconda@gmail.com> <mailto:miconda@gmail.com> *Sent:* Thursday, December 9, 2021 3:55 AM *To:* Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org> <mailto:sr-users@lists.kamailio.org>; Ben Kaufman <bkaufman@bcmone.com> <mailto:bkaufman@bcmone.com> *Subject:* Re: [SR-Users] Unquoted values from #!defenv I pushed the code to enclose the value in between quotes. Can you test and see if works now? Cheers, Daniel On 08.12.21 19:07, Daniel-Constantin Mierla wrote: I expected the quoted mode parameter does the work -- I will check and push the update. Regarding support for undefined env values, maybe add something like #!trydefenv, because I find #!defenv useful at is it, to be used when the env variable must be set for proper working of kamailio (e.g., DB url) and fail to start if not set. Cheers, Daniel On 08.12.21 17:17, Ben Kaufman wrote: Daniel, Is the #!defenvs feature still a work in progress? I wrote a change to add #!defenvn and #!defenvns to allow for undefined environmental variables, and noticed that the string quoting on #!defenvs doesn’t do anything except log the quoting mode in /src/core/ pp_define_set(). *Ben Kaufman* /Sr. VoIP Engineer/ P: E: bkaufman@bcmone.com 24 hour client support: 855.639.6300 <tel:+18556396300> *From:* sr-users <sr-users-bounces@lists.kamailio.org> <mailto:sr-users-bounces@lists.kamailio.org> *On Behalf Of *Ben Kaufman *Sent:* Tuesday, December 7, 2021 9:12 AM *To:* Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org> <mailto:sr-users@lists.kamailio.org> *Subject:* Re: [SR-Users] Unquoted values from #!defenv Thank you. I’ve been using -A to set values thus far as CMD arguments to the container’s ENTRYPOINT. If submitting a pull request, would it be preferrable to allow #!defenv/#!defenvs to accept undefined values, or to add new keywords like #!ifdefenv/#!ifdefenvs ? *Ben Kaufman* *From:* Daniel-Constantin Mierla <miconda@gmail.com> *Sent:* Tuesday, December 7, 2021 2:22 AM *To:* Ben Kaufman <bkaufman@bcmone.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org> *Subject:* Re: [SR-Users] Unquoted values from #!defenv The current behaviour targets the use of existing values from the environment variables. If you need other kind of features, you can propose pull requests. Or you can eventually have a start script that sets defines with -A cli parameter based on env variables. Cheers, Daniel On 06.12.21 21:56, Ben Kaufman wrote: Thank you :) A follow up question would be on the usability of the #!defenv (and probably #!defenvs) usability with #!ifdef. In the scenario below, if the environmental variable WITH_DEBUGGER is not defined, then Kamailio will fail to start, thus the #!ifdef is somewhat limited. It makes sense for scenarios where someone might toggle the setting editing the config file, but it would be very convenient to toggle the environmental variable instead, particularly in containerized environments. Any thoughts on how best to control this? #!defenv WITH_DEBUGGER #!ifdef WITH_DEBUGGER loadmodule "debugger" . . . #!endif *Ben Kaufman* *From:* Daniel-Constantin Mierla <miconda@gmail.com> <mailto:miconda@gmail.com> *Sent:* Monday, December 6, 2021 3:55 AM *To:* Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org> <mailto:sr-users@lists.kamailio.org>; Ben Kaufman <bkaufman@nexvortex.com> <mailto:bkaufman@nexvortex.com> *Subject:* Re: [SR-Users] Unquoted values from #!defenv Hello, #!substdef does not set the value inside quoted string, it replaces inside a string value, so it does not put quotes around replacement part. So it does it it is written in the docs. There is #!substdefs witch can create a define with quoted value. Note that defines are standalone-token replacement, you can define an ID to a number, to a keyword (e.g., src_ip), to a quoted string or even a multi-line script snippet, like: #!define IDLOOP $var(i) = 0; \ while($var(i)<5) { \ xlog("++++ $var(i)\n"); \ $var(i) = $var(i) + 1; \ } See the core cookbook for more details. Anyhow, as using env variable values as quoted string is useful and setting them with quotes might look odd, I added #!defenvs: * https://www.kamailio.org/wiki/cookbooks/devel/core#defenvs <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2Fdevel%2Fcore%23defenvs&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990886102%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=rzHyN6OflNNZgm1%2BnXypY01FK1VzlvMnQlOLrWJKOsQ%3D&reserved=0> Cheers, Daniel On 30.11.21 22:40, Ben Kaufman wrote: Hello all, Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is “It is a simplified alternative of using *#!substdef* with *$env(NAME)* in the replacement part.” But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement? I’m aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I’m just trying to understand the usage of the #!defenv feature. #!KAMAILIO ## Tested in 5.5.2 loadmodule "xlog" loadmodule "pv" loadmodule "evrexec" modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;") #!defenv HOME request_route{ forward(); } event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); } *Ben Kaufman* __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions * sr-users@lists.kamailio.org 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 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990886102%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=2NWUk3x3DCLxvb4OlaEJ8GzLrhHiWpUTVxRDca1dj%2Bk%3D&reserved=0> -- Daniel-Constantin Mierla -- www.asipto.com <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990896055%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=peqyJs2i3MG1EvbYtvTXhBuntpcp7mlcv96WlXQ0QrI%3D&reserved=0> www.twitter.com/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990896055%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=IP0%2F2k1ZMggRrbWxv3UTktcdzG0eJwazc21%2BKwgKWyM%3D&reserved=0> -- www.linkedin.com/in/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990906011%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dhO6eU%2Bj5WF0Vbnj%2BwfCmxncnIdhTKv4GW0ObmQ9E%2Fw%3D&reserved=0> Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990906011%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=kgyYXUBFZNWfxWw%2BvpEpHTGte72Y8L4rjdBGTXT59K8%3D&reserved=0> -- Daniel-Constantin Mierla -- www.asipto.com <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990915967%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=MtBR%2Fch0b%2BCp%2BcHB6CyDgWi1hHM4XiNCMFBi%2B4PPXHI%3D&reserved=0> www.twitter.com/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990915967%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=r1zg8PV6pOBnLBurftA4W3tXgcxmZqpGLmQTJP8Yn7w%3D&reserved=0> -- www.linkedin.com/in/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990915967%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=q7r01%2BF74BubqDi2XTUgX9DamSLXTaLcac%2FzvrlwY9s%3D&reserved=0> Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990925922%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=PkAex7o15U23zww3%2BAF4fHCK65L7KzmU9w%2Bx0M5o0RA%3D&reserved=0> __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions * sr-users@lists.kamailio.org 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 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990925922%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=7ZgHLhOOBDLuCkj9pnX9PQgQh9Wenm0S0QXwfrQzJDo%3D&reserved=0> -- Daniel-Constantin Mierla -- www.asipto.com <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990935880%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=vjpOo1IP%2FD2N%2BMSls0yYJ%2FgBzA2q7awWh8Ac9B%2FKZpk%3D&reserved=0> www.twitter.com/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990935880%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=vph2821YA8T1rveeJyho1yZaPDuWvQ6Kc8G7m%2BC6P2Q%3D&reserved=0> -- www.linkedin.com/in/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990935880%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ZCh%2BwrYRRCQNRYbiY9ZwQfCXpIDboKstzohxF%2BX3h2Y%3D&reserved=0> Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990945838%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2FtRwCARMqZa07vuRFmvC0KgDio53Icch4IR4w77ku%2Bc%3D&reserved=0> -- Daniel-Constantin Mierla -- www.asipto.com <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990945838%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=wHe2PK9V3cLvn2JfU95yQBHn6dGEPZd%2BD7cjIWKOngU%3D&reserved=0> www.twitter.com/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990955800%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=6HqpCa53LJlAIGp%2FoUNzEjlh2CCLo7jlusfkmMjkqOw%3D&reserved=0> -- www.linkedin.com/in/miconda <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990955800%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=bm9GbJPDtqSLFPwBXWUYbfTUyj9H8hGeSJw3FnZRlvs%3D&reserved=0> Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990965750%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ehw6onALMvWGPIEjq4HQZxrP4muNE4r0ntazRtTtAIk%3D&reserved=0> __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions * sr-users@lists.kamailio.org 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 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990965750%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=XJtCHNvDc354q25irJ6DYFUoSPPw%2FtC8nXPc0GZu3NM%3D&reserved=0>
-- Daniel-Constantin Mierla -- www.asipto.com https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990965750%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=TnSHmnSeswhQhNdUicYa0XnlV9ts7n0tUPyfAOl97KM%3D&reserved=0 www.twitter.com/miconda https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990975711%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=zTwUcRryqHHXpjH1AHfW747nOAZsFQfAqjse00GyoTc%3D&reserved=0 -- www.linkedin.com/in/miconda https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990975711%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=kBfvIpDAi6%2Fo7p%2ByC0tbz1AOrw4Ku2PdFp9JNOs9QkU%3D&reserved=0 Kamailio Advanced Training - Online Feb 21-24, 2022 (America Timezone) * https://www.asipto.com/sw/kamailio-advanced-training-online/ https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7Cd99fd09975ff46f9a2a808d9bb358e16%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746660990975711%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=JZMpIU65eFPz%2Bm53rjO7JXSuSFfLNfupZOGPM2%2BvJ28%3D&reserved=0
it is empty string followed by token 'bar' and followed by another empty string.
OK. It makes perfect sense when viewed that way.
Ben Kaufman Sr. VoIP Engineer P: E: bkaufman@bcmone.commailto:bkaufman@bcmone.com 24 hour client support: 855.639.6300tel:+18556396300
From: Daniel-Constantin Mierla miconda@gmail.com Sent: Thursday, December 9, 2021 12:37 PM To: Ben Kaufman bkaufman@bcmone.com; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: Re: [SR-Users] Unquoted values from #!defenv
#!defines are preprocessor directives, think about them like copy+paste and then config interpreter tries to understand the config content.
As one example in the wiki, the value of a define can be even a script snippet -- see the define of IDLOOP:
* https://www.kamailio.org/wiki/cookbooks/5.5.x/core#definehttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2F5.5.x%2Fcore%23define&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105422679%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=qPKKAp1IGiNlg38WTIaRLlBAjzxSaaCsStnwlEapa2k%3D&reserved=0
Your example fails because it results in copying and surrounding the value with quotes, so the interpreter sees:
""bar""
practically, it is empty string followed by token 'bar' and followed by another empty string.
It is the expected behaviour, similar to what happens in C with #define macros. One must know what sets in the value and use the appropriate pre-processor directive.
Cheers, Daniel On 09.12.21 18:13, Ben Kaufman wrote: Sorry, I noticed the file discrepancy after sending the email. I did make sure to retest with #!defenvs and it does work.
With regards to quoted/unquoted envvars, I'm not expecting that a quoted environmental variable would do anything with the quotes, but right now, Kamailio will fail to start when using #!defenvs with a quoted variable. If I set:
export FOO= ""bar""
and use:
#!defenvs FOO
Kamailio will fail to start. I would expect it to have literal quotes in the string.
Ben Kaufman Sr. VoIP Engineer P: E: bkaufman@bcmone.commailto:bkaufman@bcmone.com 24 hour client support: 855.639.6300tel:+18556396300
From: Daniel-Constantin Mierla miconda@gmail.commailto:miconda@gmail.com Sent: Thursday, December 9, 2021 11:02 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org; Ben Kaufman bkaufman@bcmone.commailto:bkaufman@bcmone.com Subject: Re: [SR-Users] Unquoted values from #!defenv
The example snippet you gave is with #!devenv, not with #!devenvs. Is it what you tested in this case?
Cheers, Daniel On 09.12.21 15:57, Ben Kaufman wrote: Thank you. It's tested and working with this simple config:
#!KAMAILIO
loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
c HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Regards,
Kaufman
From: Daniel-Constantin Mierla miconda@gmail.commailto:miconda@gmail.com Sent: Thursday, December 9, 2021 3:55 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org; Ben Kaufman bkaufman@bcmone.commailto:bkaufman@bcmone.com Subject: Re: [SR-Users] Unquoted values from #!defenv
I pushed the code to enclose the value in between quotes. Can you test and see if works now?
Cheers, Daniel On 08.12.21 19:07, Daniel-Constantin Mierla wrote:
I expected the quoted mode parameter does the work -- I will check and push the update.
Regarding support for undefined env values, maybe add something like #!trydefenv, because I find #!defenv useful at is it, to be used when the env variable must be set for proper working of kamailio (e.g., DB url) and fail to start if not set.
Cheers, Daniel On 08.12.21 17:17, Ben Kaufman wrote: Daniel,
Is the #!defenvs feature still a work in progress? I wrote a change to add #!defenvn and #!defenvns to allow for undefined environmental variables, and noticed that the string quoting on #!defenvs doesn't do anything except log the quoting mode in /src/core/ pp_define_set(). Ben Kaufman Sr. VoIP Engineer P: E: bkaufman@bcmone.commailto:bkaufman@bcmone.com 24 hour client support: 855.639.6300tel:+18556396300
From: sr-users sr-users-bounces@lists.kamailio.orgmailto:sr-users-bounces@lists.kamailio.org On Behalf Of Ben Kaufman Sent: Tuesday, December 7, 2021 9:12 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org Subject: Re: [SR-Users] Unquoted values from #!defenv
Thank you. I've been using -A to set values thus far as CMD arguments to the container's ENTRYPOINT. If submitting a pull request, would it be preferrable to allow #!defenv/#!defenvs to accept undefined values, or to add new keywords like #!ifdefenv/#!ifdefenvs ?
Ben Kaufman
From: Daniel-Constantin Mierla <miconda@gmail.commailto:miconda@gmail.com> Sent: Tuesday, December 7, 2021 2:22 AM To: Ben Kaufman <bkaufman@bcmone.commailto:bkaufman@bcmone.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Subject: Re: [SR-Users] Unquoted values from #!defenv
The current behaviour targets the use of existing values from the environment variables. If you need other kind of features, you can propose pull requests. Or you can eventually have a start script that sets defines with -A cli parameter based on env variables.
Cheers, Daniel On 06.12.21 21:56, Ben Kaufman wrote: Thank you :)
A follow up question would be on the usability of the #!defenv (and probably #!defenvs) usability with #!ifdef. In the scenario below, if the environmental variable WITH_DEBUGGER is not defined, then Kamailio will fail to start, thus the #!ifdef is somewhat limited. It makes sense for scenarios where someone might toggle the setting editing the config file, but it would be very convenient to toggle the environmental variable instead, particularly in containerized environments. Any thoughts on how best to control this?
#!defenv WITH_DEBUGGER
#!ifdef WITH_DEBUGGER loadmodule "debugger" . . . #!endif
Ben Kaufman
From: Daniel-Constantin Mierla miconda@gmail.commailto:miconda@gmail.com Sent: Monday, December 6, 2021 3:55 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org; Ben Kaufman bkaufman@nexvortex.commailto:bkaufman@nexvortex.com Subject: Re: [SR-Users] Unquoted values from #!defenv
Hello,
#!substdef does not set the value inside quoted string, it replaces inside a string value, so it does not put quotes around replacement part. So it does it it is written in the docs. There is #!substdefs witch can create a define with quoted value.
Note that defines are standalone-token replacement, you can define an ID to a number, to a keyword (e.g., src_ip), to a quoted string or even a multi-line script snippet, like:
#!define IDLOOP $var(i) = 0; \ while($var(i)<5) { \ xlog("++++ $var(i)\n"); \ $var(i) = $var(i) + 1; \ }
See the core cookbook for more details.
Anyhow, as using env variable values as quoted string is useful and setting them with quotes might look odd, I added #!defenvs:
* https://www.kamailio.org/wiki/cookbooks/devel/core#defenvshttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2Fdevel%2Fcore%23defenvs&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105432633%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=kPoQi1FAAtKdJ6p4hFKMzns0j3L245foom2qvyYQ5cg%3D&reserved=0
Cheers, Daniel On 30.11.21 22:40, Ben Kaufman wrote: Hello all,
Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is "It is a simplified alternative of using #!substdef with $env(NAME) in the replacement part." But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement?
I'm aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I'm just trying to understand the usage of the #!defenv feature.
#!KAMAILIO ## Tested in 5.5.2 loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
#!defenv HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Ben Kaufman
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105432633%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=KYdECn696%2BqO6OKOiIscyV9FjAs%2BJScHFsjYF0QGKhI%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105442582%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=2AeOPkXQdt%2F2OPqV2Ui6Ik7GIpZ3%2BeyTSSYtqSi7qMM%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105452547%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ulZOpsENaCh34RDV8KJvZlQePYhIyOJQBS%2FIpI7BKX0%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105452547%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=FBjIIYgrOlB6awwFZlajKx4g9NCCe0CPzjuPEYeJDYQ%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105462497%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Px5mRxIw2NnGSlgn%2Bxox4ltq%2Bm74AGTxTIsq0otYAGU%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105472461%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=hM7loHR8htM71QI0y5wE5hb7ier1A1heOVoghjew4II%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105472461%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=DleT8fyqCIZNBVs0aZmhbM7ypkYc315AqXarZh0QUGI%3D&reserved=0
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105482449%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=SPb9dAFyEFi39qMhdyRkrrPAlcZhh%2BdRaIF7bGrG36I%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105492365%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=yWY93sxQ8cLqiT0jnbGSvp5bGhHgbUEDtImoOaLDwKY%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105492365%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=6299VkjzSgp4AgdQdY7q1xpw%2FiT2IPPdQZc4tb5%2Bf7o%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105502323%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Uly85BJTLFgVTkTBkdYmJ%2FoUGBfPYhVP9e24MwE2GRg%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105512282%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=R2bCmtBYm%2BuUudzGwKbicvT%2FPb6d4sKxdGKwLD4AGvE%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105512282%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=UHfdIXcxMezmWLfjwS%2BxxjhZZeuPcQGuCOU%2F5VrX3Tw%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105512282%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=RTIUA79CKfwj7swC0VHHzshAV5P54MQOUsvWx0KV2ec%3D&reserved=0
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105522240%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=B7u1LsBUc06nlh8TsCYEOVtNLlmFxu1m6DeKg%2FEUXX8%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105532194%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=40oPJe4e%2BCYlCgCBKygQzgQ8IIq3s%2BrdGRl9ZvcMDe0%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105532194%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2FRDNmMZ%2FsuPkEiEqsEpVZeSfBRsdIsh4Z1ClLDGHh%2B0%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105542150%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=1Falmx7cgbHoccmN2d3AWvDnXtNTVSqFhf2mczFYN0c%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105552110%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Cm4Ab2e52cKotwXKe4BFAyvBcvb08fb1By%2FO3jjDz%2BI%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105552110%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Udd3U27WkyidaBZPvfLe%2FYCa1TjkiZXfTKtJg7EEmKo%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105562064%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Yfza4H7P0oenhop36olx0daRyb6BYREvY40fpNPhhz0%3D&reserved=0
And hindsight is always 20/20. The initial question was about this:
!!defenv HOME
. . .
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
$def(HOME) would work.
Ben Kaufman Sr. VoIP Engineer P: E: bkaufman@bcmone.commailto:bkaufman@bcmone.com 24 hour client support: 855.639.6300tel:+18556396300
From: Daniel-Constantin Mierla miconda@gmail.com Sent: Thursday, December 9, 2021 12:37 PM To: Ben Kaufman bkaufman@bcmone.com; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: Re: [SR-Users] Unquoted values from #!defenv
#!defines are preprocessor directives, think about them like copy+paste and then config interpreter tries to understand the config content.
As one example in the wiki, the value of a define can be even a script snippet -- see the define of IDLOOP:
* https://www.kamailio.org/wiki/cookbooks/5.5.x/core#definehttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2F5.5.x%2Fcore%23define&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105422679%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=qPKKAp1IGiNlg38WTIaRLlBAjzxSaaCsStnwlEapa2k%3D&reserved=0
Your example fails because it results in copying and surrounding the value with quotes, so the interpreter sees:
""bar""
practically, it is empty string followed by token 'bar' and followed by another empty string.
It is the expected behaviour, similar to what happens in C with #define macros. One must know what sets in the value and use the appropriate pre-processor directive.
Cheers, Daniel On 09.12.21 18:13, Ben Kaufman wrote: Sorry, I noticed the file discrepancy after sending the email. I did make sure to retest with #!defenvs and it does work.
With regards to quoted/unquoted envvars, I'm not expecting that a quoted environmental variable would do anything with the quotes, but right now, Kamailio will fail to start when using #!defenvs with a quoted variable. If I set:
export FOO= ""bar""
and use:
#!defenvs FOO
Kamailio will fail to start. I would expect it to have literal quotes in the string.
Ben Kaufman Sr. VoIP Engineer P: E: bkaufman@bcmone.commailto:bkaufman@bcmone.com 24 hour client support: 855.639.6300tel:+18556396300
From: Daniel-Constantin Mierla miconda@gmail.commailto:miconda@gmail.com Sent: Thursday, December 9, 2021 11:02 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org; Ben Kaufman bkaufman@bcmone.commailto:bkaufman@bcmone.com Subject: Re: [SR-Users] Unquoted values from #!defenv
The example snippet you gave is with #!devenv, not with #!devenvs. Is it what you tested in this case?
Cheers, Daniel On 09.12.21 15:57, Ben Kaufman wrote: Thank you. It's tested and working with this simple config:
#!KAMAILIO
loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
c HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Regards,
Kaufman
From: Daniel-Constantin Mierla miconda@gmail.commailto:miconda@gmail.com Sent: Thursday, December 9, 2021 3:55 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org; Ben Kaufman bkaufman@bcmone.commailto:bkaufman@bcmone.com Subject: Re: [SR-Users] Unquoted values from #!defenv
I pushed the code to enclose the value in between quotes. Can you test and see if works now?
Cheers, Daniel On 08.12.21 19:07, Daniel-Constantin Mierla wrote:
I expected the quoted mode parameter does the work -- I will check and push the update.
Regarding support for undefined env values, maybe add something like #!trydefenv, because I find #!defenv useful at is it, to be used when the env variable must be set for proper working of kamailio (e.g., DB url) and fail to start if not set.
Cheers, Daniel On 08.12.21 17:17, Ben Kaufman wrote: Daniel,
Is the #!defenvs feature still a work in progress? I wrote a change to add #!defenvn and #!defenvns to allow for undefined environmental variables, and noticed that the string quoting on #!defenvs doesn't do anything except log the quoting mode in /src/core/ pp_define_set(). Ben Kaufman Sr. VoIP Engineer P: E: bkaufman@bcmone.commailto:bkaufman@bcmone.com 24 hour client support: 855.639.6300tel:+18556396300
From: sr-users sr-users-bounces@lists.kamailio.orgmailto:sr-users-bounces@lists.kamailio.org On Behalf Of Ben Kaufman Sent: Tuesday, December 7, 2021 9:12 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org Subject: Re: [SR-Users] Unquoted values from #!defenv
Thank you. I've been using -A to set values thus far as CMD arguments to the container's ENTRYPOINT. If submitting a pull request, would it be preferrable to allow #!defenv/#!defenvs to accept undefined values, or to add new keywords like #!ifdefenv/#!ifdefenvs ?
Ben Kaufman
From: Daniel-Constantin Mierla <miconda@gmail.commailto:miconda@gmail.com> Sent: Tuesday, December 7, 2021 2:22 AM To: Ben Kaufman <bkaufman@bcmone.commailto:bkaufman@bcmone.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Subject: Re: [SR-Users] Unquoted values from #!defenv
The current behaviour targets the use of existing values from the environment variables. If you need other kind of features, you can propose pull requests. Or you can eventually have a start script that sets defines with -A cli parameter based on env variables.
Cheers, Daniel On 06.12.21 21:56, Ben Kaufman wrote: Thank you :)
A follow up question would be on the usability of the #!defenv (and probably #!defenvs) usability with #!ifdef. In the scenario below, if the environmental variable WITH_DEBUGGER is not defined, then Kamailio will fail to start, thus the #!ifdef is somewhat limited. It makes sense for scenarios where someone might toggle the setting editing the config file, but it would be very convenient to toggle the environmental variable instead, particularly in containerized environments. Any thoughts on how best to control this?
#!defenv WITH_DEBUGGER
#!ifdef WITH_DEBUGGER loadmodule "debugger" . . . #!endif
Ben Kaufman
From: Daniel-Constantin Mierla miconda@gmail.commailto:miconda@gmail.com Sent: Monday, December 6, 2021 3:55 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org; Ben Kaufman bkaufman@nexvortex.commailto:bkaufman@nexvortex.com Subject: Re: [SR-Users] Unquoted values from #!defenv
Hello,
#!substdef does not set the value inside quoted string, it replaces inside a string value, so it does not put quotes around replacement part. So it does it it is written in the docs. There is #!substdefs witch can create a define with quoted value.
Note that defines are standalone-token replacement, you can define an ID to a number, to a keyword (e.g., src_ip), to a quoted string or even a multi-line script snippet, like:
#!define IDLOOP $var(i) = 0; \ while($var(i)<5) { \ xlog("++++ $var(i)\n"); \ $var(i) = $var(i) + 1; \ }
See the core cookbook for more details.
Anyhow, as using env variable values as quoted string is useful and setting them with quotes might look odd, I added #!defenvs:
* https://www.kamailio.org/wiki/cookbooks/devel/core#defenvshttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fcookbooks%2Fdevel%2Fcore%23defenvs&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105432633%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=kPoQi1FAAtKdJ6p4hFKMzns0j3L245foom2qvyYQ5cg%3D&reserved=0
Cheers, Daniel On 30.11.21 22:40, Ben Kaufman wrote: Hello all,
Looking for some clarification regarding quoting and !#defenv . I understand that the example below fails because the environmental variable HOME is not quoted, thus when used in the xlog() call it fails. How is it possible to evaluate and/or use the value of the environmental variable if defined as a preprocessor variable? Looking at the documentation the reason for this directive is "It is a simplified alternative of using #!substdef with $env(NAME) in the replacement part." But #!substdef would allow setting the value inside of a quoted string, so does it really meet that requirement?
I'm aware that I could use $env(HOME) rather than a preprocessor directive of HOME. I'm just trying to understand the usage of the #!defenv feature.
#!KAMAILIO ## Tested in 5.5.2 loadmodule "xlog" loadmodule "pv" loadmodule "evrexec"
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
#!defenv HOME
request_route{ forward(); }
event_route[evrexec:timer] { xlog("L_N", "HOME: " + HOME + "\n"); }
Ben Kaufman
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105432633%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=KYdECn696%2BqO6OKOiIscyV9FjAs%2BJScHFsjYF0QGKhI%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105442582%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=2AeOPkXQdt%2F2OPqV2Ui6Ik7GIpZ3%2BeyTSSYtqSi7qMM%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105452547%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ulZOpsENaCh34RDV8KJvZlQePYhIyOJQBS%2FIpI7BKX0%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105452547%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=FBjIIYgrOlB6awwFZlajKx4g9NCCe0CPzjuPEYeJDYQ%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105462497%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Px5mRxIw2NnGSlgn%2Bxox4ltq%2Bm74AGTxTIsq0otYAGU%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105472461%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=hM7loHR8htM71QI0y5wE5hb7ier1A1heOVoghjew4II%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105472461%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=DleT8fyqCIZNBVs0aZmhbM7ypkYc315AqXarZh0QUGI%3D&reserved=0
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105482449%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=SPb9dAFyEFi39qMhdyRkrrPAlcZhh%2BdRaIF7bGrG36I%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105492365%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=yWY93sxQ8cLqiT0jnbGSvp5bGhHgbUEDtImoOaLDwKY%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105492365%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=6299VkjzSgp4AgdQdY7q1xpw%2FiT2IPPdQZc4tb5%2Bf7o%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105502323%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Uly85BJTLFgVTkTBkdYmJ%2FoUGBfPYhVP9e24MwE2GRg%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105512282%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=R2bCmtBYm%2BuUudzGwKbicvT%2FPb6d4sKxdGKwLD4AGvE%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105512282%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=UHfdIXcxMezmWLfjwS%2BxxjhZZeuPcQGuCOU%2F5VrX3Tw%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105512282%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=RTIUA79CKfwj7swC0VHHzshAV5P54MQOUsvWx0KV2ec%3D&reserved=0
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
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-usershttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105522240%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=B7u1LsBUc06nlh8TsCYEOVtNLlmFxu1m6DeKg%2FEUXX8%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105532194%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=40oPJe4e%2BCYlCgCBKygQzgQ8IIq3s%2BrdGRl9ZvcMDe0%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105532194%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2FRDNmMZ%2FsuPkEiEqsEpVZeSfBRsdIsh4Z1ClLDGHh%2B0%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105542150%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=1Falmx7cgbHoccmN2d3AWvDnXtNTVSqFhf2mczFYN0c%3D&reserved=0
--
www.twitter.com/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105552110%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Cm4Ab2e52cKotwXKe4BFAyvBcvb08fb1By%2FO3jjDz%2BI%3D&reserved=0 -- www.linkedin.com/in/micondahttps://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105552110%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Udd3U27WkyidaBZPvfLe%2FYCa1TjkiZXfTKtJg7EEmKo%3D&reserved=0
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=04%7C01%7Cbkaufman%40bcmone.com%7C3f07f4924c914761524308d9bb42d9c4%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637746718105562064%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Yfza4H7P0oenhop36olx0daRyb6BYREvY40fpNPhhz0%3D&reserved=0