|
|
@ -7,7 +7,6 @@ import (
|
|
|
|
"io/ioutil"
|
|
|
|
"io/ioutil"
|
|
|
|
"math/big"
|
|
|
|
"math/big"
|
|
|
|
"net/http"
|
|
|
|
"net/http"
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
"sync"
|
|
|
|
"sync"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
@ -55,8 +54,11 @@ type Request struct {
|
|
|
|
Data json.RawMessage `json:"data"`
|
|
|
|
Data json.RawMessage `json:"data"`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type Transrate struct {
|
|
|
|
type TransLateInfo struct {
|
|
|
|
TargetDnis string `json:"target_dnis"`
|
|
|
|
Use bool `json:"use"`
|
|
|
|
|
|
|
|
Token string `json:"token"`
|
|
|
|
|
|
|
|
Text string `json:"text"`
|
|
|
|
|
|
|
|
Lang string `json:"lang"`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type Response struct {
|
|
|
|
type Response struct {
|
|
|
@ -76,10 +78,10 @@ type ResData struct {
|
|
|
|
MinDigit int `json:"minDigit"`
|
|
|
|
MinDigit int `json:"minDigit"`
|
|
|
|
DigitTerm int `json:"digitTerm"`
|
|
|
|
DigitTerm int `json:"digitTerm"`
|
|
|
|
TelNo string `json:"telNo"`
|
|
|
|
TelNo string `json:"telNo"`
|
|
|
|
VoiceName int `json:"voiceName"`
|
|
|
|
VoiceName string `json:"voiceName"`
|
|
|
|
Speed int `json:"speed"`
|
|
|
|
Speed string `json:"speed"`
|
|
|
|
Volume int `json:"volume"`
|
|
|
|
Volume string `json:"volume"`
|
|
|
|
Pitch int `json:"pitch"`
|
|
|
|
Pitch string `json:"pitch"`
|
|
|
|
EndCharacter []string `json:"endCharacter"`
|
|
|
|
EndCharacter []string `json:"endCharacter"`
|
|
|
|
MaxWaitTime int `json:"maxNoInputTime"`
|
|
|
|
MaxWaitTime int `json:"maxNoInputTime"`
|
|
|
|
UUI json.RawMessage `json:"uui"`
|
|
|
|
UUI json.RawMessage `json:"uui"`
|
|
|
@ -92,6 +94,7 @@ type ResStatus struct {
|
|
|
|
PreEventNum int
|
|
|
|
PreEventNum int
|
|
|
|
PreEventNum2 int
|
|
|
|
PreEventNum2 int
|
|
|
|
LoopCount int
|
|
|
|
LoopCount int
|
|
|
|
|
|
|
|
TransLateText string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type ScenarioSession struct {
|
|
|
|
type ScenarioSession struct {
|
|
|
@ -103,6 +106,7 @@ type ScenarioSession struct {
|
|
|
|
|
|
|
|
|
|
|
|
var handles []*handleInfo
|
|
|
|
var handles []*handleInfo
|
|
|
|
var session []*ScenarioSession
|
|
|
|
var session []*ScenarioSession
|
|
|
|
|
|
|
|
var tokenMap map[string]string
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
func init() {
|
|
|
|
handles = make([]*handleInfo, HANDLE_NUM)
|
|
|
|
handles = make([]*handleInfo, HANDLE_NUM)
|
|
|
@ -168,6 +172,30 @@ func TTSFunc4(w http.ResponseWriter, r *http.Request) {
|
|
|
|
fmt.Fprintln(w, "TTS func 4", r)
|
|
|
|
fmt.Fprintln(w, "TTS func 4", r)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (s *ScenarioSession) GetSession(token string) ResStatus {
|
|
|
|
|
|
|
|
s.m.Lock()
|
|
|
|
|
|
|
|
defer s.m.Unlock()
|
|
|
|
|
|
|
|
resStatus := s.session[token]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return resStatus
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (s *ScenarioSession) UpdateSession(token string, data ResStatus) {
|
|
|
|
|
|
|
|
s.m.Lock()
|
|
|
|
|
|
|
|
defer s.m.Unlock()
|
|
|
|
|
|
|
|
s.session[token] = data
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (s *ScenarioSession) GetScnario(dnis string, count int) icsconf.ScenarioConfig {
|
|
|
|
|
|
|
|
s.m.Lock()
|
|
|
|
|
|
|
|
defer s.m.Unlock()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
conf := icsconf.GetIcsConfig()
|
|
|
|
|
|
|
|
resultConfig := conf.ScenarioConfig[dnis][count]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return resultConfig
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////
|
|
|
|
//BOT
|
|
|
|
//BOT
|
|
|
|
func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) {
|
|
|
|
func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) {
|
|
|
@ -184,71 +212,22 @@ func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) {
|
|
|
|
defer r.Body.Close()
|
|
|
|
defer r.Body.Close()
|
|
|
|
|
|
|
|
|
|
|
|
err = json.Unmarshal(resBody, &request)
|
|
|
|
err = json.Unmarshal(resBody, &request)
|
|
|
|
fmt.Printf("%+v\n", request)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, -1, "response unmarshal error!!!!! ")
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, -1, "response unmarshal error!!!!! ")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
agent := strings.SplitN(request.CallId, "@", 2)
|
|
|
|
agent := strings.SplitN(request.CallId, "@", 2)
|
|
|
|
fmt.Printf(">>>>>> DATA INFO - method [%s], agent [%s], token [%s]\n", request.Method, agent, request.Token)
|
|
|
|
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, -1, ">>>>>> DATA INFO - method [%s], agent [%s], token [%s] talk[%s]", request.Method, agent, request.Token, request.TalkText)
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, -1, ">>>>>> DATA INFO - method [%s], agent [%s], token [%s] talk[%s]", request.Method, agent, request.Token, request.TalkText)
|
|
|
|
|
|
|
|
|
|
|
|
response := new(Response)
|
|
|
|
response := new(Response)
|
|
|
|
dnis := request.Dnis
|
|
|
|
dnis := request.Dnis
|
|
|
|
|
|
|
|
|
|
|
|
s.m.Lock()
|
|
|
|
var translateinfo TransLateInfo
|
|
|
|
|
|
|
|
err = json.Unmarshal([]byte(request.Data), &translateinfo)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////
|
|
|
|
|
|
|
|
///////////// EXCEPT ///////////////
|
|
|
|
|
|
|
|
////////////////////////////////////
|
|
|
|
|
|
|
|
if conf.ExceptTest.TestInfo.Value {
|
|
|
|
|
|
|
|
// eType := conf.ExceptTest.TestInfo.Type
|
|
|
|
|
|
|
|
// if request.Method == "INIT" {
|
|
|
|
|
|
|
|
// response.ResultCode = conf.ExceptTest.TestInfo.ResultCode
|
|
|
|
|
|
|
|
// response.Token = conf.ExceptTest.TestInfo.Token
|
|
|
|
|
|
|
|
// response.Action = conf.ExceptTest.TestInfo.Action
|
|
|
|
|
|
|
|
// response.AnounceMents = conf.ExceptTest.TestInfo.Announcement
|
|
|
|
|
|
|
|
// response.Data.BargeIn = conf.ExceptTest.TestInfo.Bargein
|
|
|
|
|
|
|
|
// response.Data.RecodingFile = conf.ExceptTest.TestInfo.Recodingfile
|
|
|
|
|
|
|
|
// response.Data.SttMaxTime = conf.ExceptTest.TestInfo.Sttmaxtime
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// s.session[conf.ExceptTest.TestInfo.Token] = ResStatus{Count: 1, Status: scnarioConf[dnis].Action[0], NotUnderstand: 0}
|
|
|
|
|
|
|
|
// } else if request.TalkText == "ERROR_TTS" || request.TalkText == "ERROR_STT" {
|
|
|
|
|
|
|
|
// response.ResultCode = 200
|
|
|
|
|
|
|
|
// response.Token = request.Token
|
|
|
|
|
|
|
|
// response.AnounceMents = "서비스에 문제가 발생하여 매장으로 연결해드릴게요."
|
|
|
|
|
|
|
|
// response.Action = "TRANSFER"
|
|
|
|
|
|
|
|
// response.Data.BargeIn = ""
|
|
|
|
|
|
|
|
// response.Data.RecodingFile = ""
|
|
|
|
|
|
|
|
// response.Data.SttMaxTime = 10
|
|
|
|
|
|
|
|
// } else if request.Method == "REFER" {
|
|
|
|
|
|
|
|
// response.ResultCode = 200
|
|
|
|
|
|
|
|
// response.Token = request.Token
|
|
|
|
|
|
|
|
// response.AnounceMents = "서비스에 문제가 발생하여 매장으로 연결해드릴게요."
|
|
|
|
|
|
|
|
// response.Action = "TRANSFER"
|
|
|
|
|
|
|
|
// response.Data.BargeIn = ""
|
|
|
|
|
|
|
|
// response.Data.RecodingFile = ""
|
|
|
|
|
|
|
|
// response.Data.SttMaxTime = 10
|
|
|
|
|
|
|
|
// } else if request.Method != "INIT" && request.TalkText == "" {
|
|
|
|
|
|
|
|
// response.ResultCode = 200
|
|
|
|
|
|
|
|
// response.Token = request.Token
|
|
|
|
|
|
|
|
// if s.session[request.Token].NotUnderstand == 3 {
|
|
|
|
|
|
|
|
// response.AnounceMents = "잘 이해하지 못했습니다. 정확한 상담을 위해 매장으로 연결해드릴게요."
|
|
|
|
|
|
|
|
// response.Action = "END"
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// response.AnounceMents = "잘 이해하지 못했습니다. 다시 말씀해주세요."
|
|
|
|
|
|
|
|
// response.Action = "STT"
|
|
|
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: 1, Status: scnarioConf[dnis].Action[0], NotUnderstand: s.session[request.Token].NotUnderstand + 1}
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// response.Data.BargeIn = ""
|
|
|
|
|
|
|
|
// response.Data.RecodingFile = ""
|
|
|
|
|
|
|
|
// response.Data.SttMaxTime = 10
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
////////////////////////////////////
|
|
|
|
|
|
|
|
//////// SCENARIO MAPPING///////////
|
|
|
|
|
|
|
|
////////////////////////////////////
|
|
|
|
|
|
|
|
fmt.Println(request.Method)
|
|
|
|
|
|
|
|
if request.Method == "HANGUP" {
|
|
|
|
if request.Method == "HANGUP" {
|
|
|
|
response.ResultCode = 200
|
|
|
|
response.ResultCode = 200
|
|
|
|
response.Token = request.Token
|
|
|
|
response.Token = request.Token
|
|
|
@ -257,366 +236,72 @@ func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) {
|
|
|
|
response.Data.BargeIn = ""
|
|
|
|
response.Data.BargeIn = ""
|
|
|
|
response.Data.RecodingFile = ""
|
|
|
|
response.Data.RecodingFile = ""
|
|
|
|
response.Data.SttMaxTime = 10
|
|
|
|
response.Data.SttMaxTime = 10
|
|
|
|
} else if request.Method != "INIT" && request.TalkText == "" {
|
|
|
|
} else if (request.Method != "INIT" && request.TalkText == "") || (request.Method != "INIT" && translateinfo.Use) {
|
|
|
|
if request.TalkText == "" {
|
|
|
|
|
|
|
|
request.TalkText = "잘못된 값 입력 "
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fmt.Println(dnis)
|
|
|
|
|
|
|
|
if dnis == "AISB" || dnis == "07075999956" || dnis == "821462" || dnis == "1462" {
|
|
|
|
|
|
|
|
dnis = "9013"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println(dnis)
|
|
|
|
|
|
|
|
if dnis != "07012345678" && dnis != "07077442711" {
|
|
|
|
|
|
|
|
dnis = "sim"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if dnis == "07012345678" || dnis == "07077442711" {
|
|
|
|
|
|
|
|
dnis = "sim3"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if dnis == "9012" {
|
|
|
|
|
|
|
|
response.ResultCode = 200
|
|
|
|
response.ResultCode = 200
|
|
|
|
response.Token = request.Token
|
|
|
|
response.Token = request.Token
|
|
|
|
response.Action = scnarioConf[dnis][s.session[request.Token].Count+1].Action
|
|
|
|
|
|
|
|
response.AnounceMents = scnarioConf[dnis][s.session[request.Token].Count+1].AnounceMents
|
|
|
|
|
|
|
|
if s.session[request.Token].Count != 0 && dnis == "9012" {
|
|
|
|
|
|
|
|
response.AnounceMents = strings.ReplaceAll(response.AnounceMents, "$", request.TalkText)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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.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}
|
|
|
|
scenario := s.GetScnario(dnis, 2)
|
|
|
|
|
|
|
|
|
|
|
|
} else if dnis == "sim3" {
|
|
|
|
response.Action = scenario.Action
|
|
|
|
//시뮬레이터
|
|
|
|
response.AnounceMents = scenario.AnounceMents
|
|
|
|
response.ResultCode = 200
|
|
|
|
response.AnnounceFilePath = scenario.AudioFilePath
|
|
|
|
response.Action = scnarioConf[dnis][s.session[request.Token].Count].Action
|
|
|
|
response.Data.Speed = fmt.Sprintf("%d", scenario.Speed)
|
|
|
|
response.AnounceMents = scnarioConf[dnis][s.session[request.Token].Count].AnounceMents
|
|
|
|
// response.Data.VoiceName = scenario.VoiceName
|
|
|
|
response.Data.Speed = scnarioConf[dnis][s.session[request.Token].Count].Speed
|
|
|
|
response.Data.VoiceName = fmt.Sprintf("%d", scenario.VoiceName)
|
|
|
|
response.Data.VoiceName = scnarioConf[dnis][s.session[request.Token].Count].VoiceName
|
|
|
|
response.Data.Volume = fmt.Sprintf("%d", scenario.Volume)
|
|
|
|
response.Data.Volume = scnarioConf[dnis][s.session[request.Token].Count].Volume
|
|
|
|
response.Data.Pitch = fmt.Sprintf("%d", scenario.Pitch)
|
|
|
|
response.Data.Pitch = scnarioConf[dnis][s.session[request.Token].Count].Pitch
|
|
|
|
response.Data.MaxWaitTime = scenario.MaxWaitTime
|
|
|
|
response.Data.MaxWaitTime = scnarioConf[dnis][s.session[request.Token].Count].MaxWaitTime
|
|
|
|
response.Data.BargeIn = scenario.BargeIn
|
|
|
|
response.Data.BargeIn = scnarioConf[dnis][s.session[request.Token].Count].BargeIn
|
|
|
|
response.Data.SttMaxTime = scenario.SttMaxTime
|
|
|
|
response.Data.SttMaxTime = scnarioConf[dnis][s.session[request.Token].Count].SttMaxTime
|
|
|
|
response.Data.MaxDigit = scenario.MaxDigit
|
|
|
|
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"
|
|
|
|
response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
|
|
if s.session[request.Token].LoopCount > 100 {
|
|
|
|
// fmt.Println("-------------------------")
|
|
|
|
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+1].Action}
|
|
|
|
// fmt.Printf("lv 0 => %#v\n", translateinfo)
|
|
|
|
} else {
|
|
|
|
// fmt.Printf("lv 1 =>%#v\n", request)
|
|
|
|
s.session[request.Token] = ResStatus{LoopCount: s.session[request.Token].LoopCount + 1, Count: 1, Status: scnarioConf[dnis][s.session[request.Token].Count].Action}
|
|
|
|
// fmt.Printf("lv 2 =>%#v\n", response)
|
|
|
|
|
|
|
|
// fmt.Println("-------------------------")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if translateinfo.Use {
|
|
|
|
|
|
|
|
srcSession := s.GetSession(request.Token)
|
|
|
|
|
|
|
|
dstSession := s.GetSession(translateinfo.Token)
|
|
|
|
|
|
|
|
if request.TalkText != "" {
|
|
|
|
|
|
|
|
dstRlt := ResStatus{Count: dstSession.Count + 1, TransLateText: request.TalkText}
|
|
|
|
|
|
|
|
s.UpdateSession(translateinfo.Token, dstRlt)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
response.ResultCode = 200
|
|
|
|
|
|
|
|
response.Token = request.Token
|
|
|
|
|
|
|
|
response.Action = scnarioConf[dnis][1].Action
|
|
|
|
|
|
|
|
response.AnounceMents = scnarioConf[dnis][1].AnounceMents
|
|
|
|
|
|
|
|
response.AnnounceFilePath = scnarioConf[dnis][1].AudioFilePath
|
|
|
|
|
|
|
|
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()
|
|
|
|
if srcSession.TransLateText != "" {
|
|
|
|
s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][1].Action}
|
|
|
|
response.AnounceMents = srcSession.TransLateText
|
|
|
|
//s.m.Unlock()
|
|
|
|
srcRlt := ResStatus{Count: srcSession.Count + 1, Status: scenario.Action, TransLateText: scenario.AnounceMents}
|
|
|
|
}
|
|
|
|
s.UpdateSession(request.Token, srcRlt)
|
|
|
|
} else {
|
|
|
|
|
|
|
|
fmt.Println("RECV METHOD")
|
|
|
|
|
|
|
|
fmt.Println(dnis)
|
|
|
|
|
|
|
|
// if dnis != "9012" && dnis != "9013" && dnis != "9014" {
|
|
|
|
|
|
|
|
// dnis = "sim"
|
|
|
|
|
|
|
|
// } else
|
|
|
|
|
|
|
|
if dnis == "AISB" || dnis == "07075999956" || dnis == "821462" || dnis == "1462" {
|
|
|
|
|
|
|
|
dnis = "9013"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println(dnis)
|
|
|
|
|
|
|
|
if dnis == "9012" || dnis == "07012345678" || dnis == "07077442711" {
|
|
|
|
|
|
|
|
dnis = "sim3"
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if dnis == "9013" {
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, -1, "STT %s | TTS %s", request.TalkText, response.AnounceMents)
|
|
|
|
dnis = "9014"
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
fmt.Println(scnarioConf[dnis])
|
|
|
|
|
|
|
|
switch request.Method {
|
|
|
|
switch request.Method {
|
|
|
|
case "INIT":
|
|
|
|
case "INIT":
|
|
|
|
|
|
|
|
scenario := s.GetScnario(dnis, 1)
|
|
|
|
token := createToken(request.CallId)
|
|
|
|
token := createToken(request.CallId)
|
|
|
|
response.ResultCode = 200
|
|
|
|
response.ResultCode = 200
|
|
|
|
response.Token = token
|
|
|
|
response.Token = token
|
|
|
|
response.Action = scnarioConf[dnis][s.session[request.Token].Count+1].Action
|
|
|
|
response.Action = scenario.Action
|
|
|
|
response.AnounceMents = scnarioConf[dnis][s.session[request.Token].Count+1].AnounceMents
|
|
|
|
response.AnounceMents = scenario.AnounceMents
|
|
|
|
response.Data.Speed = scnarioConf[dnis][s.session[request.Token].Count+1].Speed
|
|
|
|
response.Data.Speed = fmt.Sprintf("%d", scenario.Speed)
|
|
|
|
response.Data.VoiceName = scnarioConf[dnis][s.session[request.Token].Count+1].VoiceName
|
|
|
|
response.Data.VoiceName = fmt.Sprintf("%d", scenario.VoiceName)
|
|
|
|
response.Data.Volume = scnarioConf[dnis][s.session[request.Token].Count+1].Volume
|
|
|
|
response.Data.Volume = fmt.Sprintf("%d", scenario.Volume)
|
|
|
|
response.Data.Pitch = scnarioConf[dnis][s.session[request.Token].Count+1].Pitch
|
|
|
|
response.Data.Pitch = fmt.Sprintf("%d", scenario.Pitch)
|
|
|
|
response.Data.MaxWaitTime = scnarioConf[dnis][s.session[request.Token].Count+1].MaxWaitTime
|
|
|
|
response.Data.MaxWaitTime = scenario.MaxWaitTime
|
|
|
|
response.Data.BargeIn = scnarioConf[dnis][s.session[request.Token].Count+1].BargeIn
|
|
|
|
response.Data.BargeIn = scenario.BargeIn
|
|
|
|
response.Data.SttMaxTime = scnarioConf[dnis][s.session[request.Token].Count+1].SttMaxTime
|
|
|
|
response.Data.SttMaxTime = scenario.SttMaxTime
|
|
|
|
response.Data.MaxDigit = scnarioConf[dnis][s.session[request.Token].Count+1].MaxDigit
|
|
|
|
response.Data.MaxDigit = scenario.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.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":
|
|
|
|
|
|
|
|
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"
|
|
|
|
response.Data.RecodingFile = "Y"
|
|
|
|
|
|
|
|
|
|
|
|
// s.m.Lock()
|
|
|
|
if translateinfo.Token != "" {
|
|
|
|
s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][actionNum+2].Action, PreEventNum: actionNum + 2}
|
|
|
|
response.AnounceMents = "고객 연결 성공"
|
|
|
|
// s.m.Unlock()
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
response.Action = scnarioConf[dnis][1].Action
|
|
|
|
s.session[token] = ResStatus{Count: 1, Status: scnarioConf[dnis][0].Action, NotUnderstand: 0, PreEventNum: 1}
|
|
|
|
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
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -637,28 +322,421 @@ func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) {
|
|
|
|
// 마샬링된 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 {
|
|
|
|
fmt.Println("Json Marshal error ", jerr)
|
|
|
|
fmt.Println("Json Marshal error ", jerr)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fmt.Printf("%+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))
|
|
|
|
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, -1, "Send From %s\n", request.TelNo)
|
|
|
|
|
|
|
|
|
|
|
|
// 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))
|
|
|
|
fmt.Fprintln(w, string(resMarshal))
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
|
|
// // get scenario config
|
|
|
|
|
|
|
|
// l := icslog.GetIcsLog()
|
|
|
|
|
|
|
|
// conf := icsconf.GetIcsConfig()
|
|
|
|
|
|
|
|
// scnarioConf := conf.ScenarioConfig
|
|
|
|
|
|
|
|
// // Request json parsing
|
|
|
|
|
|
|
|
// request := Request{}
|
|
|
|
|
|
|
|
// resBody, err := ioutil.ReadAll(r.Body)
|
|
|
|
|
|
|
|
// if err != nil {
|
|
|
|
|
|
|
|
// fmt.Println(err)
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// defer r.Body.Close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// err = json.Unmarshal(resBody, &request)
|
|
|
|
|
|
|
|
// if err != nil {
|
|
|
|
|
|
|
|
// l.Printf(icslog.LOG_LEVEL_INFO, -1, "response unmarshal error!!!!! ")
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// agent := strings.SplitN(request.CallId, "@", 2)
|
|
|
|
|
|
|
|
// fmt.Printf(">>>>>> DATA INFO - method [%s], agent [%s], token [%s]\n", request.Method, agent, request.Token)
|
|
|
|
|
|
|
|
// l.Printf(icslog.LOG_LEVEL_INFO, -1, ">>>>>> DATA INFO - method [%s], agent [%s], token [%s] talk[%s]", request.Method, agent, request.Token, request.TalkText)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// response := new(Response)
|
|
|
|
|
|
|
|
// dnis := request.Dnis
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// s.m.Lock()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var translateinfo TransLateInfo
|
|
|
|
|
|
|
|
// err = json.Unmarshal([]byte(request.Data), &translateinfo)
|
|
|
|
|
|
|
|
// if err != nil {
|
|
|
|
|
|
|
|
// return
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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 == "") || (request.Method != "INIT" && translateinfo.Use) {
|
|
|
|
|
|
|
|
// if dnis == "AISB" || dnis == "07075999956" || dnis == "821462" || dnis == "1462" {
|
|
|
|
|
|
|
|
// dnis = "9013"
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // if dnis != "07012345678" && dnis != "07077442711" {
|
|
|
|
|
|
|
|
// // dnis = "sim"
|
|
|
|
|
|
|
|
// // }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if dnis == "07012345678" || dnis == "07077442711" {
|
|
|
|
|
|
|
|
// dnis = "sim3"
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if dnis == "9012" {
|
|
|
|
|
|
|
|
// response.ResultCode = 200
|
|
|
|
|
|
|
|
// response.Token = request.Token
|
|
|
|
|
|
|
|
// response.Action = scnarioConf[dnis][s.session[request.Token].Count+1].Action
|
|
|
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][s.session[request.Token].Count+1].AnounceMents
|
|
|
|
|
|
|
|
// if s.session[request.Token].Count != 0 && dnis == "9012" {
|
|
|
|
|
|
|
|
// response.AnounceMents = strings.ReplaceAll(response.AnounceMents, "$", request.TalkText)
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// 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.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}
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// response.ResultCode = 200
|
|
|
|
|
|
|
|
// response.Token = request.Token
|
|
|
|
|
|
|
|
// response.Action = scnarioConf[dnis][2].Action
|
|
|
|
|
|
|
|
// response.AnounceMents = scnarioConf[dnis][2].AnounceMents
|
|
|
|
|
|
|
|
// response.AnnounceFilePath = scnarioConf[dnis][2].AudioFilePath
|
|
|
|
|
|
|
|
// 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"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// fmt.Println("-------------------------")
|
|
|
|
|
|
|
|
// fmt.Printf("lv 0 => %#v\n", translateinfo)
|
|
|
|
|
|
|
|
// fmt.Printf("lv 1 =>%#v\n", request)
|
|
|
|
|
|
|
|
// fmt.Printf("lv 2 =>%#v\n", response)
|
|
|
|
|
|
|
|
// fmt.Println("-------------------------")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if translateinfo.Use {
|
|
|
|
|
|
|
|
// if request.TalkText != "" {
|
|
|
|
|
|
|
|
// s.session[translateinfo.Token] = ResStatus{Count: s.session[translateinfo.Token].Count + 1, TransLateText: request.TalkText}
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if s.session[request.Token].TransLateText != "" {
|
|
|
|
|
|
|
|
// response.Action = "STT"
|
|
|
|
|
|
|
|
// response.AnounceMents = s.session[request.Token].TransLateText
|
|
|
|
|
|
|
|
// response.Data.SttMaxTime = 15
|
|
|
|
|
|
|
|
// response.Data.MaxWaitTime = 30
|
|
|
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][2].Action, TransLateText: scnarioConf[dnis][2].AnounceMents}
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][2].Action, TransLateText: scnarioConf[dnis][2].AnounceMents}
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// fmt.Println("RECV METHOD")
|
|
|
|
|
|
|
|
// fmt.Println(dnis)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // if dnis == "AISB" || dnis == "07075999956" || dnis == "821462" || dnis == "1462" {
|
|
|
|
|
|
|
|
// // dnis = "9013"
|
|
|
|
|
|
|
|
// // }
|
|
|
|
|
|
|
|
// fmt.Println(dnis)
|
|
|
|
|
|
|
|
// // if dnis == "9012" || dnis == "07012345678" || dnis == "07077442711" {
|
|
|
|
|
|
|
|
// // dnis = "sim3"
|
|
|
|
|
|
|
|
// // }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // if dnis == "9013" {
|
|
|
|
|
|
|
|
// // dnis = "9014"
|
|
|
|
|
|
|
|
// // }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// switch request.Method {
|
|
|
|
|
|
|
|
// case "INIT":
|
|
|
|
|
|
|
|
// token := createToken(request.CallId)
|
|
|
|
|
|
|
|
// response.ResultCode = 200
|
|
|
|
|
|
|
|
// response.Token = token
|
|
|
|
|
|
|
|
// 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"
|
|
|
|
|
|
|
|
// if translateinfo.Token != "" {
|
|
|
|
|
|
|
|
// response.AnounceMents = "고객 연결 성공"
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// s.session[token] = ResStatus{Count: 1, Status: scnarioConf[dnis][0].Action, NotUnderstand: 0, PreEventNum: 1}
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// case "STT", "DTMF", "BOTH", "MEMO", "NONE":
|
|
|
|
|
|
|
|
// 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.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][s.session[request.Token].Count+1].Action}
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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을 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))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// time.Sleep(time.Second * 1)
|
|
|
|
|
|
|
|
// // send response
|
|
|
|
|
|
|
|
// fmt.Fprintln(w, string(resMarshal))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
func createToken(callId string) string {
|
|
|
|
func createToken(callId string) string {
|
|
|
|
token := ""
|
|
|
|
token := ""
|
|
|
|
times := fmt.Sprintf("%d", time.Now().UnixNano()/1000000)
|
|
|
|
times := fmt.Sprintf("%d", time.Now().UnixNano()/1000000)
|
|
|
|