<div dir="ltr">Hello,<div><br></div><div>TL;DR</div><div>How can I execute a routine in my Kamailio python module (kamailio_python.py) on demand?  For example, using kamcmd from the command line.  I know you can execute <i>app_python.reload  </i>but I don't need to reload the whole python module, and furthermore, docs for this call say it's unstable and can even crash your kamailio instance.  So my goal is to execute one single python routine on demand.</div><div><a href="https://www.kamailio.org/docs/modules/5.1.x/modules/app_python.html#app_python.r.reload">https://www.kamailio.org/docs/modules/5.1.x/modules/app_python.html#app_python.r.reload</a> <br></div><div><br></div><div>Full explanation:</div><div>I'm currently implementing OIDC token authentication for Kamailio.  I have a python routine that extracts the token from a custom SIP header, and validates the token as per the OIDC spec (I'm using pyjwt plus other custom checks for this). In order to do offline validation of the token, you need the Identity Provider (IdP) Server's certificate, which I get in advance and cache in a local file on my Kamailio server.  I also have an external python script which I can run to get the latest certificate from the IdP server and update it locally.  </div><div><br></div><div>The part I'm missing is how to tell Kamailio to reload the value of the certificate from the local cache, WITHOUT stopping kamailio or interrupting any sessions.  This is needed in case the certificate is updated (e.g. due to expiration or compromise) on the IdP server; if you don't update it so that Kamailio can use the latest one, all token verification will fail (tokens signed by IdP server using latest private key corresponding to latest certificate, but Kamailio trying to validate the signature using the public key extracted from previous certificate -- this results in a signature error, as Kamailio needs to be using the public key corresponding to the private one that was used to sign the token).</div><div><br></div><div>By being able to execute one single python routine on demand (e.g. using kamcmd), I can tell Kamailio to reload the certificate value from the local cache, which I just updated by running my other (external and unrelated to Kamailio software) python script.</div><div><br></div><div>Hope this makes sense, and hopefully I can get some tips on how to achieve this.</div><div><br></div><div>Thanks,</div><div>Martín.</div><div><br></div></div>