I don't know about ESL-still very new to FS. I should look at that. If you figure it out, send some of the code here. I used this to notify my running DLL that a new one is being loaded, then start a new thread to pop events. It works and pulls events fine. I still have a problem where freeswitch crashes toward the end of it's shutdown so something is not being freed or is corrupted.(switch_core_memory.c:587 Stopping memory pool queue) is the last written on the screen. If someone knows why, let me know. Kris public class Loading : FreeSWITCH.ILoadNotificationPlugin { public bool Load() { Event loading_event = new Event("CUSTOM", "livematch::maintenance"); loading_event.AddHeader("Action", "loading"); loading_event.Fire(); freeswitch.msleep(500); ManagedApplicationBase.LoadSettings(); //from the Database ManagedApplicationBase.StartEventThread();// this does the pop in a thread, terminates itself on the next loading event. } abstract public class ManagedApplicationBase : IAppPlugin, IApiPlugin { //common Parameters public static bool ParmUsingWatchdogTimer=true; public static bool LoadingNewDLL = false; public static bool FreeSwitchShutdown = false; public static bool EventThreadStarted = false; public static System.Threading.Thread EventThread = new System.Threading.Thread(new System.Threading.ThreadStart(CheckEvents)); ....... static private void CheckEvents()//runs only in the new thread { BaseLog.WriteLine(BaseLogLevel.Info, "Starting CheckEvents"); string EventName; ODBCData Data = new ODBCData(global::LiveMatch.Properties.Settings.Default.ODBCConnectionMain); ODBCData CallsData = new ODBCData(global::LiveMatch.Properties.Settings.Default.LMCallDetailsConnectionMain); FreeSWITCH.Native.Api fsApi = new FreeSWITCH.Native.Api(); // EventConsumer con_CUSTOM = new EventConsumer("CUSTOM", "Conference::Maintenance"); EventConsumer con_all = new EventConsumer("ALL", null); while (!FreeSwitchShutdown && !LoadingNewDLL) // { Event ev_all = con_all.pop(0); if (ev_all != null) { EventName = ev_all.GetHeader("Event-Name"); switch (EventName) { case "HEARTBEAT": Log.WriteLine(LogLevel.Notice, "Got event " + EventName); BaseLog.WriteLine(BaseLogLevel.FSEVENT, ev_all.Serialize("xml")); if(ParmUsingWatchdogTimer) Data.SaveParameter(SystemInformation.ComputerName, Parameters.SPARAMETER_WATCHDOG_TIME, DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss"));//12/11/2010 03:53:02 break; case "CHANNEL_HANGUP_COMPLETE": Log.WriteLine(LogLevel.Notice, "Got event " + EventName); BaseLog.WriteLine(BaseLogLevel.FSEVENT, ev_all.Serialize("xml")); string SQL = String.Format("UPDATE Calls SET StopTime='{0}' WHERE CallGUID='{1}'", DateTime.UtcNow.ToString("MM/dd/yyyy HH:mm:ss.fff"), ev_all.GetHeader("Caller-Unique-ID")); CallsData.ExecuteSQL(SQL); break; case "SHUTDOWN": Log.WriteLine(LogLevel.Notice, "Got event " + EventName); BaseLog.WriteLine(BaseLogLevel.FSEVENT, ev_all.Serialize("xml")); FreeSwitchShutdown = true; BaseLog.WriteLine(BaseLogLevel.FSEVENT, "Exiting CheckEvents"); BaseLog.SwitchShutdown = true; //to prevent further writing goto EXIT; case "CUSTOM": Log.WriteLine(LogLevel.Notice, "Got event " + EventName); // //ManagedSession Session = new ManagedSession(ev_all.GetHeader("Caller-Unique-ID")); switch (ev_all.GetHeader("Event-Subclass")) { case "conference::maintenance": Log.WriteLine(LogLevel.Notice, "Event-Subclass " + ev_all.GetHeader("Event-Subclass")); switch (ev_all.GetHeader("Action")) { case "del-member": Log.WriteLine(LogLevel.Notice, "Action " + ev_all.GetHeader("Action")); //member is leaving or hung up? //update Conferences SET break; default: Log.WriteLine(LogLevel.Notice, "Action " + ev_all.GetHeader("Action")); break; } break; case "livematch::maintenance": Log.WriteLine(LogLevel.Notice, "Event-Subclass " + ev_all.GetHeader("Event-Subclass")); switch (ev_all.GetHeader("Action")) { case "loading": //a new version is loading, terminate this one Log.WriteLine(LogLevel.Notice, "Action " + ev_all.GetHeader("Action")); FreeSwitchShutdown = true; LoadingNewDLL = true; break; default: Log.WriteLine(LogLevel.Notice, "Action " + ev_all.GetHeader("Action")); break; } break; default: Log.WriteLine(LogLevel.Notice, "Event-Subclass " + ev_all.GetHeader("Event-Subclass")); break; } ----- Original Message ----- From: "John Rose" <johnrose@comtex.net> To: <freeswitch-users@lists.freeswitch.org> Sent: Monday, January 17, 2011 4:36 PM Subject: [Freeswitch-users] C# new ESLevent(
Does someone have an example of the C# EslConnection method SendEvent with a new ESLevent ?
Like how to fill in any info on the ESLevent object before sending it?
Thanks,
John