AgentLink Reference
The object AgentLink Flash-Javascript is designed to be used in a web-browser allowing javascript content. To works the browser will need the Flash plugin enabled or Websocket support.
This object use a persistent socket connection to CTIProxy and so is not designed to be used on multiple web-page environement.
Five files are needed (provided by Vocalcom) :
- AgentLink.js
- Agentlink_enums.js
- AgentLinkFlash.swf
- swfobject.js
- wsjavascript.js
Declaring the object
- Include in your web page (head section) the AgentLink.js file and agentlink_enums.js file.
- Define the js var “agentlink_object_path” with the path to the swf file (excluding the swf file itself)
- 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. - 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.
- 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.
- 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 - 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 :
- DEBUG
- INFO
- WARN
- ERROR
Attach AgentLink events
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 :
- AgentProxy : the IP of CTIProxy NT Service
- Port : the port that CTIProxy NT Service bind
- CustomerId : the id of customer in WebAdmin
- Locale : the culture for messages sended by CTIProxy (fr-FR, en-US, ...)
- AdminUrl : absolute url of “hermes_net_v5/Admin” virtual directory to call admin webservices on client side.
Note : AgentLink also support to call webservice by proxying requests throw WSProxy.ashx of PlateformPublication. For that, set “AdminServerUrl” with the admin url view from PlateformPublication and “LocalWebserviceProxy” with the url to WSProxy.ashx from the client side.
- OnMediaWebService : absolute url to “PlateformPublication/OnMedia/Web_Service/MailService.asmx?OMS=IP_MEDIASERVER:PORT_MEDIASERVER
Note : this webservice is used to get Attached files and Predifined answers of chats and emails campaigns. If you don't manage email and chat you don't need to set this property. - OnMediaWebServiceServerUrl : server side url to PlateformPublication/OnMedia/Web_Service/MailService.asmx?OMS=IP_MEDIASERVER:PORT_MEDIASERVER
If you don't want to use the wsproxy.ashx, don't set this property. - CrmUrl : client side url to /hermes_net_v5/CRM/
This webservice is used to load the contact informations and the contact history. - CrmServerUrl : server side url to /hermes_net_v5/CRM/
If you don't want to use the wsproxy.ashx, don't set this property.
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
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.
- Telephony context can manage one telephony session at a time,
- Mail context can manage one mail session at a time,
- Chat context can manage one or more chat session at a time,
- VoiceMail context can manage one or more voicemail session at a time,
- Fax context can manage one fax session at a time,
- Socialnetwork context can manage one socialnetwork session at a time
For example:
- Login / Logout on the level 'Agent'
- ManualCall on the context 'Telephony'
- Hangup on the session 'Telephony'.
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.