|
|
|
@ -7,7 +7,6 @@ import (
|
|
|
|
|
"io/ioutil"
|
|
|
|
|
"math/big"
|
|
|
|
|
"net/http"
|
|
|
|
|
"strconv"
|
|
|
|
|
"strings"
|
|
|
|
|
"sync"
|
|
|
|
|
"time"
|
|
|
|
@ -332,282 +331,283 @@ func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
response.Data.RecodingFile = "Y"
|
|
|
|
|
//s.m.Lock()
|
|
|
|
|
s.session[token] = ResStatus{Count: 1, Status: scnarioConf[dnis][0].Action, NotUnderstand: 0, PreEventNum: 1}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// case "STT", "DTMF", "BOTH", "MEMO", "NONE":
|
|
|
|
|
// l.Printf(icslog.LOG_LEVEL_INFO, -1, "여기는 언제 타는거지지")
|
|
|
|
|
// response.ResultCode = 200
|
|
|
|
|
// response.Token = request.Token
|
|
|
|
|
// if dnis == "9013" || dnis == "9014" {
|
|
|
|
|
// response.Action = scnarioConf[dnis][s.session[request.Token].Count+1].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][s.session[request.Token].Count+1].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][s.session[request.Token].Count+1].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][s.session[request.Token].Count+1].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][s.session[request.Token].Count+1].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][s.session[request.Token].Count+1].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][s.session[request.Token].Count+1].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][s.session[request.Token].Count+1].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][s.session[request.Token].Count+1].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][s.session[request.Token].Count+1].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][s.session[request.Token].Count+1].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][s.session[request.Token].Count+1].DigitTerm
|
|
|
|
|
// response.AnnounceFilePath = scnarioConf[dnis][s.session[request.Token].Count+1].AudioFilePath
|
|
|
|
|
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][s.session[request.Token].Count+1].Action}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// } else if dnis == "9012" {
|
|
|
|
|
// response.Action = scnarioConf[dnis][1].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][1].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][1].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][1].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][1].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][1].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][1].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][1].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][1].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][1].MaxDigit
|
|
|
|
|
// // response.Data.EndCharacter = []string{scnarioConf[dnis][1].EndCharacter}
|
|
|
|
|
// // response.Data.DigitTerm = scnarioConf[dnis][s.session[request.Token].Count+1].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][1].Action}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// } else if dnis == "1000" {
|
|
|
|
|
// preEventNum := s.session[request.Token].PreEventNum
|
|
|
|
|
// fmt.Printf("\n num %+v\n", preEventNum)
|
|
|
|
|
// switch preEventNum {
|
|
|
|
|
// case 1:
|
|
|
|
|
// actionNum, err := strconv.Atoi(request.TalkText)
|
|
|
|
|
// if err == nil {
|
|
|
|
|
// response.Action = scnarioConf[dnis][actionNum+2].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][actionNum+2].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][actionNum+2].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][actionNum+2].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][actionNum+2].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][actionNum+2].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][actionNum+2].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][actionNum+2].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][actionNum+2].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][actionNum+2].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][actionNum+2].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][actionNum+2].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][actionNum+2].Action, PreEventNum: actionNum + 2}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// } else {
|
|
|
|
|
// response.Action = scnarioConf[dnis][1].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][1].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][1].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][1].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][1].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][1].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][1].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][1].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][1].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][1].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][1].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][1].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][1].Action, PreEventNum: 1}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// }
|
|
|
|
|
// case 2:
|
|
|
|
|
// actionNum, err := strconv.Atoi(request.TalkText)
|
|
|
|
|
// if err == nil {
|
|
|
|
|
// if actionNum == 1 {
|
|
|
|
|
// response.Action = scnarioConf[dnis][s.session[request.Token].PreEventNum2].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][s.session[request.Token].PreEventNum2].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][s.session[request.Token].PreEventNum2].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][s.session[request.Token].PreEventNum2].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][s.session[request.Token].PreEventNum2].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][s.session[request.Token].PreEventNum2].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][s.session[request.Token].PreEventNum2].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][s.session[request.Token].PreEventNum2].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][s.session[request.Token].PreEventNum2].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][s.session[request.Token].PreEventNum2].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][s.session[request.Token].PreEventNum2].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][s.session[request.Token].PreEventNum2].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][s.session[request.Token].PreEventNum2].Action, PreEventNum: s.session[request.Token].PreEventNum2}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// } else {
|
|
|
|
|
// response.Action = scnarioConf[dnis][1].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][1].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][1].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][1].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][1].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][1].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][1].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][1].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][1].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][1].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][1].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][1].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][1].Action, PreEventNum: 1, PreEventNum2: 1}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
// response.Action = scnarioConf[dnis][1].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][1].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][1].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][1].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][1].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][1].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][1].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][1].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][1].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][1].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][1].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][1].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][1].Action, PreEventNum: 1}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// }
|
|
|
|
|
// default:
|
|
|
|
|
|
|
|
|
|
// response.Action = scnarioConf[dnis][2].Action
|
|
|
|
|
// response.AnounceMents = "결과 " + request.TalkText + " " + scnarioConf[dnis][2].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][2].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][2].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][2].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][2].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][2].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][2].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][2].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][2].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][2].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][2].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][2].Action, PreEventNum: 2, PreEventNum2: s.session[request.Token].PreEventNum}
|
|
|
|
|
// //s.m.Unlock()
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// //시뮬레이터
|
|
|
|
|
// response.Action = scnarioConf[dnis][s.session[request.Token].Count].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][s.session[request.Token].Count].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][s.session[request.Token].Count].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][s.session[request.Token].Count].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][s.session[request.Token].Count].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][s.session[request.Token].Count].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][s.session[request.Token].Count].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][s.session[request.Token].Count].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][s.session[request.Token].Count].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][s.session[request.Token].Count].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][s.session[request.Token].Count+1].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][s.session[request.Token].Count].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// if s.session[request.Token].LoopCount > 100 {
|
|
|
|
|
// s.session[request.Token] = ResStatus{LoopCount: s.session[request.Token].LoopCount, Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][s.session[request.Token].Count].Action}
|
|
|
|
|
// } else {
|
|
|
|
|
// s.session[request.Token] = ResStatus{LoopCount: s.session[request.Token].LoopCount + 1, Count: s.session[request.Token].Count, Status: scnarioConf[dnis][s.session[request.Token].Count].Action}
|
|
|
|
|
// }
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// case "REFER":
|
|
|
|
|
// response.ResultCode = 200
|
|
|
|
|
// response.Token = request.Token
|
|
|
|
|
// response.Action = "TRANSFER"
|
|
|
|
|
// response.AnounceMents = "네. 매장으로 연결해드릴게요."
|
|
|
|
|
// response.Data.BargeIn = ""
|
|
|
|
|
// response.Data.RecodingFile = ""
|
|
|
|
|
// response.Data.SttMaxTime = 0
|
|
|
|
|
// response.Data.TelNo = request.TelNo
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][s.session[request.Token].Count+1].Action}
|
|
|
|
|
// case "TRANSFER":
|
|
|
|
|
// response.ResultCode = 200
|
|
|
|
|
// response.Token = request.Token
|
|
|
|
|
// response.Action = "TRANSFER"
|
|
|
|
|
// response.AnounceMents = "네. 매장으로 연결해드릴게요."
|
|
|
|
|
// response.Data.BargeIn = ""
|
|
|
|
|
// response.Data.RecodingFile = ""
|
|
|
|
|
// response.Data.SttMaxTime = 0
|
|
|
|
|
// response.Data.TelNo = request.TelNo
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][s.session[request.Token].Count+1].Action}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
|
|
|
|
|
// case "TRNASFER2": // 전화 종료 요청
|
|
|
|
|
// response.ResultCode = 200
|
|
|
|
|
// response.Token = request.Token
|
|
|
|
|
// response.Action = "TRANSFER2"
|
|
|
|
|
// response.AnounceMents = "네. 매장으로 연결해드릴게요."
|
|
|
|
|
// response.Data.BargeIn = ""
|
|
|
|
|
// response.Data.RecodingFile = ""
|
|
|
|
|
// response.Data.SttMaxTime = 0
|
|
|
|
|
// response.Data.TelNo = request.TelNo
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][s.session[request.Token].Count+1].Action}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
|
|
|
|
|
// response.Token = request.Token
|
|
|
|
|
// response.Action = "END"
|
|
|
|
|
// response.AnounceMents = "접수가 완료되었습니다."
|
|
|
|
|
// response.Data.BargeIn = "N"
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
// response.Data.SttMaxTime = 0
|
|
|
|
|
// }
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// case "STT", "DTMF", "BOTH", "MEMO", "NONE":
|
|
|
|
|
// l.Printf(icslog.LOG_LEVEL_INFO, -1, "여기는 언제 타는거지지")
|
|
|
|
|
// response.ResultCode = 200
|
|
|
|
|
// response.Token = request.Token
|
|
|
|
|
// if dnis == "9013" || dnis == "9014" {
|
|
|
|
|
// response.Action = scnarioConf[dnis][s.session[request.Token].Count+1].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][s.session[request.Token].Count+1].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][s.session[request.Token].Count+1].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][s.session[request.Token].Count+1].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][s.session[request.Token].Count+1].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][s.session[request.Token].Count+1].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][s.session[request.Token].Count+1].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][s.session[request.Token].Count+1].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][s.session[request.Token].Count+1].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][s.session[request.Token].Count+1].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][s.session[request.Token].Count+1].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][s.session[request.Token].Count+1].DigitTerm
|
|
|
|
|
// response.AnnounceFilePath = scnarioConf[dnis][s.session[request.Token].Count+1].AudioFilePath
|
|
|
|
|
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][s.session[request.Token].Count+1].Action}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// } else if dnis == "9012" {
|
|
|
|
|
// response.Action = scnarioConf[dnis][1].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][1].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][1].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][1].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][1].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][1].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][1].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][1].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][1].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][1].MaxDigit
|
|
|
|
|
// // response.Data.EndCharacter = []string{scnarioConf[dnis][1].EndCharacter}
|
|
|
|
|
// // response.Data.DigitTerm = scnarioConf[dnis][s.session[request.Token].Count+1].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][1].Action}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// } else if dnis == "1000" {
|
|
|
|
|
// preEventNum := s.session[request.Token].PreEventNum
|
|
|
|
|
// fmt.Printf("\n num %+v\n", preEventNum)
|
|
|
|
|
// switch preEventNum {
|
|
|
|
|
// case 1:
|
|
|
|
|
// actionNum, err := strconv.Atoi(request.TalkText)
|
|
|
|
|
// if err == nil {
|
|
|
|
|
// response.Action = scnarioConf[dnis][actionNum+2].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][actionNum+2].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][actionNum+2].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][actionNum+2].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][actionNum+2].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][actionNum+2].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][actionNum+2].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][actionNum+2].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][actionNum+2].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][actionNum+2].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][actionNum+2].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][actionNum+2].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][actionNum+2].Action, PreEventNum: actionNum + 2}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// } else {
|
|
|
|
|
// response.Action = scnarioConf[dnis][1].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][1].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][1].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][1].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][1].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][1].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][1].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][1].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][1].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][1].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][1].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][1].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][1].Action, PreEventNum: 1}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// }
|
|
|
|
|
// case 2:
|
|
|
|
|
// actionNum, err := strconv.Atoi(request.TalkText)
|
|
|
|
|
// if err == nil {
|
|
|
|
|
// if actionNum == 1 {
|
|
|
|
|
// response.Action = scnarioConf[dnis][s.session[request.Token].PreEventNum2].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][s.session[request.Token].PreEventNum2].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][s.session[request.Token].PreEventNum2].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][s.session[request.Token].PreEventNum2].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][s.session[request.Token].PreEventNum2].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][s.session[request.Token].PreEventNum2].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][s.session[request.Token].PreEventNum2].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][s.session[request.Token].PreEventNum2].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][s.session[request.Token].PreEventNum2].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][s.session[request.Token].PreEventNum2].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][s.session[request.Token].PreEventNum2].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][s.session[request.Token].PreEventNum2].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][s.session[request.Token].PreEventNum2].Action, PreEventNum: s.session[request.Token].PreEventNum2}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// } else {
|
|
|
|
|
// response.Action = scnarioConf[dnis][1].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][1].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][1].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][1].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][1].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][1].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][1].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][1].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][1].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][1].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][1].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][1].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][1].Action, PreEventNum: 1, PreEventNum2: 1}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
// response.Action = scnarioConf[dnis][1].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][1].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][1].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][1].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][1].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][1].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][1].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][1].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][1].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][1].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][1].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][1].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][1].Action, PreEventNum: 1}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// }
|
|
|
|
|
// default:
|
|
|
|
|
|
|
|
|
|
// response.Action = scnarioConf[dnis][2].Action
|
|
|
|
|
// response.AnounceMents = "결과 " + request.TalkText + " " + scnarioConf[dnis][2].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][2].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][2].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][2].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][2].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][2].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][2].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][2].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][2].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][2].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][2].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][2].Action, PreEventNum: 2, PreEventNum2: s.session[request.Token].PreEventNum}
|
|
|
|
|
// //s.m.Unlock()
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// //시뮬레이터
|
|
|
|
|
// response.Action = scnarioConf[dnis][s.session[request.Token].Count].Action
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][s.session[request.Token].Count].AnounceMents
|
|
|
|
|
// response.Data.Speed = scnarioConf[dnis][s.session[request.Token].Count].Speed
|
|
|
|
|
// response.Data.VoiceName = scnarioConf[dnis][s.session[request.Token].Count].VoiceName
|
|
|
|
|
// response.Data.Volume = scnarioConf[dnis][s.session[request.Token].Count].Volume
|
|
|
|
|
// response.Data.Pitch = scnarioConf[dnis][s.session[request.Token].Count].Pitch
|
|
|
|
|
// response.Data.MaxWaitTime = scnarioConf[dnis][s.session[request.Token].Count].MaxWaitTime
|
|
|
|
|
// response.Data.BargeIn = scnarioConf[dnis][s.session[request.Token].Count].BargeIn
|
|
|
|
|
// response.Data.SttMaxTime = scnarioConf[dnis][s.session[request.Token].Count].SttMaxTime
|
|
|
|
|
// response.Data.MaxDigit = scnarioConf[dnis][s.session[request.Token].Count].MaxDigit
|
|
|
|
|
// response.Data.EndCharacter = []string{scnarioConf[dnis][s.session[request.Token].Count+1].EndCharacter}
|
|
|
|
|
// response.Data.DigitTerm = scnarioConf[dnis][s.session[request.Token].Count].DigitTerm
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
// if s.session[request.Token].LoopCount > 100 {
|
|
|
|
|
// s.session[request.Token] = ResStatus{LoopCount: s.session[request.Token].LoopCount, Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][s.session[request.Token].Count].Action}
|
|
|
|
|
// } else {
|
|
|
|
|
// s.session[request.Token] = ResStatus{LoopCount: s.session[request.Token].LoopCount + 1, Count: s.session[request.Token].Count, Status: scnarioConf[dnis][s.session[request.Token].Count].Action}
|
|
|
|
|
// }
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// case "REFER":
|
|
|
|
|
// response.ResultCode = 200
|
|
|
|
|
// response.Token = request.Token
|
|
|
|
|
// response.Action = "TRANSFER"
|
|
|
|
|
// response.AnounceMents = "네. 매장으로 연결해드릴게요."
|
|
|
|
|
// response.Data.BargeIn = ""
|
|
|
|
|
// response.Data.RecodingFile = ""
|
|
|
|
|
// response.Data.SttMaxTime = 0
|
|
|
|
|
// response.Data.TelNo = request.TelNo
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][s.session[request.Token].Count+1].Action}
|
|
|
|
|
// case "TRANSFER":
|
|
|
|
|
// response.ResultCode = 200
|
|
|
|
|
// response.Token = request.Token
|
|
|
|
|
// response.Action = "TRANSFER"
|
|
|
|
|
// response.AnounceMents = "네. 매장으로 연결해드릴게요."
|
|
|
|
|
// response.Data.BargeIn = ""
|
|
|
|
|
// response.Data.RecodingFile = ""
|
|
|
|
|
// response.Data.SttMaxTime = 0
|
|
|
|
|
// response.Data.TelNo = request.TelNo
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][s.session[request.Token].Count+1].Action}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
|
|
|
|
|
// case "TRNASFER2": // 전화 종료 요청
|
|
|
|
|
// response.ResultCode = 200
|
|
|
|
|
// response.Token = request.Token
|
|
|
|
|
// response.Action = "TRANSFER2"
|
|
|
|
|
// response.AnounceMents = "네. 매장으로 연결해드릴게요."
|
|
|
|
|
// response.Data.BargeIn = ""
|
|
|
|
|
// response.Data.RecodingFile = ""
|
|
|
|
|
// response.Data.SttMaxTime = 0
|
|
|
|
|
// response.Data.TelNo = request.TelNo
|
|
|
|
|
|
|
|
|
|
// // s.m.Lock()
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][s.session[request.Token].Count+1].Action}
|
|
|
|
|
// // s.m.Unlock()
|
|
|
|
|
|
|
|
|
|
// response.Token = request.Token
|
|
|
|
|
// response.Action = "END"
|
|
|
|
|
// response.AnounceMents = "접수가 완료되었습니다."
|
|
|
|
|
// response.Data.BargeIn = "N"
|
|
|
|
|
// response.Data.RecodingFile = "Y"
|
|
|
|
|
// response.Data.SttMaxTime = 0
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 {
|
|
|
|
|
fmt.Println("Error marshaling UUI:", err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// 맵을 JSON으로 마샬링
|
|
|
|
|
uuiJSON, err := json.Marshal(uuiMap)
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Println("Error marshaling UUI:", err)
|
|
|
|
|
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 {
|
|
|
|
|
fmt.Println("Json Marshal error ", jerr)
|
|
|
|
|
}
|
|
|
|
|
fmt.Printf("%+v", response)
|
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, -1, "Send Message\n %s", string(resMarshal))
|
|
|
|
|
resMarshal, jerr := json.Marshal(response)
|
|
|
|
|
if jerr != nil {
|
|
|
|
|
fmt.Println("Json Marshal error ", jerr)
|
|
|
|
|
}
|
|
|
|
|
fmt.Printf("%+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 {
|
|
|
|
|