From 144931542c117cc16fc7516603a9a2944091d63e Mon Sep 17 00:00:00 2001 From: jiyoungcheon Date: Mon, 13 Jan 2025 00:35:07 -0500 Subject: [PATCH] =?UTF-8?q?}=20=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- icshttp/handler.go | 66 +++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/icshttp/handler.go b/icshttp/handler.go index 3446531..9938f34 100644 --- a/icshttp/handler.go +++ b/icshttp/handler.go @@ -222,6 +222,7 @@ func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) { response.Data.RecodingFile = "Y" s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count, Status: scnarioConf[dnis][s.session[request.Token].Count].Action} + l.Printf(icslog.LOG_LEVEL_INFO, -1, "response.Data: %+v", response.Data) } else { switch request.Method { @@ -246,46 +247,45 @@ func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) { response.Data.RecodingFile = "Y" s.session[token] = ResStatus{Count: 1, Status: scnarioConf[dnis][1].Action, NotUnderstand: 0, PreEventNum: 1} } + } + response.Data.UUI = json.RawMessage{} + uuiMap := map[string]interface{}{ + "test1": "testdata1231", + "test2": 123, + "test3": 0.1, + } - response.Data.UUI = json.RawMessage{} - uuiMap := map[string]interface{}{ - "test1": "testdata1231", - "test2": 123, - "test3": 0.1, - } - - // 맵을 JSON으로 마샬링 - uuiJSON, err := json.Marshal(uuiMap) - if err != nil { - l.Printf(icslog.LOG_LEVEL_ERROR, -1, "Error marshaling UUI: %v", err) + // 맵을 JSON으로 마샬링 + uuiJSON, err := json.Marshal(uuiMap) + if err != nil { + l.Printf(icslog.LOG_LEVEL_ERROR, -1, "Error marshaling UUI: %v", err) - return - } + return + } - // 마샬링된 JSON을 json.RawMessage로 변환 - response.Data.UUI = json.RawMessage(uuiJSON) - response.Data.TelNo = request.TelNo - // s.m.Unlock() - // response marshal + // 마샬링된 JSON을 json.RawMessage로 변환 + response.Data.UUI = json.RawMessage(uuiJSON) + response.Data.TelNo = request.TelNo + // s.m.Unlock() + // response marshal - resMarshal, jerr := json.Marshal(response) - if jerr != nil { - l.Printf(icslog.LOG_LEVEL_ERROR, -1, "Json Marshal error %v", jerr) - } - l.Printf(icslog.LOG_LEVEL_INFO, -1, "%+v", response) - l.Printf(icslog.LOG_LEVEL_INFO, -1, "Send Message\n %s", string(resMarshal)) + resMarshal, jerr := json.Marshal(response) + if jerr != nil { + l.Printf(icslog.LOG_LEVEL_ERROR, -1, "Json Marshal error %v", jerr) + } + l.Printf(icslog.LOG_LEVEL_INFO, -1, "%+v", response) + l.Printf(icslog.LOG_LEVEL_INFO, -1, "Send Message\n %s", string(resMarshal)) - // if s.session[request.Token].Count < len(scnarioConf[dnis]) && scnarioConf[dnis][s.session[request.Token].Count].TimeValue { - // l.Printf(icslog.LOG_LEVEL_INFO, -1, "Time Sleep %d \r\n", scnarioConf[dnis][s.session[request.Token].Count].TimeSleep) - // time.Sleep(time.Second * time.Duration(time.Duration(scnarioConf[dnis][s.session[request.Token].Count].TimeSleep))) - // } else { + // if s.session[request.Token].Count < len(scnarioConf[dnis]) && scnarioConf[dnis][s.session[request.Token].Count].TimeValue { + // l.Printf(icslog.LOG_LEVEL_INFO, -1, "Time Sleep %d \r\n", scnarioConf[dnis][s.session[request.Token].Count].TimeSleep) + // time.Sleep(time.Second * time.Duration(time.Duration(scnarioConf[dnis][s.session[request.Token].Count].TimeSleep))) + // } else { - // } - time.Sleep(time.Second * 1) - // send response - fmt.Fprintln(w, string(resMarshal)) + // } + time.Sleep(time.Second * 1) + // send response + fmt.Fprintln(w, string(resMarshal)) - } } func createToken(callId string) string {