|
|
@@ -142,7 +142,7 @@ func HandleAMI(event map[string]string) {
|
|
|
//获取录音文件时长,检测录音文件是否超过3min;
|
|
|
duration, err := utils.GetDuration(event["FILENAME"])
|
|
|
if err != nil {
|
|
|
- utils.Logger.Printf("Get duration err: %+v", err)
|
|
|
+ utils.Logger.Printf("%s Get duration err: %+v", event["FILENAME"], err)
|
|
|
break
|
|
|
}
|
|
|
//lfshook.NewLogger().Infof("==========duration===== %d", duration)
|
|
|
@@ -154,7 +154,7 @@ func HandleAMI(event map[string]string) {
|
|
|
} else if duration < 600 { //小于600秒文件进行转换和切割
|
|
|
FileNames, err = utils.ConvertAndSegmentWAV(event["FILENAME"], strings.Replace(event["FILENAME"], ".wav", "", -1))
|
|
|
if err != nil {
|
|
|
- lfshook.NewLogger().Infof("Get duration err: %+v", err)
|
|
|
+ lfshook.NewLogger().Infof("%s Get duration err: %+v", event["FILENAME"], err)
|
|
|
break
|
|
|
}
|
|
|
//lfshook.NewLogger().Infof("=============== File %+v found after convert", FileNames)
|
|
|
@@ -181,7 +181,13 @@ func HandleAMI(event map[string]string) {
|
|
|
|
|
|
if strings.Contains(event["FILENAME"], "PAD") {
|
|
|
_, caller, callee := utils.GetPadInfo(event["FILENAME"])
|
|
|
- trainInfo = fmt.Sprintf("TrainNumber %s CarNumber %s ", active.TrainNum, active.TrainInfoMap[active.TrainNum][int(caller[2])])
|
|
|
+
|
|
|
+ carNum := int(caller[2] - '0')
|
|
|
+ //trainInfo = fmt.Sprintf("TrainNumber %s CarNumber %s ", active.TrainNum, active.TrainInfoMap[active.TrainNum][int(caller[2])])
|
|
|
+ lfshook.NewLogger().Infof("Train info===caller[2]==========:%c===============", carNum)
|
|
|
+
|
|
|
+ trainInfo = fmt.Sprintf("TrainNumber %s CarNumber %s ", active.TrainNum, active.TrainInfoMap[active.TrainNum][carNum])
|
|
|
+
|
|
|
lfshook.NewLogger().Infof("Train info=============%s===============", trainInfo)
|
|
|
|
|
|
if len(caller) == 4 && len(caller) > 0 {
|
|
|
@@ -217,8 +223,9 @@ func HandleAMI(event map[string]string) {
|
|
|
path := filepath.Dir(event["FILENAME"])
|
|
|
rcdFileName := filepath.Base(event["FILENAME"])
|
|
|
xmlFileName := strings.Replace(rcdFileName, "wav", "xml", 1)
|
|
|
- xmlFilePath := path + xmlFileName
|
|
|
+ xmlFilePath := path + "/" + xmlFileName
|
|
|
|
|
|
+ lfshook.NewLogger().Infof("Train info= xml path============%s===============", xmlFilePath)
|
|
|
err := active.GenerateXML(xmlFilePath)
|
|
|
if err != nil {
|
|
|
lfshook.NewLogger().Infof("Generate recording XML err:%+v", err)
|
|
|
@@ -242,7 +249,11 @@ func HandleAMI(event map[string]string) {
|
|
|
time.Sleep(time.Millisecond * 100) //wait endpoimt release
|
|
|
|
|
|
res, _ := QueueStatus("0301", "") // check OCC queue ,if empty PAD end
|
|
|
- if res.Calls == "0" { //OCC queue is empty
|
|
|
+ if res == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if res.Calls == "0" { //OCC queue is empty
|
|
|
alstatus.OccPad("end")
|
|
|
priority.OCCAnswer = 0
|
|
|
priority.PADOccStart = 0
|
|
|
@@ -324,7 +335,9 @@ func HandleAMI(event map[string]string) {
|
|
|
if utils.IsPAIU(number) {
|
|
|
res, _ := QueueStatus("0300", "") // check ICP queue ,if empty PAD end
|
|
|
res1, _ := QueueStatus("0301", "") // check OCC queue ,if empty PAD end
|
|
|
-
|
|
|
+ if res == nil || res1 == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
lfshook.NewLogger().Infof("===Hangup PAD====== ICP Queue calls:%s OCC Queue calls:%s", res.Calls, res1.Calls)
|
|
|
//if res.Calls == "0" && res1.Calls == "0" {
|
|
|
|
|
|
@@ -391,7 +404,9 @@ func HandleAMI(event map[string]string) {
|
|
|
lfshook.NewLogger().Infof("ICP QueueStatus err:%+v", err)
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+ if ICPQueue == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
if priority.ICPAnswer == 0 && ICPQueue.Calls == "1" { //ICP did not answer any first call to the ICP queue ; Ready to Set Occ Queue Timer
|
|
|
toRunpriority := priority.GetPriorityByKey("PAD-ICP")
|
|
|
|
|
|
@@ -429,6 +444,9 @@ func HandleAMI(event map[string]string) {
|
|
|
lfshook.NewLogger().Infof("OCC QueueStatus err:%+v", err)
|
|
|
return
|
|
|
}
|
|
|
+ if res == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
if res.Calls == "0" { // OCC queue empty
|
|
|
resCaller, err := QueueStatus("0300", "") // check ICP queue, get entries
|