[sr-dev] [kamailio/kamailio] CDP / IMS Diameter Server Module- diameter_request() function fails to send/forward request (#2035)

Nick notifications at github.com
Sat Aug 17 02:07:04 CEST 2019

Hi Kamailio team, 
I'm attempting to use Kamailio as a Diameter Routing Agent, but I can't seem to get the diameter_request() function to actually _send_ the diameter request, instead I get a warning about no JSON Response:
> WARNING: ims_diameter_server [avp_helper.c:341]: addAVPsfromJSON(): No JSON Response

Even when relaying received data without modifying it.

I posted this issue on the mailing list but have had no responses. Since then I've run a bunch more tests on a few different versions of Kamailio with a few different Diameter peers with the same result.

### Description
The IMS Diameter Server Module's[ diameter_request() function](https://www.kamailio.org/docs/modules/devel/modules/ims_diameter_server.html#ims_diameter_server.f.diameter_request) fails to send, reporting "No JSON Response" even when fed unmodified received data into it.

### Troubleshooting

Initially I was trying to use CDP & IMS Diameter Server Module to create & send Diameter messages, I thought my formatting in the message (the Diameter Message (as JSON)) was incorrect. as I was getting:

> WARNING: ims_diameter_server [avp_helper.c:341]: addAVPsfromJSON(): No JSON Response

When trying to send the request.

To rule out my JSON formatting being the issue I configured two Diameter Peers in Kamailio:

>From one Diameter peer, I sent a Diameter request to Kamailio.

Kamailio is configured to receive the Diameter request, and without modifying the message body ($diameter_request), put that message into the message of the the diameter_request() so as to rule out formatting errors in the message, just a relay of the message, but this also fails to send.

I also included a series of checks to confirm the peer to receive the relayed message was online and capable of handling the specified Diameter application, all of which passed.

I've defined the peers in the diametercfg.xml config file, and they're all showing as online when I do a "kamcmd cdp.list_peers":
                FQDN: ims-hss.localdomain
                Details: {
                        State: I_Open
                        Disabled: False
                        Last used: 0
                        Applications: {
                                appid:vendorid: 16777216:10415
                                appid:vendorid: 16777216:4491
                                appid:vendorid: 16777216:13019
                                appid:vendorid: 16777216:0
                                appid:vendorid: 16777217:10415
                                appid:vendorid: 16777221:10415

Here's a simplified version of my event_route[diameter:request], showing I simply receive the diameter request and then try to send it straight back out using the diameter_request() function:

      xlog("Got diameter message");
      diameter_request("ims-hss.localdomain", $diameter_application, $diameter_command, $diameter_request);
      xlog("Forwarded Diameter Request");

When tailing syslog I see the "Got diameter message" entry but not the "Forwarded Diameter Request", which suggests it's not getting past the diameter_request(), instead I just see the:

> WARNING: ims_diameter_server [avp_helper.c:341]: addAVPsfromJSON(): No JSON Response

Packet captures show Kamailio receives the request but never relays it.

The source of avp_helper.c shows the warning is called if the length of the JSON is <= 0, but as I'm feeding back out what I've received it shouldn't be 0, an no recent major changes to the source, so I'm stumped as to why it's catching this.

I've attached a full copy of the config files below.

#### Reproduction

I've tried this with a few different Diameter servers, but I can reproduce it with two FreeDIAMETER peers configured in Diameter CDP Config XML,  I've also tried with one Kamailio CDP based peer and using xhttp to call the diameter_request() function with the same results.

#### Log Messages

Copy of relevant SysLog:

### Additional Information

Full Kamailio Config: https://pastebin.com/afgqUfWr
Diameter CDP Config XML: https://pastebin.com/bVrBG8mG
Relevant Syslog: https://pastebin.com/ZY8z2kd4
Kamcmd cdp.list_peers: https://pastebin.com/cKi4JAHC

Kamailio 5.1.2 on Ubuntu 18.04 installed from Repos.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20190816/ac4150ae/attachment.html>

More information about the sr-dev mailing list