|
|
@@ -197,6 +197,7 @@ func HandleAMI(event map[string]string) {
|
|
|
} else {
|
|
|
utils.Logger.Printf("Train Information: %s, MessageType: PAD , RecordFileName:%s . Can not get caller and callee !", trainInfo, DstFile)
|
|
|
}
|
|
|
+
|
|
|
} else if strings.Contains(event["FILENAME"], "PA") {
|
|
|
_, caller, _ := utils.GetPadInfo(event["FILENAME"])
|
|
|
utils.Logger.Printf("Train Information:%s , MessageType: PA, Caller: %s, RecordFileName: %s", trainInfo, caller, DstFile)
|
|
|
@@ -283,45 +284,51 @@ func HandleAMI(event map[string]string) {
|
|
|
if active.ActivedCab == "1" && ExtenStatus("1411") == "Idle" { //check active and OCC status
|
|
|
time.Sleep(time.Second)
|
|
|
PADChan := ""
|
|
|
- for _, chanEntry := range res.Entrys {
|
|
|
- lfshook.NewLogger().Infof("PAD answered by OCC1 pos:%s chan:%s", chanEntry.Position, chanEntry.Channel)
|
|
|
- if chanEntry.Position == "1" {
|
|
|
- PADChan = chanEntry.Channel
|
|
|
- break
|
|
|
+
|
|
|
+ if res.Entrys != nil {
|
|
|
+ for _, chanEntry := range res.Entrys {
|
|
|
+ lfshook.NewLogger().Infof("PAD answered by OCC1 pos:%s chan:%s", chanEntry.Position, chanEntry.Channel)
|
|
|
+ if chanEntry.Position == "1" {
|
|
|
+ PADChan = chanEntry.Channel
|
|
|
+ break
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if PADChan != "" {
|
|
|
- Ext := strings.Split(strings.Split(res.Entrys[0].Channel, "/")[1], "-")[0]
|
|
|
+ if PADChan != "" {
|
|
|
+ Ext := strings.Split(strings.Split(res.Entrys[0].Channel, "/")[1], "-")[0]
|
|
|
|
|
|
- alstatus.AlarmStatus(Ext, "connect")
|
|
|
- go RedirectInQueue(PADChan, "1411", "pad-page-occ-icp", Ext) //PAD Page(OCC+ICPs)
|
|
|
+ alstatus.AlarmStatus(Ext, "connect")
|
|
|
+ go RedirectInQueue(PADChan, "1411", "pad-page-occ-icp", Ext) //PAD Page(OCC+ICPs)
|
|
|
|
|
|
- go Dial("0401", "0512", "pad-rule-pacus-occ", "ano1", "ano1", "1") // PACUs dial OCC1
|
|
|
- } else {
|
|
|
- lfshook.NewLogger().Infof("OCC-QueueStatus PADCchan NULL")
|
|
|
+ go Dial("0401", "0512", "pad-rule-pacus-occ", "ano1", "ano1", "1") // PACUs dial OCC1
|
|
|
+ } else {
|
|
|
+ lfshook.NewLogger().Infof("OCC-QueueStatus PADCchan NULL")
|
|
|
+ }
|
|
|
}
|
|
|
break
|
|
|
} else if active.ActivedCab == "8" && ExtenStatus("1481") == "Idle" {
|
|
|
time.Sleep(time.Second)
|
|
|
PADChan := ""
|
|
|
- for _, chanEntry := range res.Entrys {
|
|
|
- lfshook.NewLogger().Infof("PAD answered by OCC1 pos:%s chan:%s", chanEntry.Position, chanEntry.Channel)
|
|
|
- if chanEntry.Position == "1" {
|
|
|
- PADChan = chanEntry.Channel
|
|
|
- break
|
|
|
+
|
|
|
+ if res.Entrys != nil {
|
|
|
+ for _, chanEntry := range res.Entrys {
|
|
|
+ lfshook.NewLogger().Infof("PAD answered by OCC1 pos:%s chan:%s", chanEntry.Position, chanEntry.Channel)
|
|
|
+ if chanEntry.Position == "1" {
|
|
|
+ PADChan = chanEntry.Channel
|
|
|
+ break
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if PADChan != "" {
|
|
|
- Ext := strings.Split(strings.Split(res.Entrys[0].Channel, "/")[1], "-")[0]
|
|
|
+ if PADChan != "" {
|
|
|
+ Ext := strings.Split(strings.Split(res.Entrys[0].Channel, "/")[1], "-")[0]
|
|
|
|
|
|
- alstatus.AlarmStatus(Ext, "connect")
|
|
|
- go RedirectInQueue(PADChan, "1481", "pad-page-occ-icp", Ext) //PAD Page(OCC+ICPs)
|
|
|
+ alstatus.AlarmStatus(Ext, "connect")
|
|
|
+ go RedirectInQueue(PADChan, "1481", "pad-page-occ-icp", Ext) //PAD Page(OCC+ICPs)
|
|
|
|
|
|
- go Dial("0401", "0512", "pad-rule-pacus-occ", "ano8", "ano8", "8") // PACUs dial OCC1
|
|
|
- } else {
|
|
|
- lfshook.NewLogger().Infof("OCC QueueStatus PADCchan NULL")
|
|
|
+ go Dial("0401", "0512", "pad-rule-pacus-occ", "ano8", "ano8", "8") // PACUs dial OCC1
|
|
|
+ } else {
|
|
|
+ lfshook.NewLogger().Infof("OCC QueueStatus PADCchan NULL")
|
|
|
+ }
|
|
|
}
|
|
|
break
|
|
|
}
|
|
|
@@ -480,17 +487,20 @@ func HandleAMI(event map[string]string) {
|
|
|
lfshook.NewLogger().Infof("ICP QueueStatus err:%+v", err)
|
|
|
return
|
|
|
}
|
|
|
- sort.Slice(resCaller.Entrys, func(i, j int) bool {
|
|
|
- return resCaller.Entrys[i].Position < resCaller.Entrys[j].Position
|
|
|
- })
|
|
|
-
|
|
|
- for _, caller := range resCaller.Entrys {
|
|
|
- priority.ICPAnswer = 0
|
|
|
- //lfshook.NewLogger().Infof("====QueueCallerJoin==QueueTimer===%s", event["Event"])
|
|
|
- lfshook.NewLogger().Infof("Redirect to 0301 extension:%s Pos:%s", caller.CallerIDNum, caller.Position)
|
|
|
- //order by pos
|
|
|
- RedirectInQueue(caller.CallerIDNum, "0301", "queues-occ", caller.CallerIDNum) // redirect All ICP-PAD redirect to OCC queue
|
|
|
- time.Sleep(time.Millisecond * 100) //200 ms delay
|
|
|
+
|
|
|
+ if resCaller.Entrys != nil {
|
|
|
+ sort.Slice(resCaller.Entrys, func(i, j int) bool {
|
|
|
+ return resCaller.Entrys[i].Position < resCaller.Entrys[j].Position
|
|
|
+ })
|
|
|
+
|
|
|
+ for _, caller := range resCaller.Entrys {
|
|
|
+ priority.ICPAnswer = 0
|
|
|
+ //lfshook.NewLogger().Infof("====QueueCallerJoin==QueueTimer===%s", event["Event"])
|
|
|
+ lfshook.NewLogger().Infof("Redirect to 0301 extension:%s Pos:%s", caller.CallerIDNum, caller.Position)
|
|
|
+ //order by pos
|
|
|
+ RedirectInQueue(caller.CallerIDNum, "0301", "queues-occ", caller.CallerIDNum) // redirect All ICP-PAD redirect to OCC queue
|
|
|
+ time.Sleep(time.Millisecond * 100) //200 ms delay
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
})
|