[Freeswitch-svn] [commit] r8236 - in freeswitch/trunk/scripts/contrib/verifier/EventSocket: . trunk trunk/EventWatcher trunk/EventWatcher/Properties trunk/FreeSwitch.EventSocket.Test trunk/FreeSwitch.EventSocket.Test/Properties trunk/FreeSwitchEventSocket trunk/FreeSwitchEventSocket/ChannelEvents trunk/FreeSwitchEventSocket/Commands trunk/FreeSwitchEventSocket/Events trunk/FreeSwitchEventSocket/General trunk/FreeSwitchEventSocket/Ivr trunk/FreeSwitchEventSocket/Properties trunk/FreeSwitchEventSocket/SipEvents trunk/IvrSocket trunk/IvrSocket/Properties

Freeswitch SVN verifier at freeswitch.org
Thu May 1 14:27:39 EDT 2008


Author: verifier
Date: Thu May  1 14:27:39 2008
New Revision: 8236

Added:
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Call.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/CallManager.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/CallStateEvent.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/EventWatcher.csproj
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Extension.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.Designer.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.resx
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/LabelTextBox.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Program.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/AssemblyInfo.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.Designer.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.resx
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.Designer.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.settings
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/ReadMePlease.txt
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/EventSocket.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/FreeSwitch.EventSocket.Test.csproj
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/ParserTest.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Program.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Properties/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Properties/AssemblyInfo.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.sln
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/ChannelEvent.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelAnswer.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelApplication.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelBridge.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelCreate.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelDestroy.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelHangup.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOriginate.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOutgoing.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelProgress.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelState.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnbridge.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnpark.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventCodec.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmf.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmfStatus.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelInfo.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AnyCommand.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Api.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AuthCommand.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CmdBase.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CommandReply.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ExecuteJavascript.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/GetVariable.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/HoldCmd.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ParkCmd.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Playback.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/RecordCmd.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SendMsg.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SetVariable.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SleepCmd.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/TransferCmd.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventManager.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventParser.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.pfx   (contents, props changed)
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventApiCommand.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventHeartbeat.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageQuery.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageWaiting.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventReSchedule.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/Address.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/ChannelVariable.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/SipAddress.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/General/SofiaSipAddress.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrInterface.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PartyInfo.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PlainEventMsg.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Program.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Properties/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Properties/AssemblyInfo.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresence.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceIn.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceOut.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceProbe.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventRoster.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaExpire.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaRegister.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/SipEvent.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringHelper.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringParser.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/IvrSocket/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/IvrSocket/IvrSocket.csproj
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/IvrSocket/Program.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/IvrSocket/Properties/
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/IvrSocket/Properties/AssemblyInfo.cs
   freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/IvrSocket/Voicemail.cs

Log:
Initial version

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Call.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Call.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace EventWatcher
+{
+    public class Call
+    {
+        private CallState _currentState = CallState.Disconnected;
+        private CallState _previousState = CallState.Disconnected;
+        private string _id;
+        private string _destination;
+
+        public Call(string id)
+        {
+            _id = id;
+        }
+
+        public string Id
+        {
+            get { return _id; }
+            set { _id = value; }
+        }
+
+        public string Destination
+        {
+            get { return _destination; }
+        }
+
+        public CallState State
+        {
+            get { return _currentState; }
+        }
+
+        public CallState PreviousState
+        {
+            get { return _previousState; }
+        }
+
+        internal void SetCallState(CallState state)
+        {
+            _previousState = _currentState;
+            _currentState = state;
+        }
+
+        internal void SetDestination(string dest)
+        {
+            _destination = dest;
+        }
+
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/CallManager.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/CallManager.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,251 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using FreeSwitch.EventSocket;
+using FreeSwitch.EventSocket.Commands;
+
+namespace EventWatcher
+{
+    internal class CallManager
+    {
+        #region Delegates
+
+        public delegate void CallStateHandler(CallManager mgr, CallStateEvent callEvent);
+
+        #endregion
+
+        private EventManager _eventMgr;
+        private IDictionary<string, CallStateEvent> _events = new Dictionary<string, CallStateEvent>();
+
+        private IDictionary<string, ExtensionMapper> _extensions = new Dictionary<string, ExtensionMapper>();
+        private int _lastCallId = 0;
+
+        public CallManager(EventManager eventSocket)
+        {
+            _eventMgr = eventSocket;
+        }
+
+        public event ExtensionHandler ExtensionAdded;
+        public event CallHandler ExtensionChanged;
+        public event ExtensionHandler ExtensionDisconnected;
+        public event CallStateHandler OnCallState;
+
+        private ExtensionMapper GetMapper(string address)
+        {
+            if (_extensions.ContainsKey(address))
+                return _extensions[address];
+            else
+            {
+                ExtensionMapper em = new ExtensionMapper();
+                em.setter = new ExtensionSetters();
+                em.extension = new Extension(address, em.setter);
+                _extensions.Add(address, em);
+                if (ExtensionAdded != null)
+                    ExtensionAdded(em.extension);
+
+                return em;
+            }
+        }
+
+        private string ChannelDestination(string channelName)
+        {
+            //Check.Require(channelName, "Channel name must be set.");
+            string[] parts = channelName.Split('/');
+            //Check.Require(parts.Length == 3, "Channel must be sofia/<domain>/<user>");
+            return parts[2];
+        }
+
+        public void OnSwitchEvents(EventBase theEvent)
+        {
+            if (theEvent is EventPresenceIn)
+            {
+                EventPresenceIn ep = (EventPresenceIn) theEvent;
+                //Channel-State: CS_RING
+                //Channel-Name: sofia/default/jonas%40192.168.1.102%3A5070
+                //Unique-ID: 2f87ba27-2f71-d64d-8c64-9966ee894eac
+                //Call-Direction: inbound
+                //Answer-State: ringing
+                //Event-Name: PRESENCE_IN
+                CallState state = CallState.Unknown;
+                string destination = string.Empty;
+                if (ep.ChannelState.ChannelInfo.State == ChannelState.Ring)
+                {
+                    if (IsInbound(ep))
+                    {
+                        state = CallState.Alerting;
+                        destination = ep.Caller.DestinationNumber;
+                    }
+                    else
+                    {
+                        state = CallState.Offering;
+                        destination = ep.Caller.UserName;
+                    }
+                }
+                else if (ep.ChannelState.ChannelInfo.State == ChannelState.Hangup)
+                {
+                    state = CallState.Disconnected;
+                    if (IsInbound(ep))
+                        destination = ep.Caller.DestinationNumber;
+                    else
+                        destination = ep.Caller.UserName;
+                }
+                if (state != CallState.Unknown)
+                    TriggerCallState(ep.ChannelState.ChannelInfo.Address, ep.ChannelState.UniqueId, state, destination);
+            }
+            else if (theEvent is EventChannelAnswer)
+            {
+                EventChannelAnswer ea = (EventChannelAnswer) theEvent;
+                string destination;
+                if (IsInbound(ea))
+                    destination = ea.Caller.DestinationNumber;
+                else
+                    destination = ea.Caller.UserName;
+
+                TriggerCallState(ea.ChannelInfo.Address, ea.UniqueId, CallState.Connected, destination);
+            }
+
+            else if (theEvent is EventChannelDestroy)
+            {
+                EventChannelDestroy e = (EventChannelDestroy) theEvent;
+                Debug.WriteLine("triggering CallState.Disconnected");
+                TriggerCallState(e.ChannelInfo.Address, e.UniqueId, CallState.Disconnected,
+                                 e.Originator.DestinationNumber);
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="evt"></param>
+        /// <returns>true if it's inbound to pbx (not to user)</returns>
+        private bool IsInbound(EventBase evt)
+        {
+            return evt.Parameters["Call-Direction"] == "inbound";
+        }
+
+
+        public void OnSwitchEvents2(EventBase theEvent)
+        {
+            ChannelEvent evt = theEvent as ChannelEvent;
+            EventChannelState channelState = theEvent as EventChannelState;
+            if (channelState != null)
+                Debug.WriteLine("ChannelState: " + channelState.ChannelInfo.State + " " + channelState.Caller.UserName +
+                                " " + channelState.Caller.DestinationNumber);
+            else if (evt != null && evt.ChannelInfo != null)
+                Debug.WriteLine("ChannelEvent: " + evt.Name + " " + evt.ChannelInfo.Address);
+            if (evt != null)
+            {
+                // CHANNEL_ANSWER, No originator = new outgoing call. 
+                // ChannelName = the one who makes the call
+                if (evt is EventChannelAnswer)
+                {
+                    EventChannelAnswer e = (EventChannelAnswer) evt;
+                    if (e.Originator.CallerIdName != string.Empty)
+                    {
+                        Debug.WriteLine("Skipping emoty ChannelAnswer");
+                        return; // We do only want empty ones.
+                    }
+
+                    if (!IsExternalNumber(evt.ChannelInfo.Address))
+                    {
+                        Debug.WriteLine("triggering CallState.Alerting");
+                        TriggerCallState(evt.ChannelInfo.Address, e.UniqueId, CallState.Alerting,
+                                         e.Caller.DestinationNumber);
+                    }
+                }
+
+                    // CHANNEL_OUTGOING, Event for Alerting/Offering
+                    // Originator = the one calling
+                    // ChannelName = the one getting called.
+                else if (evt is EventChannelOutgoing)
+                {
+                    EventChannelOutgoing e = (EventChannelOutgoing) evt;
+                    if (!IsExternalNumber(evt.ChannelInfo.Address))
+                    {
+                        Debug.WriteLine("triggering CallState.Offering");
+                        TriggerCallState(evt.ChannelInfo.Address, e.UniqueId, CallState.Offering, e.Originator.UserName);
+                    }
+                    if (!IsExternalNumber(e.Originator.UserName))
+                    {
+                        Debug.WriteLine("triggering CallState.Alerting");
+                        TriggerCallState(e.Originator.UserName, e.Originator.UniqueId, CallState.Alerting,
+                                         e.ChannelInfo.Address);
+                    }
+                }
+
+                else if (evt is EventChannelBridge)
+                {
+                    EventChannelBridge e = (EventChannelBridge) evt;
+                    if (!IsExternalNumber(evt.ChannelInfo.Address))
+                    {
+                        Debug.WriteLine("triggering CallState.Connected");
+                        TriggerCallState(evt.ChannelInfo.Address, e.UniqueId, CallState.Connected,
+                                         e.Caller.DestinationNumber);
+                    }
+
+                    // Trigger destination
+                    if (!IsExternalNumber(e.Caller.DestinationNumber) && e.Originator.ChannelName != string.Empty)
+                    {
+                        Debug.WriteLine("triggering CallState.Connected");
+                        TriggerCallState(ChannelDestination(e.Originator.ChannelName), e.UniqueId, CallState.Connected,
+                                         e.ChannelInfo.Address);
+                    }
+                }
+
+                else if (evt is EventChannelDestroy)
+                {
+                    EventChannelDestroy e = (EventChannelDestroy) evt;
+                    Debug.WriteLine("triggering CallState.Disconnected");
+                    TriggerCallState(evt.ChannelInfo.Address, e.UniqueId, CallState.Disconnected,
+                                     e.Originator.DestinationNumber);
+                }
+            }
+        }
+
+        private bool IsExternalNumber(string number)
+        {
+            if (number == null || number == string.Empty)
+                return false;
+            return number[0] == '+';
+        }
+
+        private void TriggerCallState(string extensionOrUserName, string id, CallState state, string destination)
+        {
+            ExtensionMapper em = GetMapper(extensionOrUserName);
+            Debug.WriteLine(String.Format("{0} -> {1}, {2} id: {3}", extensionOrUserName, destination, state, id));
+            Call call = em.setter.callState(id, state, destination);
+            if (ExtensionChanged != null)
+                ExtensionChanged(em.extension, call);
+        }
+
+        private void OnBridgeCallId(CmdBase command, CommandReply reply)
+        {
+            GetVariableReply gvr = (GetVariableReply) reply;
+            if (!gvr.Success)
+                Debug.WriteLine("OnBridgeCallId " + reply.ErrCode);
+
+            string otherChannelId = (string) command.ContextData;
+            SetVariable sv = new SetVariable(otherChannelId, "gate_callid", gvr.Value);
+            sv.OnReply += OnCallIdReply;
+            _eventMgr.Send(sv);
+            command.OnReply -= OnBridgeCallId;
+        }
+
+        private void OnCallIdReply(CmdBase command, CommandReply reply)
+        {
+            if (!reply.Success)
+                Debug.WriteLine("OnCallIdReply " + reply.ErrCode);
+            command.OnReply -= OnCallIdReply;
+        }
+
+        #region Nested type: ExtensionMapper
+
+        private class ExtensionMapper
+        {
+            public Extension extension;
+            public ExtensionSetters setter;
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/CallStateEvent.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/CallStateEvent.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,158 @@
+using System;
+
+namespace EventWatcher
+{
+    public enum CallState
+    {
+        Unknown,
+
+        /// <summary>
+        /// The call has been created, but Connect has not been called yet. 
+        /// A call can never transition into the idle state. 
+        /// This is the initial state for both incoming and outgoing calls.
+        /// </summary>
+        Idle,
+        /// <summary>
+        /// Connect has been called, and the service provider is working on 
+        /// making a connection. This state is valid only on outgoing calls. 
+        /// This message is optional, because a service provider may have a 
+        /// call transition directly to the connected state.
+        /// </summary>
+        InProgress,
+        /// <summary>
+        /// Call has been connected to the remote end and communication can take place.
+        /// </summary>
+        Connected,
+        /// <summary>
+        /// Call has been disconnected. There are several causes for disconnection. 
+        /// See the table of valid call state transitions below.
+        /// </summary>
+        Disconnected,
+        /// <summary>
+        /// A new call has appeared, and is being offered to an application. 
+        /// If the application has owner privileges on the call, it can either 
+        /// call Answer or Disconnect while the call is in the offering state. 
+        /// </summary>
+        Offering,
+        Alerting,
+        /// <summary>
+        /// The call is in the hold state.
+        /// </summary>
+        Held,
+    }
+
+    public enum HangupCause
+    {
+        Success,
+        NormalClearing,
+        NoRouteTransitNet,
+        NoRouteDestination,
+        Busy,
+        Noanswer,
+        Rejected,
+        NumberChanged,
+        Congestion,
+    }
+    /// <summary>
+    /// Subclass for all call events.
+    /// The events are sent as commands through the
+    /// Command Dispatcher.
+    /// </summary>
+    [Serializable]
+    public class CallStateEvent
+    {
+        private string _callId;
+        private string _pbxId;
+        private string _destination;
+        private string _from;
+        private CallState _state = CallState.Idle;
+        private bool _isIncoming = true;
+        private bool _isInternal;
+        private HangupCause _hangupCause;
+
+        public CallStateEvent()
+        {
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="callId">Call identification string</param>
+        /// <param name="pbxId">Id used internally in the pbx to identify the call.</param>
+        /// <param name="from">Sip-Address to the one that made the call</param>
+        /// <param name="destination">Sip-address to where the call was made.</param>
+        public CallStateEvent(string callId, string pbxId, string from, string destination)
+        {
+            _callId = callId;
+            _from = from;
+            PbxId = pbxId;
+            _destination = destination;
+        }
+
+        /// <summary>
+        /// Call identification string.
+        /// </summary>
+        public string CallId
+        {
+            get { return _callId; }
+            set { _callId = value; }
+        }
+
+        /// <summary>
+        /// User that made the call.
+        /// </summary>
+        public string From
+        {
+            get { return _from; }
+            set { _from = value; }
+        }
+
+        /// <summary>
+        /// To whom the call was made.
+        /// </summary>
+        public string Destination
+        {
+            get { return _destination; }
+            set { _destination = value; }
+        }
+
+        /// <summary>
+        /// Current CallState.
+        /// </summary>
+        public CallState State
+        {
+            get { return _state; }
+            set { _state = value; }
+        }
+
+        /// <summary>
+        /// This is an incoming call.
+        /// </summary>
+        public bool Incoming
+        {
+            get { return _isIncoming; }
+            set { _isIncoming = value; }
+        }
+
+        /// <summary>
+        /// This is an internal call in the pbx.
+        /// </summary>
+        public bool Internal
+        {
+            get { return _isInternal; }
+            set { _isInternal = value; }
+        }
+
+        public HangupCause HangupCause
+        {
+            get { return _hangupCause; }
+            set { _hangupCause = value; }
+        }
+
+        internal string PbxId
+        {
+            get { return _pbxId; }
+            set { _pbxId = value; }
+        }
+    }
+}
\ No newline at end of file

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/EventWatcher.csproj
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/EventWatcher.csproj	Thu May  1 14:27:39 2008
@@ -0,0 +1,96 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{E65ABA5F-A578-4E3C-989D-0FE4E459C03D}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>EventWatcher</RootNamespace>
+    <AssemblyName>EventWatcher</AssemblyName>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Deployment" />
+    <Reference Include="System.Design" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Call.cs" />
+    <Compile Include="CallManager.cs" />
+    <Compile Include="CallStateEvent.cs" />
+    <Compile Include="Extension.cs" />
+    <Compile Include="Form1.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Form1.Designer.cs">
+      <DependentUpon>Form1.cs</DependentUpon>
+    </Compile>
+    <Compile Include="LabelTextBox.cs">
+      <SubType>Component</SubType>
+    </Compile>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <EmbeddedResource Include="Form1.resx">
+      <SubType>Designer</SubType>
+      <DependentUpon>Form1.cs</DependentUpon>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Resources.resx</DependentUpon>
+      <DesignTime>True</DesignTime>
+    </Compile>
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\FreeSwitchEventSocket\FreeSwitch.EventSocket.csproj">
+      <Project>{3F8895F6-F710-4323-B96A-4EFB6BC97E08}</Project>
+      <Name>FreeSwitch.EventSocket</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="ReadMePlease.txt" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Extension.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Extension.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,162 @@
+using System;
+using System.Collections.Generic;
+
+namespace EventWatcher
+{
+    public delegate void ExtensionHandler(Extension extension);
+    public delegate void CallHandler(Extension extension, Call call);
+    public delegate Call CallStateSetter(string id, CallState state, string destination);
+
+    /// <summary>
+    /// Used to set states for the extension.
+    /// We are using this method since we do not want anything else
+    /// but the CallMgr to be able to set stuff.
+    /// </summary>
+    /// <param name="forwardAll">null if it has changed, else the new forward destination</param>
+    /// <param name="forwardBusy">null if it has changed, else the new forward destination</param>
+    /// <param name="forwardNoAnswer">null if it has changed, else the new forward destination</param>
+    public delegate void ForwardSetter(string forwardAll, string forwardBusy, string forwardNoAnswer);
+
+    public class ExtensionSetters
+    {
+        public CallStateSetter callState;
+        public ForwardSetter forwardSetter;
+    }
+
+    /// <summary>
+    /// Class representing an extension.
+    /// </summary>
+    [Serializable]
+    public class Extension
+    {
+        private readonly string _address = string.Empty;
+        private readonly IDictionary<string, Call> _calls = new Dictionary<string, Call>();
+        private readonly string _destination = string.Empty;
+        private string _forwardAll = string.Empty;
+        private string _forwardBusy = string.Empty;
+        private string _forwardNoAnswer = string.Empty;
+        private ExtensionSetters _handler;
+
+        public Extension(string address)
+        {
+            _address = address;
+        }
+
+        public Extension(string address, ExtensionSetters setters)
+        {
+            _address = address;
+            Handler = setters;
+        }
+
+        public bool IsBusy
+        {
+            get
+            {
+                foreach (KeyValuePair<string, Call> pair in _calls)
+                {
+                    if (pair.Value.State != CallState.Disconnected
+                        && pair.Value.State != CallState.Held)
+                        return false;
+                }
+                return true;
+            }
+        }
+
+        /// <summary>
+        /// Determines if this extension is forwarded in any way
+        /// </summary>
+        public bool IsForwarded
+        {
+            get
+            {
+                return _forwardNoAnswer != string.Empty
+                       || _forwardBusy != string.Empty
+                       || _forwardAll != string.Empty;
+            }
+        }
+
+        public string ForwardAll
+        {
+            get { return _forwardAll; }
+        }
+
+        public string ForwardBusy
+        {
+            get { return _forwardBusy; }
+        }
+
+        public string ForwardNoAnswer
+        {
+            get { return _forwardNoAnswer; }
+        }
+
+        public string Destination
+        {
+            get { return _destination; }
+        }
+
+        public string Address
+        {
+            get { return _address; }
+        }
+
+        public ExtensionSetters Handler
+        {
+            get { return _handler; }
+            set
+            {
+                if (value != null)
+                    //Check.Require(_handler == null, "Handler can only be assigned one time.");
+
+                    _handler = value;
+                if (value != null)
+                {
+                    value.callState = SetCallState;
+                    value.forwardSetter = SetForward;
+                }
+            }
+        }
+
+        private Call SetCallState(string id, CallState state, string destination)
+        {
+            bool wasBusy = IsBusy;
+
+            Call call;
+            if (!_calls.ContainsKey(id))
+                call = new Call(id);
+            else
+                call = _calls[id];
+
+            call.SetCallState(state);
+            call.SetDestination(destination);
+
+            if (CallChanged != null)
+                CallChanged(this, call);
+
+            if (state == CallState.Disconnected)
+                _calls.Remove(id);
+
+
+            if (wasBusy != IsBusy && BusyStateChanged != null)
+                BusyStateChanged(this);
+
+            return call;
+        }
+
+        private void SetForward(string forwardAll, string forwardBusy, string forwardNoAnswer)
+        {
+            if (forwardAll != null)
+                _forwardAll = forwardAll;
+            if (forwardBusy != null)
+                _forwardBusy = forwardBusy;
+            if (forwardNoAnswer != null)
+                _forwardNoAnswer = forwardNoAnswer;
+            if (ForwardChanged != null)
+                ForwardChanged(this);
+        }
+
+        public event ExtensionHandler BusyStateChanged;
+        public event CallHandler CallChanged;
+        public event ExtensionHandler ForwardChanged;
+    }
+}
\ No newline at end of file

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.Designer.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.Designer.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,212 @@
+namespace EventWatcher
+{
+    partial class Form1
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.panel1 = new System.Windows.Forms.Panel();
+            this.log = new System.Windows.Forms.TextBox();
+            this.info = new System.Windows.Forms.RichTextBox();
+            this.lv = new System.Windows.Forms.ListView();
+            this.colAddress = new System.Windows.Forms.ColumnHeader();
+            this.colId = new System.Windows.Forms.ColumnHeader();
+            this.colPbxId = new System.Windows.Forms.ColumnHeader();
+            this.colState = new System.Windows.Forms.ColumnHeader();
+            this.colCaller = new System.Windows.Forms.ColumnHeader();
+            this.colOriginator = new System.Windows.Forms.ColumnHeader();
+            this.colOrginatee = new System.Windows.Forms.ColumnHeader();
+            this.lvAll = new System.Windows.Forms.ListView();
+            this.from = new System.Windows.Forms.ColumnHeader();
+            this.To = new System.Windows.Forms.ColumnHeader();
+            this.ChannelId = new System.Windows.Forms.ColumnHeader();
+            this.SessionId = new System.Windows.Forms.ColumnHeader();
+            this.State = new System.Windows.Forms.ColumnHeader();
+            this.panel1.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // panel1
+            // 
+            this.panel1.Controls.Add(this.log);
+            this.panel1.Controls.Add(this.info);
+            this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
+            this.panel1.Location = new System.Drawing.Point(627, 0);
+            this.panel1.Name = "panel1";
+            this.panel1.Size = new System.Drawing.Size(293, 546);
+            this.panel1.TabIndex = 11;
+            // 
+            // log
+            // 
+            this.log.Dock = System.Windows.Forms.DockStyle.Bottom;
+            this.log.Location = new System.Drawing.Point(0, 526);
+            this.log.Name = "log";
+            this.log.Size = new System.Drawing.Size(293, 20);
+            this.log.TabIndex = 11;
+            // 
+            // info
+            // 
+            this.info.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.info.Location = new System.Drawing.Point(0, 0);
+            this.info.Name = "info";
+            this.info.Size = new System.Drawing.Size(293, 546);
+            this.info.TabIndex = 10;
+            this.info.Text = "";
+            // 
+            // lv
+            // 
+            this.lv.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+            this.colAddress,
+            this.colId,
+            this.colPbxId,
+            this.colState,
+            this.colCaller,
+            this.colOriginator,
+            this.colOrginatee});
+            this.lv.Dock = System.Windows.Forms.DockStyle.Top;
+            this.lv.Location = new System.Drawing.Point(0, 0);
+            this.lv.Name = "lv";
+            this.lv.Size = new System.Drawing.Size(627, 152);
+            this.lv.TabIndex = 12;
+            this.lv.UseCompatibleStateImageBehavior = false;
+            this.lv.View = System.Windows.Forms.View.Details;
+            // 
+            // colAddress
+            // 
+            this.colAddress.Text = "Anknytning";
+            this.colAddress.Width = 65;
+            // 
+            // colId
+            // 
+            this.colId.Text = "Id";
+            this.colId.Width = 26;
+            // 
+            // colPbxId
+            // 
+            this.colPbxId.Text = "PbxId";
+            this.colPbxId.Width = 230;
+            // 
+            // colState
+            // 
+            this.colState.Text = "Status";
+            this.colState.Width = 50;
+            // 
+            // colCaller
+            // 
+            this.colCaller.Text = "Caller";
+            this.colCaller.Width = 62;
+            // 
+            // colOriginator
+            // 
+            this.colOriginator.Text = "Originator";
+            this.colOriginator.Width = 72;
+            // 
+            // colOrginatee
+            // 
+            this.colOrginatee.Text = "Orginatee";
+            this.colOrginatee.Width = 116;
+            // 
+            // lvAll
+            // 
+            this.lvAll.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+            this.from,
+            this.To,
+            this.ChannelId,
+            this.SessionId,
+            this.State});
+            this.lvAll.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.lvAll.Location = new System.Drawing.Point(0, 152);
+            this.lvAll.Name = "lvAll";
+            this.lvAll.Size = new System.Drawing.Size(627, 394);
+            this.lvAll.TabIndex = 13;
+            this.lvAll.UseCompatibleStateImageBehavior = false;
+            this.lvAll.View = System.Windows.Forms.View.Details;
+            this.lvAll.SelectedIndexChanged += new System.EventHandler(this.lvAll_SelectedIndexChanged);
+            this.lvAll.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lvAll_ItemSelectionChanged);
+            // 
+            // from
+            // 
+            this.from.Text = "Från";
+            // 
+            // To
+            // 
+            this.To.Text = "Till";
+            this.To.Width = 84;
+            // 
+            // ChannelId
+            // 
+            this.ChannelId.Text = "ChannelId";
+            this.ChannelId.Width = 282;
+            // 
+            // SessionId
+            // 
+            this.SessionId.Text = "SessionId";
+            this.SessionId.Width = 318;
+            // 
+            // State
+            // 
+            this.State.Text = "State";
+            this.State.Width = 99;
+            // 
+            // Form1
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(920, 546);
+            this.Controls.Add(this.lvAll);
+            this.Controls.Add(this.lv);
+            this.Controls.Add(this.panel1);
+            this.Name = "Form1";
+            this.Text = "Form1";
+            this.Load += new System.EventHandler(this.Form1_Load);
+            this.panel1.ResumeLayout(false);
+            this.panel1.PerformLayout();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Panel panel1;
+        private System.Windows.Forms.TextBox log;
+        private System.Windows.Forms.RichTextBox info;
+        private System.Windows.Forms.ListView lv;
+        private System.Windows.Forms.ColumnHeader colAddress;
+        private System.Windows.Forms.ColumnHeader colId;
+        private System.Windows.Forms.ColumnHeader colPbxId;
+        private System.Windows.Forms.ColumnHeader colState;
+        private System.Windows.Forms.ColumnHeader colCaller;
+        private System.Windows.Forms.ColumnHeader colOriginator;
+        private System.Windows.Forms.ColumnHeader colOrginatee;
+        private System.Windows.Forms.ListView lvAll;
+        private System.Windows.Forms.ColumnHeader from;
+        private System.Windows.Forms.ColumnHeader To;
+        private System.Windows.Forms.ColumnHeader ChannelId;
+        private System.Windows.Forms.ColumnHeader SessionId;
+        private System.Windows.Forms.ColumnHeader State;
+
+    }
+}
+

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,235 @@
+using System;
+using System.Diagnostics;
+using System.Drawing;
+using System.Reflection;
+using System.Windows.Forms;
+using FreeSwitch.EventSocket;
+using FreeSwitch.EventSocket.Commands;
+using FreeSwitch.EventSocket.General;
+
+namespace EventWatcher
+{
+    public partial class Form1 : Form
+    {
+        private EventManager _eventMgr;
+        private CallManager _callMgr;
+
+        public Form1()
+        {
+            InitializeComponent();
+            _eventMgr = new EventManager();
+            _callMgr = new CallManager(_eventMgr);
+            _callMgr.OnCallState += OnCallState;
+            _callMgr.ExtensionAdded += OnExtensionAdded;
+            _callMgr.ExtensionChanged += OnExtensionChanged;
+
+
+        }
+
+        private void OnExtensionAdded(Extension extension)
+        {
+            //throw new NotImplementedException();
+        }
+
+        private void OnExtensionChanged(Extension extension, Call call)
+        {
+            if (lv.InvokeRequired)
+                BeginInvoke((MethodInvoker)delegate { OnExtensionChangedX(extension, call); });
+            else
+                OnExtensionChangedX(extension, call);
+        }
+
+        private void OnExtensionChangedX(Extension extension, Call call)
+        {
+            ListViewItem item = null;
+            foreach (ListViewItem item2 in lv.Items)
+            {
+                if (String.Compare(item2.Name, extension.Address, true) == 0)
+                {
+                    item = item2;
+                    break;
+                }
+            }
+            if (item == null)//(!lv.Items.ContainsKey(extension.Address))
+            {
+                item = lv.Items.Add(extension.Address, extension.Address, 0);
+                item.Tag = extension;
+                item.SubItems.Add(call.Id);
+                item.SubItems.Add(call.State.ToString());
+                item.SubItems.Add(call.PreviousState.ToString());
+                item.SubItems.Add("");
+                item.SubItems.Add(extension.Destination);                
+            }
+            else
+            {
+                item.SubItems[2].Text = call.State.ToString();
+                item.SubItems[3].Text = call.PreviousState.ToString();
+            }
+        }
+
+        private void OnExtensionCallState(Extension e)
+        {
+            
+        }
+        private void OnCallState(CallManager mgr, CallStateEvent cs)
+        {
+            if (lv.InvokeRequired)
+                BeginInvoke((MethodInvoker)delegate { OnCallStateX(mgr, cs); });
+            else
+                OnCallStateX(mgr, cs);
+        }
+
+        private void OnCallStateX(CallManager mgr, CallStateEvent cs)
+        {
+            ListViewItem item;
+            if (!lv.Items.ContainsKey(cs.PbxId))
+            {
+                item = lv.Items.Add(cs.PbxId, cs.From, 0);
+                item.Tag = cs;
+                item.SubItems.Add(cs.CallId);
+                item.SubItems.Add(cs.PbxId);
+                item.SubItems.Add(cs.State.ToString());
+                item.SubItems.Add(cs.From);
+                item.SubItems.Add(cs.Destination);
+            }
+            else
+                item = lv.Items[cs.PbxId];
+
+            item.SubItems[1].Text = cs.CallId;
+            item.SubItems[3].Text = cs.State.ToString();
+            item.SubItems[4].Text = cs.Destination;
+
+            if (cs.State == CallState.Disconnected)
+                lv.Items.RemoveByKey(cs.PbxId);
+        }
+
+        private void Form1_Load(object sender, EventArgs e)
+        {
+            _eventMgr.Password = "ClueCon";
+            _eventMgr.Start("localhost");
+            _eventMgr.Subscribe(new Events(Event.All));
+            _eventMgr.EventReceived += OnPreSwitchEvent;
+        }
+
+        private void OnPreSwitchEvent(EventBase theEvent)
+        {
+            _callMgr.OnSwitchEvents(theEvent);
+            if (lvAll.InvokeRequired)
+                BeginInvoke((MethodInvoker)delegate { OnSwitchEvent(theEvent); });
+            else
+                OnSwitchEvent(theEvent);
+        }
+
+
+        private string DisplayProperties(object o)
+        {
+            return DisplayProperties(o, 0);
+        }
+
+        private string DisplayProperties(object o, int spaces)
+        {
+            PropertyInfo[] pis = o.GetType().GetProperties();
+            string info = string.Empty;
+            foreach (PropertyInfo pi in pis)
+            {
+                if (pi.PropertyType == typeof (ChannelInfo) || pi.PropertyType == typeof (PartyInfo))
+                {
+                    info += pi.Name.PadLeft(spaces + pi.Name.Length) + "\r\n";
+                    info += DisplayProperties(pi.GetValue(o, null), spaces + 2);
+                }
+                else
+                    info += pi.Name.PadLeft(spaces + pi.Name.Length) + ": " + pi.GetValue(o, null) + "\r\n";
+            }
+            return info;
+        }
+
+        private void OnSwitchEvent(EventBase theEvent)
+        {
+            EventChannelState e = theEvent as EventChannelState;
+            if (e != null)
+            {
+
+                EventChannelState channelEvent = theEvent as EventChannelState;
+                if (channelEvent == null)
+                    return;
+
+                //OnSwitchEvents(theEvent);
+
+                ListViewItem item;
+                item = lvAll.Items.Add(channelEvent.ChannelInfo.Address);
+                item.Tag = channelEvent;
+                item.SubItems.Add(channelEvent.Originator.UserName);
+                item.SubItems.Add(channelEvent.UniqueId);
+                item.SubItems.Add(channelEvent.Caller.UniqueId);
+                if (channelEvent.Name == "CHANNEL_STATE")
+                    item.SubItems.Add(e.ChannelInfo.State.ToString());
+                else
+                    item.SubItems.Add(e.Name);
+
+                if (e.GetType() == typeof(EventCodec) || theEvent.GetType() == typeof(EventChannelExecute)
+                    || e.Originator.DestinationNumber == string.Empty)
+                {
+                    item.ForeColor = Color.Gray;
+                }
+
+            }
+            log.Text = theEvent.Name;
+        }
+
+        private void AddEvent(ListBox box, ChannelEvent e)
+        {
+            box.Items.Insert(0, new Wrapper(e));
+        }
+
+        private void lvAll_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            /*
+            if (lvAll.SelectedItems.Count == 0)
+                return;
+            ListViewItem itm = lvAll.SelectedItems[0];
+            MessageBox.Show(DisplayProperties(itm.Tag));
+             * */
+        }
+
+        private void lvAll_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
+        {
+            if (lvAll.SelectedItems.Count == 0)
+                return;
+            ListViewItem itm = lvAll.SelectedItems[0];
+            info.Text = DisplayProperties(itm.Tag);
+        }
+
+        #region Nested type: SwitchEventHandler
+
+        private delegate void SwitchEventHandler(EventBase theEvent);
+
+        #endregion
+
+        #region Nested type: Wrapper
+
+        private class Wrapper
+        {
+            public ChannelEvent e;
+
+            public Wrapper(ChannelEvent e)
+            {
+                this.e = e;
+            }
+
+            public override string ToString()
+            {
+                return "[" + e.Name + "] " + e.ChannelInfo.State;
+            }
+        }
+
+        #endregion
+
+        private void btnOriginate_Click(object sender, EventArgs e)
+        {
+            //Originate org = new Originate();
+            //org.Caller = new SofiaSipAddress("gauffin.com");
+            //from_id.Text
+        }
+
+    }
+}
\ No newline at end of file

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.resx
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Form1.resx	Thu May  1 14:27:39 2008
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
\ No newline at end of file

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/LabelTextBox.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/LabelTextBox.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace EventWatcher
+{
+    class LabelTextBox : TextBox
+    {
+        private string _label;
+
+        public string Label
+        {
+            get { return _label; }
+            set 
+            { 
+                _label = value; 
+                if (Text == string.Empty)
+                    SetLabel();
+            }
+        }
+
+        public void test()
+        {
+            TextBox x = new TextBox();
+            x.KeyDown += tb_KeyDown;
+            x.TextChanged += tb_TextChanged;
+        }
+
+        private void tb_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
+        {
+            if (ForeColor == Color.FromKnownColor(KnownColor.InactiveCaptionText))
+                RemoveLabel();
+        }
+
+        private void tb_TextChanged(object sender, EventArgs e)
+        {
+            if (Text == string.Empty)
+              SetLabel();
+            else if (Text != _label && Text != string.Empty)
+             RemoveLabel();   
+        }
+
+        private void RemoveLabel()
+        {
+            ForeColor = Color.FromKnownColor(KnownColor.WindowText);
+            Text = string.Empty;
+
+        }
+        private void SetLabel()
+        {
+            ForeColor = Color.FromKnownColor(KnownColor.InactiveCaptionText);
+            Text = _label;
+
+        }
+
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Program.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Program.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+
+namespace EventWatcher
+{
+    static class Program
+    {
+        /// <summary>
+        /// The main entry point for the application.
+        /// </summary>
+        [STAThread]
+        static void Main()
+        {
+            Application.EnableVisualStyles();
+            Application.SetCompatibleTextRenderingDefault(false);
+            Application.Run(new Form1());
+        }
+    }
+}
\ No newline at end of file

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/AssemblyInfo.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/AssemblyInfo.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("EventWatcher")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("EventWatcher")]
+[assembly: AssemblyCopyright("Copyright ©  2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("e6a71f21-6833-455f-a398-a0d6a54c1359")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.Designer.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.Designer.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:2.0.50727.312
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace EventWatcher.Properties {
+    using System;
+    
+    
+    /// <summary>
+    ///   A strongly-typed resource class, for looking up localized strings, etc.
+    /// </summary>
+    // This class was auto-generated by the StronglyTypedResourceBuilder
+    // class via a tool like ResGen or Visual Studio.
+    // To add or remove a member, edit your .ResX file then rerun ResGen
+    // with the /str option, or rebuild your VS project.
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources {
+        
+        private static global::System.Resources.ResourceManager resourceMan;
+        
+        private static global::System.Globalization.CultureInfo resourceCulture;
+        
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources() {
+        }
+        
+        /// <summary>
+        ///   Returns the cached ResourceManager instance used by this class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EventWatcher.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+        
+        /// <summary>
+        ///   Overrides the current thread's CurrentUICulture property for all
+        ///   resource lookups using this strongly typed resource class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
+                return resourceCulture;
+            }
+            set {
+                resourceCulture = value;
+            }
+        }
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.resx
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.resx	Thu May  1 14:27:39 2008
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
\ No newline at end of file

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.Designer.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.Designer.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:2.0.50727.312
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace EventWatcher.Properties
+{
+
+
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+    {
+
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+        public static Settings Default
+        {
+            get
+            {
+                return defaultInstance;
+            }
+        }
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.settings
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.settings	Thu May  1 14:27:39 2008
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+  <Profiles>
+    <Profile Name="(Default)" />
+  </Profiles>
+  <Settings />
+</SettingsFile>

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/ReadMePlease.txt
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/ReadMePlease.txt	Thu May  1 14:27:39 2008
@@ -0,0 +1,3 @@
+This is just a test project that I used to develop the event socket lib.
+
+It could in the future be an application that keep track on all channels and their current state.
\ No newline at end of file

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/EventSocket.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/EventSocket.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using FreeSwitch.EventSocket;
+using FreeSwitch.EventSocket.Commands;
+using FreeSwitch.EventSocket.General;
+
+namespace FreeSwitch.EventSocket.Test
+{
+    class EventSocket
+    {
+        private FreeSwitch.EventSocket.EventSocket m_es = new FreeSwitch.EventSocket.EventSocket();
+
+        public void Setup()
+        {
+            m_es.Connect("192.168.1.102");
+            m_es.Subscribe(new Events(Event.All));
+            //m_es.SendApi(new Originate(new SofiaSipAddress("gauffin.com", "arne"), new Address("8888")));
+            System.Threading.Thread.Sleep(500000);
+        }
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/FreeSwitch.EventSocket.Test.csproj
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/FreeSwitch.EventSocket.Test.csproj	Thu May  1 14:27:39 2008
@@ -0,0 +1,55 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{3679225D-79A3-4B6C-BCA1-E2DC265E423A}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>FreeSwitch.EventSocket.Test</RootNamespace>
+    <AssemblyName>FreeSwitch.EventSocket.Test</AssemblyName>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="EventSocket.cs" />
+    <Compile Include="ParserTest.cs" />
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\FreeSwitchEventSocket\FreeSwitch.EventSocket.csproj">
+      <Project>{3F8895F6-F710-4323-B96A-4EFB6BC97E08}</Project>
+      <Name>FreeSwitch.EventSocket</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/ParserTest.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/ParserTest.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket.Test
+{
+    class ParserTest
+    {
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Program.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Program.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System.Text;
+
+namespace FreeSwitch.EventSocket.Test
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            EventManager mgr = new EventManager();
+            mgr.Subscribe(Events.GetChannelEvents());
+            mgr.Start("localhost");
+            Console.ReadLine();
+
+            string buffer = File.ReadAllText("..\\..\\..\\watcherRaw.log");
+            int bufLen = buffer.Length;
+
+            EventParser ep = new EventParser(buffer);
+            //int cnt = 0;
+            EventSocket es = new EventSocket();
+            es.Setup();
+        }
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Properties/AssemblyInfo.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Properties/AssemblyInfo.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("FreeSwitch.EventSocket.Test")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("FreeSwitch.EventSocket.Test")]
+[assembly: AssemblyCopyright("Copyright ©  2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("b496f9be-f1be-457d-b8c8-fae97c43df8e")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.sln
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.sln	Thu May  1 14:27:39 2008
@@ -0,0 +1,38 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeSwitch.EventSocket", "FreeSwitchEventSocket\FreeSwitch.EventSocket.csproj", "{3F8895F6-F710-4323-B96A-4EFB6BC97E08}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeSwitch.EventSocket.Test", "FreeSwitch.EventSocket.Test\FreeSwitch.EventSocket.Test.csproj", "{3679225D-79A3-4B6C-BCA1-E2DC265E423A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventWatcher", "EventWatcher\EventWatcher.csproj", "{E65ABA5F-A578-4E3C-989D-0FE4E459C03D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IvrSocket", "IvrSocket\IvrSocket.csproj", "{22F26D13-0A0E-4345-9FEC-CE13FC8F37FD}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{3F8895F6-F710-4323-B96A-4EFB6BC97E08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3F8895F6-F710-4323-B96A-4EFB6BC97E08}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3F8895F6-F710-4323-B96A-4EFB6BC97E08}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3F8895F6-F710-4323-B96A-4EFB6BC97E08}.Release|Any CPU.Build.0 = Release|Any CPU
+		{3679225D-79A3-4B6C-BCA1-E2DC265E423A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3679225D-79A3-4B6C-BCA1-E2DC265E423A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3679225D-79A3-4B6C-BCA1-E2DC265E423A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3679225D-79A3-4B6C-BCA1-E2DC265E423A}.Release|Any CPU.Build.0 = Release|Any CPU
+		{E65ABA5F-A578-4E3C-989D-0FE4E459C03D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{E65ABA5F-A578-4E3C-989D-0FE4E459C03D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{E65ABA5F-A578-4E3C-989D-0FE4E459C03D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{E65ABA5F-A578-4E3C-989D-0FE4E459C03D}.Release|Any CPU.Build.0 = Release|Any CPU
+		{22F26D13-0A0E-4345-9FEC-CE13FC8F37FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{22F26D13-0A0E-4345-9FEC-CE13FC8F37FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{22F26D13-0A0E-4345-9FEC-CE13FC8F37FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{22F26D13-0A0E-4345-9FEC-CE13FC8F37FD}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/ChannelEvent.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/ChannelEvent.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+    public class ChannelEvent : EventBase
+    {
+        private ChannelInfo _channelInfo;
+        private string _uniqueId = string.Empty;
+        private string _answerState;
+        private string _callDirection;
+
+        public override bool IsChannelEvent
+        {
+            get { return true; }
+        }
+
+        /// <summary>
+        /// Information about the used channel and it's state.
+        /// </summary>
+        public ChannelInfo ChannelInfo
+        {
+            get { return _channelInfo; }
+            set { _channelInfo = value; }
+        }
+
+        public string UniqueId
+        {
+            get { return _uniqueId; }
+            set { _uniqueId = value; }
+        }
+
+        public string AnswerState
+        {
+            get { return _answerState; }
+            set { _answerState = value; }
+        }
+
+        public string CallDirection
+        {
+            get { return _callDirection; }
+            set { _callDirection = value; }
+        }
+
+        public override bool ParseCommand(string name, string value)
+        {
+            if (name == "unique-id")
+                _uniqueId = value;
+            else if (name == "answer-state")
+                _answerState = value;
+            else if (name == "call-direction")
+                _callDirection = value;
+            else if (name.Length > 8 && name.Substring(0, 8) ==  "channel-")
+            {
+                if (_channelInfo == null)
+                    _channelInfo = new ChannelInfo();
+                return _channelInfo.Parse(name, value);
+            }
+            else
+                return base.ParseCommand(name, value);
+
+            return true;
+        }
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelAnswer.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelAnswer.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,6 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelAnswer : EventChannelState
+    {
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelApplication.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelApplication.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelApplication : EventChannelState
+    {
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelBridge.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelBridge.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelBridge : EventChannelState
+    {
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelCreate.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelCreate.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,6 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelCreate : ChannelEvent
+    {
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelDestroy.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelDestroy.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelDestroy : EventChannelState
+    {
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelExecute : EventChannelState
+    {
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,7 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelExecuteComplete : EventChannelState
+    {
+    }
+}
+

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelHangup.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelHangup.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,91 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelHangup : EventChannelState
+    {
+        private Causes m_hangupCause;
+
+        public enum Causes
+        {
+            Success,
+            NoRouteTransitNet,
+            NoRouteDestination,
+            ChannelUnacceptable,
+            CallAwardedDelivered,
+            NormalClearing,
+            UserBusy,
+            NoUserResponse,
+            NoAnswer,
+            SubscriberAbsent,
+            CallRejected,
+            NumberChanged,
+            RedirectionToNewDestination,
+            ExchangeRoutingError,
+            DestinationOutOfOrder,
+            InvalidNumberFormat,
+            FacilityRejected,
+            ResponseToStatusEnquiry,
+            NormalUnspecified,
+            NormalCircuitCongestion,
+            NetworkOutOfOrder,
+            NormalTemporaryFailure,
+            SwitchCongestion,
+            AccessInfoDiscarded,
+            RequestedChanUnavail,
+            PreEmpted,
+            FacilityNotSubscribed,
+            OutgoingCallBarred,
+            IncomingCallBarred,
+            BearercapabilityNotauth,
+            BearercapabilityNotavail,
+            ServiceUnavailable,
+            ChanNotImplemented,
+            FacilityNotImplemented,
+            ServiceNotImplemented,
+            InvalidCallReference,
+            IncompatibleDestination,
+            InvalidMsgUnspecified,
+            MandatoryIeMissing,
+            MessageTypeNonexist,
+            WrongMessage,
+            IeNonexist,
+            InvalidIeContents,
+            WrongCallState,
+            RecoveryOnTimerExpire,
+            MandatoryIeLengthError,
+            ProtocolError,
+            Interworking,
+            OriginatorCancel,
+            Crash,
+            SystemShutdown,
+            LoseRace,
+            ManagerRequest,
+            BlindTransfer,
+            AttendedTransfer,
+            AllottedTimeout            
+        }
+
+        public Causes Cause
+        {
+            get { return m_hangupCause; }
+            set { m_hangupCause = value; }
+        }
+
+        public override bool ParseCommand(string name, string value)
+        {
+            if (name == "hangupcause" || name == "hangup-cause")
+            {
+                string cause = StringHelper.UpperCaseToCamelCase(value);
+                m_hangupCause = (Causes)Enum.Parse(typeof(Causes), cause);
+            }
+            else 
+                return base.ParseCommand(name, value);
+
+            return true;
+        }
+
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOriginate.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOriginate.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelOriginate : ChannelEvent
+    {
+
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOutgoing.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOutgoing.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelOutgoing : EventChannelState
+    {
+
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelProgress.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelProgress.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelProgress : EventChannelState
+    {
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelState.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelState.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,63 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelState : ChannelEvent
+    {
+        private PartyInfo _caller = new PartyInfo();
+        private PartyInfo _originator = new PartyInfo();
+        private bool _screenBit = false;
+
+        /// <summary>
+        /// Information about the called party.
+        /// This property is null for certain channel states,
+        /// depending on if freeswitch sends it or not.
+        /// </summary>
+        public PartyInfo Caller
+        {
+            get { return _caller; }
+            set { _caller = value; }
+        }
+
+        /// <summary>
+        /// Information about the destination (place that the caller want to reach).
+        /// This property is null for certain channel states,
+        /// depending on if freeswitch sends it or not.
+        /// </summary>
+        public PartyInfo Originator
+        {
+            get { return _originator; }
+            set { _originator = value; }
+        }
+
+        public bool ScreenBit
+        {
+            get { return _screenBit; }
+            set { _screenBit = value; }
+        }
+
+        public override bool ParseCommand(string name, string value)
+        {
+            if (name == "screen-bit")
+            {
+                ScreenBit = value == "yes";
+                return true;
+            }
+            else if (name.Length > 11 && name.Substring(0, 11) == "originator-"
+                     || name.Length > 11 && name.Substring(0, 11) == "originatee-")
+            {
+                if (_originator == null)
+                    _originator = new PartyInfo();
+
+                return _originator.Parse(name.Substring(11), value);
+            }
+            else if (name.Length > 7 && name.Substring(0, 7) == "caller-")
+            {
+                if (_caller == null)
+                    _caller = new PartyInfo();
+
+                return _caller.Parse(name.Substring(7), value);
+            }
+            else
+                return base.ParseCommand(name, value);
+        }
+    }
+}
\ No newline at end of file

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnbridge.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnbridge.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelUnbridge : EventChannelState
+    {
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnpark.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnpark.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+    public class EventChannelUnpark : EventChannelState
+    {
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventCodec.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventCodec.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,6 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventCodec : EventChannelState
+    {
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmf.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmf.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,35 @@
+namespace FreeSwitch.EventSocket
+{
+    public class EventDtmf : ChannelEvent
+    {
+        private char _digit;
+        private int _duration;
+
+        public char Digit
+        {
+            get { return _digit; }
+            set { _digit = value; }
+        }
+
+        public int Duration
+        {
+            get { return _duration; }
+            set { _duration = value; }
+        }
+
+        public override bool ParseCommand(string name, string value)
+        {
+            switch(name)
+            {
+                case "dtmf-digit":
+                    _digit = value[0];
+                    break;
+                case "dtmf-duration":
+                    int.TryParse(value, out _duration);
+                    break;
+            }
+
+            return base.ParseCommand(name, value);
+        }
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmfStatus.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmfStatus.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,31 @@
+namespace FreeSwitch.EventSocket
+{
+    /// <summary>
+    /// Reports when DTMF digits have been pressed
+    /// </summary>
+    public class EventDtmfStatus : ChannelEvent
+    {
+        private int _count;
+
+        /// <summary>
+        /// Number of digits in the buffer.
+        /// </summary>
+        public int Count
+        {
+            get { return _count; }
+        }
+
+
+        public override bool ParseCommand(string name, string value)
+        {
+            switch (name)
+            {
+                case "dtmf-count":
+                    int.TryParse(value, out _count);
+                    break;
+            }
+
+            return base.ParseCommand(name, value);
+        }
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelInfo.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelInfo.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,225 @@
+namespace FreeSwitch.EventSocket
+{
+    #region enum ChannelState
+    public enum ChannelState
+    {
+        New,       // Channel is newly created 
+        Init,      // Channel has been initilized
+        Ring,      // Channel is looking for a dialplan
+        Transmit,  // Channel is in a passive transmit state
+        Execute,   // Channel is executing it's dialplan 
+        Loopback,  // Channel is in loopback
+        Hold,	  // Channel is on hold
+        Hibernate, // Channel is in a sleep state
+        Hangup,    // Channel is flagged for hangup and ready to end
+        Done,      // Channel is ready to be destroyed and out of the state machine
+        Unknown
+    }
+    #endregion
+
+    public class ChannelInfo
+    {
+        private ChannelState m_state;
+        private int m_stateNumber;
+        private string _profile;
+        private string m_address;
+        private string _hostName;
+        private string m_protocol = string.Empty;
+        private string m_readCodecName;
+        private int m_readCodecRate;
+        private string m_writeCodecName;
+        private int m_writeCodecRate;
+
+        /// <summary>
+        /// Coded used to read information from the channel.
+        /// Example: L16
+        /// </summary>
+        public string ReadCodecName
+        {
+            get { return m_readCodecName; }
+            set { m_readCodecName = value; }
+        }
+
+        /// <summary>
+        /// Bitrate of the read coded that is used.
+        /// Example: 8000
+        /// </summary>
+        public int ReadCodecRate
+        {
+            get { return m_readCodecRate; }
+            set { m_readCodecRate = value; }
+        }
+
+        /// <summary>
+        /// Codec used for writing to the channel.
+        /// Example: L16
+        /// </summary>
+        public string WriteCodecName
+        {
+            get { return m_writeCodecName; }
+            set { m_writeCodecName = value; }
+        }
+
+        /// <summary>
+        /// Bitrate of the codec.
+        /// Example: 8000
+        /// </summary>
+        public int WriteCodecRate
+        {
+            get { return m_writeCodecRate; }
+            set { m_writeCodecRate = value; }
+        }
+
+        /// <summary>
+        /// State that the channel is in. Check ChannelState enum for more information.
+        /// </summary>
+        public ChannelState State
+        {
+            get { return m_state; }
+            set { m_state = value; }
+        }
+
+        /// <summary>
+        /// Number of the state (from the enum in FreeSwitch)
+        /// </summary>
+        public int StateNumber
+        {
+            get { return m_stateNumber; }
+            set { m_stateNumber = value; }
+        }
+
+        /// <summary>
+        /// Name of the channel.
+        /// </summary>
+        /// <example>sofia/mydomain.com/1234 at conference.freeswitch.org</example>
+        /// <seealso cref="ChannelInfo.Protocol"/>
+        /// <seealso cref="ProfileName"/>
+        /// <seealso cref="Address"/>
+        /// <seealso cref="HostName"/>
+        public string Name
+        {
+            get { return m_protocol + "/" + _profile + "/" + m_address + "@" + _hostName; }
+            set 
+            { 
+                string[] bits = value.Split('/');
+                if (bits.Length == 3)
+                {
+                    m_protocol = bits[0];
+                    _profile = bits[1];
+                    string[] userParts = bits[2].Split('@');
+                    if (userParts.Length == 2)
+                    {
+                        m_address = userParts[0];
+                        HostName = userParts[1];
+                    }
+                    else
+                        m_address = bits[2];
+                }
+                
+            }
+        }
+
+        /// <summary>
+        /// ProfileName for the diaplan/sip.
+        /// </summary>
+        public string ProfileName
+        {
+            get { return _profile; }
+            set { _profile = value; }
+        }
+
+        /// <summary>
+        /// Extension/Username for the channel
+        /// </summary>
+        public string Address
+        {
+            get { return m_address; }
+            set { m_address = value; }
+        }
+
+        /// <summary>
+        /// Where the extension/user is calling from.
+        /// </summary>
+        public string HostName
+        {
+            get { return _hostName; }
+            set
+            {
+                if (value == null)
+                {
+                    _hostName = string.Empty;
+                    return;
+                }
+
+                int pos = value.IndexOf(':');
+                if (pos == -1)
+                    _hostName = value;
+                else
+                    _hostName = value.Substring(0, pos);
+            }
+        }
+
+        /// <summary>
+        /// Protocol used for communication.
+        /// "sofia" = sip.
+        /// </summary>
+        public string Protocol
+        {
+            get { return m_protocol;  }
+        }
+
+        public bool Parse(string name, string value)
+        {
+            switch (name)
+            {
+                case "channel-state":
+                    m_state = StateFromString(value);
+                    break;
+                case "channel-state-number":
+                    int.TryParse(value, out m_stateNumber);
+                    break;
+                case "channel-name":
+                    Name = value;
+                    break;
+                case "channel-read-codec-name":
+                    m_readCodecName = value;
+                    break;
+                case "channel-read-codec-rate":
+                    int.TryParse(value, out m_readCodecRate);
+                    break;
+                case "channel-write-codec-name":
+                    m_writeCodecName = value;
+                    break;
+                case "channel-write-codec-rate":
+                    int.TryParse(value, out m_writeCodecRate);
+                    break;
+                default:
+                    return false;
+            }
+            return true;
+        }
+
+        public ChannelState StateFromString(string state)
+        {
+            switch (state)
+            {
+                case "CS_NEW": return ChannelState.New;
+                case "CS_INIT": return ChannelState.Init;
+                case "CS_RING": return ChannelState.Ring;
+                case "CS_TRANSMIT": return ChannelState.Transmit;
+                case "CS_EXECUTE": return ChannelState.Execute;
+                case "CS_LOOPBACK": return ChannelState.Loopback;
+                case "CS_HOLD": return ChannelState.Hold;
+                case "CS_HIBERNATE": return ChannelState.Hibernate;
+                case "CS_HANGUP": return ChannelState.Hangup;
+                case "CS_DONE": return ChannelState.Done;
+                default: return ChannelState.Unknown;
+            }
+        }
+
+        public string StateToString(ChannelState state)
+        {
+            return "Unknown";
+        }
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AnyCommand.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AnyCommand.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,36 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class AnyCommand : Api
+    {
+        private readonly string _name;
+        private readonly string _value;
+
+        public AnyCommand(string name, string arguments)
+        {
+            _name = name;
+            _value = arguments;
+        }
+
+        public override string Command
+        {
+            get { return _name; }
+        }
+
+        public override string Arguments
+        {
+            get { return _value; }
+        }
+
+        public override CommandReply CreateReply(string dataToParse)
+        {
+            if (dataToParse.Length > 0 && (dataToParse[0] == '+') || dataToParse == "OK")
+                return new CommandReply(true);
+            else
+            {
+                CommandReply reply = new CommandReply(false);
+                reply.ErrCode = dataToParse;
+                return reply;
+            }
+        }
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Api.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Api.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,10 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    public abstract class Api : CmdBase
+    {
+        public override string ToString()
+        {
+            return string.Format("api {0} {1}", Command, Arguments);
+        }
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AuthCommand.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AuthCommand.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,34 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class AuthCommand : CmdBase
+    {
+        private readonly string _password;
+
+        public AuthCommand(string password)
+        {
+            _password = password;
+        }
+
+        public override string Command
+        {
+            get { return "auth"; }
+        }
+
+        public override string Arguments
+        {
+            get { return _password; }
+        }
+
+        public override CommandReply CreateReply(string dataToParse)
+        {
+            if (dataToParse.Contains("+OK"))
+                return new CommandReply(true);
+            else
+            {
+                CommandReply reply = new CommandReply(false);
+                reply.ErrCode = dataToParse;
+                return reply;
+            }
+        }
+    }
+}
\ No newline at end of file

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CmdBase.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CmdBase.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,55 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    #region Delegates
+
+    public delegate void ReplyHandler(CmdBase command, CommandReply reply);
+
+    #endregion
+
+    public abstract class CmdBase
+    {
+        public event ReplyHandler OnReply;
+
+        private object _contextData;
+
+        public abstract string Command
+        {
+            get;
+        }
+
+        public abstract string Arguments
+        {
+            get;
+        }
+
+        /// <summary>
+        /// You can attach something that you need to
+        /// identify the command.
+        /// </summary>
+        public object ContextData
+        {
+            get { return _contextData; }
+            set { _contextData = value; }
+        }
+
+        public virtual void HandleReply(CommandReply reply)
+        {
+            // a command is only invoked once.
+            if (OnReply != null)
+            {
+                OnReply(this, reply);
+                OnReply = null;                
+            }
+        }
+
+        public virtual CommandReply CreateReply(string dataToParse)
+        {
+            return null;
+        }
+
+        public override string ToString()
+        {
+            return string.Format("{0} {1}", Command, Arguments);
+        }
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CommandReply.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CommandReply.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,35 @@
+namespace FreeSwitch.EventSocket.Commands
+{
+    /// <summary>
+    /// Baseclass for replies that commands get.
+    /// </summary>
+    public class CommandReply
+    {
+        private bool _success;
+        private string _errCode;
+
+        public CommandReply(bool success)
+        {
+            _success = success;
+        }
+
+        public bool Success
+        {
+            get { return _success; }
+        }
+
+        public string ErrCode
+        {
+            get { return _errCode; }
+            set { _errCode = value; }
+        }
+
+        public override string ToString()
+        {
+            if (_success)
+                return "Success";
+            else
+                return "Failed: " + _errCode;
+        }
+    }
+}

Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ExecuteJavascript.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ExecuteJavascript.cs	Thu May  1 14:27:39 2008
@@ -0,0 +1,63 @@
+using System.Collections.Generic;
+
+namespace FreeSwitch.EventSocket.Commands
+{
+    public class ExecuteJavascript : Api
+    {
+        private readonly string _scriptName;
+        private readonly IList<string> _arguments = new List<string>();
+
+        public ExecuteJavascript()
+        {
+            
+        }
+
+        public ExecuteJavascript(string scriptName)
+        {
+            _scriptName = scriptName;
+        }
+
+        /// <summary>
+        /// Arguments to javascript
+        /// </summary>
+        /// <seealso cref="Arguments"/>
+        public IList<string> Args
+        {
+            get { return _arguments; }
+        }
+
+        public override string Command
+        {
+            get { return "jsrun"; }
+        }
+
+        /// <summary>
+        /// Args to the CmdBase api
+        /// </summary>
+        /// <seealso cref="Args"/>
+        public override string Arguments
+        {
+            get { return _scriptName + " " + JoinArguments(); }
+        }