private void Initialize(YateClient client) { var status = client.SendMessage(new EngineStatusSip()); if (status.Name != "sip") { return; } foreach (var detail in status.Details) { if (!detail.TryGetValue("id", out var id)) { continue; } var hash = new HashEntry[3]; if (detail.TryGetValue("Status", out var value)) { hash[0] = new HashEntry("status", value); } if (detail.TryGetValue("Address", out var address)) { hash[1] = new HashEntry("address", address); } if (detail.TryGetValue("Peer", out var peer)) { hash[2] = new HashEntry("peerid", peer); } UpdateRedis(id, hash, TimeSpan.FromHours(1)); } }
private void UpdateFromStatus(YateClient client) { var status = client.SendMessage(new EngineStatusSip()); if (status.Name != "sip") { return; } foreach (var detail in status.Details) { var data = new Dictionary <string, string> { { "status", GetValueOrDefault(detail, "Status") }, { "address", GetValueOrDefault(detail, "Address") }, { "peerid", GetValueOrDefault(detail, "Peer") } }; UpdateChan(GetValueOrDefault(detail, "id"), data); } UpdateDisplay(); }