Show / Hide Table of Contents

    Extensions

    This section provides you with instructions on how to create, configure and run an extension within Desktop Connect Express.

    Extensions allow developers to extend Desktop Connect Express functionality by writing custom code for various business logic, when an extension is loaded into Desktop Connect Express this forwards event data, allowing the custom assembly to perform custom action and to execute rules.

    Every extension integrated into Desktop Connect Express requires to have a configuration section, the section needs to be listed under Desktop Connects “ExtensionList”, and every valid extension configuration bares with the “AssemblyFileName” and the “ExtensionType” settings

    e.g.

    [ExtensionList]

    Sample = SampleExtension

    Event types

    Desktop Connect Express publishes the following events:

    Event

    Description

    Unknown

    The triggering event source is unknown for Desktop Connect Express

    Cleared

    The event is triggered as the result of a call terminate event, can be inbound or outbound (APC dialer)

    InboundDelivered

    The event is triggered as the result of an alerting call at the station

    InboundTransferred

    A transfer event occurred

    InboundConnected

    The alerting call is connected on the station

    OutboundConnected

    A dialer call is delivered to the agent, agent is in conversation with customer

    Web

    Event was triggered from via the Web Plugin module

    Extension

    The event was triggered from an extension

    Button

    The event is triggered as the result of a button click on Desktop Connect Express

    Published interface

    In order for Desktop Connect Express to load a custom extension, the following interfaces need to be implemented.

    Interface name

    Description

    IActionContext

    Defines the data structure that is being passed to and from an extension

    IBaseExtension

    Basic description for an extension

    IDCXNotification

    Extension notification interface

    IDCXtension

    The interface defines an extension that can be loaded into Desktop Connect Express at runtime

    Interface details

    Interface Reference: Geomant.DCX.Extension.IActionContext

    Description: Defines the data structure that is being passed to and from an extension:

    Properties:

    Name

    Type

    Description

    Source

    ActionSource

    Get/set the source of the event

    Data

    Dictionary<string, string>

    Get/set association data for the event

    Interface Reference: Geomant.DCX.Extension.IBaseExtension

    Description: Base extension description

    Properties:

    Name

    Type

    Description

    AssemblyPath

    string

    Path of the extension

    ExtensionName

    string

    Name of the extension

    ExtensionConfiguration

    NameValueCollection

    Get/set extension setting defined in DesktopConnect.ini extension section

    Interface Reference: Geomant.DCX.Extension.IDCXNotification

    Description: Extension notification interface, extension can communicate and pass data to Desktop Connect Express engine by implementing this event.

    Events:

    Name

    Type

    Description

    OnContext

    DCXExtensionEventHandler

    Extensions can pass context data using the OnContext event

    Interface Reference: Geomant.DCX.Extension.IDCXtension

    Description: Base extension description

    Methods:

    Name

    Type

    Description

    PerformAction(IActionContext context)

    void

    Desktop Connect Express calls this method and passes on data context, extension business logic should be implemented within this method

    ResetContext()

    void

    This method is raised when the event is cleared, e.g. Call is terminated

    Enumeration type definition

    Enumeration Geomant.DCX.Extension.ActionSource indicates the originating source of the event context

    Name

    Description

    Unknown

    Source is unknown

    Cleared

    Inbound/Outbound call has been terminated

    InboundDelivered

    Inbound call is alerting

    InboundEstablished

    Inbound call is established

    InboundTransferred

    Inbound call is transferred

    InboundConnected

    Inbound call is connected

    OutboundConnected

    Dialer call is connected to agent

    Web

    Event is triggered via the web plugin

    Extension

    Event is triggered by an external extension

    Button

    Event is triggered by a button action

    Delegates

    Desktop Connect Express defines the following delegate methods for raising an event with Desktop Connect Express event handling engine.

    delegate void Geomant.DCX.Ecntesion.DCXExtensionEventHandler(IDCX extension, IActionContext context)

    Parameters:

    extension: Extension raising the event

    context: Context data to be passed

    Sample extension

    The following sample code subscribes to Desktop Connect Express events and triggers a Rule for call connected and call cleared events.

    Code

    using System; using System.Collections.Generic; using System.Text;

    using log4net;

    namespace PopAndClose

    {
    
      #region DataContainer
    
      /// <summary>
    
      /// Data container to be passed back to Desktop Connect Express
    
      /// </summary>
    
      public class ExtensionContext : Geomant.DCX.Extension.IActionContext
    
      {
    
        private Dictionary<string, string> _data;
    
        private Geomant.DCX.Extension.ActionSource _source;
    
    
    
        public ExtensionContext()
    
        {
    
          _source = Geomant.DCX.Extension.ActionSource.Extension;
    
          _data = new Dictionary<string, string>();
    
        }
    
    
    
        Dictionary<string, string> Geomant.DCX.Extension.IActionContext.Data
    
        {
    
          get
    
          {
    
            return _data;
    
          }
    
          set
    
          {
    
            _data = value;
    
          }
    
        }
    
    
    
        Geomant.DCX.Extension.ActionSource Geomant.DCX.Extension.IActionContext.Source
    
        {
    
          get
    
          {
    
            return _source;
    
          }
    
          set
    
          {
    
            throw new NotImplementedException();
    
          }
    
        }
    
    
    
        public void SetData(Dictionary<string, string> data)
    
        {
    
          _data = data;
    
        }
    
      }
    
    
    
      #endregion
    
    
    
      public class PopAndClose : Geomant.DCX.Extension.IDCXtension
    
      {
    
        private string _assemblyPath;
    
        private string _extensionName;
    
        /// <summary>
    
        /// Extension configuration values stored in DesktopConnect.ini (e.g. url to call, Ip address, port) can be empty
    
        /// </summary>
    
        private System.Collections.Specialized.NameValueCollection _config;
    
    
    
        /// <summary>
    
        /// This event is raised when passing data to Desktop Connect Express
    
        /// </summary>
    
        public event Geomant.DCX.Extension.DXExtensionEventHandler OnContext;
    
    
    
        private readonly ILog _log = LogManager.GetLogger(typeof(PopAndClose));
    
    
    
        private System.Collections.Hashtable _callMap = new System.Collections.Hashtable();
    
    
    
        public PopAndClose()
    
        { 
    
        }
    
    
    
        #region Process event from 
    
        /// <summary>
    
        /// Every event is passed onto this function
    
        /// </summary>
    
        /// <param name="context"></param>
    
        public void PerformAction(Geomant.DCX.Extension.IActionContext context)
    
        {
    
          if (context == null)
    
          {
    
            _log.DebugFormat("Perform action received {0}, context is empty", this.ExtensionName);
    
          }
    
    
    
          string callid = "";
    
          string _message = null;
    
          foreach (KeyValuePair<string, string> entry in context.Data)
    
          {
    
            _message += entry.Key + "," + entry.Value + Convert.ToString(Convert.ToChar(30));
    
            if (entry.Key.Equals("CALLID")) {
    
              callid = entry.Value;
    
            }
    
          }
    
    
    
          _log.DebugFormat("Perform action received {0}, message {1}", this.ExtensionName, _message);
    
    
    
          string myCustomData = "";
    
          switch (context.Source)
    
          {
    
            case Geomant.DCX.Extension.ActionSource.InboundDelivered:
    
              //Start gathering data, save UCID
    
              myCustomData = "MyCustomData-Init";
    
              break;
    
            case Geomant.DCX.Extension.ActionSource.InboundConnected:
    
              //Craft URL
    
              myCustomData = "MyCustomData-Do";
    
              SendData("Pop", "003b000000MPWbo");
    
              break;
    
            case Geomant.DCX.Extension.ActionSource.Cleared:
    
              myCustomData = "MyCustomData-Clear";
    
              SendData("Refresh", "");
    
              break;
    
          }
    
    
    
          if (!_callMap.ContainsKey(callid))
    
          {
    
            _callMap.Add(callid, myCustomData);
    
          }
    
          else
    
          {
    
            _callMap[callid] = myCustomData;
    
          }
    
        }
    
    
    
        /// <summary>
    
        /// Desktop Connect Express raises this event when call is terminated/disconnected
    
        /// </summary>
    
        public void ResetContext()
    
        {
    
          _log.DebugFormat("Reset context received {0}", this.ExtensionName);
    
        }
    
    
    
        #endregion
    
    
    
        private void SendData(string simonsays, string SID)
    
        {
    
          if (OnContext != null)
    
          {
    
            ExtensionContext myContext = new ExtensionContext();
    
            Dictionary<string, string> myData = new Dictionary<string, string>();
    
            myData.Add("SIMONSAYS", simonsays);
    
            myData.Add("SID", SID);
    
            myContext.SetData(myData);
    
            this.OnContext(this, myContext);
    
          }
    
        }
    
    
    
        #region Extension propeties
    
    
    
        /// <summary>
    
        /// Assembly path
    
        /// </summary>
    
        public string AssemblyPath
    
        {
    
          get
    
          {
    
            return this._assemblyPath;
    
          }
    
          set
    
          {
    
            this._assemblyPath = value;
    
          }
    
        }
    
    
    
        /// <summary>
    
        /// Configuration values retireved from Desktop Connect Express
    
        /// </summary>
    
        public System.Collections.Specialized.NameValueCollection ExtensionConfiguration
    
        {
    
          get
    
          {
    
            return _config;
    
          }
    
          set
    
          {
    
            _config = value;
    
          }
    
        }
    
    
    
        /// <summary>
    
        /// Extension name
    
        /// </summary>
    
        public string ExtensionName
    
        {
    
          get
    
          {
    
            if (String.IsNullOrEmpty(_extensionName))
    
              _extensionName = this.GetType().AssemblyQualifiedName;
    
            return _extensionName;
    
          }
    
          set
    
          {
    
            _extensionName = value;
    
          }
    
        }
    
    
    
        #endregion
    
      }
    
    }
    
    Sorry, your browser does not support inline SVG. article updatedarticle updated6/23/2020 9:06:57 AM (UTC)6/23/2020 9:06:57 AM (UTC)
    Feedback     Back to top Copyright © Geomant