`find-worklist` with `LocalAet` from Modality configuration

Dear Orthanc Team,

We use /modalities to dynamically create configurations for different connections. We need to customise the LocalAet that is used for that modality when using /modalities/:modalityName/find-worklist.

In Orthanc < 1.13.0 this would work well. The local AET used by the Worklist Query would be the LocalAet from the modality configuration.

In Orthanc v1.13.0 - from our testing it appears that the local AET used by the same endpoint /modaliites/:modalityName/find-worklist is the Orthanc AET - defined globally. I’m not sure if this behaviour was planned.

We investigated and have created 2 patches to address this.

This patch fixes the issue:

diff --git a/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp b/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp
index 896330fcb..31ded7c38 100644
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp
@@ -80,11 +80,16 @@ namespace Orthanc
   static DicomAssociationParameters GetAssociationParameters(RestApiPostCall& call,
                                                              const Json::Value& body)
   {
-    const std::string& localAet =
-      OrthancRestApi::GetContext(call).GetDefaultLocalApplicationEntityTitle();
     const RemoteModalityParameters remote =
       MyGetModalityUsingSymbolicName(call.GetUriComponent("id", ""));
 
+    std::string localAet = OrthancRestApi::GetContext(call).GetDefaultLocalApplicationEntityTitle(); // from the global configuration file
+    if (remote.HasLocalAet()) // from the "DicomModalities" configuration
+    {
+      localAet = remote.GetLocalAet();
+    }
+    localAet = Toolbox::GetJsonStringField(body, KEY_LOCAL_AET, localAet); // from the payload
+
     DicomAssociationParameters params(localAet, remote);
     InjectAssociationTimeout(params, body);
 

I have attached a patch for orthanc-tests that tests this behaviour. The test succeeds for Orthanc versions < 1.13.0. and fails for 1.13.0. It passes with the patch above.

find-worklist-local-aet.patch.txt (3.9 KB)

I hope this helps and welcome and thoughts/comments.

James