Question: Lua Modality Sent to

Good Day All,
Hopefully an easy question. I have a PACS sending to an Orthanc install. PACS sends to two AE titles, CURRENT and PRIOR which are both the Orthanc server. Both are received no problem and I can forward no problem using the standard Lua script.
What I am looking to do now is forward studies sent to Orthanc using the CURRENT AE to one destination and PRIOR to a different destination. I am having trouble identifying where I can tell what AE title was used.
In DCM4Chee I could use tag: 21000140 but no such luck with Orthanc.

Any help would be greatly appreciated. Thanks!

Got it. If anyone else runs into this. Lua Script Below

function OnStoredInstance(instanceId, tags, metadata, origin)
PrintRecursive(origin)

if origin[‘CalledAet’] == ‘Current’ then
– Only Route for calling AET Current
Delete(SendToModality(instanceId, ‘FORARDEDAET’))

else
PrintRecursive(“Not Current”)
end