root пре 5 дана
родитељ
комит
e9673febf9
3 измењених фајлова са 20 додато и 5 уклоњено
  1. 15 3
      internal/app/ami/action/call.go
  2. 2 2
      internal/app/ami/action/index.go
  3. 3 0
      internal/app/stc/priority/task.go

+ 15 - 3
internal/app/ami/action/call.go

@@ -702,10 +702,16 @@ func CPAConfbridgeKick(confnum string) (res map[string]string, err error) {
 func CPAConfbridgeReinvite(confID string) bool {
 func CPAConfbridgeReinvite(confID string) bool {
 
 
 	utils.LoggerDebug.Printf("CPA CPAConfbridgeReinvite , resume CPA .")
 	utils.LoggerDebug.Printf("CPA CPAConfbridgeReinvite , resume CPA .")
+
+	if priority.PAInterrupt == 1 {
+		utils.LoggerDebug.Printf("CPA CPAConfbridgeReinvite , Get PA Interrupt PAInterrupt == 1 return !")
+		return false
+	}
+
 	time.Sleep(time.Millisecond * 100)
 	time.Sleep(time.Millisecond * 100)
 	for _, ext := range Speakers {
 	for _, ext := range Speakers {
 		if utils.IsICP(ext) {
 		if utils.IsICP(ext) {
-			if priority.CABInterrupt == 1 || priority.PAInterrupt == 1 {
+			if priority.CABInterrupt == 1 {
 				utils.LoggerDebug.Printf("CPA CPAConfbridgeReinvite , Get PA/CABCAB Interrupt resume CPA , ignore %s continue .", ext)
 				utils.LoggerDebug.Printf("CPA CPAConfbridgeReinvite , Get PA/CABCAB Interrupt resume CPA , ignore %s continue .", ext)
 				continue
 				continue
 			}
 			}
@@ -734,11 +740,17 @@ func EMGConfbridgeKick(confnum string) (res map[string]string, err error) {
 func EMGConfbridgeReinvite(confID string) {
 func EMGConfbridgeReinvite(confID string) {
 
 
 	utils.LoggerDebug.Printf("EMG ConfbridgeReinvite , resume EMG .")
 	utils.LoggerDebug.Printf("EMG ConfbridgeReinvite , resume EMG .")
+
+	if priority.PAInterrupt == 1 {
+		utils.LoggerDebug.Printf("EMG ConfbridgeReinvite , Get PA Interrupt PAInterrupt == 1 return !")
+		return
+	}
+
 	time.Sleep(time.Millisecond * 100)
 	time.Sleep(time.Millisecond * 100)
 	for _, ext := range Speakers {
 	for _, ext := range Speakers {
 		if utils.IsICP(ext) {
 		if utils.IsICP(ext) {
-			if priority.CABInterrupt == 1 || priority.PAInterrupt == 1 {
-				utils.LoggerDebug.Printf("EMG ConfbridgeReinvite , Get PA/CABCAB Interrupt resume EMG , ignore %s continue .", ext)
+			if priority.CABInterrupt == 1 {
+				utils.LoggerDebug.Printf("EMG ConfbridgeReinvite , Get CABCAB Interrupt resume EMG , ignore %s continue .", ext)
 				continue
 				continue
 			}
 			}
 		}
 		}

+ 2 - 2
internal/app/ami/action/index.go

@@ -73,6 +73,7 @@ func HandleAMI(event map[string]string) {
 					Hangup(event["CallerIDNum"])
 					Hangup(event["CallerIDNum"])
 				}
 				}
 
 
+				priority.PAInterrupt = 0
 				WaitTaskCreate("PA", event["CallerIDNum"])
 				WaitTaskCreate("PA", event["CallerIDNum"])
 
 
 				if priority.CheckPriority("ManuPa") {
 				if priority.CheckPriority("ManuPa") {
@@ -160,6 +161,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
@@ -943,7 +945,6 @@ func HandleAMI(event map[string]string) {
 				ConfbridgeID: event["Conference"],
 				ConfbridgeID: event["Conference"],
 				Running:      true,
 				Running:      true,
 			}
 			}
-			priority.PAInterrupt = 0
 
 
 			utils.LoggerDebug.Printf("PA Runing , Set PA task info %+v .", task)
 			utils.LoggerDebug.Printf("PA Runing , Set PA task info %+v .", task)
 			priority.RegistryTask.Register("PA", task)
 			priority.RegistryTask.Register("PA", task)
@@ -1276,7 +1277,6 @@ func HandleAMI(event map[string]string) {
 				Running:      true,
 				Running:      true,
 			}
 			}
 
 
-			priority.CABInterrupt = 0
 			priority.RegistryTask.Register("C2C", task)
 			priority.RegistryTask.Register("C2C", task)
 			alstatus.PaStatus(event["CallerIDNum"], "C2C", "start")
 			alstatus.PaStatus(event["CallerIDNum"], "C2C", "start")
 			if priority.TaskCreating == "C2C" {
 			if priority.TaskCreating == "C2C" {

+ 3 - 0
internal/app/stc/priority/task.go

@@ -1,6 +1,7 @@
 package priority
 package priority
 
 
 import (
 import (
+	"pbx-api-gin/pkg/utils"
 	"sync"
 	"sync"
 )
 )
 
 
@@ -96,6 +97,7 @@ func (r *TaskRegistry) HighestPriorityRunningTask() (string, TaskInfo, bool) {
 			found = true
 			found = true
 		}
 		}
 	}
 	}
+	utils.LoggerDebug.Printf("HighestPriorityRunningTask1 Get task:%+v", best)
 	return bestKey, best, found
 	return bestKey, best, found
 }
 }
 
 
@@ -124,5 +126,6 @@ func (r *TaskRegistry) HighestPriorityRunningTask1() (string, TaskInfo, bool) {
 	}
 	}
 
 
 	//lfshook.NewLogger().Infof("====HighestPriorityRunningTask1 ret=====%s", best.RunType)
 	//lfshook.NewLogger().Infof("====HighestPriorityRunningTask1 ret=====%s", best.RunType)
+	utils.LoggerDebug.Printf("HighestPriorityRunningTask1 Get task:%+v", best)
 	return bestKey, best, found
 	return bestKey, best, found
 }
 }