Przeglądaj źródła

update priority

dujunchen 3 dni temu
rodzic
commit
f5e51d7cfa

+ 12 - 23
internal/app/ami/action/call.go

@@ -72,10 +72,10 @@ func HangupAllExcept(caller string) {
 func HangupRunningTask(toRunTask string) {
 	lfshook.NewLogger().Infof("===HangupRunningTask=task=%+v", toRunTask)
 	if priority.RunningPATaskChan != "" {
-
 		switch priority.RunningType {
-		case "PAD-ICP", "PAD-TMS": // PAD task running
-		/*
+
+		case "PAD-ICP", "PAD-TMS": // Interrupt PAD task running,
+
 			chans, err := CoreShowChannels()
 			if err != nil {
 				lfshook.NewLogger().Errorf("CoreShowChannels %+v", err)
@@ -92,19 +92,10 @@ func HangupRunningTask(toRunTask string) {
 			}
 
 			//2. hangup task channel (ICP + PACU)
-			Hangup(priority.RunningPATaskChan)
-
-			//3. hangup other channel
-			//HangupICP()
+			HangupAllLocalChan()
+			priority.CleanPriorityTag()
 
-			//4. Hangup Local channel
-			for _, ret := range chans {
-				if strings.Contains(ret.Channel, "Local") {
-					Hangup(ret.Channel)
-				}
-			}
-		*/
-		case "PAD-OCC":
+		case "PAD-OCC": // Interrupt PAD-OCC task running,
 
 			if toRunTask == "C2C" {
 				break
@@ -123,19 +114,17 @@ func HangupRunningTask(toRunTask string) {
 				}
 
 				//3. Hangup OI & ICP
-				//HangupIO()
-				//HangupICP()
-
-				//4. Hangup Local channel
+				HangupIO()
 				HangupAllLocalChan()
 				priority.CleanPriorityTag()
 			}
-		case "C2C":
+
+		case "C2C": // Interrupt C2C task running,
 			if toRunTask == "PA" || toRunTask == "PAD-ICP" || toRunTask == "PAD-TMS" {
-				break
+				HangupICP()
+				priority.CleanPriorityTag()
 			}
-			Hangup(priority.RunningPATaskChan)
-			priority.CleanPriorityTag()
+
 		default:
 			Hangup(priority.RunningPATaskChan)
 			priority.CleanPriorityTag()

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

@@ -54,7 +54,7 @@ func HandleAMI(event map[string]string) {
 					if priority.RunningType != "C2C" {
 						HangupRunningTask("CPA") //CPA interrupt other
 					} else {
-						//call to ICP , can not stop
+						//call to ICP ; can not stop calling ICP
 						lfshook.NewLogger().Info("==Running CabCab , CPA start call ICP(ICP is on the phone)=====")
 					}
 				} else {
@@ -65,7 +65,7 @@ func HandleAMI(event map[string]string) {
 
 			if priority.CheckPriority("CabCab") {
 
-				if priority.RunningType == "PA" || priority.RunningType == "PAD-ICP" {
+				if priority.RunningType == "PA" || priority.RunningType == "PAD-ICP" || priority.RunningType == "PAD-TMS" {
 					HangupRunningTask("C2C") //C2C interrupt other
 				} else {
 					//Hangup the other ICP

+ 11 - 34
internal/app/stc/broadcast/stc-broadcast.go

@@ -86,7 +86,6 @@ func processPacket(packet []byte) {
 
 	case 0x02: // STN
 		if priority.CheckPriority("STN") {
-			//action.HangupICP()
 			action.HangupRunningTask("STN") //STN interrupt other
 			StationAnn(packet)
 		} else {
@@ -95,7 +94,6 @@ func processPacket(packet []byte) {
 
 	case 0x05: // SPC
 		if priority.CheckPriority("SPC") {
-			//action.HangupICP()
 			action.HangupRunningTask("SPC") //SPC interrupt other
 			SpecialAnn(packet)
 		} else {
@@ -104,7 +102,6 @@ func processPacket(packet []byte) {
 
 	case 0x06: // EMG
 		if priority.CheckPriority("EMG") {
-			//action.HangupICP()
 			action.HangupRunningTask("EMG") //EMG interrupt other
 			EmgMsg(packet)
 		} else {
@@ -115,7 +112,6 @@ func processPacket(packet []byte) {
 
 	case 0x08: // DCS
 		if priority.CheckPriority("DCS") {
-			//action.HangupICP()
 			action.HangupRunningTask("DCS") //DCS interrupt other
 			DcsAnn(packet)
 		} else {
@@ -124,7 +120,6 @@ func processPacket(packet []byte) {
 
 	case 0x09: // SELF CHECK
 		if priority.CheckPriority("CHK") {
-			//action.HangupICP()
 			action.HangupRunningTask("CHK") //CHK interrupt other
 			SelfCheck(packet)
 		} else {
@@ -133,7 +128,6 @@ func processPacket(packet []byte) {
 
 	case 0x10: // VOLUME Adjust
 		if priority.CheckPriority("VOL") {
-			//action.HangupICP()
 			action.HangupRunningTask("VOL") //VOL interrupt other
 			VolumeAdjust(packet)
 		} else {
@@ -142,8 +136,6 @@ func processPacket(packet []byte) {
 
 	case 0x0a: //TMS answer PAD
 		if priority.CheckPriority("PAD-TMS") {
-
-			//action.HangupICP()
 			action.HangupRunningTask("PAD-TMS") //PAD-TMS interrupt other
 			AlarmHandleICP(packet)              //for test
 			//AlarmHandleTMS(packet)
@@ -159,7 +151,7 @@ func processPacket(packet []byte) {
 
 	case 0x0d: // ICP answer PAD
 		if priority.CheckPriority("PAD-ICP") {
-			//action.HangupICP()
+
 			action.HangupRunningTask("PAD-ICP") //PAD-ICP interrupt other
 			AlarmHandleICP(packet)              //
 		} else {
@@ -400,21 +392,14 @@ func AlarmHandleICP(data []byte) {
 		if err != nil {
 			lfshook.NewLogger().Info(err)
 		}
-		//action.HangupICP()
-		if priority.RunningType == "PAD-ICP" {
-			action.HangupRunningTask("") //STOP PAD-ICP
-			//priority.CleanPriorityTag()
-		}
+		action.HangupAllLocalChan()
 
 	case 0x03: //hangup
 		//NotifyPaiu(exten, "hangup")
-		//action.Hangup(exten) //Pad
-		if priority.RunningType == "PAD-ICP" {
-			action.HangupRunningTask("") //STOP PAD-ICP
-			//priority.CleanPriorityTag()
-		}
-		//action.HangupICP()
-
+		action.Hangup(exten) //Pad
+		action.HangupAllLocalChan()
+		action.HangupICP()
+		priority.CleanPriorityTag()
 	}
 }
 
@@ -470,22 +455,14 @@ func AlarmHandleTMS(data []byte) {
 		if err != nil {
 			lfshook.NewLogger().Info(err)
 		}
-		if priority.RunningType == "PAD-TMS" {
-			action.HangupRunningTask("") //STOP PAD-TMS
-			//priority.CleanPriorityTag()
-		}
-		//action.Hangup("2311") //1 车接听
-		//action.Hangup("2381") //8 车接听
+		action.HangupAllLocalChan()
 
 	case 0x03: //hangup
 		//NotifyPaiu(exten, "hangup")
-		//action.Hangup(exten) //PAD
-		//action.Hangup("2311") //1 车接听
-		//action.Hangup("2381") //8 车接听
-		if priority.RunningType == "PAD-TMS" {
-			action.HangupRunningTask("") //STOP PAD-TMS
-			//priority.CleanPriorityTag()
-		}
+		action.Hangup(exten) //Pad
+		action.HangupAllLocalChan()
+		action.HangupICP()
+		priority.CleanPriorityTag()
 	}
 }