From ac2314e51a43b11acbe421152150bd949328242e Mon Sep 17 00:00:00 2001 From: jiyoungcheon Date: Fri, 10 Jan 2025 03:51:27 -0500 Subject: [PATCH] joy4 deleted --- go.mod | 1 - go.sum | 7 - icsmediaconv/icsmediaconv.go | 147 ------------------- icssessionmanager/icsanalyzertp.go | 76 ---------- icssessionmanager/icsanalyzesip.go | 211 --------------------------- icssessionmanager/icssession.go | 34 ++--- icssessionmanager/sessionoperator.go | 27 ++-- 7 files changed, 29 insertions(+), 474 deletions(-) delete mode 100644 icsmediaconv/icsmediaconv.go delete mode 100644 icssessionmanager/icsanalyzertp.go delete mode 100644 icssessionmanager/icsanalyzesip.go diff --git a/go.mod b/go.mod index d61e4b7..2da0275 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ require ( cloud.google.com/go/texttospeech v1.0.0 github.com/gorilla/websocket v1.4.2 github.com/stretchr/testify v1.7.0 - gitlab.com/ics_cinnamon/joy4 v1.0.25 golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb ) diff --git a/go.sum b/go.sum index 13b4183..c3ccf82 100644 --- a/go.sum +++ b/go.sum @@ -162,7 +162,6 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -180,10 +179,6 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -gitlab.com/ics_cinnamon/joy4 v1.0.24 h1:MQlMxeJ5ZBEerHzHf1D+/ruTeA1YXJKL5XbJdI3NVf4= -gitlab.com/ics_cinnamon/joy4 v1.0.24/go.mod h1:LFfF6nA92KMmd/hrGEgQzkIsX/n+IlqCI8vbY8/NnNI= -gitlab.com/ics_cinnamon/joy4 v1.0.25 h1:e20ciX68hnLv50GVENWDeyYkKz0XiX6ALevQfeSfrQc= -gitlab.com/ics_cinnamon/joy4 v1.0.25/go.mod h1:LFfF6nA92KMmd/hrGEgQzkIsX/n+IlqCI8vbY8/NnNI= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -193,8 +188,6 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -gocv.io/x/gocv v0.27.0 h1:3X8I74ULsWHd4m7DQRv2Nqx5VkKscfUFnKgLNodiboI= -gocv.io/x/gocv v0.27.0/go.mod h1:n4LnYjykU6y9gn48yZf4eLCdtuSb77XxSkW6g0wGf/A= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/icsmediaconv/icsmediaconv.go b/icsmediaconv/icsmediaconv.go deleted file mode 100644 index 86fc7fa..0000000 --- a/icsmediaconv/icsmediaconv.go +++ /dev/null @@ -1,147 +0,0 @@ -package icsmediaconv - -import ( - "sync" - - "gitlab.com/cinnamon/voiceagent/icserror" - "gitlab.com/cinnamon/voiceagent/icslog" - "gitlab.com/cinnamon/voiceagent/icspacketparser" - "gitlab.com/ics_cinnamon/joy4/av" - "gitlab.com/ics_cinnamon/joy4/cgo/ffmpeg" - "gitlab.com/ics_cinnamon/joy4/codec" -) - -const ( - ICS_PT_MULAW = 0 - ICS_PT_ALAW = 8 - ICS_PT_G729 = 18 - ICS_PT_END = ICS_PT_G729 -) - -const PCM_8K_16BIT_10MS_SIZE = 160 - -type Converter struct { - payloadtype icspacketparser.PayloadType - codec av.AudioCodecData - decoder *ffmpeg.AudioDecoder - - samplingRate int - onePacketSize int - - isStart bool - m *sync.Mutex - - ID int -} - -func NewConverter(id int, pt icspacketparser.PayloadType) (*Converter, *icserror.IcsError) { - conv := &Converter{payloadtype: pt} - - conv.ID = id - conv.isStart = false - conv.m = &sync.Mutex{} - - switch pt { - case ICS_PT_MULAW: - conv.codec = codec.NewPCMMulawCodecData() - conv.samplingRate = 8000 - conv.onePacketSize = 160 - case ICS_PT_ALAW: - conv.codec = codec.NewPCMAlawCodecData() - conv.samplingRate = 8000 - conv.onePacketSize = 160 - case ICS_PT_G729: - conv.codec = codec.NewG729CodecData() - conv.samplingRate = 8000 - conv.onePacketSize = 10 - default: - return nil, icserror.ICSERRCONVNotSupportedCodec - } - - var err error - conv.decoder, err = ffmpeg.NewAudioDecoder(conv.codec) - if err != nil { - icserror.ICSERRCONVNotSupportedCodec.SetError(err) - return nil, icserror.ICSERRCONVNotSupportedCodec - } - ffmpeg.SetLogLevel(ffmpeg.QUIET) - - conv.Start() - - l := icslog.GetIcsLog() - l.Printf(icslog.LOG_LEVEL_DEBUG2, id, "### NewDecode()") - - return conv, nil -} - -func (c *Converter) Start() { - c.m.Lock() - c.isStart = true - c.m.Unlock() -} - -func (c *Converter) Stop() { - c.m.Lock() - c.isStart = false - c.m.Unlock() -} - -func (c *Converter) IsStart() bool { - return c.isStart -} - -func (c *Converter) Close() { - c.Stop() - c.decoder.Close() - - l := icslog.GetIcsLog() - l.Print(icslog.LOG_LEVEL_INFO, c.ID, "Closed Decoder") -} - -func (c *Converter) Decode(packet []byte) ([]byte, *icserror.IcsError) { - //l := icslog.GetIcsLog() - //l.Printf(icslog.LOG_LEVEL_DEBUG2, -1, "converter### Decode() packet length: %d", len(packet)) - - retBuf := make([]byte, PCM_8K_16BIT_10MS_SIZE*2) - packetLen := len(packet) - iter := 0 - for packetLen >= c.onePacketSize { - packetLen -= c.onePacketSize - - //fmt.Printf("### Decode() iter(%d) packetlen(%d)\n", iter, packetLen) - buf := packet[c.onePacketSize*iter : c.onePacketSize*(iter+1)] - //fmt.Printf("### Decode() iter(%d), buf length %d %v\n", iter, len(buf), buf) - //l.Printf(icslog.LOG_LEVEL_DEBUG2, c.ID, "### Decode() iter(%d), buf length %d %v", iter, len(buf), buf) - - c.m.Lock() - if c.IsStart() { - ok, frame, errDec := c.decoder.Decode(buf) - if !ok { - icserror.ICSERRCONVDecodeFail.SetError(errDec) - //icserror.ICSERRCONVDecodeFail.Print() - c.m.Unlock() - return nil, icserror.ICSERRCONVDecodeFail - } - - //fmt.Println("###frame len", iter, PCM_8K_16BIT_10MS_SIZE*iter, PCM_8K_16BIT_10MS_SIZE*(iter+1)) - //fmt.Println("###frame len", len(frame.Data[0]), len(frame.Data), frame) - copy(retBuf[PCM_8K_16BIT_10MS_SIZE*iter:PCM_8K_16BIT_10MS_SIZE*(iter+1)], frame.Data[0][:PCM_8K_16BIT_10MS_SIZE]) - } - c.m.Unlock() - - /* - f1, err := os.OpenFile("./tx.voice.raw", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) - if err != nil { - log.Fatal(err) - } - f1.Write(frame.Data[0][:PCM_8K_16BIT_10MS_SIZE]) - f1.Sync() - f1.Close() - */ - - iter++ - } - //fmt.Println("###retBuf len", len(retBuf), retBuf) - - return retBuf, nil -} diff --git a/icssessionmanager/icsanalyzertp.go b/icssessionmanager/icsanalyzertp.go deleted file mode 100644 index efe794f..0000000 --- a/icssessionmanager/icsanalyzertp.go +++ /dev/null @@ -1,76 +0,0 @@ -package icssessionmanager - -import ( - "strings" - - "gitlab.com/cinnamon/voiceagent/icserror" - "gitlab.com/cinnamon/voiceagent/icslog" - "gitlab.com/cinnamon/voiceagent/icspacketparser" - "gitlab.com/cinnamon/voiceagent/icssvc" - "gitlab.com/cinnamon/voiceagent/recorddata" -) - -func (s *IcsSession) analyzeRTP(rtp *icspacketparser.RTP) *icserror.IcsError { - l := icslog.GetIcsLog() - - RPT := rtp.GetPayloadType() - SPT := s.GetPayloadType() - if SPT == RPT { - if s.VoiceNeter == nil { - l.Print(icslog.LOG_LEVEL_ERROR, s.ID, icserror.ICSERRNETNotConnectError.GetMessage()) - return icserror.ICSERRNETNotConnectError - } - - voicedata := recorddata.NewVoiceData() - svc := icssvc.GetServiceStatus() - conf := svc.GetIcsConfig() - if strings.Compare(conf.HTTPConfig.SrcIP, rtp.SrcAddr.IPv4String) == 0 { //RX - //if strings.Compare(conf.PbxConfig.PbxIp, rtp.SrcAddr.IPv4String) == 0 { //RX - /*////////////////// - s.rxFile.Write(rtp.Payload) - */ ////////////////// - pcm, err := s.RxConverter.Decode(rtp.Payload) - if err != nil { - l.Print(icslog.LOG_LEVEL_ERROR, s.ID, err.GetMessage()) - return err - } - - if s.rxSeq == -1 { - s.rxSeq = int(rtp.Seq) - } - - voicedata.SetData(s.ServerID, s.Station, int32(rtp.Seq-uint16(s.rxSeq)), s.StartTimeStamp, "0", "0", pcm) - - wsize, err := s.VoiceNeter.Write(voicedata.GetData()) - if wsize == -1 || err != nil { - l.Printf(icslog.LOG_LEVEL_ERROR, s.ID, "RTP send error-%v", err.GetError()) - return err - } - } else { //TX - /*////////////////// - s.txFile.Write(rtp.Payload) - */ ////////////////// - pcm, err := s.TxConverter.Decode(rtp.Payload) - if err != nil { - l.Print(icslog.LOG_LEVEL_ERROR, s.ID, err.GetMessage()) - return err - } - - if s.txSeq == -1 { - s.txSeq = int(rtp.Seq) - } - - voicedata.SetData(s.ServerID, s.Station, int32(rtp.Seq-uint16(s.txSeq)), s.StartTimeStamp, "1", "0", pcm) - - wsize, err := s.VoiceNeter.Write(voicedata.GetData()) - if wsize == -1 || err != nil { - //l.Printf(icslog.LOG_LEVEL_ERROR, s.ID, "RTP send error-%v", err.GetError()) - return err - } - } - } else { - l.Print(icslog.LOG_LEVEL_ERROR, s.ID, "NO same payload type!!!") - } - - return nil -} diff --git a/icssessionmanager/icsanalyzesip.go b/icssessionmanager/icsanalyzesip.go deleted file mode 100644 index 5895ae4..0000000 --- a/icssessionmanager/icsanalyzesip.go +++ /dev/null @@ -1,211 +0,0 @@ -package icssessionmanager - -import ( - "strconv" - "strings" - "time" - - "gitlab.com/cinnamon/voiceagent/icserror" - "gitlab.com/cinnamon/voiceagent/icslog" - "gitlab.com/cinnamon/voiceagent/icsmediaconv" - "gitlab.com/cinnamon/voiceagent/icsnet" - "gitlab.com/cinnamon/voiceagent/icspacketparser" - "gitlab.com/cinnamon/voiceagent/icssvc" - "gitlab.com/cinnamon/voiceagent/recorddata/writecallsignal" -) - -func (s *IcsSession) analyzeSIP(sip *icspacketparser.SIP) *icserror.IcsError { - // fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>") - // fmt.Println("sip.Method", sip.Method) - // fmt.Println("sip.Version", sip.Version) - // fmt.Println("sip.Headers", sip.Headers) - // fmt.Println("sip.Source", sip.Source) - - // fmt.Printf("%+v\n", sip) - //fmt.Println(">>>>>>>>>>>>>>>>>>>>>>> sip.Method", sip.Method) - - l := icslog.GetIcsLog() - // fmt.Println(">>>>>>>>>>>>>>>>>>>>>>> sip.Method", sip.Method) - - if sip.Method == icspacketparser.ICS_SIP_METHOD_INVITE { - s.setSrcPort(sip) - - payload, err := s.setSDPMediaPayload(sip) - if err != nil { - return icserror.ICSERRSDPAudiotagPortValue - } else { - s.invitePayloads = payload - } - } else if strings.Contains(sip.Cseq, " INVITE") { - s.setDstPort(sip) - } - - if sip.Method == icspacketparser.ICS_SIP_METHOD_SIP20 && !s.isFoundPayload { - // fmt.Println(">>>>>>>>>>>>>>> ICS_SIP_METHOD_SIP20", sip.ResType, sip.ContentType, sip.ContentLength) - if strings.Contains(sip.ContentType, "sdp") && sip.ContentLength > 0 { - payload, err := s.compareSDPMediaPayload(sip) - if err != nil { - return icserror.ICSERRSDPAudiotagPortValue - } else { - s.isFoundPayload = true - s.payloadType = icspacketparser.PayloadType(payload) - //fmt.Println("s.payload >>>>>>>>>>>>>>>", s.payloadType) - - //create media decoder - var cerr *icserror.IcsError - s.TxConverter, cerr = icsmediaconv.NewConverter(s.ID, s.payloadType) - if cerr != nil { - //s.isFoundPayload = false - //cerr.Print() - l.Printf(icslog.LOG_LEVEL_FATAL, s.ID, "Failed to New Tx Converter-%v", cerr) - s.SendVoiceGatewayByeSignal() - return cerr - } else { - l.Print(icslog.LOG_LEVEL_INFO, s.ID, "New Tx Converter(Decoder)") - } - s.RxConverter, cerr = icsmediaconv.NewConverter(s.ID, s.payloadType) - if cerr != nil { - //s.isFoundPayload = false - l.Printf(icslog.LOG_LEVEL_FATAL, s.ID, "Failed to New Rx Converter-%v", cerr) - s.SendVoiceGatewayByeSignal() - return cerr - } else { - l.Print(icslog.LOG_LEVEL_INFO, s.ID, "New Rx Converter(Decoder)") - } - - //init VoiceAgent net - conf := icssvc.GetServiceStatus().GetIcsConfig() - if conf != nil { - //set call signal remote addr - csraddr := icsnet.NewNetAddrWithIPPort("127.0.0.1", 1111) - csladdr := icsnet.NewNetAddrWithIPPort("127.0.0.1", 2222) - //csraddr := icsnet.NewNetAddrWithIPPort(conf.VoiceAgentConfig.AgentAddr.VoiceAgentIP, conf.VoiceAgentConfig.AgentAddr.CallSignalPort) - //csladdr := icsnet.NewNetAddrWithIPPort(conf.VoiceAgentConfig.MyAddr.ServerIP, conf.VoiceAgentConfig.MyAddr.ServerPort) - - //set Voice remote addr - vraddr := icsnet.NewNetAddrWithIPPort("127.0.0.1", 3333) - //vraddr := icsnet.NewNetAddrWithIPPort(conf.VoiceAgentConfig.AgentAddr.VoiceAgentIP, conf.VoiceAgentConfig.AgentAddr.VoicePort) - //vladdr := icsnet.NewNetAddrWithIPPort(conf.VoiceAgentConfig.MyAddr.ServerIP, conf.VoiceAgentConfig.MyAddr.BasePort) - - s.VoiceNeter = icsnet.NewUDP(nil, &vraddr) - //s.VoiceNeter = icsnet.NewUDP(&vladdr, &vraddr) - conerr := s.VoiceNeter.Connect() - if conerr != nil { - l.Printf(icslog.LOG_LEVEL_ERROR, s.ID, "Error init Voice Neter[%s->%s]-%v", s.VoiceNeter.LocalAddr().String(), vraddr.String(), conerr.GetError()) - s.SendVoiceGatewayByeSignal() - return conerr - } - l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Voice(UDP) Connected to VoiceAgent[%s->%s]", s.VoiceNeter.LocalAddr().String(), vraddr.String()) - - //send call signal data to VoiceAgent - defer func() { - if err := recover(); err != nil { - l.Print(icslog.LOG_LEVEL_WARN, s.ID, icserror.ICSERRNETNotConnectError.GetMessage()) - } - }() - var inout string = "O" - if s.GetDirection() { - inout = "I" - } - callsignal := writecallsignal.NewCallSignalData() - //callsignal := recorddata.NewCallSignalData() - //s.StartTimeStamp = time.Now().UnixNano() / 1e6 - s.StartTimeStamp = time.Now().UnixNano() - callsignal.SetData(s.ChannelID, s.ServerID, s.Station, "CUSTID", s.StartTimeStamp, 0, "S", inout) - wlen, werr := icsnet.SendCallSignal(&csladdr, &csraddr, callsignal.GetData()) - if werr == nil { - l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Transmitted Call-Start signal to VoiceAgent(%d)", wlen) - } - } - } - } - } - - return nil -} - -func (s *IcsSession) setSrcPort(sip *icspacketparser.SIP) *icserror.IcsError { - if sip.Content == nil { - //error 처리 invite인데, sdp 데이터가 없음 - return icserror.ICSERRINVITERequired - } else { - // fmt.Println("sdpMedias", *sip.Content.Media) - port, err := s.findSDPMediaAudioPort(sip) - if err != nil { - return icserror.ICSERRSDPAudiotagPortValue - } else { - s.srcPort = port - } - } - return nil -} - -func (s *IcsSession) setDstPort(sip *icspacketparser.SIP) *icserror.IcsError { - // fmt.Println(">>>>>>>>>>>>>>>>>>>>>>> sip.Cseq", sip.Cseq, sip.Method) - if sip.Method == icspacketparser.ICS_SIP_METHOD_SIP20 && sip.ResType == "200" { - if sip.Content == nil { - //error 처리 INVITE처리의 200 OK인데, sdp 데이터가 없음 - return icserror.ICSERR200OKRequired - } else { - // fmt.Println("sdpMedias", *sip.Content.Media) - port, err := s.findSDPMediaAudioPort(sip) - if err != nil { - return icserror.ICSERRSDPAudiotagPortValue - } else { - s.dstPort = port - } - } - } else if sip.Method == icspacketparser.ICS_SIP_METHOD_BYE { - //fmt.Println(">>>>>>>>>>> haup up event") - // s.RemoveSession() - } - return nil -} - -func (s *IcsSession) findSDPMediaAudioPort(sip *icspacketparser.SIP) (int, *icserror.IcsError) { - for _, value := range *sip.Content.Media { - if strings.Contains(value.MediaDescription, "audio ") { - arrSdpMedia := strings.Split(value.MediaDescription, " ") - port, err := strconv.Atoi(arrSdpMedia[1]) - if err != nil { - return -1, icserror.ICSERRSDPAudiotagPortValue - } else { - //fmt.Println(">>>>>>>>>>>>>>>>>>>>>>> port", port) - return port, nil - } - } else { - return -1, icserror.ICSERRNotFoundSdpMedia - } - } - return -1, icserror.ICSERRNotFoundSdpMedia -} - -func (s *IcsSession) setSDPMediaPayload(sip *icspacketparser.SIP) ([]string, *icserror.IcsError) { - for _, value := range *sip.Content.Media { - if strings.Contains(value.MediaDescription, "audio ") { - //fmt.Println("value.Payload >>>>>>>>>>>", value.Payload) - return value.Payload, nil - } else { - return nil, icserror.ICSERRNotFoundSdpMedia - } - } - return nil, icserror.ICSERRNotFoundSdpMedia -} - -func (s *IcsSession) compareSDPMediaPayload(sip *icspacketparser.SIP) (int, *icserror.IcsError) { - for _, value := range *sip.Content.Media { - for _, thisPayload := range value.Payload { - for _, invitePayload := range s.invitePayloads { - if thisPayload == invitePayload { - payload, err := strconv.Atoi(thisPayload) - if err != nil { - return -1, icserror.ICSERRSDPAudiotagPortValue - } else { - return payload, nil - } - } - } - } - } - return -1, icserror.ICSERRNotFoundSdpMedia -} diff --git a/icssessionmanager/icssession.go b/icssessionmanager/icssession.go index d9c8262..61f399a 100644 --- a/icssessionmanager/icssession.go +++ b/icssessionmanager/icssession.go @@ -14,7 +14,6 @@ import ( "gitlab.com/cinnamon/voiceagent/icsevent" "gitlab.com/cinnamon/voiceagent/icshttpclient" "gitlab.com/cinnamon/voiceagent/icslog" - "gitlab.com/cinnamon/voiceagent/icsmediaconv" "gitlab.com/cinnamon/voiceagent/icsnet" "gitlab.com/cinnamon/voiceagent/icspacketparser" "gitlab.com/cinnamon/voiceagent/icssvc" @@ -23,7 +22,6 @@ import ( "gitlab.com/cinnamon/voiceagent/recorddata/readcallsignal" "gitlab.com/cinnamon/voiceagent/recorddata/responsecs" "gitlab.com/cinnamon/voiceagent/stt" - "gitlab.com/ics_cinnamon/joy4/format" ) type IcsSession struct { @@ -52,13 +50,13 @@ type IcsSession struct { invitePayloads []string payloadType icspacketparser.PayloadType isFoundPayload bool - TxConverter *icsmediaconv.Converter - RxConverter *icsmediaconv.Converter - txSeq int //first TX seq num - rxSeq int //first RX seq num - STTTx *stt.STT - STTRx *stt.STT - cs *readcallsignal.CallSignal + // TxConverter *icsmediaconv.Converter + // RxConverter *icsmediaconv.Converter + txSeq int //first TX seq num + rxSeq int //first RX seq num + STTTx *stt.STT + STTRx *stt.STT + cs *readcallsignal.CallSignal isSTTStartTimer *time.Timer isSTTStart bool @@ -107,12 +105,12 @@ const ( ////////////////////////////////////////////////////////////////// //session routine -//init ffmpeg -func init() { - format.RegisterAll() -} +// init ffmpeg +// func init() { +// format.RegisterAll() +// } -//on/off check the session idle +// on/off check the session idle func (s *IcsSession) Start() { s.SetTimestamp(time.Now()) @@ -358,13 +356,13 @@ func (s *IcsSession) Run() *icserror.IcsError { */ case icspacketparser.SIP: l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Get SIP Event[%d]", evt.ID) - sip := v - s.analyzeSIP(&sip) + // sip := v + // s.analyzeSIP(&sip) case icspacketparser.RTP: //l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Get RTP Event[%d]", evt.ID) - rtp := v + // rtp := v //fmt.Println(rtp) - s.analyzeRTP(&rtp) + // s.analyzeRTP(&rtp) //default: //fmt.Println(time.Now(), "NOT DEFINED EVENT TYPE!!!!!!!!!!!!!!!!!") default: diff --git a/icssessionmanager/sessionoperator.go b/icssessionmanager/sessionoperator.go index 59fe562..0df9b7a 100644 --- a/icssessionmanager/sessionoperator.go +++ b/icssessionmanager/sessionoperator.go @@ -17,8 +17,8 @@ import ( "gitlab.com/cinnamon/voiceagent/recorddata/responsecs" ) -////////////////////////////////////////////////////////////////// -//session operator +// //////////////////////////////////////////////////////////////// +// session operator func findSessionWithCallID(callId string) *IcsSession { sessions := getSessionInstance() for _, session := range sessions { @@ -256,14 +256,14 @@ func (s *IcsSession) RemoveSession() *icserror.IcsError { s.sstation = e.sstation s.isFoundPayload = false - if s.RxConverter != nil { - s.RxConverter.Close() - s.RxConverter = nil - } - if s.TxConverter != nil { - s.TxConverter.Close() - s.TxConverter = nil - } + // if s.RxConverter != nil { + // s.RxConverter.Close() + // s.RxConverter = nil + // } + // if s.TxConverter != nil { + // s.TxConverter.Close() + // s.TxConverter = nil + // } s.botStatus = nil s.botToken = "" @@ -313,8 +313,7 @@ func (s *IcsSession) CheckSignalMethod(sip icspacketparser.SIP) *icserror.IcsErr return nil } -////////////////////////////////////////////////////////////////// -// +// //////////////////////////////////////////////////////////////// func (s *IcsSession) SetTimestamp(now time.Time) { s.lastTimestamp = now } @@ -412,8 +411,8 @@ func (s *IcsSession) SendVoiceGatewayBotByeSignal(url string, custid string, sst } } -////////////////////////////////////////// -//DTMF +// //////////////////////////////////////// +// DTMF // add DTMF func (s *IcsSession) AddDtmf() { inputDtmf := s.cs.InOut