<apex:page showChat="false" Controller="SoftphoneConsoleController" showHeader="false" sidebar="false" action="{!init}" id="allpage">
|
<apex:includeScript value="{!URLFOR($Resource.cti)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
|
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
|
|
<script type="text/javascript">
|
var cti;
|
var stateDescrArray = ["未登录", "示忙", "示闲", "小休", "振铃", "拨号", "通话", "话后"];
|
var consultStateDescrArray = ["未知状态", "正在呼叫", "协商接通", "三方通话", "三方失败"];
|
|
try {
|
cti = createCTI();
|
cti.onAgentStateChanged = function (e) {
|
AppendLog("状态改变, 当前状态: " + getStateDescr(e.NewState.StateCode));
|
};
|
cti.onAnswerRequest = function () { AppendLog("请求应答"); };
|
cti.onRecordStart = function (e) { AppendLog("录音开始: CallId = " + e.CallId + ", 文件名 = " + e.RecordFileName) };
|
cti.onRecordStop = function (e) { AppendLog("录音停止: CallId = " + e.CallId + ", 文件名 = " + e.RecordFileName) };
|
cti.onConsultStateChange = function (e) { AppendLog("三方状态改变: " + getConsultStateDescr(e.NewState.StateCode)); };
|
cti.onAgentAsrNotify = function (e) { AppendLog("语音识别: ") };
|
cti.onQueueNumNotify = function (e) { AppendLog(e) };
|
cti.attachEvent();
|
}
|
catch (e) {
|
alert(e.message);
|
}
|
|
// 配置参数
|
function config() {
|
try {
|
//var config = GetConfig(服务器地址, 端口, 坐席号, "as", 是否开启软电话,软电话地址, 端口号,软电话号码, 密码);
|
var config = GetConfig("domain_ysb", "223.112.26.254", "9528", "10005", "1234", "true", "223.112.26.254|domain_ysb", "63000", "80005", "1234");
|
//var config = GetConfig("domain_ysb", "223.112.26.254", "9528", "10200", "1234", "true", "223.112.26.254|domain_ysb", "9060", "80200", "pactera_op");
|
cti.setConfig(config);
|
}
|
catch (e) {
|
alert(e.message);
|
}
|
}
|
function getConsultStateDescr(stateCode) {
|
|
if (stateCode < 0 || stateCode >= consultStateDescrArray.length) {
|
return "未知状态";
|
}
|
|
return consultStateDescrArray[stateCode];
|
}
|
|
function getStateDescr(stateCode) {
|
|
if (stateCode < 0 || stateCode >= stateDescrArray.length) {
|
return "未知状态";
|
}
|
|
return stateDescrArray[stateCode];
|
}
|
var GetConfig = function (domain, serverAddress, serverPort, agentID, agentPassword,
|
useWebVoip, webVoipSIPServerIP, webVoipSIPServerPort, webVoipAccount, webVoipPassword) {
|
|
return {
|
"CTI.Provider": "Lusca.LuscaCTIProvider, Lusca" // 提供程序
|
, "CTI.Timeout": "30000" // 超时设置
|
, "CTI.Lusca.ServerAddress": serverAddress // 服务器地址 |domain
|
, "CTI.Lusca.ServerPort": serverPort // 服务器端口号
|
, "CTI.Lusca.EventPollUrl": "http://"+serverAddress+":"+serverPort + "/as/event?agent_id="+agentID
|
, "CTI.Lusca.UseWebVoip": useWebVoip // 是否使用软电话
|
, "CTI.Lusca.WebVoipSIPServerIP": webVoipSIPServerIP // 软电话服务器地址
|
, "CTI.Lusca.WebVoipSIPServerPort": webVoipSIPServerPort // 软电话服务器端口
|
, "CTI.Lusca.WebVoipAccount": webVoipAccount // 软电话账号
|
, "CTI.Lusca.WebVoipPassword": webVoipPassword // 软电话密码
|
, "CTI.AgentID": agentID // 座席工号
|
, "CTI.AgentPassword": agentPassword // 座席密码
|
, "CTI.Lusca.TenantId": "as"
|
, "CTI.Lusca.QueueName": "support@default" //队列
|
, "CTI.UpdatePath": "ftp://192.168.17.141//Lusca"
|
, "CTI.UpdateMode": "0" //0:ftp 1:netbios
|
, "CTI.AutoLogout": "true"
|
, "CTI.EnableVoiceAnalysis": "false"
|
, "CTI.LocalRecording.Mode": ""
|
, "CTI.LocalRecording.Path": ""
|
, "CTI.Lusca.Domain": ""//domain
|
}
|
}
|
|
// 登录
|
function login() {
|
try {
|
config();
|
var result = cti.agentLogin(false);
|
|
if (result == 1) {
|
if (confirm("座席已经登录,要强制登录吗?")) {
|
cti.agentLogin(true);
|
}
|
else {
|
return;
|
}
|
}
|
|
}
|
catch (e) {
|
alert(e.message);
|
}
|
}
|
</script>
|
|
<style type="text/css">
|
#btnLogin {
|
width: 100px;
|
}
|
|
.login {
|
width: 150px;
|
text-align: center;
|
|
|
}
|
</style>
|
|
<apex:form id="allform">
|
|
<apex:outputPanel >
|
<div class="login" ><input type="userName" id="userName" name="userName" /></div>
|
<div class="login" ><input type="password" id="password" name="password" /></div>
|
<input id="btnLogin" type="button" value="登录" onclick="login()" />
|
</apex:outputPanel>
|
|
</apex:form>
|
|
</apex:page>
|