<%@page import="com.edeal.frontline.navigation.FlRequest"%><% /****************************************************************************** * Copyright (c) 2000-2009 e-Deal * * e-Deal S.A. * 55 rue Brillat Savarin * 75013 Paris * France * * T: +33 (0)1 53 80 80 30 * F: +33 (0)1 73 01 69 77 * http://www.e-deal.com * * La diffusion de ce code source sous quelque forme que ce soit sans * l'autorisation de E-DEAL est interdite. * * Vous êtes autorisés à modifier ce code source uniquement pour votre usage * propre et sous réserve que les mentions de copyright demeurent intactes. * * Ce code est fourni en l'état. Aucune garantie d'aucune sorte, explicite ou * implicite n'est donnée. En aucun cas E-DEAL ne pourra être tenu pour * responsable des dommages pouvant résulter de l'utilisation de ce code * source. * * ******************************************************************************/ %><%@page session="true" import="com.edeal.frontline.*,java.util.*"%><%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl"%> <% final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass()); FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); /// Proxy options. String proxy_server = context.getContextParameter("CTI.Option.VOCALCOM_Server"); String proxy_port = context.getContextParameter("CTI.Option.VOCALCOM_Port"); String innerNumberLength = context.getContextParameter("CTI.Option.InnerNumberLength"); String outboundprefix = context.getContextParameter("CTI.Option.OutboundPrefix"); String inboundprefix = context.getContextParameter("CTI.Option.InboundPrefix"); String strActID = (String)session.getAttribute("actorID"); ActorBean actBean; String actVocalcomUserID_; String actVocalcomPwd_; String actVocalcomStation_; try { actBean = new ActorBean(strActID, context); } catch (Exception e) { logger.error("Could not load this actor", e); actBean = null; } try { actVocalcomUserID_ = (String)actBean.getCustomProperty("ActVocalcomUserID_"); } catch (Exception e) { actVocalcomUserID_ = ""; } try { actVocalcomPwd_ = (String)actBean.getCustomProperty("ActVocalcomPwd_"); } catch (Exception e) { actVocalcomPwd_ = ""; } try { actVocalcomStation_ = (String)actBean.getCustomProperty("ActVocalcomStation_"); String filledInStation = (String)session.getAttribute("vocalcomStation"); if (filledInStation != null && !"".equals(filledInStation)) { actVocalcomStation_ = filledInStation; logger.warn("actVocalcomStation_ : "+actVocalcomStation_); } } catch (Exception e) { actVocalcomStation_ = ""; } %> var agentlink_toolbar; function doOnLoadCTI() { var ctiWindow = window.open('','CTI'); try { agentlink_toolbar = document.getElementById("WSA_CTI_BAR"); // Proxy server identification. agentlink_toolbar.object.AgentProxy='<%= proxy_server %>'; agentlink_toolbar.object.Port=<%= proxy_port %>; // Events to spy. agentlink_toolbar.attachEvent("Connect", doConnect); agentlink_toolbar.attachEvent("UserIdentification", setReady); agentlink_toolbar.attachEvent("CallAlerting", doReceiveCall); agentlink_toolbar.object.Connect(); } catch (error) { } } function doUnLoad2() { //agentlink_toolbar.object.Logout(); //agentlink_toolbar.object.Disconnect(); eraseCookie('EdealCtiWindow'); //var ctiWindow = window.open('','CTI'); try { // ctiWindow.WSA_CTI_BAR.Disconnect(); } catch (error) { } try { if (agentlink_toolbar.object.LoggedIn == true) { agentlink_toolbar.object.Logout(); } } catch (error) { } try { if (agentlink_toolbar.object.Connected == true) { agentlink_toolbar.object.Disconnect(); } } catch(error) { } window.self.close(); } function doReceiveCall() { var url = '/receive_call.fl?'; //alert('com type : '+agentlink_toolbar.object.CallInformation.ComType); //alert('com reason : '+agentlink_toolbar.object.CallInformation.ComReason); // 20 sur agent 24310 et 220 pour 24320 sur l'entrant ... if (agentlink_toolbar.object.CallInformation.ComType > 100 || agentlink_toolbar.object.CallInformation.ComType == 20) { try { url += 'phone=<%= inboundprefix %>'+agentlink_toolbar.object.CallInformation.ANI; } catch (error) { } //alert('url : '+url); window.open(url, 'cti_popup', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=500'); } } function getPurePhone(phone){ var formated = phone; var number = '0123456789'; //alert('getPurePhone : '+phone); if (formated == '' || formated == null){ return ''; }else{ if (formated.charAt(0) == '+'){ formated = '00'+formated.substring(1, formated.length); } if (formated.indexOf('(')>-1){ formated = formated.substring(0,formated.indexOf('('))+formated.substring(formated.indexOf(')')+1, formated.length); } //alert('formated : '+formated); for(var i=0; i < formated.length; i++){ //Suprresion de tout les caracteres non num?riques var currentChar = formated.charAt(i); if (number.indexOf(currentChar)==-1){ formated = formated.substring(0,i)+formated.substring(i+1, formated.length); i--; } } if (formated != '' && formated != null && formated.length > 10) { formated = '0'+formated.substring(4,formated.length); } //alert('formated retourne : '+formated); return formated; } } //function doCallCTI(arg0, arg1, arg2){ function doCallCTI(pPhone, pObj, pID){ //if (arg0 == '') { if (pPhone == '') { return; } //alert('arg0 : '+arg0); //alert('pPhone : ' + pPhone); try { //var formatedPhone = getPurePhone(arg0); var formatedPhone = getPurePhone(pPhone); //alert('phone : '+phone); //alert('formatedPhone : '+ formatedPhone); if (formatedPhone.length > <%= innerNumberLength %>) { formatedPhone = '<%= outboundprefix %>' + formatedPhone; } agentlink_toolbar.object.ManualCall(formatedPhone); } catch (error) { alert(error); } } function doAnswerCTI(pRef){ //var ctiWindow = window.open('','CTI'); try { //agentlink_toolbar.object.Hangup(); } catch (error) { } } function doTransferCTI(pRef, pPhone){ //var ctiWindow = window.open('','CTI'); try { //agentlink_toolbar.object.BlindTransfer(pPhone); } catch (error) { } } // Vocalcom specific function doConnect() { //doOnLoad(); try { // agentlink_toolbar.object.Login('24310','','20001'); } catch (error) { } doLogin('<%= actVocalcomUserID_ %>','<%= actVocalcomPwd_ %>','<%= actVocalcomStation_ %>'); } function doLogin(userId, Pwd, Station) { try { agentlink_toolbar.object.Login(userId, Pwd, Station); } catch (error) { } } function setReady() { if (agentlink_toolbar.object.LoggedIn == true) { agentlink_toolbar.object.SetReady(); } }