I've tried to send Sh requests to HSS via xhttp -> diameter_request and found that
after successful call I've always got empty $diameter_response.
After reading code of ims_diameter_server module I made following patch to finally get
responses:
```
--- a/src/modules/ims_diameter_server/avp_helper.c
+++ b/src/modules/ims_diameter_server/avp_helper.c
int pv_get_response(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) {
- if ((msg->id != current_msg_id_repl) || (responsejson.len < 0)) {
+ if (responsejson.len < 0) {
return pv_get_strval(msg, param, res, &responsejson);
```
but then I thought that there should be workaround for unpatched version, so here's
little hack to set empty $diameter_response before calling diameter_request function:
```
#
# Processing HTTP request, it should be POST,
# with URI:
http://host:port/lcs/diameter-peer-name/diameter-app-id/function-code
#
event_route[xhttp:request] {
xlog("Recieved HTTP request with request $hu\n");
# make diameter_request function happy -- initialize $diameter_response ;)
# without setting $diameter_response first - there's no way to get back
response_data
$diameter_response = '';
xlog('trying to call: "diameter_request($(hu{s.select,2,/})",
$(hu{s.select,3,/}), $(hu{s.select,4,/}), rb);\n');
diameter_request($(hu{s.select,2,/}), $(hu{s.select,3,/}), $(hu{s.select,4,/}), $rb);
xlog("Received Diameter response:\n");
# xlog("$diameter_response \n");
xhttp_reply("200", "OK", "application/json",
"$diameter_response");
}
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2035#issuecomment-1673511815
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/2035/1673511815(a)github.com>