|
|
@ -222,6 +222,7 @@ func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) {
|
|
|
|
response.Data.RecodingFile = "Y"
|
|
|
|
response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
|
|
s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count, Status: scnarioConf[dnis][s.session[request.Token].Count].Action}
|
|
|
|
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 {
|
|
|
|
} else {
|
|
|
|
switch request.Method {
|
|
|
|
switch request.Method {
|
|
|
@ -246,46 +247,45 @@ func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) {
|
|
|
|
response.Data.RecodingFile = "Y"
|
|
|
|
response.Data.RecodingFile = "Y"
|
|
|
|
s.session[token] = ResStatus{Count: 1, Status: scnarioConf[dnis][1].Action, NotUnderstand: 0, PreEventNum: 1}
|
|
|
|
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{}
|
|
|
|
// 맵을 JSON으로 마샬링
|
|
|
|
uuiMap := map[string]interface{}{
|
|
|
|
uuiJSON, err := json.Marshal(uuiMap)
|
|
|
|
"test1": "testdata1231",
|
|
|
|
if err != nil {
|
|
|
|
"test2": 123,
|
|
|
|
l.Printf(icslog.LOG_LEVEL_ERROR, -1, "Error marshaling UUI: %v", err)
|
|
|
|
"test3": 0.1,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 맵을 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로 변환
|
|
|
|
// 마샬링된 JSON을 json.RawMessage로 변환
|
|
|
|
response.Data.UUI = json.RawMessage(uuiJSON)
|
|
|
|
response.Data.UUI = json.RawMessage(uuiJSON)
|
|
|
|
response.Data.TelNo = request.TelNo
|
|
|
|
response.Data.TelNo = request.TelNo
|
|
|
|
// s.m.Unlock()
|
|
|
|
// s.m.Unlock()
|
|
|
|
// response marshal
|
|
|
|
// response marshal
|
|
|
|
|
|
|
|
|
|
|
|
resMarshal, jerr := json.Marshal(response)
|
|
|
|
resMarshal, jerr := json.Marshal(response)
|
|
|
|
if jerr != nil {
|
|
|
|
if jerr != nil {
|
|
|
|
l.Printf(icslog.LOG_LEVEL_ERROR, -1, "Json Marshal error %v", jerr)
|
|
|
|
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, "%+v", response)
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, -1, "Send Message\n %s", string(resMarshal))
|
|
|
|
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 {
|
|
|
|
// 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)
|
|
|
|
// 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)))
|
|
|
|
// time.Sleep(time.Second * time.Duration(time.Duration(scnarioConf[dnis][s.session[request.Token].Count].TimeSleep)))
|
|
|
|
// } else {
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
time.Sleep(time.Second * 1)
|
|
|
|
time.Sleep(time.Second * 1)
|
|
|
|
// send response
|
|
|
|
// send response
|
|
|
|
fmt.Fprintln(w, string(resMarshal))
|
|
|
|
fmt.Fprintln(w, string(resMarshal))
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func createToken(callId string) string {
|
|
|
|
func createToken(callId string) string {
|
|
|
|