|
@@ -10,7 +10,6 @@ import (
|
|
|
"pbx-api-gin/internal/pkg/configs"
|
|
"pbx-api-gin/internal/pkg/configs"
|
|
|
"pbx-api-gin/pkg/lfshook"
|
|
"pbx-api-gin/pkg/lfshook"
|
|
|
"pbx-api-gin/pkg/utils"
|
|
"pbx-api-gin/pkg/utils"
|
|
|
- "sort"
|
|
|
|
|
"strings"
|
|
"strings"
|
|
|
"time"
|
|
"time"
|
|
|
|
|
|
|
@@ -29,7 +28,7 @@ func HandleAMI(event map[string]string) {
|
|
|
case "DTMFBegin": //ICP interrupt PAD
|
|
case "DTMFBegin": //ICP interrupt PAD
|
|
|
lfshook.NewLogger().Infof("=========%s====caller:%s=====digit:%s==", event["Event"], event["CallerIDNum"], event["Digit"])
|
|
lfshook.NewLogger().Infof("=========%s====caller:%s=====digit:%s==", event["Event"], event["CallerIDNum"], event["Digit"])
|
|
|
|
|
|
|
|
- if utils.IsICP(event["CallerIDNum"]) && event["Exten"] != "" {
|
|
|
|
|
|
|
+ if utils.IsICP(event["CallerIDNum"]) && event["Exten"] != "" && event["Direction"] == "Received" {
|
|
|
|
|
|
|
|
//PA interrupt PAD
|
|
//PA interrupt PAD
|
|
|
switch event["Digit"] {
|
|
switch event["Digit"] {
|
|
@@ -68,6 +67,8 @@ func HandleAMI(event map[string]string) {
|
|
|
if event["UserEvent"] == "CallType" && (event["Type"] == "PA" || event["Type"] == "CPA") { //PA start; check manual PA priority
|
|
if event["UserEvent"] == "CallType" && (event["Type"] == "PA" || event["Type"] == "CPA") { //PA start; check manual PA priority
|
|
|
//PA & CPA interrupt others
|
|
//PA & CPA interrupt others
|
|
|
if utils.IsICP(event["CallerIDNum"]) { //PA
|
|
if utils.IsICP(event["CallerIDNum"]) { //PA
|
|
|
|
|
+ //清除标记
|
|
|
|
|
+
|
|
|
utils.LoggerDebug.Printf("Get UserEvent , %s calling !", event["Type"])
|
|
utils.LoggerDebug.Printf("Get UserEvent , %s calling !", event["Type"])
|
|
|
if active.ActivedCab == "" { //No active Signal on both side,Hangup caller
|
|
if active.ActivedCab == "" { //No active Signal on both side,Hangup caller
|
|
|
Hangup(event["CallerIDNum"])
|
|
Hangup(event["CallerIDNum"])
|
|
@@ -86,6 +87,10 @@ func HandleAMI(event map[string]string) {
|
|
|
time.Sleep(time.Millisecond * 100) //wait endpoint release
|
|
time.Sleep(time.Millisecond * 100) //wait endpoint release
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if priority.TaskCreating == "PA" {
|
|
|
|
|
+ utils.LoggerDebug.Printf("PA : Clean priority.TaskCreating = '' !")
|
|
|
|
|
+ priority.TaskCreating = ""
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
if priority.TaskCreating == "PA" {
|
|
if priority.TaskCreating == "PA" {
|
|
|
utils.LoggerDebug.Printf("PA : Clean priority.TaskCreating = '' !")
|
|
utils.LoggerDebug.Printf("PA : Clean priority.TaskCreating = '' !")
|
|
@@ -96,12 +101,17 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
time.Sleep(1 * time.Second)
|
|
time.Sleep(1 * time.Second)
|
|
|
- if priority.TaskCreating == "PA" {
|
|
|
|
|
- utils.LoggerDebug.Printf("PA : Clean priority.TaskCreating = '' !")
|
|
|
|
|
- priority.TaskCreating = ""
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ priority.PAInterrupt = 0
|
|
|
} else if utils.IsIO(event["CallerIDNum"]) { // CPA
|
|
} else if utils.IsIO(event["CallerIDNum"]) { // CPA
|
|
|
|
|
|
|
|
|
|
+ priority.CPAActived = 1 //CPA触发
|
|
|
|
|
+ if /* priority.CABInterrupt == 1 || */ priority.PAInterrupt == 1 {
|
|
|
|
|
+ utils.LoggerDebug.Printf("Get UserEvent CPA calling ! Ignored because of PAInterrupt=1 !")
|
|
|
|
|
+ Hangup(event["CallerIDNum"])
|
|
|
|
|
+ priority.CPAActived = 0
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
utils.LoggerDebug.Printf("Get UserEvent , %s calling !", event["Type"])
|
|
utils.LoggerDebug.Printf("Get UserEvent , %s calling !", event["Type"])
|
|
|
WaitTaskCreate("CPA", event["CallerIDNum"])
|
|
WaitTaskCreate("CPA", event["CallerIDNum"])
|
|
|
|
|
|
|
@@ -116,6 +126,7 @@ func HandleAMI(event map[string]string) {
|
|
|
utils.LoggerDebug.Printf("CPA calling , ActivedCab = %s !", active.ActivedCab)
|
|
utils.LoggerDebug.Printf("CPA calling , ActivedCab = %s !", active.ActivedCab)
|
|
|
if active.ActivedCab == "" { //No active Signal on both side,Hangup caller
|
|
if active.ActivedCab == "" { //No active Signal on both side,Hangup caller
|
|
|
Hangup(event["CallerIDNum"])
|
|
Hangup(event["CallerIDNum"])
|
|
|
|
|
+ priority.CPAActived = 0
|
|
|
if priority.TaskCreating == "CPA" {
|
|
if priority.TaskCreating == "CPA" {
|
|
|
utils.LoggerDebug.Printf("CPA : Clean priority.TaskCreating = '' !")
|
|
utils.LoggerDebug.Printf("CPA : Clean priority.TaskCreating = '' !")
|
|
|
priority.TaskCreating = ""
|
|
priority.TaskCreating = ""
|
|
@@ -123,6 +134,7 @@ func HandleAMI(event map[string]string) {
|
|
|
return
|
|
return
|
|
|
} else if active.ActivedCab == "1" && event["CallerIDNum"] == "1411" {
|
|
} else if active.ActivedCab == "1" && event["CallerIDNum"] == "1411" {
|
|
|
Hangup(event["CallerIDNum"])
|
|
Hangup(event["CallerIDNum"])
|
|
|
|
|
+ priority.CPAActived = 0
|
|
|
if priority.TaskCreating == "CPA" {
|
|
if priority.TaskCreating == "CPA" {
|
|
|
utils.LoggerDebug.Printf("CPA : Clean priority.TaskCreating = '' !")
|
|
utils.LoggerDebug.Printf("CPA : Clean priority.TaskCreating = '' !")
|
|
|
priority.TaskCreating = ""
|
|
priority.TaskCreating = ""
|
|
@@ -130,6 +142,7 @@ func HandleAMI(event map[string]string) {
|
|
|
return
|
|
return
|
|
|
} else if active.ActivedCab == "8" && event["CallerIDNum"] == "1481" {
|
|
} else if active.ActivedCab == "8" && event["CallerIDNum"] == "1481" {
|
|
|
Hangup(event["CallerIDNum"])
|
|
Hangup(event["CallerIDNum"])
|
|
|
|
|
+ priority.CPAActived = 0
|
|
|
if priority.TaskCreating == "CPA" {
|
|
if priority.TaskCreating == "CPA" {
|
|
|
utils.LoggerDebug.Printf("CPA : Clean priority.TaskCreating = '' !")
|
|
utils.LoggerDebug.Printf("CPA : Clean priority.TaskCreating = '' !")
|
|
|
priority.TaskCreating = ""
|
|
priority.TaskCreating = ""
|
|
@@ -138,11 +151,25 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //hangup others if priority is higher
|
|
|
|
|
- runningTaskName := InterruptRunningTask("CPA") //CPA interrupt other
|
|
|
|
|
- if runningTaskName != "" {
|
|
|
|
|
- time.Sleep(time.Millisecond * 100) //wait endpoint release
|
|
|
|
|
|
|
+ //CPA 发起之前检查是否有更高优先级任务在运行,有则不发起CPA
|
|
|
|
|
+ taskName, task, _ := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
|
|
+ if len(taskName) > 0 && task.Priority < priority.AllTasks.CPA.Priority {
|
|
|
|
|
+ utils.LoggerDebug.Printf("CPA : other task running , return !")
|
|
|
|
|
+ Hangup(event["CallerIDNum"])
|
|
|
|
|
+ priority.CPAActived = 0
|
|
|
|
|
+ if priority.TaskCreating == "CPA" {
|
|
|
|
|
+ utils.LoggerDebug.Printf("CPA : Clean priority.TaskCreating = '' !")
|
|
|
|
|
+ priority.TaskCreating = ""
|
|
|
|
|
+ }
|
|
|
|
|
+ return
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //hangup others if priority is higher
|
|
|
|
|
+ runningTaskName := InterruptRunningTask("CPA") //CPA interrupt other
|
|
|
|
|
+ if runningTaskName != "" {
|
|
|
|
|
+ time.Sleep(time.Millisecond * 100) //wait endpoint release
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
} else {
|
|
} else {
|
|
|
if priority.TaskCreating == "CPA" {
|
|
if priority.TaskCreating == "CPA" {
|
|
|
utils.LoggerDebug.Printf("CPA : Clean priority.TaskCreating = '' !")
|
|
utils.LoggerDebug.Printf("CPA : Clean priority.TaskCreating = '' !")
|
|
@@ -150,6 +177,7 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
utils.LoggerDebug.Printf("CPA calling failed , check priority return false !")
|
|
utils.LoggerDebug.Printf("CPA calling failed , check priority return false !")
|
|
|
Hangup(event["CallerIDNum"]) //lowwer priority ,hangup caller
|
|
Hangup(event["CallerIDNum"]) //lowwer priority ,hangup caller
|
|
|
|
|
+ priority.CPAActived = 0 //CPA触发,但未运行
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
time.Sleep(1 * time.Second)
|
|
time.Sleep(1 * time.Second)
|
|
@@ -160,7 +188,7 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
} else if event["UserEvent"] == "CallType" && event["Type"] == "C2C" { //CabCab start; check cab cab priority
|
|
} else if event["UserEvent"] == "CallType" && event["Type"] == "C2C" { //CabCab start; check cab cab priority
|
|
|
utils.LoggerDebug.Printf("Get UserEvent , %s calling !", event["Type"])
|
|
utils.LoggerDebug.Printf("Get UserEvent , %s calling !", event["Type"])
|
|
|
- priority.CABInterrupt = 0
|
|
|
|
|
|
|
+
|
|
|
WaitTaskCreate("C2C", event["CallerIDNum"])
|
|
WaitTaskCreate("C2C", event["CallerIDNum"])
|
|
|
|
|
|
|
|
if priority.CheckPriority("CabCab") { // interrupt OCC-PAD
|
|
if priority.CheckPriority("CabCab") { // interrupt OCC-PAD
|
|
@@ -188,6 +216,8 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
//}
|
|
//}
|
|
|
}
|
|
}
|
|
|
|
|
+ time.Sleep(time.Second * 1)
|
|
|
|
|
+ priority.CABInterrupt = 0
|
|
|
|
|
|
|
|
} else { // hangup caller; C2C start failed
|
|
} else { // hangup caller; C2C start failed
|
|
|
//lfshook.NewLogger().Infof("CabCab hangup caller %s", event["CallerIDNum"])
|
|
//lfshook.NewLogger().Infof("CabCab hangup caller %s", event["CallerIDNum"])
|
|
@@ -362,15 +392,15 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RegistryTask.StopAndUnregister("PAD-OCC")
|
|
priority.RegistryTask.StopAndUnregister("PAD-OCC")
|
|
|
ConfbridgeKick(taskTmp.ConfbridgeID, "all")
|
|
ConfbridgeKick(taskTmp.ConfbridgeID, "all")
|
|
|
|
|
|
|
|
|
|
+ time.Sleep(time.Millisecond * 350) //wait CPA Active
|
|
|
|
|
+
|
|
|
//check resume
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
if ok {
|
|
|
if taskName == "EMG" {
|
|
if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
|
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
} else if taskName == "CPA" {
|
|
} else if taskName == "CPA" {
|
|
|
- if CPAConfbridgeReinvite(task.ConfbridgeID) {
|
|
|
|
|
- alstatus.PaStatus("", "CPA", "start")
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -387,7 +417,7 @@ func HandleAMI(event map[string]string) {
|
|
|
//time.Sleep(time.Millisecond * 100) //wait io idle
|
|
//time.Sleep(time.Millisecond * 100) //wait io idle
|
|
|
//lfshook.NewLogger().Infof("====Start OCC-PAD===next==%+v", res)
|
|
//lfshook.NewLogger().Infof("====Start OCC-PAD===next==%+v", res)
|
|
|
if active.TrainDevide == 0 { //列车没有断开
|
|
if active.TrainDevide == 0 { //列车没有断开
|
|
|
- if (active.ActivedCab == "1" && ExtenStatus("1411") == "Idle") || (active.ActivedCab == "" && active.ActivedCabDelay == "1" && ExtenStatus("1411") == "Idle") { //check active and OCC status
|
|
|
|
|
|
|
+ if (ExtenStatus("1411") == "Idle") && ((active.ActivedCab == "1" || (active.ActivedCab == "" && active.ActivedCabDelay == "1")) || (active.ActivedCab == "" && active.ActivedCabDelay == "")) { //check active and OCC status
|
|
|
time.Sleep(time.Second)
|
|
time.Sleep(time.Second)
|
|
|
PADChan := ""
|
|
PADChan := ""
|
|
|
|
|
|
|
@@ -463,7 +493,7 @@ func HandleAMI(event map[string]string) {
|
|
|
|
|
|
|
|
if utils.IsPAIU(event["CallerIDNum"]) { // PAD hangup, check if PAD all end, send PAD end status
|
|
if utils.IsPAIU(event["CallerIDNum"]) { // PAD hangup, check if PAD all end, send PAD end status
|
|
|
|
|
|
|
|
- utils.LoggerDebug.Printf("===event:=====%+v======", event)
|
|
|
|
|
|
|
+ //utils.LoggerDebug.Printf("===event:=====%+v======", event)
|
|
|
number := strings.Split(strings.Split(event["Channel"], "-")[0], "/")[1]
|
|
number := strings.Split(strings.Split(event["Channel"], "-")[0], "/")[1]
|
|
|
|
|
|
|
|
//lfshook.NewLogger().Infof("===hangup PAD ===NUM:%s=================listAllTask:%+v===", number, priority.RegistryTask.ListAll())
|
|
//lfshook.NewLogger().Infof("===hangup PAD ===NUM:%s=================listAllTask:%+v===", number, priority.RegistryTask.ListAll())
|
|
@@ -487,6 +517,7 @@ func HandleAMI(event map[string]string) {
|
|
|
|
|
|
|
|
if event["Context"] == "chanspy-rule-whisper" {
|
|
if event["Context"] == "chanspy-rule-whisper" {
|
|
|
alstatus.PaStatus("", "PAD", "end")
|
|
alstatus.PaStatus("", "PAD", "end")
|
|
|
|
|
+ utils.LoggerDebug.Printf("Check PAD-ICP queue chanspy-rule-whisper !")
|
|
|
|
|
|
|
|
res, _ := QueueStatus("0301", "") // check ICP queue ,if empty PAD end
|
|
res, _ := QueueStatus("0301", "") // check ICP queue ,if empty PAD end
|
|
|
if res == nil {
|
|
if res == nil {
|
|
@@ -500,16 +531,15 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if priority.OCCAnswer == 0 { // not OCC-PAD
|
|
if priority.OCCAnswer == 0 { // not OCC-PAD
|
|
|
|
|
+ time.Sleep(time.Millisecond * 350) //wait CPA Active
|
|
|
|
|
+ utils.LoggerDebug.Printf("======================================")
|
|
|
//check resume
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
if ok {
|
|
|
if taskName == "EMG" {
|
|
if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
|
|
- //alstatus.PaStatus("", "EMG", "start")
|
|
|
|
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
} else if taskName == "CPA" {
|
|
} else if taskName == "CPA" {
|
|
|
- if CPAConfbridgeReinvite(task.ConfbridgeID) {
|
|
|
|
|
- alstatus.PaStatus("", "CPA", "start")
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -531,16 +561,21 @@ func HandleAMI(event map[string]string) {
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
if ok {
|
|
|
if taskName == "EMG" {
|
|
if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
|
|
- //alstatus.PaStatus("", "EMG", "start")
|
|
|
|
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
} else if taskName == "CPA" {
|
|
} else if taskName == "CPA" {
|
|
|
- if CPAConfbridgeReinvite(task.ConfbridgeID) {
|
|
|
|
|
- alstatus.PaStatus("", "CPA", "start")
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if utils.IsICP(event["CallerIDNum"]) && event["Exten"] == "h" && event["ConnectedLineNum"] == "<unknown>" {
|
|
|
|
|
+ utils.LoggerDebug.Printf("CABCAB Canceled by ICP !")
|
|
|
|
|
+
|
|
|
|
|
+ if priority.TaskCreating == "C2C" {
|
|
|
|
|
+ utils.LoggerDebug.Printf("C2C : Clean priority.TaskCreating = '' !")
|
|
|
|
|
+ priority.TaskCreating = ""
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
case "QueueCallerJoin":
|
|
case "QueueCallerJoin":
|
|
|
lfshook.NewLogger().Infof("=========%s", event["Event"])
|
|
lfshook.NewLogger().Infof("=========%s", event["Event"])
|
|
|
|
|
|
|
@@ -602,7 +637,7 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if res.Calls == "0" { // OCC queue empty
|
|
if res.Calls == "0" { // OCC queue empty
|
|
|
- resCaller, err := QueueStatus("0300", "") // check ICP queue, get entries
|
|
|
|
|
|
|
+ /*resCaller, err := QueueStatus("0300", "") // check ICP queue, get entries
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
lfshook.NewLogger().Infof("ICP QueueStatus err:%+v", err)
|
|
lfshook.NewLogger().Infof("ICP QueueStatus err:%+v", err)
|
|
|
return
|
|
return
|
|
@@ -622,6 +657,13 @@ func HandleAMI(event map[string]string) {
|
|
|
RedirectInQueue(caller.CallerIDNum, "0301", "queues-occ", caller.CallerIDNum) // redirect All ICP-PAD redirect to OCC queue
|
|
RedirectInQueue(caller.CallerIDNum, "0301", "queues-occ", caller.CallerIDNum) // redirect All ICP-PAD redirect to OCC queue
|
|
|
time.Sleep(time.Millisecond * 100) //200 ms delay
|
|
time.Sleep(time.Millisecond * 100) //200 ms delay
|
|
|
}
|
|
}
|
|
|
|
|
+ }*/
|
|
|
|
|
+
|
|
|
|
|
+ for _, ret := range alstatus.PadQueues {
|
|
|
|
|
+ priority.ICPAnswer = 0
|
|
|
|
|
+ //order by pos
|
|
|
|
|
+ RedirectInQueue(ret.Exten, "0301", "queues-occ", ret.Exten) // redirect All ICP-PAD redirect to OCC queue
|
|
|
|
|
+ time.Sleep(time.Millisecond * 100)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -650,7 +692,7 @@ func HandleAMI(event map[string]string) {
|
|
|
time.Sleep(time.Millisecond * 300)
|
|
time.Sleep(time.Millisecond * 300)
|
|
|
|
|
|
|
|
if active.TrainDevide == 0 { //列车没有断开
|
|
if active.TrainDevide == 0 { //列车没有断开
|
|
|
- if (active.ActivedCab == "1" && ExtenStatus("1411") == "Idle") || (active.ActivedCab == "" && active.ActivedCabDelay == "1" && ExtenStatus("1411") == "Idle") { //check active and OCC status
|
|
|
|
|
|
|
+ if (ExtenStatus("1411") == "Idle") && ((active.ActivedCab == "1" || (active.ActivedCab == "" && active.ActivedCabDelay == "1")) || (active.ActivedCab == "" && active.ActivedCabDelay == "")) { //check active and OCC status
|
|
|
utils.LoggerDebug.Printf("PAD %s goto OCC1 .", event["CallerIDNum"])
|
|
utils.LoggerDebug.Printf("PAD %s goto OCC1 .", event["CallerIDNum"])
|
|
|
alstatus.AlarmStatus(event["CallerIDNum"], "connect")
|
|
alstatus.AlarmStatus(event["CallerIDNum"], "connect")
|
|
|
go RedirectInQueue(event["Channel"], "1411", "pad-page-occ-icp", event["CallerIDNum"]) //PAD Page(OCC+ICPs)
|
|
go RedirectInQueue(event["Channel"], "1411", "pad-page-occ-icp", event["CallerIDNum"]) //PAD Page(OCC+ICPs)
|
|
@@ -901,8 +943,8 @@ func HandleAMI(event map[string]string) {
|
|
|
*/
|
|
*/
|
|
|
//Send PA start msg to STC
|
|
//Send PA start msg to STC
|
|
|
if utils.IsICP(event["CallerIDNum"]) && event["Exten"] == "0500" { // PA start
|
|
if utils.IsICP(event["CallerIDNum"]) && event["Exten"] == "0500" { // PA start
|
|
|
|
|
+ priority.PAInterrupt = 0
|
|
|
|
|
|
|
|
- alstatus.PaStatus(event["CallerIDNum"], "PA", "start")
|
|
|
|
|
//================================
|
|
//================================
|
|
|
task := priority.TaskInfo{
|
|
task := priority.TaskInfo{
|
|
|
RunChannel: event["Channel"],
|
|
RunChannel: event["Channel"],
|
|
@@ -920,7 +962,6 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.TaskCreating = ""
|
|
priority.TaskCreating = ""
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- priority.PAInterrupt = 0 //清除标记
|
|
|
|
|
//check PAD timer
|
|
//check PAD timer
|
|
|
if priority.AllTasks.PADOCC.Priority > priority.AllTasks.PA.Priority {
|
|
if priority.AllTasks.PADOCC.Priority > priority.AllTasks.PA.Priority {
|
|
|
if active.QueueTimer != nil {
|
|
if active.QueueTimer != nil {
|
|
@@ -931,6 +972,7 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ alstatus.PaStatus(event["CallerIDNum"], "PA", "start")
|
|
|
|
|
|
|
|
break
|
|
break
|
|
|
} else if utils.IsIO(event["CallerIDNum"]) && event["Exten"] == "0501" { //CPA start
|
|
} else if utils.IsIO(event["CallerIDNum"]) && event["Exten"] == "0501" { //CPA start
|
|
@@ -945,10 +987,11 @@ func HandleAMI(event map[string]string) {
|
|
|
ConfbridgeID: event["Conference"],
|
|
ConfbridgeID: event["Conference"],
|
|
|
Running: true,
|
|
Running: true,
|
|
|
}
|
|
}
|
|
|
|
|
+ priority.CPAActived = 0
|
|
|
utils.LoggerDebug.Printf("CPA Runing , Set CPA task info %+v .", task)
|
|
utils.LoggerDebug.Printf("CPA Runing , Set CPA task info %+v .", task)
|
|
|
priority.RegistryTask.Register("CPA", task)
|
|
priority.RegistryTask.Register("CPA", task)
|
|
|
|
|
|
|
|
- utils.LoggerDebug.Printf("CPA Runing , Set CPA task info %+v .", priority.RegistryTask.ListAll())
|
|
|
|
|
|
|
+ //utils.LoggerDebug.Printf("CPA Runing , Set CPA task info %+v .", priority.RegistryTask.ListAll())
|
|
|
|
|
|
|
|
if priority.TaskCreating == "CPA" {
|
|
if priority.TaskCreating == "CPA" {
|
|
|
utils.LoggerDebug.Printf("CPA Connected : Clean priority.TaskCreating = '' !")
|
|
utils.LoggerDebug.Printf("CPA Connected : Clean priority.TaskCreating = '' !")
|
|
@@ -985,6 +1028,8 @@ func HandleAMI(event map[string]string) {
|
|
|
Running: true,
|
|
Running: true,
|
|
|
}
|
|
}
|
|
|
priority.RegistryTask.Register("PAD-ICP", task)
|
|
priority.RegistryTask.Register("PAD-ICP", task)
|
|
|
|
|
+
|
|
|
|
|
+ alstatus.PaStatus("", "PAD", "start")
|
|
|
if priority.TaskCreating == "PAD-ICP" {
|
|
if priority.TaskCreating == "PAD-ICP" {
|
|
|
utils.LoggerDebug.Printf("PAD-ICP Connected : Clean priority.TaskCreating = '' !")
|
|
utils.LoggerDebug.Printf("PAD-ICP Connected : Clean priority.TaskCreating = '' !")
|
|
|
priority.TaskCreating = ""
|
|
priority.TaskCreating = ""
|
|
@@ -1011,6 +1056,8 @@ func HandleAMI(event map[string]string) {
|
|
|
Running: true,
|
|
Running: true,
|
|
|
}
|
|
}
|
|
|
priority.RegistryTask.Register("PAD-ICP", task)
|
|
priority.RegistryTask.Register("PAD-ICP", task)
|
|
|
|
|
+
|
|
|
|
|
+ alstatus.PaStatus("", "PAD", "start")
|
|
|
if priority.TaskCreating == "PAD-ICP" {
|
|
if priority.TaskCreating == "PAD-ICP" {
|
|
|
utils.LoggerDebug.Printf("PAD-ICP Connected : Clean priority.TaskCreating = '' !")
|
|
utils.LoggerDebug.Printf("PAD-ICP Connected : Clean priority.TaskCreating = '' !")
|
|
|
priority.TaskCreating = ""
|
|
priority.TaskCreating = ""
|
|
@@ -1050,41 +1097,44 @@ func HandleAMI(event map[string]string) {
|
|
|
case "ConfbridgeLeave":
|
|
case "ConfbridgeLeave":
|
|
|
lfshook.NewLogger().Infof("=========%s", event["Event"])
|
|
lfshook.NewLogger().Infof("=========%s", event["Event"])
|
|
|
if utils.IsICP(event["CallerIDNum"]) && event["Exten"] == "0500" { // PA end
|
|
if utils.IsICP(event["CallerIDNum"]) && event["Exten"] == "0500" { // PA end
|
|
|
-
|
|
|
|
|
alstatus.PaStatus(event["CallerIDNum"], "PA", "end")
|
|
alstatus.PaStatus(event["CallerIDNum"], "PA", "end")
|
|
|
|
|
|
|
|
priority.RegistryTask.StopAndUnregister("PA")
|
|
priority.RegistryTask.StopAndUnregister("PA")
|
|
|
SetPadTimer()
|
|
SetPadTimer()
|
|
|
|
|
+
|
|
|
|
|
+ time.Sleep(time.Millisecond * 350) //wait CPA Active
|
|
|
// check resume
|
|
// check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
if ok {
|
|
|
if taskName == "EMG" {
|
|
if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
|
|
- //alstatus.PaStatus("", "EMG", "start")
|
|
|
|
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
} else if taskName == "CPA" {
|
|
} else if taskName == "CPA" {
|
|
|
- if CPAConfbridgeReinvite(task.ConfbridgeID) {
|
|
|
|
|
- alstatus.PaStatus("", "CPA", "start")
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} else if utils.IsIO(event["CallerIDNum"]) && event["Exten"] == "0501" { //CPA end
|
|
} else if utils.IsIO(event["CallerIDNum"]) && event["Exten"] == "0501" { //CPA end
|
|
|
|
|
|
|
|
- alstatus.PaStatus(event["CallerIDNum"], "CPA", "end")
|
|
|
|
|
-
|
|
|
|
|
//CPA
|
|
//CPA
|
|
|
taskTmp, ok := priority.RegistryTask.Get("CPA")
|
|
taskTmp, ok := priority.RegistryTask.Get("CPA")
|
|
|
if ok {
|
|
if ok {
|
|
|
ConfbridgeKick(taskTmp.ConfbridgeID, "all")
|
|
ConfbridgeKick(taskTmp.ConfbridgeID, "all")
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ //已经被打断的CPA不会重复发送end
|
|
|
|
|
+ if taskTmp.Running {
|
|
|
|
|
+ alstatus.PaStatus(event["CallerIDNum"], "CPA", "end")
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
priority.RegistryTask.StopAndUnregister("CPA")
|
|
priority.RegistryTask.StopAndUnregister("CPA")
|
|
|
SetPadTimer()
|
|
SetPadTimer()
|
|
|
|
|
+
|
|
|
|
|
+ time.Sleep(time.Millisecond * 350) //wait CPA Active
|
|
|
//check resume
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
if ok {
|
|
|
if taskName == "EMG" {
|
|
if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
|
|
- //alstatus.PaStatus("", "EMG", "start")
|
|
|
|
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1100,13 +1150,13 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
priority.RegistryTask.StopAndUnregister("EMG")
|
|
priority.RegistryTask.StopAndUnregister("EMG")
|
|
|
SetPadTimer()
|
|
SetPadTimer()
|
|
|
|
|
+
|
|
|
|
|
+ time.Sleep(time.Millisecond * 350) //wait CPA Active
|
|
|
//check resume
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
if ok {
|
|
|
if taskName == "CPA" {
|
|
if taskName == "CPA" {
|
|
|
- if CPAConfbridgeReinvite(task.ConfbridgeID) {
|
|
|
|
|
- alstatus.PaStatus("", "CPA", "start")
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1121,16 +1171,15 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
priority.RegistryTask.StopAndUnregister("STN")
|
|
priority.RegistryTask.StopAndUnregister("STN")
|
|
|
SetPadTimer()
|
|
SetPadTimer()
|
|
|
|
|
+
|
|
|
|
|
+ time.Sleep(time.Millisecond * 350) //wait CPA Active
|
|
|
//check resume
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
if ok {
|
|
|
if taskName == "CPA" {
|
|
if taskName == "CPA" {
|
|
|
- if CPAConfbridgeReinvite(task.ConfbridgeID) {
|
|
|
|
|
- alstatus.PaStatus("", "CPA", "start")
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
} else if taskName == "EMG" {
|
|
} else if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
|
|
- //alstatus.PaStatus("", "EMG", "start")
|
|
|
|
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1145,16 +1194,15 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
priority.RegistryTask.StopAndUnregister("DCS")
|
|
priority.RegistryTask.StopAndUnregister("DCS")
|
|
|
SetPadTimer()
|
|
SetPadTimer()
|
|
|
|
|
+
|
|
|
|
|
+ time.Sleep(time.Millisecond * 350) //wait CPA Active
|
|
|
//check resume
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
if ok {
|
|
|
if taskName == "CPA" {
|
|
if taskName == "CPA" {
|
|
|
- if CPAConfbridgeReinvite(task.ConfbridgeID) {
|
|
|
|
|
- alstatus.PaStatus("", "CPA", "start")
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
} else if taskName == "EMG" {
|
|
} else if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
|
|
- //alstatus.PaStatus("", "EMG", "start")
|
|
|
|
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1169,16 +1217,15 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
priority.RegistryTask.StopAndUnregister("SPC")
|
|
priority.RegistryTask.StopAndUnregister("SPC")
|
|
|
SetPadTimer()
|
|
SetPadTimer()
|
|
|
|
|
+
|
|
|
|
|
+ time.Sleep(time.Millisecond * 350) //wait CPA Active
|
|
|
//check resume
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
if ok {
|
|
|
if taskName == "CPA" {
|
|
if taskName == "CPA" {
|
|
|
- if CPAConfbridgeReinvite(task.ConfbridgeID) {
|
|
|
|
|
- alstatus.PaStatus("", "CPA", "start")
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
} else if taskName == "EMG" {
|
|
} else if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
|
|
- //alstatus.PaStatus("", "EMG", "start")
|
|
|
|
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1193,16 +1240,15 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
priority.RegistryTask.StopAndUnregister("CHK")
|
|
priority.RegistryTask.StopAndUnregister("CHK")
|
|
|
SetPadTimer()
|
|
SetPadTimer()
|
|
|
|
|
+
|
|
|
|
|
+ time.Sleep(time.Millisecond * 350) //wait CPA Active
|
|
|
//check resume
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
if ok {
|
|
|
if taskName == "CPA" {
|
|
if taskName == "CPA" {
|
|
|
- if CPAConfbridgeReinvite(task.ConfbridgeID) {
|
|
|
|
|
- alstatus.PaStatus("", "CPA", "start")
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
} else if taskName == "EMG" {
|
|
} else if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
|
|
- //alstatus.PaStatus("", "EMG", "start")
|
|
|
|
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1217,16 +1263,15 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
priority.RegistryTask.StopAndUnregister("VOL")
|
|
priority.RegistryTask.StopAndUnregister("VOL")
|
|
|
SetPadTimer()
|
|
SetPadTimer()
|
|
|
|
|
+
|
|
|
|
|
+ time.Sleep(time.Millisecond * 350) //wait CPA Active
|
|
|
//check resume
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
if ok {
|
|
|
if taskName == "CPA" {
|
|
if taskName == "CPA" {
|
|
|
- if CPAConfbridgeReinvite(task.ConfbridgeID) {
|
|
|
|
|
- alstatus.PaStatus("", "CPA", "start")
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
} else if taskName == "EMG" {
|
|
} else if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
|
|
- //alstatus.PaStatus("", "EMG", "start")
|
|
|
|
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1246,6 +1291,7 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
priority.RegistryTask.Register("C2C", task)
|
|
priority.RegistryTask.Register("C2C", task)
|
|
|
|
|
+ priority.CABInterrupt = 0
|
|
|
alstatus.PaStatus(event["CallerIDNum"], "C2C", "start")
|
|
alstatus.PaStatus(event["CallerIDNum"], "C2C", "start")
|
|
|
if priority.TaskCreating == "C2C" {
|
|
if priority.TaskCreating == "C2C" {
|
|
|
utils.LoggerDebug.Printf("C2C Connected : Clean priority.TaskCreating = '' !")
|
|
utils.LoggerDebug.Printf("C2C Connected : Clean priority.TaskCreating = '' !")
|
|
@@ -1291,6 +1337,8 @@ func HandleAMI(event map[string]string) {
|
|
|
Running: true,
|
|
Running: true,
|
|
|
}
|
|
}
|
|
|
priority.RegistryTask.Register("PAD-TMS", task)
|
|
priority.RegistryTask.Register("PAD-TMS", task)
|
|
|
|
|
+
|
|
|
|
|
+ alstatus.PaStatus("", "PAD", "start")
|
|
|
if priority.TaskCreating == "PAD-TMS" {
|
|
if priority.TaskCreating == "PAD-TMS" {
|
|
|
utils.LoggerDebug.Printf("PAD-TMS Connected : Clean priority.TaskCreating = '' !")
|
|
utils.LoggerDebug.Printf("PAD-TMS Connected : Clean priority.TaskCreating = '' !")
|
|
|
priority.TaskCreating = ""
|
|
priority.TaskCreating = ""
|
|
@@ -1313,20 +1361,19 @@ func HandleAMI(event map[string]string) {
|
|
|
//lfshook.NewLogger().Infof("=========%s", event["Event"])
|
|
//lfshook.NewLogger().Infof("=========%s", event["Event"])
|
|
|
//Cab Cab end
|
|
//Cab Cab end
|
|
|
if utils.IsICP(event["CallerIDNum"]) && utils.IsICP(event["ConnectedLineNum"]) && event["Exten"] == "0400" {
|
|
if utils.IsICP(event["CallerIDNum"]) && utils.IsICP(event["ConnectedLineNum"]) && event["Exten"] == "0400" {
|
|
|
-
|
|
|
|
|
alstatus.PaStatus(event["CallerIDNum"], "C2C", "end")
|
|
alstatus.PaStatus(event["CallerIDNum"], "C2C", "end")
|
|
|
priority.RegistryTask.StopAndUnregister("C2C")
|
|
priority.RegistryTask.StopAndUnregister("C2C")
|
|
|
//time.Sleep(time.Millisecond * 100)
|
|
//time.Sleep(time.Millisecond * 100)
|
|
|
SetPadTimer()
|
|
SetPadTimer()
|
|
|
|
|
+
|
|
|
|
|
+ time.Sleep(time.Millisecond * 350) //wait CPA Active
|
|
|
//check resume
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
if ok {
|
|
|
if taskName == "EMG" {
|
|
if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
|
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
} else if taskName == "CPA" {
|
|
} else if taskName == "CPA" {
|
|
|
- if CPAConfbridgeReinvite(task.ConfbridgeID) {
|
|
|
|
|
- alstatus.PaStatus("", "CPA", "start")
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
} else {
|
|
} else {
|
|
|
ICPConfbridgeReinvite(task.ConfbridgeID, taskName)
|
|
ICPConfbridgeReinvite(task.ConfbridgeID, taskName)
|
|
|
}
|
|
}
|
|
@@ -1343,7 +1390,7 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- case "BridgeEnter": // TMS-ICP answer PAD; PACU connect ICP
|
|
|
|
|
|
|
+ case "BridgeEnter": //
|
|
|
lfshook.NewLogger().Infof("=========event:%s callerid-num:%s callerid-name:%s", event["Event"], event["CallerIDNum"], event["CallerIDName"])
|
|
lfshook.NewLogger().Infof("=========event:%s callerid-num:%s callerid-name:%s", event["Event"], event["CallerIDNum"], event["CallerIDName"])
|
|
|
|
|
|
|
|
//PAD-OCC start
|
|
//PAD-OCC start
|
|
@@ -1404,6 +1451,8 @@ func HandleAMI(event map[string]string) {
|
|
|
Running: true,
|
|
Running: true,
|
|
|
}
|
|
}
|
|
|
priority.RegistryTask.Register("PAD-TMS", task)
|
|
priority.RegistryTask.Register("PAD-TMS", task)
|
|
|
|
|
+
|
|
|
|
|
+ alstatus.PaStatus("", "PAD", "start")
|
|
|
if priority.TaskCreating == "PAD-TMS" {
|
|
if priority.TaskCreating == "PAD-TMS" {
|
|
|
utils.LoggerDebug.Printf("PAD-TMS Connected : Clean priority.TaskCreating = '' !")
|
|
utils.LoggerDebug.Printf("PAD-TMS Connected : Clean priority.TaskCreating = '' !")
|
|
|
priority.TaskCreating = ""
|
|
priority.TaskCreating = ""
|