Index

Classes


Declaring the object

  1. Include in your web page (head section) the AgentLink.js file and agentlink_enums.js file.
  2. Define the js var “agentlink_object_path” with the path to the swf file (excluding the swf file itself)
  3. Define the js var “agentlink_default_protocol” with the default socket mode you wants to use :
      “WEBSOCKET”
      “FLASH”
    This define the default mode only : if the mode defined is available, AgentLink will use it. If the mode defined is not avalaible, the other one will be tested.
  4. Define the js var “websock_protocol” to the wanted value : “wss” to use secure websocket or “ws” to use normal websocket. This var is required only for the websocket connection and is not necessary if you are sure that only the Flash mode will be used. The value must match the websocket mode defined on the CTProxy.
  5. Define the js var “websock_port” to the websocket connection port. The value sould be a Number vale. The value must match the websocket port defined on the CTProxy.
  6. Add one div somewhere in your HTML page.
    The Flash animation will be add in this div. So to allow flash to wake up the Div must be displayed and visible. If you want to hidde it, you can do it by positionning it in absolute mode, outside the dimensions of the page
  7. After (or on) the triggering of event “PageLoad” you can instanciate the main class “AgentLinkClass” by giving to the constructor the div id :
/*linkContainer is the ID of the Div*/
var container = document.getElementById("linkContainer"); 
var agentlink = new AgentLinkClass(container);


Only one instance of the main class should be instanciate for one Agent login.

You should also define the “Log” function that will be called for log. Function definition is

function Log(logger, level, text)

Level values are :

You can attach the events you want on the main class instance (instanciate in previous section) in this way :

agentlink.attachEvent("OnConnect", Connect);
agentlink.attachEvent("OnUserIdentification", UserIdentification);

function Connect() {
    /** After connect - log the agent **/
    agentlink.Login(1000, "password", 1);
}

function UserIdentification(userId, userName, station) {
   if (agentlink.LoggedIn) {
      Log("EXAMPLE", "DEBUG", "Agent is connected");
   } else {
      Log("EXAMPLE", "DEBUG", "Agent is not connected");
   }
}

Complete list of events can be see here.

Connecting to CTIProxy

Before connecting to the proxy, there is several properties to set on the main class instance :

You need always to listen the “Connect” event : agent login must be done only if connect is succesful.

After setting theses properties and attaching all the events you need, connect agent to proxy by calling the “Connect” function on the main instance :

agentlink.AgentProxy = "127.0.0.1";
agentlink.Port = 3005;
agentlink.Locale = "en-US";
agentlink.AdminUrl = "http://127.0.0.1/hermes_net_v5/admin/";

if (!agentlink.Connect()) {
   alert("Error on connecting to proxy");
}

If the connection is successful, the “connect” event will be fired. On it, you can call the “Login” function to log the agent (see the example of the previous section).

General consideration

The new AgentLink manages several contexts (Telephony, Mail, Chat, Voicemail, Fax, SocialNetwork) corresponding roughly to the tabs of the new interface agent.

Context's managers have to be access by the AgentLinkClass properties :
On each context some active 'session' can exist (example : a call on the telephony context). Some contexts as the Chat, can manage more that one session at a time. There is so three levels of management : the agent level (or general level), the context level and the session level. Each of these levels contain methods, properties and associated events.
For example:
It is therefore no longer unique state of the agent available AgentLink. Each level has its own state. An agent can be in:

For 'Agent' level : 'Working',
For 'Context' level : 'Working' on Telephony, Chat and on 'Waiting' on 'Mail',
For 'Session' level : 'Online' on Telephony, and two Chat, respectively 'Chatting' and 'Wrapup'.

Even if some events ar particular to one context, listening the event is always done on the instance of the AgentLinkClass object.

Examples

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Nov 05 2014 12:49:33 GMT+0100 (CET)