시나리오 바진, STTMAXTIME 추가

main
JungJun 3 years ago
parent bea4919fdc
commit 0eb6110d8e

@ -314,8 +314,10 @@ func (c IcsConfig) ShowConfig() string {
} }
type ScenarioConfig struct { type ScenarioConfig struct {
Order []string `xml:"method,attr"` Order []string `xml:"method,attr"`
Value []string `xml:"value,attr"` Value []string `xml:"value,attr"`
BargeIn []string `xml:"bargeIn,attr"`
SttMaxTime []int `xml:"sttMaxTime,attr"`
} }
type SimConfig struct { type SimConfig struct {

@ -179,71 +179,82 @@ func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) {
// 현재 들어온 method로 분기 // 현재 들어온 method로 분기
// next 시나리오로 넘겨주기 // next 시나리오로 넘겨주기
if request.Method == "HANGUP" { fmt.Printf("response %+v", request)
s.ByeCheck(request.Method, request.Token) if request.Method != "INIT" && request.TalkText == "" {
response.ResultCode = 200
response.Token = request.Token
response.Action = "END"
response.AnounceMents = "서비스에 장애가 발생하였습니다. 상담사를 연결해드리겠습니다."
response.Data.BargeIn = "Y"
response.Data.RecodingFile = "Y"
response.Data.SttMaxTime = 0
} else { } else {
switch request.Method { if request.Method == "HANGUP" {
case "INIT": s.ByeCheck(request.Method, request.Token)
token := createToken(request.CallId) } else {
response.ResultCode = 200 switch request.Method {
response.Token = token case "INIT":
response.Action = scnarioConf.Order[1] token := createToken(request.CallId)
response.AnounceMents = scnarioConf.Value[0] response.ResultCode = 200
response.Data.BargeIn = "N" response.Token = token
response.Data.RecodingFile = "Y" response.Action = scnarioConf.Order[1]
response.Data.SttMaxTime = 4 response.AnounceMents = scnarioConf.Value[0]
response.Data.BargeIn = scnarioConf.BargeIn[0]
s.m.Lock() response.Data.RecodingFile = "Y"
s.session[token] = ResStatus{Count: 1, Status: scnarioConf.Order[0]} response.Data.SttMaxTime = scnarioConf.SttMaxTime[0]
s.m.Unlock()
case "STT": s.m.Lock()
response.ResultCode = 200 s.session[token] = ResStatus{Count: 1, Status: scnarioConf.Order[0]}
response.Token = request.Token s.m.Unlock()
response.Action = scnarioConf.Order[s.session[request.Token].Count+1] case "STT":
response.AnounceMents = scnarioConf.Value[s.session[request.Token].Count] response.ResultCode = 200
response.Data.BargeIn = "N" response.Token = request.Token
response.Data.RecodingFile = "Y" response.Action = scnarioConf.Order[s.session[request.Token].Count+1]
response.Data.SttMaxTime = 4 response.AnounceMents = scnarioConf.Value[s.session[request.Token].Count]
response.Data.BargeIn = scnarioConf.BargeIn[s.session[request.Token].Count]
s.m.Lock() response.Data.RecodingFile = "Y"
s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf.Order[s.session[request.Token].Count+1]} response.Data.SttMaxTime = scnarioConf.SttMaxTime[s.session[request.Token].Count]
s.m.Unlock()
case "DTMF": s.m.Lock()
response.ResultCode = 200 s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf.Order[s.session[request.Token].Count+1]}
response.Token = request.Token s.m.Unlock()
response.Action = scnarioConf.Order[s.session[request.Token].Count+1] case "DTMF":
response.AnounceMents = scnarioConf.Value[s.session[request.Token].Count] response.ResultCode = 200
response.Data.BargeIn = "N" response.Token = request.Token
response.Data.RecodingFile = "Y" response.Action = scnarioConf.Order[s.session[request.Token].Count+1]
response.Data.SttMaxTime = 3 response.AnounceMents = scnarioConf.Value[s.session[request.Token].Count]
response.Data.BargeIn = "N"
s.m.Lock() response.Data.RecodingFile = "Y"
s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf.Order[s.session[request.Token].Count+1]} response.Data.SttMaxTime = 3
s.m.Unlock()
case "REFER": s.m.Lock()
response.Data.TelNo = "010-1234-1234" s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf.Order[s.session[request.Token].Count+1]}
s.m.Unlock()
s.m.Lock() case "REFER":
s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf.Order[s.session[request.Token].Count+1]} response.Data.TelNo = "010-1234-1234"
s.m.Unlock()
case "BYE": // 전화 종료 요청 s.m.Lock()
response.ResultCode = 200 s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf.Order[s.session[request.Token].Count+1]}
response.Token = request.Token s.m.Unlock()
response.Action = "END" case "BYE": // 전화 종료 요청
response.AnounceMents = "접수가 완료되었습니다." response.ResultCode = 200
response.Data.BargeIn = "Y" response.Token = request.Token
response.Data.RecodingFile = "Y" response.Action = "END"
response.Data.SttMaxTime = 0 response.AnounceMents = "접수가 완료되었습니다."
// case "HANGUP": response.Data.BargeIn = "Y"
// response.ResultCode = 200 response.Data.RecodingFile = "Y"
// response.Token = request.Token response.Data.SttMaxTime = 0
// response.Action = "" // case "HANGUP":
// response.AnounceMents = "" // response.ResultCode = 200
// response.Data.BargeIn = "" // response.Token = request.Token
// response.Data.RecodingFile = "" // response.Action = ""
// response.Data.SttMaxTime = 0 // response.AnounceMents = ""
// if ByeCheck(request.Method, request.Token) { // response.Data.BargeIn = ""
// } // response.Data.RecodingFile = ""
// response.Data.SttMaxTime = 0
// if ByeCheck(request.Method, request.Token) {
// }
}
} }
} }

Loading…
Cancel
Save