|
|
@ -13,8 +13,8 @@ import (
|
|
|
|
"gitlab.com/ics_cinnamon/voiceStatistics/icsnet"
|
|
|
|
"gitlab.com/ics_cinnamon/voiceStatistics/icsnet"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type SidVal struct {
|
|
|
|
type SeqVal struct {
|
|
|
|
Sid string
|
|
|
|
Seq string
|
|
|
|
M *sync.Mutex
|
|
|
|
M *sync.Mutex
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -53,7 +53,7 @@ type StatInfos struct {
|
|
|
|
TtsText string // 1024
|
|
|
|
TtsText string // 1024
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var gSidVal *SidVal
|
|
|
|
var gSeqVal *SeqVal
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
const (
|
|
|
|
//necessary value
|
|
|
|
//necessary value
|
|
|
@ -138,15 +138,15 @@ func ListenStatMNG1() (icserr *icserror.IcsError) {
|
|
|
|
func NewSidVal() {
|
|
|
|
func NewSidVal() {
|
|
|
|
timeN := time.Now()
|
|
|
|
timeN := time.Now()
|
|
|
|
nano := fmt.Sprintf("%d", timeN.UTC().Nanosecond())
|
|
|
|
nano := fmt.Sprintf("%d", timeN.UTC().Nanosecond())
|
|
|
|
sid := fmt.Sprintf("%02d%02d%02d%03s", timeN.Hour(), timeN.Minute(), timeN.Second(), nano[:3])
|
|
|
|
seq := fmt.Sprintf("%02d%02d%02d%03s", timeN.Hour(), timeN.Minute(), timeN.Second(), nano[:3])
|
|
|
|
gSidVal = &SidVal{
|
|
|
|
gSeqVal = &SeqVal{
|
|
|
|
Sid: sid,
|
|
|
|
Seq: seq,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gSidVal.M = &sync.Mutex{}
|
|
|
|
gSeqVal.M = &sync.Mutex{}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func GetIcsSid() *SidVal {
|
|
|
|
func GetIcsSid() *SeqVal {
|
|
|
|
return gSidVal
|
|
|
|
return gSeqVal
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func StatsCommandVG(t *icsnet.IcsTCPNet, bufend string) {
|
|
|
|
func StatsCommandVG(t *icsnet.IcsTCPNet, bufend string) {
|
|
|
@ -156,16 +156,18 @@ func StatsCommandVG(t *icsnet.IcsTCPNet, bufend string) {
|
|
|
|
s := GetIcsSid()
|
|
|
|
s := GetIcsSid()
|
|
|
|
randNum := fmt.Sprintf("%d4", rand.Intn(9999))
|
|
|
|
randNum := fmt.Sprintf("%d4", rand.Intn(9999))
|
|
|
|
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
// defer func() {
|
|
|
|
if err := recover(); err != nil {
|
|
|
|
// if err := recover(); err != nil {
|
|
|
|
l.Printf(icslog.LOG_LEVEL_WARN, -1, "%s\n",
|
|
|
|
// l.Printf(icslog.LOG_LEVEL_WARN, -1, "%s\n",
|
|
|
|
icserror.ICSERRNETNotConnectError.GetMessage())
|
|
|
|
// icserror.ICSERRNETNotConnectError.GetMessage())
|
|
|
|
if t != nil {
|
|
|
|
// if t != nil {
|
|
|
|
t.Close()
|
|
|
|
// t.Close()
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
return
|
|
|
|
// return
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}()
|
|
|
|
// }()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defer t.Close()
|
|
|
|
|
|
|
|
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, -1, "Connected from - %s", t.RemoteAddr())
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, -1, "Connected from - %s", t.RemoteAddr())
|
|
|
|
|
|
|
|
|
|
|
@ -179,7 +181,7 @@ func StatsCommandVG(t *icsnet.IcsTCPNet, bufend string) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
svc := statInfos.SvcType[0:1]
|
|
|
|
svc := statInfos.SvcType[0:1]
|
|
|
|
seqId := s.Sid + svc + randNum
|
|
|
|
seqId := s.Seq + svc + randNum
|
|
|
|
|
|
|
|
|
|
|
|
fmt.Printf("Recved Stat Command(%s) %d \n", statReads, rlen)
|
|
|
|
fmt.Printf("Recved Stat Command(%s) %d \n", statReads, rlen)
|
|
|
|
statInfos.ChangeByteToString(statReads)
|
|
|
|
statInfos.ChangeByteToString(statReads)
|
|
|
@ -256,16 +258,18 @@ func StatsCommandVA(t *icsnet.IcsTCPNet, bufend string) {
|
|
|
|
s := GetIcsSid()
|
|
|
|
s := GetIcsSid()
|
|
|
|
randNum := fmt.Sprintf("%d4", rand.Intn(9999))
|
|
|
|
randNum := fmt.Sprintf("%d4", rand.Intn(9999))
|
|
|
|
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
// defer func() {
|
|
|
|
if err := recover(); err != nil {
|
|
|
|
// if err := recover(); err != nil {
|
|
|
|
l.Printf(icslog.LOG_LEVEL_WARN, -1, "%s\n",
|
|
|
|
// l.Printf(icslog.LOG_LEVEL_WARN, -1, "%s\n",
|
|
|
|
icserror.ICSERRNETNotConnectError.GetMessage())
|
|
|
|
// icserror.ICSERRNETNotConnectError.GetMessage())
|
|
|
|
if t != nil {
|
|
|
|
// if t != nil {
|
|
|
|
t.Close()
|
|
|
|
// t.Close()
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
return
|
|
|
|
// return
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}()
|
|
|
|
// }()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defer t.Close()
|
|
|
|
|
|
|
|
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, -1, "Connected from - %s", t.RemoteAddr())
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, -1, "Connected from - %s", t.RemoteAddr())
|
|
|
|
|
|
|
|
|
|
|
@ -279,7 +283,7 @@ func StatsCommandVA(t *icsnet.IcsTCPNet, bufend string) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
svc := statInfos.SvcType[0:1]
|
|
|
|
svc := statInfos.SvcType[0:1]
|
|
|
|
seqId := s.Sid + svc + randNum
|
|
|
|
seqId := s.Seq + svc + randNum
|
|
|
|
fmt.Printf("Recved Stat Command(%s) %d \n", statReads, rlen)
|
|
|
|
fmt.Printf("Recved Stat Command(%s) %d \n", statReads, rlen)
|
|
|
|
statInfos.ChangeByteToString(statReads)
|
|
|
|
statInfos.ChangeByteToString(statReads)
|
|
|
|
|
|
|
|
|
|
|
|