开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
forked from youngoldman/web
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (1)
master
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
项目仓库所选许可证以仓库主分支所使用许可证为准
master
分支 (1)
master
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (1)
master
web
/
src
/
BSHCallFlowAgi.java
web
/
src
/
BSHCallFlowAgi.java
BSHCallFlowAgi.java 35.99 KB
一键复制 编辑 原始数据 按行查看 历史
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.asteriskjava.fastagi.AgiChannel;
import org.asteriskjava.fastagi.AgiException;
import org.asteriskjava.fastagi.AgiRequest;
import org.asteriskjava.fastagi.BaseAgiScript;
import com.callke8.bsh.bshorderlist.BSHHttpRequestThread;
import com.callke8.bsh.bshorderlist.BSHOrderList;
import com.callke8.bsh.bshvoice.BSHVoice;
import com.callke8.bsh.bshvoice.BSHVoiceConfig;
import com.callke8.predialqueuforbsh.BSHLaunchDialService;
import com.callke8.pridialqueueforbshbyquartz.BSHPredial;
import com.callke8.system.param.ParamConfig;
import com.callke8.utils.BlankUtils;
import com.callke8.utils.DateFormatUtils;
import com.callke8.utils.StringUtil;
import com.jfinal.plugin.activerecord.Record;
public class BSHCallFlowAgi extends BaseAgiScript {
private Log log = LogFactory.getLog(BSHCallFlowAgi.class);
@Override
public void service(AgiRequest request, AgiChannel channel) throws AgiException {
channel.exec("Noop","执行到了 BSHCallFlowAgi-----");
//执行到这里之后,由于 Avaya 传过来的状态有可能出现这种情况:通道已接听,但是在 BSHLaunchDialService 的返回的呼叫状态结果中可能还是出现了 NOANSWER 状态
String bshOrderListId = channel.getVariable("bshOrderListId");
StringUtil.writeString("/opt/dial-log.log",DateFormatUtils.getCurrentDate() + ",/(流程执行):bshOrderListId " + bshOrderListId + ",通道标识:" + channel.getName(), true);
//List<Record> playList = new ArrayList<Record>(); //定义一个List,用于储存插入列表
StringBuilder readFileSb = new StringBuilder(); //定义一个用于储存read命令所需语音文件字符串
List<Record> respond1PlayList = new ArrayList<Record>(); //定义一个当回复1,即是确认安装后播放的语音列表
List<Record> respond2PlayList = new ArrayList<Record>(); //定义一个当回复2,即是暂不安装后播放的语音列表
List<Record> respond3PlayList = new ArrayList<Record>(); //定义一个当回复3,即是延后安装后播放的语音列表
List<Record> respond4PlayList = new ArrayList<Record>(); //定义一个当回复4,即是已经预约后播放的语音列表
List<Record> respondErrorPlayList = new ArrayList<Record>(); //定义一个当无回复或是错误回复,播放的语音列表
exec("Noop","bshOrderListId-----" + bshOrderListId);
//从数据表中取出订单信息
BSHOrderList bshOrderList = BSHOrderList.dao.getBSHOrderListById(bshOrderListId);
//System.out.println("取出的订单信息为---=========:" + bshOrderList);
exec("Noop","AGI流程得到的订单ID为:" + bshOrderListId + ",订单详情:" + bshOrderList);
StringUtil.writeString("/opt/dial-log.log",DateFormatUtils.getCurrentDate() + ",FastAGI11111(流程执行):" + bshOrderList.getStr("CUSTOMER_TEL") + ",通道标识:" + channel.getName(), true);
/**
* 2018年09月06日 强行加入逻辑,用于处理,提交上来的订单,如果平台渠道为非国美平台,但是日期类型却又是送货日期时,需要强行将送货日期改为安装日期
*/
int channelSource = bshOrderList.getInt("CHANNEL_SOURCE"); //购物平台,1:京东;2:苏宁;3:天猫;4:国美
int timeType = bshOrderList.getInt("TIME_TYPE"); //日期类型,1:安装日期;2:送货日期
if(timeType==2) { //即等于2,送货日期时
if(channelSource!=4) { //而购物平台却又非国美时(因为只有国美是送货日期类型)
bshOrderList.set("TIME_TYPE", 1);
}
}
//playList = getPlayList(bshOrderList); //组织播放开始语音
String readVoiceFileList = getReadVoiceFileToString(bshOrderList); //Read应用所需语音文件
respond1PlayList = getRespond1PlayList(bshOrderList);
respond2PlayList = getRespond2PlayList(bshOrderList);
respond3PlayList = getRespond3PlayList(bshOrderList);
respond4PlayList = getRespond4PlayList(bshOrderList);
respondErrorPlayList = getRespondErrorPlayList(bshOrderList);
//如果开始播放列表不为空时
if(!BlankUtils.isBlank(readVoiceFileList)) {
exec("Noop","Read播放文件列表内容:" + readVoiceFileList);
exec("Wait","1");
execRead(readVoiceFileList,respond1PlayList, respond2PlayList, respond3PlayList, respond4PlayList,respondErrorPlayList,bshOrderList, channel); //执行调查操作
StringUtil.writeString("/opt/dial-log.log",DateFormatUtils.getCurrentDate() + ",FastAGI22222(流程执行结束):" + bshOrderList.getStr("CUSTOMER_TEL") + ",通道标识:" + channel.getName(), true);
}else {
exec("Noop","Read播放文件列表内容为空!系统无法调查客户!");
}
}
public void execRead(String readVoiceFileList,List<Record> respond1PlayList,List<Record> respond2PlayList,List<Record> respond3PlayList,List<Record> respond4PlayList,List<Record> respondErrorPlayList,BSHOrderList bshOrderList,AgiChannel channel) {
try {
String voicePath = ParamConfig.paramConfigMap.get("paramType_3_voicePathSingle"); //取出配置的语音文件(单声道)路径
exec("Read","respond," + readVoiceFileList + ",1,,1,8");
String respond = channel.getVariable("respond"); //取得回复结果
StringUtil.log(BSHCallFlowAgi.class, "客户 " + bshOrderList.get("CUSTOMER_TEL") + " 第1次回复输入:" + respond);
//一共要求两次,如果客户第一次回复为空或是错误回复时,再执行一次。
if(BlankUtils.isBlank(respond) || !(respond.equalsIgnoreCase("1") || respond.equalsIgnoreCase("2") || respond.equalsIgnoreCase("3") || respond.equalsIgnoreCase("4"))) {
if(!BlankUtils.isBlank(respond)) { //如果客户回复不为空,但是按键又不为 1,2,3,4 时
String inputErrorVoice = voicePath + "/" + BSHVoiceConfig.getVoiceMap().get("response_error_for_first_time");
exec("PlayBack",inputErrorVoice); //提示输入有误
}
exec("Read","respond," + readVoiceFileList + ",1,,1,8");
respond = channel.getVariable("respond"); //再次取得回复结果
StringUtil.log(BSHCallFlowAgi.class, "客户 " + bshOrderList.get("CUSTOMER_TEL") + " 第2次回复输入:" + respond);
}
if(!BlankUtils.isBlank(respond)) { //客户回复不为空时
if(respond.equalsIgnoreCase("1")) { //如果回复的是1时,确认安装
exec("Noop","客户" + bshOrderList.get("CUSTOMER_TEL") + "回复1,即确认安装");
//更改客户回复的同时,将呼叫状态更改为2,即是外呼成功
//BSHOrderList.dao.updateBSHOrderListRespondAndBillsec(bshOrderList.get("ID").toString(), respond,Integer.valueOf(channel.getVariable("CDR(billsec)")));
execPlayBack(respond1PlayList); //回复后,还需要将结果播放回去
}else if(respond.equalsIgnoreCase("2")) { //如果回复的是2时,暂不安装
exec("Noop","客户" + bshOrderList.get("CUSTOMER_TEL") + "回复2,即暂不安装");
//更改客户回复的同时,将呼叫状态更改为2,即是外呼成功
//BSHOrderList.dao.updateBSHOrderListRespondAndBillsec(bshOrderList.get("ID").toString(), respond,Integer.valueOf(channel.getVariable("CDR(billsec)")));
execPlayBack(respond2PlayList); //回复后,还需要将结果播放回去
}else if(respond.equalsIgnoreCase("3")) { //如果回复的是3时,延后安装
exec("Noop","客户" + bshOrderList.get("CUSTOMER_TEL") + "回复3,即延后安装");
//更改客户回复的同时,将呼叫状态更改为2,即是外呼成功
//BSHOrderList.dao.updateBSHOrderListRespondAndBillsec(bshOrderList.get("ID").toString(), respond,Integer.valueOf(channel.getVariable("CDR(billsec)")));
execPlayBack(respond3PlayList); //回复后,还需要将结果播放回去
}else if(respond.equalsIgnoreCase("4")) { //如果回复的是4时,表示已预约
exec("Noop","客户" + bshOrderList.get("CUSTOMER_TEL") + "回复4,即已经预约");
execPlayBack(respond4PlayList); //回复后,还需要将结果播放回去
}else { //如果回复的是其他按键时,按回复
exec("Noop","客户 " + bshOrderList.get("CUSTOMER_TEL") + "回复" + respond + ",即为错误回复");
respond = "5"; //强制为错误回复
//更改客户回复的同时,将呼叫状态更改为2,即是外呼成功
//BSHOrderList.dao.updateBSHOrderListRespondAndBillsec(bshOrderList.get("ID").toString(), respond,Integer.valueOf(channel.getVariable("CDR(billsec)")));
execPlayBack(respondErrorPlayList); //回复后,还需要将结果播放回去
}
}else {
exec("Noop","客户" + bshOrderList.get("CUSTOMER_TEL") + "无回复任何");
respond = "5";
execPlayBack(respondErrorPlayList); //回复后,还需要将结果播放回去
}
BSHOrderList.dao.updateBSHOrderListRespondAndBillsec(bshOrderList.get("ID").toString(), respond,Integer.valueOf(channel.getVariable("CDR(billsec)")));
//需要将客户回复结果返回给BSH服务器
//同时,将呼叫成功结果反馈给 BSH 服务器
BSHHttpRequestThread httpRequestT = new BSHHttpRequestThread(bshOrderList.get("ID").toString(),bshOrderList.getStr("ORDER_ID"), "1", String.valueOf(respond));
Thread httpRequestThread = new Thread(httpRequestT);
httpRequestThread.start();
//无论是否回复什么结果,或是没有回复结果,在这里表示外呼已经结束,需要将活跃通道减掉一个
if(BSHPredial.activeChannelCount > 0) {
BSHPredial.activeChannelCount--;
}
} catch (AgiException e) {
e.printStackTrace();
}
}
/**
* 执行播放
*
* @param playList
* @param bshOrderListId
* @param channel
*/
public void execPlay(List<Record> playList,List<Record> respond1PlayList,List<Record> respond2PlayList,List<Record> respond3PlayList,List<Record> respond4PlayList,BSHOrderList bshOrderList,AgiChannel channel) {
//如果插入列表不为空时
if(!BlankUtils.isBlank(playList) && playList.size()>0) {
for(Record record:playList) {
String action = record.get("action");
String path = record.get("path");
if(action.equalsIgnoreCase("Read")) { //如果为Read的应用时,表示需要等待客户回复
try {
exec(action,path); //执行播放并等待客户回复
String respond = channel.getVariable("respond");
if(!BlankUtils.isBlank(respond)) { //客户回复不为空时
if(respond.equalsIgnoreCase("1")) { //如果回复的是1时,确认安装
exec("Noop","客户" + bshOrderList.get("CUSTOMER_TEL") + "回复1,即确认安装");
//更改客户回复的同时,将呼叫状态更改为2,即是外呼成功
BSHOrderList.dao.updateBSHOrderListRespond(bshOrderList.get("ID").toString(), respond);
execPlayBack(respond1PlayList); //回复后,还需要将结果播放回去
}else if(respond.equalsIgnoreCase("2")) { //如果回复的是2时,暂不安装
exec("Noop","客户" + bshOrderList.get("CUSTOMER_TEL") + "回复2,即暂不安装");
//更改客户回复的同时,将呼叫状态更改为2,即是外呼成功
BSHOrderList.dao.updateBSHOrderListRespond(bshOrderList.get("ID").toString(), respond);
execPlayBack(respond2PlayList); //回复后,还需要将结果播放回去
}else if(respond.equalsIgnoreCase("3")) { //如果回复的是3时,延后安装
exec("Noop","客户" + bshOrderList.get("CUSTOMER_TEL") + "回复3,即延后安装");
//更改客户回复的同时,将呼叫状态更改为2,即是外呼成功
BSHOrderList.dao.updateBSHOrderListRespond(bshOrderList.get("ID").toString(), respond);
execPlayBack(respond3PlayList); //回复后,还需要将结果播放回去
}else { //如果回复的是其他按键时,按回复
exec("Noop","客户 " + bshOrderList.get("CUSTOMER_TEL") + "回复" + respond + ",即为错误回复");
respond = "4"; //强制为错误回复
//更改客户回复的同时,将呼叫状态更改为2,即是外呼成功
BSHOrderList.dao.updateBSHOrderListRespond(bshOrderList.get("ID").toString(), respond);
execPlayBack(respond4PlayList); //回复后,还需要将结果播放回去
}
}else {
exec("Noop","客户" + bshOrderList.get("CUSTOMER_TEL") + "无回复任何");
respond = "4";
//更改客户回复的同时,将呼叫状态更改为2,即是外呼成功
BSHOrderList.dao.updateBSHOrderListRespond(bshOrderList.get("ID").toString(), respond);
execPlayBack(respond4PlayList); //回复后,还需要将结果播放回去
}
//无论是否回复什么结果,或是没有回复结果,在这里表示外呼已经结束,需要将活跃通道减掉一个
BSHPredial.activeChannelCount--;
} catch (AgiException e) {
e.printStackTrace();
}
}else { //如果PlayBack 就执行插放操作
try {
exec(action,path);
} catch (AgiException e) {
e.printStackTrace();
}
}
}
}
}
/**
* 播放语音
* @param playList
*/
public void execPlayBack(List<Record> playList) {
//如果插入列表不为空时
if(!BlankUtils.isBlank(playList) && playList.size()>0) {
for(Record record:playList) {
String action = record.get("action");
String path = record.get("path");
try {
exec(action,path);
} catch (AgiException e) {
e.printStackTrace();
}
}
}
}
/**
* 取得 Read 命令所需语音文件名字符串
* 一次性取得多个文件,形成完整的调查语音
*
* 开场分两种情况:
*
* 开场1:您好,这里是(西门子/博世)家电客服中心,来电跟您确认(洗衣机/XXX)的安装日期。根据(京东/苏宁/国美/天猫)平台传来的信息,
* 我们将于(明天/12月10号)上门安装。确认请按1,暂不安装请按2,如需改约到后面3天,请按3,如果您已经提前预约好服务,请按4。
开场2:您好,这里是(西门子/博世)家电客服中心。您在国美选购的(洗衣机/XXX)将于(明天/12月10号)送货,我们将于送货当天上门安装,
需要您进一步确认。确认送货当天安装请按1,暂不安装请按2,如需改约到后面3天请按3,如果您已经提前预约好服务,请按4。
语音列表如下:
begin_1_brand_0_timeType_1:您好,这里是西门子家电客服中心,来电跟您确认
begin_1_brand_1_timeType_1:您好,这里是博世家电客服中心,来电跟您确认
begin_1_brand_0_timeType_2:您好,这里是西门子家电客服中心
begin_1_brand_1_timeType_2:您好,这里是博世家电客服中心
begin_2_timeType_1:的安装日期
begin_2_timeType_2:您在国美选购的
begin_3_channelSource_1:根据京东平台传来的信息,我们将于
begin_3_channelSource_2:根据苏宁平台传来的信息,我们将于
begin_3_channelSource_3:根据天猫平台传来的信息,我们将于
begin_3_channelSource_4:根据国美平台传来的信息,我们将于
begin_3_timeType_2:将于
begin_4_timeType_1:上门安装
begin_4_timeType_2:送货,我们将于送货当天上门安装,需要您进一步确认
begin_5_timeType_1:确认请按1,暂不安装请按2,如需改约到后面3天,请按3,如果您已经提前预约好服务,请按4。
begin_5_timeType_2:确认送货当天安装请按1,暂不安装请按2,如需改约到后面3天请按3,如果您已经提前预约好服务,请按4。
*
*
* @param bshOrderList
* @return
*/
public String getReadVoiceFileToString(BSHOrderList bshOrderList) {
StringBuilder sb = new StringBuilder();
String voicePath = ParamConfig.paramConfigMap.get("paramType_3_voicePathSingle"); //取出配置的语音文件(单声道)路径
int brand = bshOrderList.getInt("BRAND"); //品牌,0:西门子;1:博世
int channelSource = bshOrderList.getInt("CHANNEL_SOURCE"); //购物平台,1:京东;2:苏宁;3:天猫;4:国美
int timeType = bshOrderList.getInt("TIME_TYPE"); //日期类型,1:安装日期;2:送货日期
int productName = bshOrderList.getInt("PRODUCT_NAME"); //产品名称
/** 一、组织第一条语音
begin_1_brand_0_timeType_1:您好,这里是西门子家电客服中心,来电跟您确认
begin_1_brand_1_timeType_1:您好,这里是博世家电客服中心,来电跟您确认
begin_1_brand_0_timeType_2:您好,这里是西门子家电客服中心
begin_1_brand_1_timeType_2:您好,这里是博世家电客服中心
*/
String voiceNameFor1 = "begin_1_brand_" + brand + "_timeType_" + timeType;
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceNameFor1)) {
sb.append(voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameFor1));
}
/**
* 二、再根据日期类型,决定直接报产品名称,还是报:您在国美选购的
*/
if(timeType==1) { //表示安装日期,需要直接报出产品的名称
/**
* 整句即是:
* produceName_*:洗衣机
* begin_2_timeType_1:的安装日期
*/
String voiceNameForProductName = "productName_" + productName;
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceNameForProductName)) {
sb.append("&");
sb.append(voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameForProductName));
}
//紧接着第二条语音: 的安装日期
String voiceNameFor2 = "begin_2_timeType_1";
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceNameFor2)) {
sb.append("&");
sb.append(voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameFor2));
}
}else { //如果日期类型为送货日期,则需要先报出: 您在国美选购的
/**
* 整句为:
* begin_2_timeType_2:您在国美选购的
* productName_*: 洗衣机
*/
//先紧接着第二条语音: 您在国美选购的
String voiceNameFor2 = "begin_2_timeType_2";
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceNameFor2)) {
sb.append("&");
sb.append(voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameFor2));
}
//产品语音播报
String voiceNameForProductName = "productName_" + productName;
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceNameForProductName)) {
sb.append("&");
sb.append(voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameForProductName));
}
}
/**
* 三、组织第三条语音
*
begin_3_channelSource_1:根据京东平台传来的信息,我们将于
begin_3_channelSource_2:根据苏宁平台传来的信息,我们将于
begin_3_channelSource_3:根据天猫平台传来的信息,我们将于
begin_3_channelSource_4:根据国美平台传来的信息,我们将于
begin_3_timeType_2:将于
*/
if(timeType==1) { //日期类型为:安装日期
String voiceNameFor3 = "begin_3_channelSource_" + channelSource;
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceNameFor3)) {
sb.append("&");
sb.append(voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameFor3));
}
}else { //日期类型为:送货日期
String voiceNameFor3 = "begin_3_timeType_2";
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceNameFor3)) {
sb.append("&");
sb.append(voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameFor3));
}
}
/**
* 安装日期或是送货日期 组织
*
* 还有一种情况需要考虑:
* 如果安装/送货日期为明天(即是第二天时),即无需报出具体时间,只需要播报"明天"即可
*
*/
String expectInstallDate = bshOrderList.getDate("EXPECT_INSTALL_DATE").toString(); //取出期望安装日期
boolean b = checkInstallDateIsNextDay(expectInstallDate);
if(b) {
//System.out.println("安装日期为明天");
String voiceNameForDate = "tomorrow";
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceNameForDate)) {
sb.append("&");
sb.append(voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameForDate));
}
}else {
//System.out.println("安装日期不是明天,而是" + expectInstallDate);
Date installDate = DateFormatUtils.parseDateTime(expectInstallDate, "yyyy-MM-dd");
String monthStr = DateFormatUtils.formatDateTime(installDate, "MM");
String dayStr = DateFormatUtils.formatDateTime(installDate,"dd");
String voiceNameForMonth = "month_" + monthStr;
String voiceNameForDay = "day_" + dayStr;
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceNameForMonth)) {
sb.append("&");
sb.append(voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameForMonth));
}
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceNameForDay)) {
sb.append("&");
sb.append(voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameForDay));
}
}
/**
* 四、组织第四条语音
*
begin_4_timeType_1:上门安装
begin_4_timeType_2:送货,我们将于送货当天上门安装,需要您进一步确认
*/
String voiceNameFor4 = "begin_4_timeType_" + timeType;
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceNameFor4)) {
sb.append("&");
sb.append(voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameFor4));
}
/**
* 五、组织第五条语音
* begin_5_timeType_1:确认请按1,暂不安装请按2,如需改约到后面3天,请按3,如果您已经提前预约好服务,请按4。
begin_5_timeType_2:确认送货当天安装请按1,暂不安装请按2,如需改约到后面3天请按3,如果您已经提前预约好服务,请按4。
*/
String voiceNameFor5 = "begin_5_timeType_" + timeType;
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceNameFor5)) {
sb.append("&");
sb.append(voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameFor5));
}
return sb.toString();
}
/**
* 根据传入的订单信息,生成播放列表
*
* 完整的调查流程是这样的:
* 您好,这里是博世家电客服中心,来电跟您确认 洗衣机 的安装日期。 根据京东平台传来的信息,我们将于 12月10号 上门安装。
确认安装请按"1",暂不安装请按"2",如需改约到后面3天,请按"3"。
*
* 不过语音并不是一整段的,需要重新拼接
*
* (1)您好,这里是博世家电客服中心,来电跟您确认 (2)洗衣机 (3)的安装日期。 (4)根据京东平台传来的信息,我们将于(5) 12月10号 (6)上门安装。
(7)确认安装请按"1",暂不安装请按"2",如需改约到后面3天,请按"3"。
*
* @param bshOrderList
* @return
*/
public List<Record> getPlayList(BSHOrderList bshOrderList) {
String voicePath = ParamConfig.paramConfigMap.get("paramType_3_voicePathSingle"); //取出配置的语音文件(单声道)路径
List<Record> list = new ArrayList<Record>(); //新建一个List,用于储存语音
//(1)您好,这里是西门子家电客服中心,来电跟您确认
// 您好,这里是博世家电客服中心,来电跟您确认
int brand = bshOrderList.getInt("BRAND"); //取得品牌
String voiceId1 = "Brand_" + brand;
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceId1)) {
list.add(setRecord("wait","1")); //先停顿1秒
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceId1)));
}
//(2)产品语音
int productName = bshOrderList.getInt("PRODUCT_NAME"); //取得产品
String voiceId2 = "ProductName_" + productName;
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceId2)) {
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceId2)));
}
//(3)的安装日期
String voiceId3 = "Notice_1";
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceId3)) {
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceId3)));
}
//(4)根据京东平台传来的信息,我们将于
int channelSource = bshOrderList.getInt("CHANNEL_SOURCE"); //取出平台信息
String voiceId4 = "ChannelSource_" + channelSource;
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceId4)) {
list.add(setRecord("wait","0.5")); //先停顿1秒
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceId4)));
//list.add(setRecord("wait","1")); //先停顿1秒
}
//(5)5月12号
String expectInstallDate = bshOrderList.getDate("EXPECT_INSTALL_DATE").toString(); //取出期望安装日期
Date installDate = DateFormatUtils.parseDateTime(expectInstallDate, "yyyy-MM-dd");
String monthStr = DateFormatUtils.formatDateTime(installDate, "MM");
String dayStr = DateFormatUtils.formatDateTime(installDate,"dd");
String voiceIdForMonth = "Month_" + monthStr;
String voiceIdForDay = "Day_" + dayStr;
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceIdForMonth)) {
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceIdForMonth)));
}
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceIdForDay)) {
list.add(setRecord("wait","0.5")); //先停顿0.5秒
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceIdForDay)));
//list.add(setRecord("wait","0.5")); //先停顿0.5秒
}
//(6)上门安装
String voiceId6 = "Notice_2";
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceId6)) {
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceId6)));
}
//(7)确认安装请按"1",暂不安装请按"2",如需改约到后面3天,请按"3"。
String voiceId7 = "ComfirmVoice";
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceId7)) {
String comfirmVoicePath = voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceId7);
list.add(setRecord("wait","1")); //先停顿1秒
list.add(setRecord("Read","respond," + comfirmVoicePath + ",1,,2,8")); //一个回复按键,2次播放,等待8秒
}
return list;
}
/**
* 客户回复1,即确认安装时
*
* 场景1:京东、苏宁、天猫
您的机器安装日期已确认为12月10号,工程师最迟会在当天早上9:30之前与您联系具体上门时间。感谢您的配合,再见。
场景2:国美
您的机器安装日期已确认为12月10号,工程师最迟会在当天早上9:30之前与您联系具体上门时间。为确保您的权益,请认准(西门子/博世)厂家的专业工程师。感谢您的配合,再见。
*
* 并非一整段语音
*
respond_1_1: 您的机器安装日期已确认为
respond_1_2_timeType_1: 工程师最迟会在当天早上9点半之前与您联系具体上门时间,感谢您的配合,再见。
respond_1_2_timeType_2_brand_0: 工程师最迟会在当天早上9点半之前与您联系具体上门时间,为确保您的权益,请认准西门子厂家的专业工程师,感谢您的配合,再见。
respond_1_2_timeType_2_brand_1: 工程师最迟会在当天早上9点半之前与您联系具体上门时间,为确保您的权益,请认准博世厂家的专业工程师,感谢您的配合,再见。
* @param bshOrderList
* @return
*/
public List<Record> getRespond1PlayList(BSHOrderList bshOrderList) {
String voicePath = ParamConfig.paramConfigMap.get("paramType_3_voicePathSingle"); //取出配置的语音文件(单声道)路径
List<Record> list = new ArrayList<Record>();
//(1)您的机器安装日期已确认为
String voiceName = "respond_1_1";
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceName)) {
list.add(setRecord("wait","1")); //先停顿1秒
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceName)));
//list.add(setRecord("wait","1")); //先停顿1秒
}
//(2)12月10号
String expectInstallDate = bshOrderList.getDate("EXPECT_INSTALL_DATE").toString(); //取出期望安装日期
Date installDate = DateFormatUtils.parseDateTime(expectInstallDate, "yyyy-MM-dd");
String monthStr = DateFormatUtils.formatDateTime(installDate, "MM");
String dayStr = DateFormatUtils.formatDateTime(installDate,"dd");
String voiceNameForMonth = "month_" + monthStr;
String voiceNameForDay = "day_" + dayStr;
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceNameForMonth)) {
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameForMonth)));
}
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceNameForDay)) {
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameForDay)));
}
//(3)
// A:工程师最迟会在当天早上9点半之前与您联系具体上门时间,感谢您的配合,再见。
// B:工程师最迟会在当天早上9点半之前与您联系具体上门时间,为确保您的权益,请认准西门子厂家的专业工程师,感谢您的配合,再见。
// C:工程师最迟会在当天早上9点半之前与您联系具体上门时间,为确保您的权益,请认准博世厂家的专业工程师,感谢您的配合,再见。
int timeType = bshOrderList.getInt("TIME_TYPE"); //日期类型: 1:安装日期; 2:送货日期
int brand = bshOrderList.getInt("BRAND"); //品牌: 0:西门子; 1:博世
int channelSource = bshOrderList.getInt("CHANNEL_SOURCE"); //购物平台:1:京东 2:苏宁 3:天猫 4:国美
if(timeType==1) { //日期类型为安装日期
String voiceNameForTimeType1 = "respond_1_2_timeType_1";
if(channelSource==4) { //如果购物平台为国美
voiceNameForTimeType1 = "respond_1_2_timeType_2_brand_" + brand;
}
list.add(setRecord("wait","0.5")); //先停半秒
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameForTimeType1)));
}else { //日期类型为送货日期
String voiceNameForTimeType2 = "respond_1_2_timeType_2_brand_" + brand;
list.add(setRecord("wait","0.5")); //先停半秒
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceNameForTimeType2)));
}
return list;
}
/**
* 回复2,即是暂不安装
*
* 您的机器,暂时将不会安排上门安装。如后期仍然需要安装,欢迎拨打400-889-9999,或者关注西门子家电微信公众号预约。感谢您的配合,再见。
* 您的机器,暂时将不会安排上门安装。如后期仍然需要安装,欢迎拨打 400-885-5888 或者关注 "博世家电" 微信公众号预约。感谢您的配合,再见。
*
* 根据品牌组织语音
*
* @param bshOrderList
* @return
*/
public List<Record> getRespond2PlayList(BSHOrderList bshOrderList) {
String voicePath = ParamConfig.paramConfigMap.get("paramType_3_voicePathSingle"); //取出配置的语音文件(单声道)路径
List<Record> list = new ArrayList<Record>();
int brand = bshOrderList.getInt("BRAND"); //取得品牌
String voiceName = "respond_2_brand_" + brand;
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceName)) {
list.add(setRecord("wait","0.5")); //先停顿1秒
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceName)));
}
return list;
}
/**
* 客户回复 3,延后安装
*
* 稍后您会收到1条确认短信,请您按短信提示,直接回复数字即可。感谢您的配合,再见。
* @param bshOrderList
* @return
*/
public List<Record> getRespond3PlayList(BSHOrderList bshOrderList) {
String voicePath = ParamConfig.paramConfigMap.get("paramType_3_voicePathSingle"); //取出配置的语音文件(单声道)路径
List<Record> list = new ArrayList<Record>();
//(1)
String voiceName = "respond_3";
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceName)) {
list.add(setRecord("wait","0.5")); //先停顿1秒
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceName)));
}
return list;
}
public List<Record> getRespond4PlayList(BSHOrderList bshOrderList) {
String voicePath = ParamConfig.paramConfigMap.get("paramType_3_voicePathSingle"); //取出配置的语音文件(单声道)路径
List<Record> list = new ArrayList<Record>();
int brand = bshOrderList.getInt("BRAND"); //取得品牌
String voiceName = "respond_4_brand_" + brand;
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceName)) {
list.add(setRecord("wait","0.5")); //先停顿1秒
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceName)));
}
return list;
}
public List<Record> getRespondErrorPlayList(BSHOrderList bshOrderList) {
String voicePath = ParamConfig.paramConfigMap.get("paramType_3_voicePathSingle"); //取出配置的语音文件(单声道)路径
List<Record> list = new ArrayList<Record>();
String voiceName = "respond_error";
if(BSHVoiceConfig.getVoiceMap().containsKey(voiceName)) {
list.add(setRecord("wait","0.5")); //先停顿1秒
list.add(setRecord("PlayBack",voicePath + "/" + BSHVoiceConfig.getVoiceMap().get(voiceName)));
}
return list;
}
/**
* 检查安装/送货日期是否为第二天
*
* @param expectInstallDate
* 安装/送货 日期,格式:yyyy-MM-dd,如:2018年12月10日
*
* @return
* 是:返回true; 否: 返回 false
*/
public boolean checkInstallDateIsNextDay(String expectInstallDate) {
//先判断当天日期与安装日期是否相差一天
String installDateTime = expectInstallDate + " 00:00:00";
String currDateTime = DateFormatUtils.formatDateTime(new Date(), "yyyy-MM-dd") + " 00:00:00";
Date installDate = DateFormatUtils.parseDateTime(installDateTime, "yyyy-MM-dd HH:mm:ss");
Date currDate = DateFormatUtils.parseDateTime(currDateTime, "yyyy-MM-dd HH:mm:ss");
long installDateTimes = installDate.getTime();
long currDateTimes = currDate.getTime();
long intervalTimes = installDateTimes - currDateTimes;
System.out.println("安装日期:expectInstallDate 为 " + expectInstallDate + ",与今天相差毫秒数:" + intervalTimes);
if(intervalTimes == 24 * 60 * 60 * 1000) {
return true;
}else {
return false;
}
}
public Record setRecord(String action,String path) {
Record record = new Record();
record.set("action", action);
record.set("path", path);
return record;
}
}
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

呼叫中心项目,基于 asterisk 开发的一套 web 项目。主要功能有自动外呼(催缴外呼、调查外呼、通知类外呼),催缴外呼支持几大业 务的外呼:电费催缴、水费催缴、电话费催缴、物业费催缴、交通移车、交通违法通知等八种催缴(提醒)类型。 同时支持扩展开发, 可以应用于各种电话自动外呼项目,比如:对于物业公司,在有紧急情况可以下发通知告知业主,等等。 同时,系统已经支持了短信接口,如果有短信方面的需求,在自动外呼的同时,可以支持同时下发短信。 项目的上线运营情况: (1)项目已经应用到江苏的电信局的相关业务,用于江苏地区的电费、水费、微信交通移车等业务。系统对接运营商的IMS作为落地资源, 线路的并发能力为:120线。 (2)西门子电器项目,系统对接西门子电器的几大购物平...
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/jf_linux/web.git
git@gitee.com:jf_linux/web.git
jf_linux
web
web
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /