Ah, that looks easy indeed. Just have to build that module. :)
Thanks!

-----Message d'origine-----
De : Alex Balashov <abalas...@evaristesys.com> 
Envoyé : lundi 6 mars 2023 18:30

I don’t think there is any practical RPC method restriction, but parsing the 
JSON body in script is indeed possible, easy and pretty cheap:

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

— Alex

> On Mar 6, 2023, at 11:57 AM, Chaigneau, Nicolas 
> <nicolas.chaign...@capgemini.com> wrote:
> 
> Hello,
>   I’m using jsonrpc_dispatch in a "xhttp:request" section (with xhttp and 
> jsonrpcs modules), e.g.:
>  event_route[xhttp:request] {
>        if ($hu =~ "^/RPC") {
>              jsonrpc_dispatch();
>              exit;
>        }
>         xhttp_reply("404", "Not Found", "", "");
>        exit;
> }
>  This works, but I would like to restrict the RPC functions that can be 
> invoked this way.
> Any advice on how I could do that ?
>  The xhttp module provides "url_skip" and "url_match" but this is not useful 
> because in the URL I only have something like "RPC".
> And the method is in the JSON body.
>  I could parse the JSON body before calling jsonrpc_dispatch, but it’s a bit 
> complicated (I don’t know if it’s feasible in Kamailio script ?), and seems 
> redundant because jsonrpc_dispatch already does that…
>   Maybe somehow this could be checked from the "void *" second argument 
> passed to the RPC function ?
>    Thanks.
>  Regards,
> Nicolas.

This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient, you are not authorized 
to read, print, retain, copy, disseminate, distribute, or use this message or 
any part thereof. If you receive this message in error, please notify the 
sender immediately and delete all copies of this message.
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:

Reply via email to