root пре 1 недеља
родитељ
комит
fd504e2df7
2 измењених фајлова са 44 додато и 24 уклоњено
  1. 26 22
      internal/app/stc/broadcast/stc-broadcast.go
  2. 18 2
      internal/app/stc/priority/index.go

+ 26 - 22
internal/app/stc/broadcast/stc-broadcast.go

@@ -316,7 +316,7 @@ func processPacket(packet []byte) {
 		//Drop other handler in 2 sec
 		//PACUs---call---->ICP1
 		//PAD---->Chanspy(WEq)-->ICP1;PAD--->Call---->ICP2
-		if handler == 0x01 {
+		if handler == 0x01 { //answer PAD
 			if _, loaded := suppressedExts.LoadOrStore(key, struct{}{}); loaded {
 				utils.LoggerDebug.Printf("Suppressed duplicate ICP Alarm (handler=0x01) for PAD: within 2 seconds")
 				return
@@ -326,12 +326,12 @@ func processPacket(packet []byte) {
 				suppressedExts.Delete(key)
 				utils.LoggerDebug.Printf("Suppression released .")
 			})
-		}
+			//}
 
-		//检查是否有任务正在创建
-		action.WaitTaskCreate("PAD-TMS")
+			//检查是否有任务正在创建
+			action.WaitTaskCreate("PAD-TMS")
 
-		if packet[8] == 0x01 { //answer PAD
+			//if packet[8] == 0x01 { //answer PAD
 			if priority.CheckPriority("PAD-TMS") {
 
 				//Before Answer PAD
@@ -355,7 +355,7 @@ func processPacket(packet []byte) {
 			} else {
 				alstatus.PaStatus("", "PAD-TMS", "refuse")
 			}
-		} else {
+		} else { //hangup + hold
 			AlarmHandleTMS(packet)
 		}
 
@@ -391,34 +391,38 @@ func processPacket(packet []byte) {
 				suppressedExts.Delete(key)
 				utils.LoggerDebug.Printf("Suppression released for key: %s", key)
 			})
-		}
+			//}
 
-		//检查是否有任务正在创建
-		action.WaitTaskCreate("PAD-ICP")
+			//检查是否有任务正在创建
+			action.WaitTaskCreate("PAD-ICP")
 
-		if priority.CheckPriority("PAD-ICP") {
+			//if packet[8] == 0x01 { //answer PAD
+			if priority.CheckPriority("PAD-ICP") {
 
-			//Before Answer PAD
-			if packet[8] == 0x01 {
+				//Before Answer PAD
+				//if packet[8] == 0x01 {
 
 				runningTaskName := action.InterruptRunningTask("PAD-ICP") //PAD-ICP interrupt other
 				if runningTaskName != "" {
 					time.Sleep(time.Millisecond * 100) //wait endpoint release
 				}
-			}
+				//}
 
-			if active.QueueTimer != nil {
-				utils.LoggerDebug.Printf("PAD Timeout timer != nil !")
-				if active.QueueTimer.Stop() {
-					utils.LoggerDebug.Printf("Stop PAD timer true !")
-				} else {
-					utils.LoggerDebug.Printf("Stop PAD timer false !")
+				if active.QueueTimer != nil {
+					utils.LoggerDebug.Printf("PAD Timeout timer != nil !")
+					if active.QueueTimer.Stop() {
+						utils.LoggerDebug.Printf("Stop PAD timer true !")
+					} else {
+						utils.LoggerDebug.Printf("Stop PAD timer false !")
+					}
 				}
-			}
 
+				AlarmHandleICP(packet)
+			} else {
+				alstatus.PaStatus("", "PAD-ICP", "refuse")
+			}
+		} else { //hangup + hold
 			AlarmHandleICP(packet)
-		} else {
-			alstatus.PaStatus("", "PAD-ICP", "refuse")
 		}
 
 		time.Sleep(3 * time.Second)

+ 18 - 2
internal/app/stc/priority/index.go

@@ -126,6 +126,10 @@ func CheckPriority(runType string) bool {
 	checkMutex.Lock()
 	defer checkMutex.Unlock()
 
+	var taskRuning TaskInfo
+	var runingtaskName string
+	var ok bool
+
 	//Check special voice can not interrupt
 	if SpecialVoice == 1 {
 		return false
@@ -134,7 +138,19 @@ func CheckPriority(runType string) bool {
 	//Get the to run priority number in the config file
 	toRunpriority := GetPriorityByKey(runType)
 
-	runingtaskName, taskRuning, ok := RegistryTask.HighestPriorityRunningTask()
+	//获取当前优先级最高的任务信息
+	if runType != "PA" && runType != "PAD-ICP" && runType != "PAD-TMS" { // ignore C2C
+		runingtaskName, taskRuning, ok = RegistryTask.HighestPriorityRunningTask1()
+		if !ok {
+			return true
+		}
+	} else {
+		runingtaskName, taskRuning, ok = RegistryTask.HighestPriorityRunningTask()
+		if !ok {
+			return true
+		}
+	}
+
 	if ok {
 		utils.LoggerDebug.Printf("CheckPriority  TorunType:%s 	SpecialVoice:%d 	toRunpriority:%d 	runingpriority:%d ", runType, SpecialVoice, toRunpriority, taskRuning.Priority)
 		//if the running task priority is lowwer
@@ -147,7 +163,7 @@ func CheckPriority(runType string) bool {
 			case "PAD-ICP":
 				return true
 			case "PAD-TMS":
-				return false
+				return true
 			case "EMG":
 				return true
 			case "SPC":