<p>Hi Kamailio team,<br>
I'm attempting to use Kamailio as a Diameter Routing Agent, but I can't seem to get the diameter_request() function to actually <em>send</em> the diameter request, instead I get a warning about no JSON Response:</p>
<blockquote>
<p>WARNING: ims_diameter_server [avp_helper.c:341]: addAVPsfromJSON(): No JSON Response</p>
</blockquote>
<p>Even when relaying received data without modifying it.</p>
<p>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.</p>
<h3>Description</h3>
<p>The IMS Diameter Server Module's<a href="https://www.kamailio.org/docs/modules/devel/modules/ims_diameter_server.html#ims_diameter_server.f.diameter_request" rel="nofollow"> diameter_request() function</a> fails to send, reporting "No JSON Response" even when fed unmodified received data into it.</p>
<h3>Troubleshooting</h3>
<p>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:</p>
<blockquote>
<p>WARNING: ims_diameter_server [avp_helper.c:341]: addAVPsfromJSON(): No JSON Response</p>
</blockquote>
<p>When trying to send the request.</p>
<p>To rule out my JSON formatting being the issue I configured two Diameter Peers in Kamailio:</p>
<p>From one Diameter peer, I sent a Diameter request to Kamailio.</p>
<p>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.</p>
<p>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.</p>
<p>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":<br>
FQDN: ims-hss.localdomain<br>
Details: {<br>
State: I_Open<br>
Disabled: False<br>
Last used: 0<br>
Applications: {<br>
appid:vendorid: 16777216:10415<br>
appid:vendorid: 16777216:4491<br>
appid:vendorid: 16777216:13019<br>
appid:vendorid: 16777216:0<br>
appid:vendorid: 16777217:10415<br>
appid:vendorid: 16777221:10415<br>
}<br>
}</p>
<p>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:</p>
<pre><code>event_route[diameter:request]{
      xlog("Got diameter message");
      diameter_request("ims-hss.localdomain", $diameter_application, $diameter_command, $diameter_request);
      xlog("Forwarded Diameter Request");
}
</code></pre>
<p>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:</p>
<blockquote>
<p>WARNING: ims_diameter_server [avp_helper.c:341]: addAVPsfromJSON(): No JSON Response</p>
</blockquote>
<p>Packet captures show Kamailio receives the request but never relays it.</p>
<p>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.</p>
<p>I've attached a full copy of the config files below.</p>
<h4>Reproduction</h4>
<p>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.</p>
<h4>Log Messages</h4>
<p>Copy of relevant SysLog:<br>
<a href="https://pastebin.com/ZY8z2kd4" rel="nofollow">https://pastebin.com/ZY8z2kd4</a></p>
<h3>Additional Information</h3>
<p>Full Kamailio Config: <a href="https://pastebin.com/afgqUfWr" rel="nofollow">https://pastebin.com/afgqUfWr</a><br>
Diameter CDP Config XML: <a href="https://pastebin.com/bVrBG8mG" rel="nofollow">https://pastebin.com/bVrBG8mG</a><br>
Relevant Syslog: <a href="https://pastebin.com/ZY8z2kd4" rel="nofollow">https://pastebin.com/ZY8z2kd4</a><br>
Kamcmd cdp.list_peers: <a href="https://pastebin.com/cKi4JAHC" rel="nofollow">https://pastebin.com/cKi4JAHC</a></p>
<p>Kamailio 5.1.2 on Ubuntu 18.04 installed from Repos.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2035?email_source=notifications&email_token=ABO7UZPVW5FSDWHUV5IOIN3QE46KRA5CNFSM4IMNUHLKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFYCDZA">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZK4DGYRSIVFYJRDDPLQE46KRANCNFSM4IMNUHLA">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABO7UZMVB65GORSHARV6KHTQE46KRA5CNFSM4IMNUHLKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFYCDZA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2035?email_source=notifications\u0026email_token=ABO7UZPVW5FSDWHUV5IOIN3QE46KRA5CNFSM4IMNUHLKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFYCDZA",
"url": "https://github.com/kamailio/kamailio/issues/2035?email_source=notifications\u0026email_token=ABO7UZPVW5FSDWHUV5IOIN3QE46KRA5CNFSM4IMNUHLKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFYCDZA",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>