/// <summary>
        /// This is the primary hander for “new” call event’s from the CIT system.
        /// This event is raised by the call state manager after primary translation from the base CTI event.
        /// This event is used to create a Search Request to the system search provider or do other “pre-search” handling
        /// </summary>
        /// <param name="sender">Call State Manager that raised this request.</param>
        /// <param name="e">New Event call Arguments</param>
        private void OnCallManagerStateNewCall(object sender, NewCallEventArgs e)
        {
            // This is how to determin if the current session has a call
            if (((AgentDesktopSession)localSessionManager.ActiveSession).CtiCallRefId != Guid.Empty)
            {
                // I have a call.
                // Do some alert or compenstation logic here.
                // maybe return ;
            }

            // Form a request to the customer provider to launch a customer lookup with CTI data..
            CtiLookupRequest lookupRequest = new CtiLookupRequest(
                e.CallInfo.GetCtiCallRefId, // Internal UII Call ID
                this.ApplicationName,       // Application Name that is raising the Lookup Request.
                e.CallInfo.CallType,        // Type of call
                e.CallInfo.Ani,             // Number that called me.
                e.CallInfo.Dnis);           // Number that they called.

            //If you would like to add in custom properties that can be access by the search provider, use this construct
            // lookupRequest.AddLookupRequestItem("CUSTOMERID", GetParamFromCallState(e.UiiRefCallID, "custID"));

            // Now Serilize the Request and send it to the UII enviroment.
            string sData = GeneralFunctions.Serialize <CtiLookupRequest>(lookupRequest);

            // This is a custom implemented action sender that uses a threaded approach to send this request.
            // It is very important that you do this in a threaded manner because actions are blocking and
            //      can slow down response to the Cti system.
            SendCommandParams cmd = new SendCommandParams("*", CtiLookupRequest.CTILOOKUPACTIONNAME, sData);

            new Thread(new ParameterizedThreadStart(SendAction)).Start(cmd);
        }
 /// <summary>
 /// Thread Safe version of the Uii Send Action
 /// </summary>
 /// <param name="oData"></param>
 private void SendAction(object oData)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new SendActionDel(SendAction), new object[] { oData });
     }
     else
     {
         SendCommandParams      cmd  = (SendCommandParams)oData;
         RequestActionEventArgs args = new RequestActionEventArgs(cmd.Target, cmd.Action, cmd.Data);
         FireRequestAction(args);
     }
 }