|
|
@@ -13,6 +13,8 @@ import (
|
|
|
"pbx-api-gin/internal/app/mysql"
|
|
|
"pbx-api-gin/internal/app/stc/active"
|
|
|
msgdata "pbx-api-gin/internal/app/stc/data"
|
|
|
+ alstatus "pbx-api-gin/internal/app/stc/sendstatus"
|
|
|
+ "pbx-api-gin/internal/app/stc/socket"
|
|
|
"pbx-api-gin/pkg/lfshook"
|
|
|
"sync"
|
|
|
"time"
|
|
|
@@ -132,6 +134,14 @@ func StationAnn(data []byte) (err error) {
|
|
|
return er
|
|
|
}
|
|
|
|
|
|
+ //Pa status report
|
|
|
+ if active.Actived && active.CabNum == "1" {
|
|
|
+ alstatus.PaStatus("", "STN", "start", socket.Conn)
|
|
|
+ }
|
|
|
+ if active.Actived && active.CabNum == "8" {
|
|
|
+ alstatus.PaStatus("", "STN", "start", socket.Conn8)
|
|
|
+ }
|
|
|
+
|
|
|
action.PlaybackPacu(filename, int(cycleCount), int(delay), "STN")
|
|
|
return nil
|
|
|
}
|
|
|
@@ -213,6 +223,14 @@ func SpecialAnn(data []byte) {
|
|
|
lfshook.NewLogger().Logger.Infof("update special voice to exten err : %+v", er.Error())
|
|
|
}
|
|
|
|
|
|
+ //Pa status report
|
|
|
+ if active.Actived && active.CabNum == "1" {
|
|
|
+ alstatus.PaStatus("", "SPC", "start", socket.Conn)
|
|
|
+ }
|
|
|
+ if active.Actived && active.CabNum == "8" {
|
|
|
+ alstatus.PaStatus("", "SPC", "start", socket.Conn8)
|
|
|
+ }
|
|
|
+
|
|
|
lfshook.NewLogger().Infof("======count:%x", cycleCount)
|
|
|
if int(cycleCount) == 255 {
|
|
|
action.PlaybackPacu(filename, 9999999, int(delay), "SPC")
|
|
|
@@ -235,6 +253,14 @@ func EmgMsg(data []byte) {
|
|
|
lfshook.NewLogger().Logger.Infof("update special voice to exten err : %+v", er.Error())
|
|
|
}
|
|
|
|
|
|
+ //Pa status report
|
|
|
+ if active.Actived && active.CabNum == "1" {
|
|
|
+ alstatus.PaStatus("", "EMG", "start", socket.Conn)
|
|
|
+ }
|
|
|
+ if active.Actived && active.CabNum == "8" {
|
|
|
+ alstatus.PaStatus("", "EMG", "start", socket.Conn8)
|
|
|
+ }
|
|
|
+
|
|
|
lfshook.NewLogger().Infof("======count:%x", cycleCount)
|
|
|
if int(cycleCount) == 255 {
|
|
|
action.PlaybackPacu(filename, 9999999, int(delay), "EMG")
|
|
|
@@ -245,8 +271,16 @@ func EmgMsg(data []byte) {
|
|
|
|
|
|
// 停止指定类型广播
|
|
|
func AnnStop(data [4]byte) {
|
|
|
+
|
|
|
+ var conn net.Conn
|
|
|
RunningType := ""
|
|
|
|
|
|
+ if active.Actived && active.CabNum == "1" {
|
|
|
+ conn = socket.Conn
|
|
|
+ } else if active.Actived && active.CabNum == "8" {
|
|
|
+ conn = socket.Conn8
|
|
|
+ }
|
|
|
+
|
|
|
switch data[0] {
|
|
|
case 0x03:
|
|
|
RunningType = "DCS"
|
|
|
@@ -259,6 +293,9 @@ func AnnStop(data [4]byte) {
|
|
|
case 0x09:
|
|
|
RunningType = "CHK"
|
|
|
}
|
|
|
+
|
|
|
+ alstatus.PaStatus("", RunningType, "end", conn)
|
|
|
+
|
|
|
for _, ext := range Pacus {
|
|
|
action.Hangup(ext)
|
|
|
}
|
|
|
@@ -286,6 +323,14 @@ func DcsAnn(data []byte) {
|
|
|
}
|
|
|
|
|
|
//lfshook.NewLogger().Infof("======count:%x", cycleCount)
|
|
|
+ //Pa status report
|
|
|
+ if active.Actived && active.CabNum == "1" {
|
|
|
+ alstatus.PaStatus("", "DCS", "start", socket.Conn)
|
|
|
+ }
|
|
|
+ if active.Actived && active.CabNum == "8" {
|
|
|
+ alstatus.PaStatus("", "DCS", "start", socket.Conn8)
|
|
|
+ }
|
|
|
+
|
|
|
if int(cycleCount) == 255 {
|
|
|
action.PlaybackPacu(filename, 9999999, int(delay), "DCS")
|
|
|
} else {
|
|
|
@@ -309,9 +354,27 @@ func SelfCheck(data []byte) {
|
|
|
}
|
|
|
|
|
|
switch check {
|
|
|
- case 0x01:
|
|
|
+ case 0x01: //start
|
|
|
+
|
|
|
+ //Pa status report
|
|
|
+ if active.Actived && active.CabNum == "1" {
|
|
|
+ alstatus.PaStatus("", "CHK", "start", socket.Conn)
|
|
|
+ }
|
|
|
+ if active.Actived && active.CabNum == "8" {
|
|
|
+ alstatus.PaStatus("", "CHK", "start", socket.Conn8)
|
|
|
+ }
|
|
|
+
|
|
|
action.PlaybackPacu(filename, int(cycleCount), int(delay), "CHK")
|
|
|
- case 0x02:
|
|
|
+ case 0x02: //stop
|
|
|
+
|
|
|
+ //Pa status report
|
|
|
+ if active.Actived && active.CabNum == "1" {
|
|
|
+ alstatus.PaStatus("", "CHK", "end", socket.Conn)
|
|
|
+ }
|
|
|
+ if active.Actived && active.CabNum == "8" {
|
|
|
+ alstatus.PaStatus("", "CHK", "end", socket.Conn8)
|
|
|
+ }
|
|
|
+
|
|
|
for _, ext := range Pacus {
|
|
|
asterisk.Hangup(ext)
|
|
|
}
|
|
|
@@ -453,9 +516,11 @@ func AlarmResetAll() {
|
|
|
}
|
|
|
|
|
|
if active.CabNum == "1" && active.Actived {
|
|
|
- action.Hangup("2311") //1 车接听
|
|
|
+ action.Hangup("2311") //1 车接听
|
|
|
+ alstatus.AlarmStatus("0000", "allreset", socket.Conn) //send all reset status
|
|
|
} else if active.CabNum == "8" && active.Actived {
|
|
|
- action.Hangup("2381") //8 车接听
|
|
|
+ action.Hangup("2381") //8 车接听
|
|
|
+ alstatus.AlarmStatus("0000", "allreset", socket.Conn8) // send all reset status
|
|
|
}
|
|
|
}
|
|
|
|