execute config route by ctp command?
Is there a way to execute a named config route, such as an event_route, by an rpc command? -- Juha
On Wed, Feb 01, 2017 at 10:41:47PM +0200, Juha Heinanen wrote:
Is there a way to execute a named config route, such as an event_route, by an rpc command?
I'm not aware of one, but xhttp requests inherently trigger an event_route: http://kamailio.org/docs/modules/4.4.x/modules/xhttp.html#idp49731828 If you had a need to execute some other logic that cannot be located there, I suppose you could do something like: event_route[xhttp:request] { if($hu =~ "^/juha_special_rpc_path") { route(THE_ROUTE); xhttp_reply("200", "OK", "text/plain", ""); } else xhttp_reply("404", "Not Found", "text/html", ""); } -- Alex -- Alex Balashov | Principal | Evariste Systems LLC Tel: +1-706-510-6800 (direct) / +1-800-250-5920 (toll-free) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
On 01/02/2017 21:45, Alex Balashov wrote:
On Wed, Feb 01, 2017 at 10:41:47PM +0200, Juha Heinanen wrote:
Is there a way to execute a named config route, such as an event_route, by an rpc command? I'm not aware of one, but xhttp requests inherently trigger an event_route:
http://kamailio.org/docs/modules/4.4.x/modules/xhttp.html#idp49731828
If you had a need to execute some other logic that cannot be located there, I suppose you could do something like:
event_route[xhttp:request] { if($hu =~ "^/juha_special_rpc_path") { route(THE_ROUTE); xhttp_reply("200", "OK", "text/plain", ""); } else xhttp_reply("404", "Not Found", "text/html", ""); }
This is also how the jsonrpcs module can execute the rpc commands: - https://www.kamailio.org/docs/modules/stable/modules/jsonrpc-s.html#jsonrpc-... So indeed, it's the option here. Cheers, Daniel -- Daniel-Constantin Mierla www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - Mar 6-8 (Europe) and Mar 20-22 (USA) - www.asipto.com Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com
Daniel-Constantin Mierla writes:
I'm not aware of one, but xhttp requests inherently trigger an event_route:
http://kamailio.org/docs/modules/4.4.x/modules/xhttp.html#idp49731828
If you had a need to execute some other logic that cannot be located there, I suppose you could do something like:
event_route[xhttp:request] { if($hu =~ "^/juha_special_rpc_path") { route(THE_ROUTE); xhttp_reply("200", "OK", "text/plain", ""); } else xhttp_reply("404", "Not Found", "text/html", ""); }
This is also how the jsonrpcs module can execute the rpc commands:
Thanks for the answers. I decided to use the former solution, because I already had event_route[xhttp:request] in my config. -- Juha
On 06/02/2017 20:00, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
I'm not aware of one, but xhttp requests inherently trigger an event_route:
http://kamailio.org/docs/modules/4.4.x/modules/xhttp.html#idp49731828
If you had a need to execute some other logic that cannot be located there, I suppose you could do something like:
event_route[xhttp:request] { if($hu =~ "^/juha_special_rpc_path") { route(THE_ROUTE); xhttp_reply("200", "OK", "text/plain", ""); } else xhttp_reply("404", "Not Found", "text/html", ""); }
This is also how the jsonrpcs module can execute the rpc commands: Thanks for the answers. I decided to use the former solution, because I already had event_route[xhttp:request] in my config.
I only confirmed that other modules do the same. Cheers, Daniel -- Daniel-Constantin Mierla www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - Mar 6-8 (Europe) and Mar 20-22 (USA) - www.asipto.com Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com
participants (3)
-
Alex Balashov -
Daniel-Constantin Mierla -
Juha Heinanen