|
|
|
@ -1,12 +1,12 @@
|
|
|
|
|
package icsstat
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"bytes"
|
|
|
|
|
"fmt"
|
|
|
|
|
"io"
|
|
|
|
|
"math/rand"
|
|
|
|
|
"sync"
|
|
|
|
|
"time"
|
|
|
|
|
"unicode/utf8"
|
|
|
|
|
|
|
|
|
|
"gitlab.com/ics_cinnamon/voiceStatistics/icsconf"
|
|
|
|
|
"gitlab.com/ics_cinnamon/voiceStatistics/icserror"
|
|
|
|
@ -325,36 +325,6 @@ func StatsCommandVA(t *icsnet.IcsTCPNet, bufend string) {
|
|
|
|
|
insLog += fmt.Sprintf("TTS_TEXT=%s", statInfos.TtsText)
|
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, -1, "%s", insLog)
|
|
|
|
|
|
|
|
|
|
fmt.Printf("SEQ_ID=%+v|", utf8.ValidString(seqId))
|
|
|
|
|
fmt.Printf("LOG_TIME=%+v|", utf8.ValidString(statInfos.LogTime))
|
|
|
|
|
fmt.Printf("LOG_TYPE=%+v|", utf8.ValidString(statInfos.LogType))
|
|
|
|
|
fmt.Printf("SID=%+v|", utf8.ValidString(statInfos.Sid))
|
|
|
|
|
fmt.Printf("RESULT_CODE=%+v|", utf8.ValidString(statInfos.ResultCode))
|
|
|
|
|
fmt.Printf("REQ_TIME=%+v|", utf8.ValidString(statInfos.ReqTime))
|
|
|
|
|
fmt.Printf("RSP_TIME=%+v|", utf8.ValidString(statInfos.RspTime))
|
|
|
|
|
fmt.Printf("CLIENT_IP=%+v|", utf8.ValidString(statInfos.ClientIp))
|
|
|
|
|
fmt.Printf("DEV_INFO=%+v|", utf8.ValidString(statInfos.DevInfo))
|
|
|
|
|
fmt.Printf("OS_INFO=%+v|", utf8.ValidString(statInfos.OsInfo))
|
|
|
|
|
fmt.Printf("NW_INFO=%+v|", utf8.ValidString(statInfos.NwInfo))
|
|
|
|
|
fmt.Printf("SVC_NAME=%+v|", utf8.ValidString(statInfos.SvcName))
|
|
|
|
|
fmt.Printf("DEV_MODEL=%+v|", utf8.ValidString(statInfos.DevModel))
|
|
|
|
|
fmt.Printf("CARRIER_TYPE=%+v|", utf8.ValidString(statInfos.CarrierType))
|
|
|
|
|
fmt.Printf("HOST_NAME=%+v|", utf8.ValidString(hostName))
|
|
|
|
|
fmt.Printf("SCN_NAME=%+v|", utf8.ValidString(statInfos.ScnName))
|
|
|
|
|
fmt.Printf("CALL_ID=%+v|", utf8.ValidString(statInfos.CallId))
|
|
|
|
|
fmt.Printf("TR_ID=%+v|", utf8.ValidString(statInfos.TrId))
|
|
|
|
|
fmt.Printf("CONC_CALL=%+v|", utf8.ValidString(statInfos.ConcCall))
|
|
|
|
|
fmt.Printf("SVC_TYPE=%+v|", utf8.ValidString(statInfos.SvcType))
|
|
|
|
|
fmt.Printf("SVC_REQ_TIME=%+v|", utf8.ValidString(statInfos.SvcReqTime))
|
|
|
|
|
fmt.Printf("SVC_RSP_TIME=%+v|", utf8.ValidString(statInfos.SvcRspTime))
|
|
|
|
|
fmt.Printf("TRANSFER_NO=%+v|", utf8.ValidString(statInfos.TransferNo))
|
|
|
|
|
fmt.Printf("CALL_TIME=%+v|", utf8.ValidString(statInfos.CallTime))
|
|
|
|
|
fmt.Printf("CALL_TYPE=%+v|", utf8.ValidString(statInfos.CallType))
|
|
|
|
|
fmt.Printf("FUN_NAME=%+v|", utf8.ValidString(statInfos.FunName))
|
|
|
|
|
fmt.Printf("RESULT_MSG=%+v|", utf8.ValidString(statInfos.ResultMsg))
|
|
|
|
|
fmt.Printf("STT_TEXT=%+v|", utf8.ValidString(statInfos.SttText))
|
|
|
|
|
fmt.Printf("TTS_TEXT=%+v", utf8.ValidString(statInfos.TtsText))
|
|
|
|
|
|
|
|
|
|
// fmt.Printf("stats- %s \n", statInfos.SeqId)
|
|
|
|
|
// fmt.Printf("stats- %s \n", statInfos.LogTime)
|
|
|
|
|
// fmt.Printf("stats- %s \n", statInfos.LogType)
|
|
|
|
@ -397,9 +367,268 @@ func (statInfos *StatInfos) ChangeByteToString(statInfo []byte) *icserror.IcsErr
|
|
|
|
|
// }()
|
|
|
|
|
|
|
|
|
|
// n := bytes.Index(statInfo[STAT_INFO:SEQ_ID], []byte{0})
|
|
|
|
|
seqId := string(statInfo[STAT_INFO:SEQ_ID])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n := bytes.Index([]byte(seqId), []byte{0})
|
|
|
|
|
if n != -1 && n < SEQ_ID {
|
|
|
|
|
statInfos.SeqId = string([]byte(seqId)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.SeqId = string(statInfo[STAT_INFO:SEQ_ID])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logTime := string(statInfo[SEQ_ID:LOG_TIME])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(logTime), []byte{0})
|
|
|
|
|
if n != -1 && n < LOG_TIME {
|
|
|
|
|
statInfos.LogTime = string([]byte(logTime)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.LogTime = string(statInfo[SEQ_ID:LOG_TIME])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logType := string(statInfo[LOG_TIME:LOG_TYPE])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(logType), []byte{0})
|
|
|
|
|
if n != -1 && n < LOG_TYPE {
|
|
|
|
|
statInfos.LogType = string([]byte(logType)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.LogType = string(statInfo[LOG_TIME:LOG_TYPE])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sid := string(statInfo[LOG_TYPE:SID])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(sid), []byte{0})
|
|
|
|
|
if n != -1 && n < SID {
|
|
|
|
|
statInfos.Sid = string([]byte(sid)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.Sid = string(statInfo[LOG_TYPE:SID])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resultCode := string(statInfo[SID:RESULT_CODE])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(resultCode), []byte{0})
|
|
|
|
|
if n != -1 && n < RESULT_CODE {
|
|
|
|
|
statInfos.ResultCode = string([]byte(resultCode)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.ResultCode = string(statInfo[SID:RESULT_CODE])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reqTime := string(statInfo[RESULT_CODE:REQ_TIME])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(reqTime), []byte{0})
|
|
|
|
|
if n != -1 && n < REQ_TIME {
|
|
|
|
|
statInfos.ReqTime = string([]byte(reqTime)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.ReqTime = string(statInfo[RESULT_CODE:REQ_TIME])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rspTime := string(statInfo[REQ_TIME:RES_TIME])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(rspTime), []byte{0})
|
|
|
|
|
if n != -1 && n < RES_TIME {
|
|
|
|
|
statInfos.RspTime = string([]byte(rspTime)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.RspTime = string(statInfo[REQ_TIME:RES_TIME])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clientIp := string(statInfo[REQ_TIME:RES_TIME])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(clientIp), []byte{0})
|
|
|
|
|
if n != -1 && n < RES_TIME {
|
|
|
|
|
statInfos.ClientIp = string([]byte(clientIp)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.ClientIp = string(statInfo[RES_TIME:CLIENT_IP])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
devInfo := string(statInfo[CLIENT_IP:DEV_INFO])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(devInfo), []byte{0})
|
|
|
|
|
if n != -1 && n < DEV_INFO {
|
|
|
|
|
statInfos.DevInfo = string([]byte(devInfo)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.DevInfo = string(statInfo[CLIENT_IP:DEV_INFO])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
osInfo := string(statInfo[DEV_INFO:OS_INFO])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(osInfo), []byte{0})
|
|
|
|
|
if n != -1 && n < OS_INFO {
|
|
|
|
|
statInfos.OsInfo = string([]byte(osInfo)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.OsInfo = string(statInfo[DEV_INFO:OS_INFO])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nwInfo := string(statInfo[OS_INFO:NW_INFO])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(nwInfo), []byte{0})
|
|
|
|
|
if n != -1 && n < NW_INFO {
|
|
|
|
|
statInfos.NwInfo = string([]byte(nwInfo)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.NwInfo = string(statInfo[OS_INFO:NW_INFO])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
svcName := string(statInfo[NW_INFO:SVC_NAME])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(svcName), []byte{0})
|
|
|
|
|
if n != -1 && n < SVC_NAME {
|
|
|
|
|
statInfos.SvcName = string([]byte(svcName)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.SvcName = string(statInfo[NW_INFO:SVC_NAME])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
devModel := string(statInfo[SVC_NAME:DEV_MODEL])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(devModel), []byte{0})
|
|
|
|
|
if n != -1 && n < DEV_MODEL {
|
|
|
|
|
statInfos.DevModel = string([]byte(devModel)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.DevModel = string(statInfo[SVC_NAME:DEV_MODEL])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
carrierType := string(statInfo[DEV_MODEL:CARRIER_TYPE])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(carrierType), []byte{0})
|
|
|
|
|
if n != -1 && n < CARRIER_TYPE {
|
|
|
|
|
statInfos.CarrierType = string([]byte(carrierType)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.CarrierType = string(statInfo[DEV_MODEL:CARRIER_TYPE])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hostName := string(statInfo[CARRIER_TYPE:HOST_NAME])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(hostName), []byte{0})
|
|
|
|
|
if n != -1 && n < HOST_NAME {
|
|
|
|
|
statInfos.HostName = string([]byte(hostName)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.HostName = string(statInfo[CARRIER_TYPE:HOST_NAME])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
scnName := string(statInfo[HOST_NAME:SCN_NAME])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(scnName), []byte{0})
|
|
|
|
|
if n != -1 && n < SCN_NAME {
|
|
|
|
|
statInfos.ScnName = string([]byte(scnName)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.HostName = string(statInfo[HOST_NAME:SCN_NAME])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
callId := string(statInfo[SCN_NAME:CALL_ID])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(callId), []byte{0})
|
|
|
|
|
if n != -1 && n < CALL_ID {
|
|
|
|
|
statInfos.CallId = string([]byte(callId)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.CallId = string(statInfo[SCN_NAME:CALL_ID])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trId := string(statInfo[CALL_ID:TR_ID])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(trId), []byte{0})
|
|
|
|
|
if n != -1 && n < TR_ID {
|
|
|
|
|
statInfos.TrId = string([]byte(trId)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.TrId = string(statInfo[CALL_ID:TR_ID])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
concCall := string(statInfo[TR_ID:CONC_CALL])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(concCall), []byte{0})
|
|
|
|
|
if n != -1 && n < CONC_CALL {
|
|
|
|
|
statInfos.ConcCall = string([]byte(concCall)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.ConcCall = string(statInfo[TR_ID:CONC_CALL])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
svcType := string(statInfo[CONC_CALL:SVC_TYPE])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(svcType), []byte{0})
|
|
|
|
|
if n != -1 && n < SVC_TYPE {
|
|
|
|
|
statInfos.SvcType = string([]byte(svcType)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.SvcType = string(statInfo[CONC_CALL:SVC_TYPE])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
svcReqTime := string(statInfo[SVC_TYPE:SVC_REQ_TIME])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(svcReqTime), []byte{0})
|
|
|
|
|
if n != -1 && n < SVC_REQ_TIME {
|
|
|
|
|
statInfos.SvcReqTime = string([]byte(svcReqTime)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.SvcReqTime = string(statInfo[SVC_TYPE:SVC_REQ_TIME])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
svcRspTime := string(statInfo[SVC_REQ_TIME:SVC_RSP_TIME])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(svcRspTime), []byte{0})
|
|
|
|
|
if n != -1 && n < SVC_RSP_TIME {
|
|
|
|
|
statInfos.SvcRspTime = string([]byte(svcRspTime)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.SvcRspTime = string(statInfo[SVC_REQ_TIME:SVC_RSP_TIME])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
transferNo := string(statInfo[SVC_REQ_TIME:SVC_RSP_TIME])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(transferNo), []byte{0})
|
|
|
|
|
if n != -1 && n < SVC_RSP_TIME {
|
|
|
|
|
statInfos.TransferNo = string([]byte(transferNo)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.TransferNo = string(statInfo[SVC_RSP_TIME:TRANSFER_NO])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
callTime := string(statInfo[TRANSFER_NO:CALL_TIME])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(callTime), []byte{0})
|
|
|
|
|
if n != -1 && n < CALL_TIME {
|
|
|
|
|
statInfos.CallTime = string([]byte(callTime)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.CallTime = string(statInfo[TRANSFER_NO:CALL_TIME])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
callType := string(statInfo[CALL_TIME:CALL_TYPE])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(callType), []byte{0})
|
|
|
|
|
if n != -1 && n < CALL_TYPE {
|
|
|
|
|
statInfos.CallType = string([]byte(callType)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.CallType = string(statInfo[CALL_TIME:CALL_TYPE])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
funName := string(statInfo[CALL_TYPE:FUN_NAME])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(funName), []byte{0})
|
|
|
|
|
if n != -1 && n < FUN_NAME {
|
|
|
|
|
statInfos.FunName = string([]byte(funName)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.FunName = string(statInfo[CALL_TYPE:FUN_NAME])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resultMsg := string(statInfo[FUN_NAME:RESULT_MSG])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(resultMsg), []byte{0})
|
|
|
|
|
if n != -1 && n < RESULT_MSG {
|
|
|
|
|
statInfos.ResultMsg = string([]byte(resultMsg)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.ResultMsg = string(statInfo[FUN_NAME:RESULT_MSG])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sttText := string(statInfo[RESULT_MSG:STT_TEXT])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(sttText), []byte{0})
|
|
|
|
|
if n != -1 && n < RESULT_MSG {
|
|
|
|
|
statInfos.SttText = string([]byte(sttText)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.SttText = string(statInfo[RESULT_MSG:STT_TEXT])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ttsText := string(statInfo[STT_TEXT:])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[STAT_INFO : SEQ_ID])
|
|
|
|
|
n = bytes.Index([]byte(ttsText), []byte{0})
|
|
|
|
|
if n != -1 {
|
|
|
|
|
statInfos.TtsText = string([]byte(ttsText)[:n])
|
|
|
|
|
} else {
|
|
|
|
|
statInfos.TtsText = string(statInfo[STT_TEXT:])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
// n := bytes.Index(statInfo[SEQ_ID:LOG_TIME], []byte{0})
|
|
|
|
|
statInfos.LogTime = string(statInfo[SEQ_ID:LOG_TIME])
|
|
|
|
|
// fmt.Println("seqid ", statInfo[SEQ_ID : SEQ_ID+n])
|
|
|
|
@ -486,5 +715,7 @@ func (statInfos *StatInfos) ChangeByteToString(statInfo []byte) *icserror.IcsErr
|
|
|
|
|
// n = bytes.Index(statInfo[STT_TEXT:TTS_TEXT], []byte{0})
|
|
|
|
|
statInfos.TtsText = string(statInfo[STT_TEXT:])
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|