Hi,
for the first time we tried to build all routing in kemi with app_python3, and it works well.
But app_python.reload only reloads the file in:
modparam("app_python3", "load", "/etc/kamailio/kemi/kamailio.py")
And that is a little problem for us, since we are using multiple files to use modules etc. At the moment we have 8 files besides kamailio.py.
Is there a way to reload all of them, without restarting kamailio?
/niklas
Hello,
have you tried to just use "import my-file" the file my-file in your kamailio.py?
Cheers,
Henning
Hi,
that is what we do:
import sys import KSR as KSR import constants import endpointparam as epParam import iendpoint as ep from util import ParseAddress from endpoint import GetEgressEndPointInstance, CreateAsteriskEndPoint, CreateSipTrunkEndPoint
etc
Been googling a bit, and it's should be possible to do a module.reload() - but is there a way to find out in that the modules needs to be reloaded?
/niklas
Den 2022-11-14 kl. 09:05, skrev Henning Westerholt:
Hello,
have you tried to just use "import my-file" the file my-file in your kamailio.py?
Cheers,
Henning
Hi, our python configuration consists of many files, too. To have the reload working, we have this block in our configuration:
import mod1 import mod2 import mod3 from importlib import reload
def mod_init(): KSR.info("===== initializing kamailio.py\n") reload(mod1) reload(mod2) reload(mod3) KSR.info("===== Done reloading modules\n") return kamailio() modX will be the modules you import at the top. HTH Sebastian ________________________________ From: sr-users sr-users-bounces@lists.kamailio.org on behalf of Niklas Larsson niklas@tese.se Sent: Monday, November 14, 2022 10:46 To: Henning Westerholt hw@gilawa.com; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: Re: [SR-Users] KEMI - app_python3 - reload multiple python files
Hi,
that is what we do:
import sys import KSR as KSR import constants import endpointparam as epParam import iendpoint as ep from util import ParseAddress from endpoint import GetEgressEndPointInstance, CreateAsteriskEndPoint, CreateSipTrunkEndPoint
etc
Been googling a bit, and it's should be possible to do a module.reload() - but is there a way to find out in that the modules needs to be reloaded?
/niklas
Den 2022-11-14 kl. 09:05, skrev Henning Westerholt:
Hello,
have you tried to just use "import my-file" the file my-file in your kamailio.py?
Cheers,
Henning
__________________________________________________________ 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
Hi,
thanks - that solved our problem
/niklas
On 2022-11-15 09:14, sdamm@pascom.net wrote:
Hi, our python configuration consists of many files, too. To have the reload working, we have this block in our configuration:
import mod1 import mod2 import mod3 from importlib import reload
def mod_init(): KSR.info("===== initializing kamailio.py\n") reload(mod1) reload(mod2) reload(mod3) KSR.info("===== Done reloading modules\n") return kamailio() modX will be the modules you import at the top. HTH Sebastian
*From:* sr-users sr-users-bounces@lists.kamailio.org on behalf of Niklas Larsson niklas@tese.se *Sent:* Monday, November 14, 2022 10:46 *To:* Henning Westerholt hw@gilawa.com; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org *Subject:* Re: [SR-Users] KEMI - app_python3 - reload multiple python files Hi,
that is what we do:
import sys import KSR as KSR import constants import endpointparam as epParam import iendpoint as ep from util import ParseAddress from endpoint import GetEgressEndPointInstance, CreateAsteriskEndPoint, CreateSipTrunkEndPoint
etc
Been googling a bit, and it's should be possible to do a module.reload()
- but is there a way to find out in that the modules needs to be reloaded?
/niklas
Den 2022-11-14 kl. 09:05, skrev Henning Westerholt:
Hello,
have you tried to just use "import my-file" the file my-file in your
kamailio.py?
Cheers,
Henning
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
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
Hello,
thanks for sharing it! I think it could be useful for many others, therefore I added it to the docs of the module.
Cheers, Daniel
On 15.11.22 09:14, sdamm@pascom.net wrote:
Hi, our python configuration consists of many files, too. To have the reload working, we have this block in our configuration:
import mod1 import mod2 import mod3 from importlib import reload
def mod_init(): KSR.info("===== initializing kamailio.py\n") reload(mod1) reload(mod2) reload(mod3) KSR.info("===== Done reloading modules\n") return kamailio() modX will be the modules you import at the top. HTH Sebastian
*From:* sr-users sr-users-bounces@lists.kamailio.org on behalf of Niklas Larsson niklas@tese.se *Sent:* Monday, November 14, 2022 10:46 *To:* Henning Westerholt hw@gilawa.com; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org *Subject:* Re: [SR-Users] KEMI - app_python3 - reload multiple python files Hi,
that is what we do:
import sys import KSR as KSR import constants import endpointparam as epParam import iendpoint as ep from util import ParseAddress from endpoint import GetEgressEndPointInstance, CreateAsteriskEndPoint, CreateSipTrunkEndPoint
etc
Been googling a bit, and it's should be possible to do a module.reload()
- but is there a way to find out in that the modules needs to be reloaded?
/niklas
Den 2022-11-14 kl. 09:05, skrev Henning Westerholt:
Hello,
have you tried to just use "import my-file" the file my-file in your
kamailio.py?
Cheers,
Henning
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
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