Edit C:\galaxie\Back\galaxie\js\cti\cti_avaya_js.jsp
<%/****************************************************************************** * Copyright (c) 2000-2004 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.*,com.edeal.frontline.services.*,com.edeal.frontline.services.cti.*"%><%@ page import="com.edeal.frontline.services.cti.CTIServiceClient" %><%@ page import="com.edeal.frontline.navigation.FlRequest" %><%@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(); String avayaURL=null; String pPhone = Utils.getRequestParameter(context, request, "phone"); CTIServiceClient cti = null; String polInterval=null; try { cti = (CTIServiceClient)context.getServiceManager().getServiceClient(session, "CTI"); cti.setAllOptions(); avayaURL = cti.getOption("URL", ""); polInterval = cti.getOption("PollInterval", "1000"); if ("".equals(avayaURL)) { logger.error("CTI AVAYA Error, option 'CTI.Opyion.URL' is not initialise"); } } catch(Exception e) { logger.error("Error in CTI Service : ", e); }%> var call = '<%=avayaURL%>/call'; var transfert='<%=avayaURL%>/transfert?phone='; var answer='<%=avayaURL%>/answer'; var clear='<%=avayaURL%>/clear'; var okResponse='OK'; var koResponse='NOK'; var callReturn='caller='; var proxyPage = '<fl:webapp/>/cti/proxy_avaya.jsp'; var pool='<fl:webapp/>/call_pool'; 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 doOnLoadCTI(){ startListen(); } //function doCallCTI(pPhone){ function doCallCTI(pPhone, pObj, pID){ var formatedPhone = getPurePhone(pPhone); var url = call+'?phone='+formatedPhone; url=encodeURI(url); doAjax(proxyPage+'?url='+url, cTIReturn); } function doAnswerCTI(pRef){ var ref = ''; if (pRef!=null) ref = pRef; var url = answer+ref; url=encodeURI(url); doAjax(proxyPage+'?url='+url, cTIReturn); } function doTransferCTI(pRef, pPhone){ var ref = ''; if (pRef!=null) ref = pRef; var formatedPhone = getPurePhone(pPhone); var url = transfert+formatedPhone+'&ref='+ref; url=encodeURI(url); doAjax(proxyPage+'?url='+url, cTIReturn); } function cTIReturn(arrIndex){ var response = ''; if (eDealXmlhttpArr[arrIndex].readyState == 4) { response = eDealXmlhttpArr[arrIndex].responseText; //Traitement de la reponse ... if (response==okResponse){ //OK, on ne fait rien //Trace à enlever //alert(response); }else{ //alert(response.substring(koResponse.length+1, response.length)); //Trace à enlever //alert(response); } } } function startListen(){ var periode = '<%=polInterval%>'; dummyStuff=(new Date).getMilliseconds(); doAjax(pool+"?dummy="+dummyStuff, ctiPoolReturn); setTimeout('startListen()', periode); } function ctiPoolReturn(arrIndex){ var response = ''; var num=''; if (eDealXmlhttpArr[arrIndex].readyState == 4) { response = eDealXmlhttpArr[arrIndex].responseText; //Traitement de la reponse ... if (response=='null'){ //Le pool est vide }else if (response.indexOf('caller')>-1){ // Parser le retour var caller = response.substring('caller='.length, response.indexOf('\n')); var called = response.substring(response.indexOf('called=')+'called='.length, response.length); window.open('<fl:webapp/>/cti/call.jsp?phone='+caller+'&called='+called, '', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=700,top=0,left=0'); } } }
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de