I agree on the "make it a separate server" as a best practice, however I think that unless the discussion is implementing a SIP stack in the python script, this is not the way to go. Assuming that the question is about using KEMI for the script (either as the entire Kamailio scripting or calling a python function inline with scripting), the same problem remains:

You need to make WAITING for the reply to be asynchronous.

I'm not sure that you can do that in a python function and then resume the SIP processing (i.e. Do something useful with the reply). I'm not absolutely certain on this, but I think that is the general problem with using just the async module when 100% (or near 100%) of your requests will follow this pattern.

Kaufman
Senior Voice Engineer



E: bkaufman@bcmone.com




 

SIP.US Client Support: 800.566.9810  |  SIPTRUNK Client Support: 800.250.6510  |  Flowroute Client Support: 855.356.9768

img
img
img
 


From: Alex Balashov via sr-users <sr-users@lists.kamailio.org>
Sent: Monday, December 23, 2024 9:25 AM
To: sr-users@lists.kamailio.org <sr-users@lists.kamailio.org>
Cc: Alex Balashov <abalashov@evaristesys.com>
Subject: [SR-Users] Re: Kamailio not receiving packets on high CPS
 
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.


> On Dec 23, 2024, at 10:06 am, Sergio Charrua <sergio.charrua@voip.pt> wrote:
>
> Could creating a "middleware" python script (or any other language) that Kamailio calls and sends required data, and then makes a HTTP request to the API be efficient ?

100%, and this is what you should do. Just make sure it's a separate service and not a script.

--
Alex Balashov
Principal Consultant
Evariste Systems LLC
Web: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fevaristesys.com%2F&data=05%7C02%7Cbkaufman%40bcmone.com%7Ce2033a2ac9dd4731fed108dd23669e6a%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C638705645865051882%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=c2z6jfFDeI961isIiKsPEJhDhzQ0iIalPpkBPbrJW0g%3D&reserved=0
Tel: +1-706-510-6800

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!