Hi Karsten
how are you measure the traffic you don't want to your Homer? Print stuff in that Kamailio event route or something else?
Basically, I want to mirror sip messages to homer, only sip messages relevant to calls, not anything else which might be processed by kamailio.
modules.inc:loadmodule "siptrace.so" modules.inc:modparam("siptrace", "trace_flag", 22); modules.inc:modparam("siptrace", "trace_on", 1) modules.inc:modparam("siptrace", "trace_mode", 1) modules.inc:modparam("siptrace", "hep_mode_on", 1) modules.inc:modparam("siptrace", "hep_version", 3) modules.inc:modparam("siptrace", "hep_capture_id", HEP_CAP_AGENT) modules.inc:modparam("siptrace", "duplicate_uri", HOMERSIPURI)
I also use the xhttp interface for jsonrpc and a custom API.
For this I have kamailio also listen to TCP port 8080 to have those API xhttp requests clearly separated from call traffic.
But, as I understand, xhttp requests are initially handled as if they were sip requests and get processed request_route{}
So my request route starts with:
request_route {
# Handle DMQ requests route(DMQ_CAPTURE);
# Make sure we operate on the correct port (not on the xhttp one) if ($Rp != 5060 && $Rp != 5061) { xlog("L_ERROR", "REQUEST_ROUTE $rm to wrong port $Rp\n"); exit; }
so all SIP method requests to port 8080 are being dropped.
I process xhttp traffic with the appropriate event route and of course reject http requests to sip ports with the appropriate http error message.
event_route[xhttp:request] { if ($avp(debug) > 0) { xlog("L_INFO", "$cfg(route): XHTTP Request to URI: $hu Port: $Rp BODY: $rb\n"); } if ($Rp != 8080) { # We got a HTTP Request on a sip port. Reject! xhttp_reply("418", "I'm a teapot", "text/html", "<html><body>I'm not a Web-Server!</body></html>"); exit; } if ($hu =~ "^/RPC") { ### KAMAILIO JSONRCP pass-through jsonrpc_dispatch(); } else if ($hu =~ "^/API") { ### IMPROWARE API
[...]
What I observe is the siptrace module being triggered right at the start of request_route. This makes sense, I want to mirror every sip message.
But his also causes mirroring of the xhttp requests and replies to port 8080.
Is there a way to prevent this?
siptrace has an event route capable of filtering, as I understand it is only possible to filter on the SIP request method, not anything else:
event_route[siptrace:msg] { if(is_method("KDMQ")) { drop(); } }
Do I miss something? How can I prevent/filter xhttp requests to be mirrored by the siptrace module?
Mit freundlichen Grüssen
-Benoît Panizzon-