OK, good it was sorted out, body being indeed added in two places with the first config.
Cheers,
Daniel
Updating the event route to:
event_route[xhttp:request] {
$var(xhttp_uri) = $(hu{s.tolower});
xlog("L_INFO", "event_route[xhttp:request] : hu = '$hu' var(xhttp_uri) = '$var(xhttp_uri)'");
if ( $var(xhttp_uri) =~ "^/rpc") {
jsonrpc_dispatch();
} else if ( $var(xhttp_uri) =~ "^/http_rpc") {
dispatch_xhttp_rpc();
} else {
xhttp_reply("200", "OK", "text/html", "<html><body>Wrong URL $hu</body></html>");
}
return;
}
Fixed the issue, sorry for the noise :)
On 06/06/18 15:47, Asgaroth wrote:
Hi,
I performed the following:
# kamcmd dbg.trace on
# curl --header 'Content-Type: application/json' \
--data-binary '{\
"jsonrpc": "2.0", \
"method": "ul.lookup", \
"params": [ "location","user@example.com" ], \
"id": 3 }' http://registrar.example.com/rpc
# kamcmd dbg.trace off
And the following was presented in the log file
[5843]: ERROR: *** cfgtrace:request_route=[xhttp:request] c=[/etc/kamailio/routing_logic.cfg] l=301 a=63 n=assign
[5843]: ERROR: *** cfgtrace:request_route=[xhttp:request] c=[/etc/kamailio/routing_logic.cfg] l=305 a=16 n=if
[5843]: ERROR: *** cfgtrace:request_route=[xhttp:request] c=[/etc/kamailio/routing_logic.cfg] l=303 a=24 n=jsonrpc_dispatch
[5843]: ERROR: *** cfgtrace:request_route=[xhttp:request] c=[/etc/kamailio/routing_logic.cfg] l=305 a=63 n=assign
[5843]: ERROR: *** cfgtrace:request_route=[xhttp:request] c=[/etc/kamailio/routing_logic.cfg] l=313 a=16 n=if
[5843]: ERROR: *** cfgtrace:request_route=[xhttp:request] c=[/etc/kamailio/routing_logic.cfg] l=314 a=28 n=xhttp_reply
[5843]: ERROR: <core> [core/data_lump_rpl.c:83]: add_lump_rpl2(): LUMP_RPL_BODY already added!
[5843]: ERROR: xhttp [xhttp_mod.c:410]: xhttp_send_reply(): Error while adding reply lump
The relevent request route is as follows:
# Handling HTTP events
event_route[xhttp:request] {
$var(xhttp_rpc_root) = $(hu{s.substr,0,4});
if ($var(xhttp_rpc_root) == "/rpc") {
jsonrpc_dispatch();
}
$var(xhttp_rpc_root) = $(hu{s.substr,0,9});
if ($var(xhttp_rpc_root) == "/http_rpc") {
dispatch_xhttp_rpc();
}
#$var(xhttp_rpc_root) = $(hu{s.substr,0,8});
#if ($var(xhttp_rpc_root) == "/http_pi") {
# dispatch_xhttp_pi();
#}
xhttp_reply("200", "OK", "text/html",
"<html><body>Wrong URL $hu</body></html>");
}
Just looking at the above event route, do I need to "exit" the if statements above, would the last xhttp_reply be causing this error?
Thanks
On 18/05/18 13:52, Daniel-Constantin Mierla wrote:
this sounds like the body for reply was already set. Can you enable cfgtrace in debugger module and see what actions are executed in that situation?
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio World Conference -- www.kamailioworld.com