diff OrthancServer/ServerContext.cpp @ 1427:d710ea64f0fd

Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 Jun 2015 12:42:54 +0200
parents b22ba8c5edbe
children 461e7554bff7
line wrap: on
line diff
--- a/OrthancServer/ServerContext.cpp	Fri Jun 26 16:30:51 2015 +0200
+++ b/OrthancServer/ServerContext.cpp	Mon Jun 29 12:42:54 2015 +0200
@@ -79,10 +79,9 @@
     scheduler_(Configuration::GetGlobalIntegerParameter("LimitJobs", 10)),
     plugins_(NULL),
     pluginsManager_(NULL),
-    queryRetrieveArchive_(Configuration::GetGlobalIntegerParameter("QueryRetrieveSize", 10))
+    queryRetrieveArchive_(Configuration::GetGlobalIntegerParameter("QueryRetrieveSize", 10)),
+    defaultLocalAet_(Configuration::GetGlobalStringParameter("DicomAet", "ORTHANC"))
   {
-    scu_.SetLocalApplicationEntityTitle(Configuration::GetGlobalStringParameter("DicomAet", "ORTHANC"));
-
     uint64_t s = Configuration::GetGlobalIntegerParameter("DicomAssociationCloseDelay", 5);  // In seconds
     scu_.SetMillisecondsBeforeClose(s * 1000);  // Milliseconds are expected here
 
@@ -140,10 +139,21 @@
 
     if (operation == "store-scu")
     {
+      std::string localAet;
+      if (parameters.isMember("LocalAet"))
+      {
+        localAet = parameters["LocalAet"].asString();
+      }
+      else
+      {
+        localAet = context.GetDefaultLocalApplicationEntityTitle();
+      }
+
       std::string modality = parameters["Modality"].asString();
       LOG(INFO) << "Lua script to send instance " << parameters["Instance"].asString()
                 << " to modality " << modality << " using Store-SCU";
-      return new StoreScuCommand(context, Configuration::GetModalityUsingSymbolicName(modality), true);
+      return new StoreScuCommand(context, localAet,
+                                 Configuration::GetModalityUsingSymbolicName(modality), true);
     }
 
     if (operation == "store-peer")