Hello,

 Thank you for your reply! I've used your suggestion to accomplish some amazing things. However, I'm having an issue when calling the "sl.stats" or any other procedures. I've noticed that the number of "200" responses gets incremented by 2, which is not the case when using the `kamcmd` tool. I suspect that this may be due to jsonrpc using http/https, which is causing Kamailio to treat it as a "200" response code. Could you advise on how to avoid this issue?
 Is there any further configuration that needs to be done?

Best regards.

On Sat, Feb 25, 2023 at 12:00 PM <sr-users-request@lists.kamailio.org> wrote:
Send sr-users mailing list submissions to
        sr-users@lists.kamailio.org

To subscribe or unsubscribe via email, send a message with subject or
body 'help' to
        sr-users-request@lists.kamailio.org

You can reach the person managing the list at
        sr-users-owner@lists.kamailio.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of sr-users digest..."Today's Topics:

   1. Kamailio RPC configuration (sadik.oualla.mohamed@gmail.com)
   2. Re: Kamailio RPC configuration (Alex Balashov)



---------- Forwarded message ----------
From: sadik.oualla.mohamed@gmail.com
To: sr-users@lists.kamailio.org
Cc: 
Bcc: 
Date: Fri, 24 Feb 2023 17:07:33 -0000
Subject: [SR-Users] Kamailio RPC configuration
Dear Kamailio community,

I am a newbie in Kamailio and I am currently working on a project that involves communicating with Kamailio using Python. I have been exploring the Kamailio documentation and I have come across RPC, JSONRPCS..., which I believe can help me achieve my goal.

However, I am not sure about the steps to follow in the Kamailio configuration file to create my own script to communicate with Kamailio using Python (the script is on an other machine on the same LAN). I would be grateful if someone could guide me through the process.

I have already set up Kamailio (builed it from the source code 5.5.5) and Python on my machines and I have basic knowledge of Kamailio configuration. I just need some guidance on how to set up the RPC module in Kamailio and how to create a Python script to communicate with it. I found that I can use RPyC library of python.

I would appreciate any help or suggestions from the Kamailio community. Thank you in advance for your time and assistance.

Best regards,
Wild Coder.



---------- Forwarded message ----------
From: Alex Balashov <abalashov@evaristesys.com>
To: "Kamailio (SER) - Users Mailing List" <sr-users@lists.kamailio.org>
Cc: 
Bcc: 
Date: Fri, 24 Feb 2023 13:22:16 -0500
Subject: [SR-Users] Re: Kamailio RPC configuration
Hi,

The easiest way to communicate with the JSONRPCS module is probably to use HTTP, in the form of the `xhttp` module:

https://kamailio.org/docs/modules/5.6.x/modules/xhttp.html

You will need...

1) To enable the HTTP transport in the `jsonrpcs` module;

2) A TCP or TLS listener (listen= config directive) to accept the traffic;

3) An xhttp `event_route[xhttp:request]` route, as detailed in that module's docs:

https://kamailio.org/docs/modules/5.6.x/modules/xhttp.html#xhttp.f.xhttp_reply

4) Probably some measure of security / authentication for #3.

The example from jsonrpc_dispatch() is perfectly sufficient to get you started:

https://kamailio.org/docs/modules/5.6.x/modules/jsonrpcs.html#jsonrpcs.f.jsonrpc_dispatch

You should then be able to do things like:

   # curl \
     -X POST \
     -d '{"jsonrpc": "2.0", "id": "abc123", "method": "ul.dump"}' \
     http://${KAMAILIO_IP}:5060/RPC <http://${kamailio_ip}:5060/RPC>

-- Alex

> On Feb 24, 2023, at 12:07 PM, sadik.oualla.mohamed@gmail.com wrote:
>
> Dear Kamailio community,
>
> I am a newbie in Kamailio and I am currently working on a project that involves communicating with Kamailio using Python. I have been exploring the Kamailio documentation and I have come across RPC, JSONRPCS..., which I believe can help me achieve my goal.
>
> However, I am not sure about the steps to follow in the Kamailio configuration file to create my own script to communicate with Kamailio using Python (the script is on an other machine on the same LAN). I would be grateful if someone could guide me through the process.
>
> I have already set up Kamailio (builed it from the source code 5.5.5) and Python on my machines and I have basic knowledge of Kamailio configuration. I just need some guidance on how to set up the RPC module in Kamailio and how to create a Python script to communicate with it. I found that I can use RPyC library of python.
>
> I would appreciate any help or suggestions from the Kamailio community. Thank you in advance for your time and assistance.
>
> Best regards,
> Wild Coder.
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
> 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!
> Edit mailing list options or unsubscribe:

--
Alex Balashov
Principal Consultant
Evariste Systems LLC
Web: https://evaristesys.com
Tel: +1-706-510-6800 e

_______________________________________________
sr-users mailing list -- sr-users@lists.kamailio.org
To unsubscribe send an email to sr-users-leave@lists.kamailio.org