That's the one, thanks @Karsten!
More info, i changed my systemd unit to execute a script when starting up,
like so:
# cat /etc/systemd/system/multi-user.target.wants/kamailio.service
[Unit]
Description=Kamailio (OpenSER) - the Open Source SIP Server
After=network.target
[Service]
Type=forking
Environment='CFGFILE=/etc/kamailio/kamailio.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
Environment='USER=kamailio'
Environment='GROUP=kamailio'
EnvironmentFile=-/etc/default/kamailio
EnvironmentFile=-/etc/default/kamailio.d/*
# PIDFile requires a full absolute path
PIDFile=/var/run/kamailio/kamailio.pid
ExecStart=/etc/kamailio/startkam.sh
Restart=on-abort
[Install]
WantedBy=multi-user.target
And /etc/kamailio/startkam.sh is like:
#!/bin/bash
MYSQL=$(/etc/kamailio/aws-getpass.sh dev us-east-1 dburl)
SHM_MEMORY=64
PKG_MEMORY=8
USER=kamailio
GROUP=kamailio
CFGFILE=/etc/kamailio/kamailio.cfg
/usr/sbin/kamailio -P /var/run/kamailio/kamailio.pid -f $CFGFILE -m
$SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP -A "DBURL=\"$MYSQL\""
-A
"CBDBURL=\"cb=>$MYSQL\"" -A
"ASGDBURL=\"asg=>$MYSQL\""
which in turn calls /etc/kamailio/aws-getpass.sh, which is the actual
script talking to AWS via BOTO3 to get the data i need.
You can just change the params and use them in your kam script normally
like:
modparam("acc", "db_url", DBURL )
Hope that helps.
Regards,
David Villasmil
email: david.villasmil.work(a)gmail.com
phone: +34669448337
On Sun, Nov 10, 2019 at 9:22 PM Alex Balashov <abalashov(a)evaristesys.com>
wrote:
-A ... oh wow. That's savvy! Cheers.
On Sun, Nov 10, 2019 at 08:51:59PM +0100, Karsten Horsmann wrote:
Great
help the mailing list archive btw.
Cheers
Karsten
David Villasmil <david.villasmil.work(a)gmail.com> schrieb am So., 10.
Nov.
2019, 19:03:
> I needed to discover the user/pass for the dB when kamailio starts so
as
> not to store it locally. I get the data via
an AWS script, then start
> kamailio passing the parameters, then use of those in the script. You
can
> do exactly this to get and set the current
ip address.
>
> I don’t know how to share a thread from this mailing list, but search
for
> the subject “ define a DBURL with SLQOPS
fails” and you will find all
info
> there.
>
> On Sun, 10 Nov 2019 at 17:48, Alex Balashov <
abalashov(a)evaristesys.com>
> wrote:
>
>> On Sun, Nov 10, 2019 at 06:16:44PM +0100, Alejandro Recarey wrote:
>>
>> > Hi, I am trying to get kamailio working cloud provider, autoscaling
>> > them behind a TCP load balancer.
>> >
>> > Is there a way for kamailio to discover its Public IP at startup?
Or
>> > do people generally program their
own startup scripts that modify
the
>> > kamailio config file before
starting it?
>>
>> They generally do the latter, especially since public IP discovery
>> mechanisms tend to be specific to the cloud provider.
>>
>> But various templating mechanisms make this quite easy to do.
>>
>> --
>> Alex Balashov | Principal | Evariste Systems LLC
>>
>> Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
>> Web:
http://www.evaristesys.com/,
http://www.csrpswitch.com/
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users(a)lists.kamailio.org
>>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
> --
> Regards,
>
> David Villasmil
> email: david.villasmil.work(a)gmail.com
> phone: +34669448337
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web:
http://www.evaristesys.com/,
http://www.csrpswitch.com/
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org