From efcbe63597f2f6b2ced5bf044b9ab154158edc2e Mon Sep 17 00:00:00 2001 From: JungJun Date: Thu, 14 Jul 2022 16:26:36 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=ED=95=B4=EB=AA=BB=ED=95=98=EB=8A=94?= =?UTF-8?q?=20count=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- icshttp/handler.go | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/icshttp/handler.go b/icshttp/handler.go index da992b7..a035062 100644 --- a/icshttp/handler.go +++ b/icshttp/handler.go @@ -68,8 +68,9 @@ type ResData struct { } type ResStatus struct { - Count int - Status string + Count int + Status string + NotUnderstand int } type ScenarioSession struct { @@ -180,11 +181,24 @@ func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) { // 현재 들어온 method로 분기 // next 시나리오로 넘겨주기 fmt.Printf("response %+v", request) - if request.Method != "INIT" && request.TalkText == "" { + if request.Method == "HANGUP" { + response.ResultCode = 200 + response.Token = request.Token + response.Action = "" + response.AnounceMents = "" + response.Data.BargeIn = "" + response.Data.RecodingFile = "" + response.Data.SttMaxTime = 10 + } else if request.Method != "INIT" && request.TalkText == "" { response.ResultCode = 200 response.Token = request.Token response.Action = "END" - response.AnounceMents = "잘 이해하지 못했습니다. 다시 말씀해주세요." + if s.session[request.Token].NotUnderstand == 3 { + response.AnounceMents = "잘 이해하지 못했습니다. 정확한 상담을 위해 매장으로 연결해드릴게요." + } else { + response.AnounceMents = "잘 이해하지 못했습니다. 다시 말씀해주세요." + s.session[request.Token] = ResStatus{Count: 1, Status: scnarioConf.Order[0], NotUnderstand: s.session[request.Token].NotUnderstand + 1} + } response.Data.BargeIn = "" response.Data.RecodingFile = "" response.Data.SttMaxTime = 10 @@ -204,7 +218,7 @@ func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) { response.Data.SttMaxTime = scnarioConf.SttMaxTime[0] s.m.Lock() - s.session[token] = ResStatus{Count: 1, Status: scnarioConf.Order[0]} + s.session[token] = ResStatus{Count: 1, Status: scnarioConf.Order[0], NotUnderstand: 0} s.m.Unlock() case "STT": response.ResultCode = 200