public void GatherCommandsInQueue(string command, Usage_Code_Point codePoint, int type, NodeId viaGateway, bool CommandFinished = false, params object[] arguments) //TODO: combine to one single method
{
IUsage usage = null;
StoredDataSpecifier specifier = null;
if (command.Equals("Store"))
{
StoreKindData kindData;
usage = m_UsageManager.CreateUsage(codePoint, type, arguments);
//foreach (UInt32 kindId in usage.Kinds) TODO:
{
//kindData = new StoreKindData(kindId, 0, new StoredData(usage.Encapsulate(kindId, true)));
kindData = new StoreKindData(usage.KindId, 0, new StoredData(usage.Encapsulate(true)));
gatheredStoreDatas.Add(kindData);
//m_ReloadConfig.GatheringList.Add(kindData);
}
if (CommandFinished == true)
{
if (viaGateway != null)
storeViaGateway.Add(gatheredStoreDatas, viaGateway);
gatheredStoreDatasQueue.Post(gatheredStoreDatas);
gatheredStoreDatas = new List<StoreKindData>();
}
}
if (command.Equals("Fetch"))
{
//UInt32[] kinds = UsageManager.CreateUsage(codePoint, null, null).Kinds; TODO: cleanup
UInt32 kind = UsageManager.CreateUsage(codePoint, null, null).KindId;
// To further garantee SIP Usage with Telefonenumbers
if (codePoint == Usage_Code_Point.SIP_REGISTRATION && arguments[0].ToString().StartsWith("+"))
{
string FetchUrl = "";
ReloadConfigResolve res = new ReloadConfigResolve(m_ReloadConfig);
FetchUrl = res.ResolveNaptr(arguments[0].ToString());
if (FetchUrl == null)
{
ReloadConfig.Logger(ReloadGlobals.TRACEFLAGS.T_WARNING, "DNS Enum fallback to sip uri analysis");
FetchUrl = arguments[0].ToString();
FetchUrl = FetchUrl.TrimStart(' ');
FetchUrl = FetchUrl.Replace(" ", "");
FetchUrl = "sip:" + FetchUrl + "@" + m_ReloadConfig.OverlayName;
arguments[0] = FetchUrl;
}
}
//foreach (UInt32 kindId in kinds) TODO: cleanup
{
specifier = m_UsageManager.createSpecifier(kind, arguments);
gatheredSpecifiers.Add(specifier);
}
if (CommandFinished == true)
{
if (viaGateway != null)
fetchViaGateway.Add(gatheredSpecifiers, viaGateway);
gatheredSpecifiersQueue.Post(gatheredSpecifiers);
gatheredSpecifiers = new List<StoredDataSpecifier>();
}
}
}