Bläddra i källkod

check actived or not before handle cmd and event

dujunchen 2 veckor sedan
förälder
incheckning
c1358f864c
2 ändrade filer med 6 tillägg och 23 borttagningar
  1. 0 21
      internal/app/ami/action/index.go
  2. 6 2
      internal/app/stc/broadcast/stc-broadcast.go

+ 0 - 21
internal/app/ami/action/index.go

@@ -93,27 +93,6 @@ func HandleAMI(event map[string]string) {
 				alstatus.AlarmStatus(event["CallerIDName"], "connect", conn)          // Alarm connected
 				go RedirectInQueue(event["CallerIDName"], "2311", "chanspy-rule", "") // 1车ICP接听PAIU
 			}
-
-			/*
-				switch string(event["CallerIDNum"][2]) { // connect the pacu to pad acording to the pad number
-				case "1":
-					ChanSpy(event["CallerIDNum"], pacu1, false, true) //connect pacu to pad
-				case "2":
-					ChanSpy(event["CallerIDNum"], pacu2, false, true) //connect pacu to pad
-				case "3":
-					ChanSpy(event["CallerIDNum"], pacu3, false, true) //connect pacu to pad
-				case "4":
-					ChanSpy(event["CallerIDNum"], pacu4, false, true) //connect pacu to pad
-				case "5":
-					ChanSpy(event["CallerIDNum"], pacu5, false, true) //connect pacu to pad
-				case "6":
-					ChanSpy(event["CallerIDNum"], pacu6, false, true) //connect pacu to pad
-				case "7":
-					ChanSpy(event["CallerIDNum"], pacu7, false, true) //connect pacu to pad
-				case "8":
-					ChanSpy(event["CallerIDNum"], pacu8, false, true) //connect pacu to pad
-				}
-			*/
 		} else if utils.IsPAIU(event["CallerIDNum"]) { //No PACU available in the cab
 			lfshook.NewLogger().Infof("====BridgeEnter==IN action===%s===ID:%s   Name:%s", event["Event"], event["CallerIDNum"], event["CallerIDName"])
 			alstatus.AlarmStatus(event["CallerIDName"], "connect", conn) // Alarm connected

+ 6 - 2
internal/app/stc/broadcast/stc-broadcast.go

@@ -41,8 +41,12 @@ func HandleStcCmd(ctx context.Context, conn net.Conn) {
 					}
 					return
 				}
-				// 将新读取的数据追加到缓冲区
-				buf.Write(tmp[:n])
+				if active.Actived { // check actived or not
+					// 将新读取的数据追加到缓冲区
+					buf.Write(tmp[:n])
+				} else {
+					break
+				}
 			}
 			// 尝试从缓冲区中提取完整数据包
 			for {