|
|
@@ -104,10 +104,11 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.PAInterrupt = 0
|
|
|
} else if utils.IsIO(event["CallerIDNum"]) { // CPA
|
|
|
|
|
|
- if /*priority.CABInterrupt == 1 || */ priority.PAInterrupt == 1 {
|
|
|
+ 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 = 1 //CPA触发,但未运行
|
|
|
+ priority.CPAActived = 0
|
|
|
return
|
|
|
}
|
|
|
|
|
|
@@ -125,6 +126,7 @@ func HandleAMI(event map[string]string) {
|
|
|
utils.LoggerDebug.Printf("CPA calling , ActivedCab = %s !", active.ActivedCab)
|
|
|
if active.ActivedCab == "" { //No active Signal on both side,Hangup caller
|
|
|
Hangup(event["CallerIDNum"])
|
|
|
+ priority.CPAActived = 0
|
|
|
if priority.TaskCreating == "CPA" {
|
|
|
utils.LoggerDebug.Printf("CPA : Clean priority.TaskCreating = '' !")
|
|
|
priority.TaskCreating = ""
|
|
|
@@ -132,6 +134,7 @@ func HandleAMI(event map[string]string) {
|
|
|
return
|
|
|
} else if active.ActivedCab == "1" && event["CallerIDNum"] == "1411" {
|
|
|
Hangup(event["CallerIDNum"])
|
|
|
+ priority.CPAActived = 0
|
|
|
if priority.TaskCreating == "CPA" {
|
|
|
utils.LoggerDebug.Printf("CPA : Clean priority.TaskCreating = '' !")
|
|
|
priority.TaskCreating = ""
|
|
|
@@ -139,6 +142,7 @@ func HandleAMI(event map[string]string) {
|
|
|
return
|
|
|
} else if active.ActivedCab == "8" && event["CallerIDNum"] == "1481" {
|
|
|
Hangup(event["CallerIDNum"])
|
|
|
+ priority.CPAActived = 0
|
|
|
if priority.TaskCreating == "CPA" {
|
|
|
utils.LoggerDebug.Printf("CPA : Clean priority.TaskCreating = '' !")
|
|
|
priority.TaskCreating = ""
|
|
|
@@ -159,7 +163,7 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
|
utils.LoggerDebug.Printf("CPA calling failed , check priority return false !")
|
|
|
Hangup(event["CallerIDNum"]) //lowwer priority ,hangup caller
|
|
|
- //priority.CPAActived = 1 //CPA触发,但未运行
|
|
|
+ priority.CPAActived = 0 //CPA触发,但未运行
|
|
|
}
|
|
|
|
|
|
time.Sleep(1 * time.Second)
|
|
|
@@ -374,14 +378,15 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RegistryTask.StopAndUnregister("PAD-OCC")
|
|
|
ConfbridgeKick(taskTmp.ConfbridgeID, "all")
|
|
|
|
|
|
- time.Sleep(time.Millisecond * 500) //wait CPA Active
|
|
|
+ time.Sleep(time.Millisecond * 900) //wait CPA Active
|
|
|
+
|
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
|
if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
} else if taskName == "CPA" {
|
|
|
- CPAConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -498,6 +503,7 @@ func HandleAMI(event map[string]string) {
|
|
|
|
|
|
if event["Context"] == "chanspy-rule-whisper" {
|
|
|
alstatus.PaStatus("", "PAD", "end")
|
|
|
+ utils.LoggerDebug.Printf("Check PAD-ICP queue chanspy-rule-whisper !")
|
|
|
|
|
|
res, _ := QueueStatus("0301", "") // check ICP queue ,if empty PAD end
|
|
|
if res == nil {
|
|
|
@@ -511,14 +517,15 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
|
|
|
|
if priority.OCCAnswer == 0 { // not OCC-PAD
|
|
|
- time.Sleep(time.Millisecond * 500) //wait CPA Active
|
|
|
+ time.Sleep(time.Millisecond * 900) //wait CPA Active
|
|
|
+ utils.LoggerDebug.Printf("======================================")
|
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
|
if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
} else if taskName == "CPA" {
|
|
|
- CPAConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -540,9 +547,9 @@ func HandleAMI(event map[string]string) {
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
|
if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
} else if taskName == "CPA" {
|
|
|
- CPAConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -915,7 +922,7 @@ func HandleAMI(event map[string]string) {
|
|
|
//Send PA start msg to STC
|
|
|
if utils.IsICP(event["CallerIDNum"]) && event["Exten"] == "0500" { // PA start
|
|
|
priority.PAInterrupt = 0
|
|
|
- alstatus.PaStatus(event["CallerIDNum"], "PA", "start")
|
|
|
+
|
|
|
//================================
|
|
|
task := priority.TaskInfo{
|
|
|
RunChannel: event["Channel"],
|
|
|
@@ -943,6 +950,7 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ alstatus.PaStatus(event["CallerIDNum"], "PA", "start")
|
|
|
|
|
|
break
|
|
|
} else if utils.IsIO(event["CallerIDNum"]) && event["Exten"] == "0501" { //CPA start
|
|
|
@@ -957,6 +965,7 @@ func HandleAMI(event map[string]string) {
|
|
|
ConfbridgeID: event["Conference"],
|
|
|
Running: true,
|
|
|
}
|
|
|
+ priority.CPAActived = 0
|
|
|
utils.LoggerDebug.Printf("CPA Runing , Set CPA task info %+v .", task)
|
|
|
priority.RegistryTask.Register("CPA", task)
|
|
|
|
|
|
@@ -1067,35 +1076,39 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RegistryTask.StopAndUnregister("PA")
|
|
|
SetPadTimer()
|
|
|
|
|
|
- time.Sleep(time.Millisecond * 500) //wait CPA Active
|
|
|
+ time.Sleep(time.Millisecond * 900) //wait CPA Active
|
|
|
// check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
|
if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
} else if taskName == "CPA" {
|
|
|
- CPAConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} else if utils.IsIO(event["CallerIDNum"]) && event["Exten"] == "0501" { //CPA end
|
|
|
|
|
|
- alstatus.PaStatus(event["CallerIDNum"], "CPA", "end")
|
|
|
-
|
|
|
//CPA
|
|
|
taskTmp, ok := priority.RegistryTask.Get("CPA")
|
|
|
if ok {
|
|
|
ConfbridgeKick(taskTmp.ConfbridgeID, "all")
|
|
|
}
|
|
|
+
|
|
|
+ //已经被打断的CPA不会重复发送end
|
|
|
+ if taskTmp.Running {
|
|
|
+ alstatus.PaStatus(event["CallerIDNum"], "CPA", "end")
|
|
|
+ }
|
|
|
+
|
|
|
priority.RegistryTask.StopAndUnregister("CPA")
|
|
|
SetPadTimer()
|
|
|
|
|
|
- time.Sleep(time.Millisecond * 500) //wait CPA Active
|
|
|
+ time.Sleep(time.Millisecond * 900) //wait CPA Active
|
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
|
if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1112,12 +1125,12 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RegistryTask.StopAndUnregister("EMG")
|
|
|
SetPadTimer()
|
|
|
|
|
|
- time.Sleep(time.Millisecond * 500) //wait CPA Active
|
|
|
+ time.Sleep(time.Millisecond * 900) //wait CPA Active
|
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
|
if taskName == "CPA" {
|
|
|
- CPAConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1133,14 +1146,14 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RegistryTask.StopAndUnregister("STN")
|
|
|
SetPadTimer()
|
|
|
|
|
|
- time.Sleep(time.Millisecond * 500) //wait CPA Active
|
|
|
+ time.Sleep(time.Millisecond * 900) //wait CPA Active
|
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
|
if taskName == "CPA" {
|
|
|
- CPAConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
} else if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1156,14 +1169,14 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RegistryTask.StopAndUnregister("DCS")
|
|
|
SetPadTimer()
|
|
|
|
|
|
- time.Sleep(time.Millisecond * 500) //wait CPA Active
|
|
|
+ time.Sleep(time.Millisecond * 900) //wait CPA Active
|
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
|
if taskName == "CPA" {
|
|
|
- CPAConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
} else if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1179,14 +1192,14 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RegistryTask.StopAndUnregister("SPC")
|
|
|
SetPadTimer()
|
|
|
|
|
|
- time.Sleep(time.Millisecond * 500) //wait CPA Active
|
|
|
+ time.Sleep(time.Millisecond * 900) //wait CPA Active
|
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
|
if taskName == "CPA" {
|
|
|
- CPAConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
} else if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1202,14 +1215,14 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RegistryTask.StopAndUnregister("CHK")
|
|
|
SetPadTimer()
|
|
|
|
|
|
- time.Sleep(time.Millisecond * 500) //wait CPA Active
|
|
|
+ time.Sleep(time.Millisecond * 900) //wait CPA Active
|
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
|
if taskName == "CPA" {
|
|
|
- CPAConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
} else if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1225,14 +1238,14 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RegistryTask.StopAndUnregister("VOL")
|
|
|
SetPadTimer()
|
|
|
|
|
|
- time.Sleep(time.Millisecond * 500) //wait CPA Active
|
|
|
+ time.Sleep(time.Millisecond * 900) //wait CPA Active
|
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
|
if taskName == "CPA" {
|
|
|
- CPAConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
} else if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1325,14 +1338,14 @@ func HandleAMI(event map[string]string) {
|
|
|
//time.Sleep(time.Millisecond * 100)
|
|
|
SetPadTimer()
|
|
|
|
|
|
- time.Sleep(time.Millisecond * 500) //wait CPA Active
|
|
|
+ time.Sleep(time.Millisecond * 900) //wait CPA Active
|
|
|
//check resume
|
|
|
taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
if ok {
|
|
|
if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ EMGConfbridgeReinvite(task)
|
|
|
} else if taskName == "CPA" {
|
|
|
- CPAConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ CPAConfbridgeReinvite(task)
|
|
|
} else {
|
|
|
ICPConfbridgeReinvite(task.ConfbridgeID, taskName)
|
|
|
}
|
|
|
@@ -1349,7 +1362,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"])
|
|
|
|
|
|
//PAD-OCC start
|
|
|
@@ -1418,6 +1431,12 @@ func HandleAMI(event map[string]string) {
|
|
|
|
|
|
alstatus.AlarmStatus(event["CallerIDNum"], "connect") // PAD connect ICP-TMS
|
|
|
}
|
|
|
+ case "NewConnectedLine": //PAD-ICP/PAD_TMS answered
|
|
|
+ if utils.IsICP(event["CallerIDNum"]) && event["Exten"] == "0402" && (event["ConnectedLineNum"] == "ani1" || event["ConnectedLineNum"] == "ani8") {
|
|
|
+ alstatus.PaStatus("", "PAD", "start") //PAD-ICP icp connected pad
|
|
|
+ } else if utils.IsICP(event["CallerIDNum"]) && event["Exten"] == "0403" && (utils.IsPACU(event["ConnectedLineNum"])) {
|
|
|
+ alstatus.PaStatus("", "PAD", "start") //PAD-TMS icp connected pad
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|