|
|
@@ -103,26 +103,26 @@ func HandleAMI(event map[string]string) {
|
|
|
case "Hangup":
|
|
|
|
|
|
lfshook.NewLogger().Infof("=========%s", event["Event"])
|
|
|
- if utils.IsPAIU(event["CallerIDNum"]) && !strings.Contains(event["Channel"], "Local") { // PAD hangup , check if PAD all end
|
|
|
+ if utils.IsPAIU(event["CallerIDNum"]) && !strings.Contains(event["Channel"], "Local") { // PAD hangup, check if PAD all end, send PAD end status
|
|
|
|
|
|
res, _ := QueueStatus("0300", "") // check ICP queue ,if empty PAD end
|
|
|
if res.Calls == "0" {
|
|
|
- priority.CleanPriorityTag()
|
|
|
- HangupAllLocalChan()
|
|
|
+ //priority.CleanPriorityTag()
|
|
|
+ //HangupAllLocalChan()
|
|
|
if priority.PADStart == 1 {
|
|
|
alstatus.PaStatus(event["CallerIDNum"], "PAD", "end")
|
|
|
priority.PADStart = 0
|
|
|
}
|
|
|
- if priority.ResumeEmgPara.FileName != "" {
|
|
|
+ /*if priority.ResumeEmgPara.FileName != "" {
|
|
|
CheckEmgResume()
|
|
|
- }
|
|
|
+ }*/
|
|
|
//priority.ICPAnswer = 0
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//OCC answer PAD, hangup, redirect the next PAD to OCC
|
|
|
- if (event["CallerIDNum"] == "ano1" || event["CallerIDNum"] == "ano8") && utils.IsIO(event["ConnectedLineNum"]) {
|
|
|
+ if (event["CallerIDNum"] == "ano1" || event["CallerIDNum"] == "ano8") && utils.IsIO(event["ConnectedLineNum"]) && utils.IsPAIU(event["CallerIDName"]) {
|
|
|
HangupAllLocalChan()
|
|
|
res, _ := QueueStatus("0301", "") // check OCC queue ,if empty PAD end
|
|
|
if res.Calls == "0" { //OCC queue is empty
|
|
|
@@ -130,17 +130,21 @@ func HandleAMI(event map[string]string) {
|
|
|
alstatus.OccPad("end")
|
|
|
|
|
|
if priority.ResumeEmgPara.FileName != "" {
|
|
|
+ time.Sleep(time.Second)
|
|
|
CheckEmgResume()
|
|
|
}
|
|
|
|
|
|
break
|
|
|
} else { //OCC queue is not empty
|
|
|
HangupAllLocalChan()
|
|
|
+
|
|
|
if active.CabNum == "1" && active.Actived && ExtenStatus("1411") == "Idle" { //check active and OCC status
|
|
|
- Dial("0401", "0512", "pad-rule-pacus-occ", "ano1", event["CallerIDNum"], "1") // PACUs dial OCC1
|
|
|
+ time.Sleep(time.Second)
|
|
|
+ Dial("0401", "0512", "pad-rule-pacus-occ", "ano1", event["CallerIDName"], "1") // PACUs dial OCC1
|
|
|
//goto ConfbridgeJoin, OCC1 answer PAD
|
|
|
} else if active.CabNum == "8" && active.Actived && ExtenStatus("1481") == "Idle" {
|
|
|
- Dial("0401", "0512", "pad-rule-pacus-occ", "ano8", event["CallerIDNum"], "8") // PACUs dial OCC8
|
|
|
+ time.Sleep(time.Second)
|
|
|
+ Dial("0401", "0512", "pad-rule-pacus-occ", "ano8", event["CallerIDName"], "8") // PACUs dial OCC8
|
|
|
//goto ConfbridgeJoin, OCC8 answer PAD
|
|
|
}
|
|
|
}
|
|
|
@@ -314,25 +318,48 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
|
|
|
|
//OCC answer PAD;
|
|
|
- if event["ConnectedLineNum"] == "ano1" && event["Exten"] == "0512" { //PAD answered by OCC; PACUs connected IO1
|
|
|
+ if event["ConnectedLineNum"] == "ano1" && event["Exten"] == "0512" && utils.IsPAIU(event["ConnectedLineName"]) { //PAD answered by OCC; PACUs connected IO1
|
|
|
lfshook.NewLogger().Infof("====PAD answered by OCC1:%s=====", event["ConnectedLineName"])
|
|
|
alstatus.AlarmStatus(event["ConnectedLineName"], "connect")
|
|
|
priority.OCCAnswer = 1
|
|
|
priority.RunningPATaskChan = event["Channel"]
|
|
|
priority.RunningType = "PAD-OCC"
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.PADOCC)
|
|
|
- go RedirectInQueue(event["ConnectedLineName"], "1411", "chanspy-rule-whisper", event["ConnectedLineName"]) //PAD chanspy(EqW) IO1
|
|
|
+
|
|
|
+ res, err := QueueStatus("0301", "") // check OCC queue , if empty OCC-PAD start
|
|
|
+ if err != nil {
|
|
|
+ lfshook.NewLogger().Infof("===OCC-QueueStatus==%+v", err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ PADChan := res.Entrys[0].Channel
|
|
|
+ if PADChan != "" {
|
|
|
+ go RedirectInQueue(PADChan, "1411", "chanspy-rule-whisper", event["ConnectedLineName"]) //PAD chanspy(EqW) IO1
|
|
|
+ } else {
|
|
|
+ lfshook.NewLogger().Infof("===OCC-QueueStatus==PADCchan NULL")
|
|
|
+ }
|
|
|
//goto event=ChanSpyStart; ICPs spy PAD
|
|
|
break
|
|
|
}
|
|
|
- if event["ConnectedLineNum"] == "ano8" && event["Exten"] == "0512" { //PAD ansered by OCC8; PACUs connected IO8
|
|
|
+ if event["ConnectedLineNum"] == "ano8" && event["Exten"] == "0512" && utils.IsPAIU(event["ConnectedLineName"]) { //PAD ansered by OCC8; PACUs connected IO8
|
|
|
lfshook.NewLogger().Infof("====PAD answered by OCC8:%s=====", event["ConnectedLineName"])
|
|
|
alstatus.AlarmStatus(event["ConnectedLineName"], "connect")
|
|
|
priority.OCCAnswer = 1
|
|
|
priority.RunningPATaskChan = event["Channel"]
|
|
|
priority.RunningType = "PAD-OCC"
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.PADOCC)
|
|
|
- go RedirectInQueue(event["ConnectedLineName"], "1481", "chanspy-rule-whisper", event["ConnectedLineName"]) //PAD chanspy(EqW) IO8
|
|
|
+
|
|
|
+ res, err := QueueStatus("0301", "") // check OCC queue , if empty OCC-PAD start
|
|
|
+ if err != nil {
|
|
|
+ lfshook.NewLogger().Infof("===OCC-QueueStatus==%+v", err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ PADChan := res.Entrys[0].Channel
|
|
|
+
|
|
|
+ if PADChan != "" {
|
|
|
+ go RedirectInQueue(PADChan, "1481", "chanspy-rule-whisper", event["ConnectedLineName"]) //PAD chanspy(EqW) IO8
|
|
|
+ } else {
|
|
|
+ lfshook.NewLogger().Infof("===OCC-QueueStatus==PADCchan NULL")
|
|
|
+ }
|
|
|
//goto event=ChanSpyStart; ICPs spy PAD
|
|
|
break
|
|
|
}
|