|
|
@@ -353,62 +353,77 @@ func HandleAMI(event map[string]string) {
|
|
|
|
|
|
//time.Sleep(time.Millisecond * 100) //wait io idle
|
|
|
//lfshook.NewLogger().Infof("====Start OCC-PAD===next==%+v", res)
|
|
|
- if active.ActivedCab == "1" && ExtenStatus("1411") == "Idle" { //check active and OCC status
|
|
|
- time.Sleep(time.Second)
|
|
|
- PADChan := ""
|
|
|
-
|
|
|
- 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
|
|
|
- utils.LoggerDebug.Printf("PAD-OCC , Get the first PAD(%s) in the queue !", PADChan)
|
|
|
- break
|
|
|
+ if active.TrainDevide == 0 { //列车没有断开
|
|
|
+ if (active.ActivedCab == "1" && ExtenStatus("1411") == "Idle") || (active.ActivedCab == "" && active.ActivedCabDelay == "1" && ExtenStatus("1411") == "Idle") { //check active and OCC status
|
|
|
+ time.Sleep(time.Second)
|
|
|
+ PADChan := ""
|
|
|
+
|
|
|
+ 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
|
|
|
+ utils.LoggerDebug.Printf("PAD-OCC , Get the first PAD(%s) in the queue !", PADChan)
|
|
|
+ break
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if PADChan != "" {
|
|
|
- Ext := strings.Split(strings.Split(res.Entrys[0].Channel, "/")[1], "-")[0]
|
|
|
- alstatus.AlarmStatus(Ext, "connect")
|
|
|
+ if PADChan != "" {
|
|
|
+ Ext := strings.Split(strings.Split(res.Entrys[0].Channel, "/")[1], "-")[0]
|
|
|
+ alstatus.AlarmStatus(Ext, "connect")
|
|
|
|
|
|
- utils.LoggerDebug.Printf("PAD goto OCC1 , redirect %s to OCC1 !", PADChan)
|
|
|
- go RedirectInQueue(PADChan, "1411", "pad-page-occ-icp", Ext) //PAD Page(OCC+ICPs)
|
|
|
+ utils.LoggerDebug.Printf("PAD goto OCC1 , redirect %s to OCC1 !", PADChan)
|
|
|
+ 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")
|
|
|
- utils.LoggerDebug.Printf("PAD-OCC , OCC Queue Status PADCchan return NULL .")
|
|
|
- }
|
|
|
- }
|
|
|
- break
|
|
|
- } else if active.ActivedCab == "8" && ExtenStatus("1481") == "Idle" {
|
|
|
- time.Sleep(time.Second)
|
|
|
- PADChan := ""
|
|
|
-
|
|
|
- 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
|
|
|
- utils.LoggerDebug.Printf("PAD-OCC , Get the first PAD(%s) in the queue !", PADChan)
|
|
|
- break
|
|
|
+ go Dial("0401", "0512", "pad-rule-pacus-occ", "ano1", "ano1", "1") // PACUs dial OCC1
|
|
|
+ } else {
|
|
|
+ lfshook.NewLogger().Infof("OCC-QueueStatus PADCchan NULL")
|
|
|
+ utils.LoggerDebug.Printf("PAD-OCC , OCC Queue Status PADCchan return NULL .")
|
|
|
}
|
|
|
}
|
|
|
+ break
|
|
|
+ } else if (active.ActivedCab == "8" && ExtenStatus("1481") == "Idle") || (active.ActivedCab == "" && active.ActivedCabDelay == "8" && ExtenStatus("1481") == "Idle") {
|
|
|
+ time.Sleep(time.Second)
|
|
|
+ PADChan := ""
|
|
|
+
|
|
|
+ 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
|
|
|
+ utils.LoggerDebug.Printf("PAD-OCC , Get the first PAD(%s) in the queue !", PADChan)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if PADChan != "" {
|
|
|
- Ext := strings.Split(strings.Split(res.Entrys[0].Channel, "/")[1], "-")[0]
|
|
|
- alstatus.AlarmStatus(Ext, "connect")
|
|
|
+ if PADChan != "" {
|
|
|
+ Ext := strings.Split(strings.Split(res.Entrys[0].Channel, "/")[1], "-")[0]
|
|
|
+ alstatus.AlarmStatus(Ext, "connect")
|
|
|
|
|
|
- utils.LoggerDebug.Printf("PAD goto OCC8 , redirect %s to OCC8 !", PADChan)
|
|
|
- go RedirectInQueue(PADChan, "1481", "pad-page-occ-icp", Ext) //PAD Page(OCC+ICPs)
|
|
|
+ utils.LoggerDebug.Printf("PAD goto OCC8 , redirect %s to OCC8 !", PADChan)
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ } else { //列车断开模式下
|
|
|
+ if active.ActivedCab == "1" && ExtenStatus("1411") == "Idle" { //check active and OCC status
|
|
|
+
|
|
|
+ alstatus.AlarmStatus(event["CallerIDNum"], "connect")
|
|
|
+ go RedirectInQueue(event["Channel"], "1411", "pad-page-occ-icp", event["CallerIDNum"]) //PAD Page(OCC+ICPs)
|
|
|
+ go Dial("0401", "0512", "pad-rule-pacus-occ", "ano1", "ano1", "1") // PACUs dial OCC1
|
|
|
+
|
|
|
+ } else if active.ActivedCab == "8" && ExtenStatus("1481") == "Idle" {
|
|
|
+
|
|
|
+ alstatus.AlarmStatus(event["CallerIDNum"], "connect")
|
|
|
+ go RedirectInQueue(event["Channel"], "1481", "pad-page-occ-icp", event["CallerIDNum"]) //PAD Page(OCC+ICPs)
|
|
|
+ go Dial("0401", "0512", "pad-rule-pacus-occ", "ano8", "ano8", "8") // PACUs dial OCC8
|
|
|
}
|
|
|
- break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -549,9 +564,9 @@ func HandleAMI(event map[string]string) {
|
|
|
active.QueueTimer = time.AfterFunc(time.Duration(active.PADTimeout)*time.Second, func() { // check the PAD 30s timeout
|
|
|
//active.QueueTimer = time.AfterFunc(30*time.Second, func() { // check the PAD 30s timeout
|
|
|
//if both not active , return
|
|
|
- if active.ActivedCab == "" {
|
|
|
- return
|
|
|
- }
|
|
|
+ //if active.ActivedCab == "" {
|
|
|
+ // return
|
|
|
+ //}
|
|
|
|
|
|
res, err := QueueStatus("0301", "") // check OCC queue , if empty OCC-PAD start
|
|
|
if err != nil {
|
|
|
@@ -610,20 +625,20 @@ func HandleAMI(event map[string]string) {
|
|
|
|
|
|
time.Sleep(time.Millisecond * 300)
|
|
|
|
|
|
- //if active.TrainDevide == 0 { //列车没有断开
|
|
|
- if active.ActivedCab == "1" && ExtenStatus("1411") == "Idle" { //check active and OCC status
|
|
|
- utils.LoggerDebug.Printf("PAD %s goto OCC1 .", event["CallerIDNum"])
|
|
|
- alstatus.AlarmStatus(event["CallerIDNum"], "connect")
|
|
|
- go RedirectInQueue(event["Channel"], "1411", "pad-page-occ-icp", event["CallerIDNum"]) //PAD Page(OCC+ICPs)
|
|
|
- go Dial("0401", "0512", "pad-rule-pacus-occ", "ano1", "ano1", "1") // PACUs dial OCC1
|
|
|
-
|
|
|
- } else if active.ActivedCab == "8" && ExtenStatus("1481") == "Idle" {
|
|
|
- utils.LoggerDebug.Printf("PAD %s goto OCC8 .", event["CallerIDNum"])
|
|
|
- alstatus.AlarmStatus(event["CallerIDNum"], "connect")
|
|
|
- go RedirectInQueue(event["Channel"], "1481", "pad-page-occ-icp", event["CallerIDNum"]) //PAD Page(OCC+ICPs)
|
|
|
- go Dial("0401", "0512", "pad-rule-pacus-occ", "ano8", "ano8", "8") // PACUs dial OCC8
|
|
|
- }
|
|
|
- /*} else { //列车断开模式下
|
|
|
+ if active.TrainDevide == 0 { //列车没有断开
|
|
|
+ if (active.ActivedCab == "1" && ExtenStatus("1411") == "Idle") || (active.ActivedCab == "" && active.ActivedCabDelay == "1" && ExtenStatus("1411") == "Idle") { //check active and OCC status
|
|
|
+ utils.LoggerDebug.Printf("PAD %s goto OCC1 .", event["CallerIDNum"])
|
|
|
+ alstatus.AlarmStatus(event["CallerIDNum"], "connect")
|
|
|
+ go RedirectInQueue(event["Channel"], "1411", "pad-page-occ-icp", event["CallerIDNum"]) //PAD Page(OCC+ICPs)
|
|
|
+ go Dial("0401", "0512", "pad-rule-pacus-occ", "ano1", "ano1", "1") // PACUs dial OCC1
|
|
|
+
|
|
|
+ } else if (active.ActivedCab == "8" && ExtenStatus("1481") == "Idle") || (active.ActivedCab == "" && active.ActivedCabDelay == "8" && ExtenStatus("1481") == "Idle") {
|
|
|
+ utils.LoggerDebug.Printf("PAD %s goto OCC8 .", event["CallerIDNum"])
|
|
|
+ alstatus.AlarmStatus(event["CallerIDNum"], "connect")
|
|
|
+ go RedirectInQueue(event["Channel"], "1481", "pad-page-occ-icp", event["CallerIDNum"]) //PAD Page(OCC+ICPs)
|
|
|
+ go Dial("0401", "0512", "pad-rule-pacus-occ", "ano8", "ano8", "8") // PACUs dial OCC8
|
|
|
+ }
|
|
|
+ } else { //列车断开模式下
|
|
|
if active.ActivedCab == "1" && ExtenStatus("1411") == "Idle" { //check active and OCC status
|
|
|
|
|
|
alstatus.AlarmStatus(event["CallerIDNum"], "connect")
|
|
|
@@ -636,7 +651,8 @@ func HandleAMI(event map[string]string) {
|
|
|
go RedirectInQueue(event["Channel"], "1481", "pad-page-occ-icp", event["CallerIDNum"]) //PAD Page(OCC+ICPs)
|
|
|
go Dial("0401", "0512", "pad-rule-pacus-occ", "ano8", "ano8", "8") // PACUs dial OCC8
|
|
|
}
|
|
|
- }*/
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
lfshook.NewLogger().Infof("====PAD-OCC Priority false===")
|
|
|
}
|