From 134108aca78225485e79121d9eb3a9e5c4e27c80 Mon Sep 17 00:00:00 2001 From: Stoyan Dimov Date: Mon, 18 Jul 2022 15:02:20 +0200 Subject: [PATCH] Fire user events --- Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs index 8c42d95..acea622 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs @@ -719,9 +719,10 @@ namespace AsterNET.Manager private void internalEventHandler(object sender, ManagerEvent e) { int eventHash = e.GetType().Name.GetHashCode(); - if (registeredEventHandlers.ContainsKey(eventHash)) + int userEventHash = typeof(UserEvent).Name.GetHashCode(); + if (registeredEventHandlers.TryGetValue(eventHash, out var currentEvent) + || (registeredEventHandlers.TryGetValue(userEventHash, out currentEvent) && typeof(UserEvent).IsAssignableFrom(e.GetType()))) { - var currentEvent = registeredEventHandlers[eventHash]; if (currentEvent(e)) { return;