| 
					
				 | 
			
			
				@@ -10,8 +10,6 @@ import ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"pbx-api-gin/pkg/utils" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-var AlarmHandling = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 func SendToStc(conn net.Conn, data []byte) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	_, err := conn.Write(data) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -19,7 +17,7 @@ func SendToStc(conn net.Conn, data []byte) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		fmt.Println("send msg err:", err) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		conn.Close() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	lfshook.NewLogger().Logger.Infof("====data:==%x", data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	lfshook.NewLogger().Logger.Infof("==send==data:==%x", data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // report alarm status to STC 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -147,3 +145,48 @@ func PaStatus(src string, patype string, operation string) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		SendToStc(socket.Conn8, encoded) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// report broadcast status to STC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+func SendRecordFile(filename, rcdtype string) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//time.Sleep(5 * time.Second) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if !utils.FileExists(filename) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			lfshook.NewLogger().Logger.Infof("===Recording filename not exist:%+v=", filename) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	protocol := msgdata.NewProtocol() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	protocol.MessageID = 0x31 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	filenameHex := []byte(filename) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	dataLen := len(filenameHex) + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	protocol.DataLength = uint16(dataLen) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	protocol.Data = make([]byte, dataLen) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	copy(protocol.Data[1:], filenameHex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	switch rcdtype { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	case "C2C": // 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		protocol.Data[0] = 0x01 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	case "PA": // 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		protocol.Data[0] = 0x02 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	case "PAD": // 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		protocol.Data[0] = 0x05 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	case "CPA": // 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		protocol.Data[0] = 0x06 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	case "OTR": // 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		protocol.Data[0] = 0x03 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//lfshook.NewLogger().Logger.Infof("===Recording filename:%+v=", protocol.Data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	encoded, errEn := protocol.Encode() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if errEn != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		fmt.Println("Encode error:", errEn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if active.Actived { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SendToStc(socket.Conn, encoded) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SendToStc(socket.Conn8, encoded) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |