|
|
@ -107,6 +107,7 @@ type ScenarioSession struct {
|
|
|
|
var handles []*handleInfo
|
|
|
|
var handles []*handleInfo
|
|
|
|
var session []*ScenarioSession
|
|
|
|
var session []*ScenarioSession
|
|
|
|
var tokenMap map[string]string
|
|
|
|
var tokenMap map[string]string
|
|
|
|
|
|
|
|
var customerTelno string
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
func init() {
|
|
|
|
handles = make([]*handleInfo, HANDLE_NUM)
|
|
|
|
handles = make([]*handleInfo, HANDLE_NUM)
|
|
|
@ -155,7 +156,7 @@ func TTSFunc2(w http.ResponseWriter, r *http.Request) {
|
|
|
|
fmt.Fprintln(w, "TTS func 2", r)
|
|
|
|
fmt.Fprintln(w, "TTS func 2", r)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//post
|
|
|
|
// post
|
|
|
|
func TTSFunc3(w http.ResponseWriter, r *http.Request) {
|
|
|
|
func TTSFunc3(w http.ResponseWriter, r *http.Request) {
|
|
|
|
fmt.Fprintln(w, "TTS func 3", r)
|
|
|
|
fmt.Fprintln(w, "TTS func 3", r)
|
|
|
|
body := make([]byte, r.ContentLength)
|
|
|
|
body := make([]byte, r.ContentLength)
|
|
|
@ -167,7 +168,7 @@ func TTSFunc3(w http.ResponseWriter, r *http.Request) {
|
|
|
|
fmt.Println(string(body))
|
|
|
|
fmt.Println(string(body))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//post
|
|
|
|
// post
|
|
|
|
func TTSFunc4(w http.ResponseWriter, r *http.Request) {
|
|
|
|
func TTSFunc4(w http.ResponseWriter, r *http.Request) {
|
|
|
|
fmt.Fprintln(w, "TTS func 4", r)
|
|
|
|
fmt.Fprintln(w, "TTS func 4", r)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -196,8 +197,8 @@ func (s *ScenarioSession) GetScnario(dnis string, count int) icsconf.ScenarioCon
|
|
|
|
return resultConfig
|
|
|
|
return resultConfig
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////
|
|
|
|
// ///////////////////////////////////////////
|
|
|
|
//BOT
|
|
|
|
// BOT
|
|
|
|
func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) {
|
|
|
|
func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) {
|
|
|
|
// get scenario config
|
|
|
|
// get scenario config
|
|
|
|
l := icslog.GetIcsLog()
|
|
|
|
l := icslog.GetIcsLog()
|
|
|
@ -262,15 +263,30 @@ func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) {
|
|
|
|
// fmt.Printf("lv 2 =>%#v\n", response)
|
|
|
|
// fmt.Printf("lv 2 =>%#v\n", response)
|
|
|
|
// fmt.Println("-------------------------")
|
|
|
|
// fmt.Println("-------------------------")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if customerTelno == "" {
|
|
|
|
|
|
|
|
customerTelno = request.TelNo
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if translateinfo.Use {
|
|
|
|
if translateinfo.Use {
|
|
|
|
srcSession := s.GetSession(request.Token)
|
|
|
|
srcSession := s.GetSession(request.Token)
|
|
|
|
dstSession := s.GetSession(translateinfo.Token)
|
|
|
|
dstSession := s.GetSession(translateinfo.Token)
|
|
|
|
if request.TalkText != "" {
|
|
|
|
if request.TalkText != "" {
|
|
|
|
|
|
|
|
if customerTelno == request.TelNo {
|
|
|
|
|
|
|
|
l.PrintAnnouce(request.TalkText, true)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
l.PrintAnnouce(request.TalkText, false)
|
|
|
|
|
|
|
|
}
|
|
|
|
dstRlt := ResStatus{Count: dstSession.Count + 1, TransLateText: request.TalkText}
|
|
|
|
dstRlt := ResStatus{Count: dstSession.Count + 1, TransLateText: request.TalkText}
|
|
|
|
s.UpdateSession(translateinfo.Token, dstRlt)
|
|
|
|
s.UpdateSession(translateinfo.Token, dstRlt)
|
|
|
|
|
|
|
|
response.AnounceMents = request.TalkText
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if srcSession.TransLateText != "" {
|
|
|
|
if srcSession.TransLateText != "" {
|
|
|
|
|
|
|
|
if customerTelno == request.TelNo {
|
|
|
|
|
|
|
|
l.PrintAnnouce(srcSession.TransLateText, false)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
l.PrintAnnouce(srcSession.TransLateText, false)
|
|
|
|
|
|
|
|
}
|
|
|
|
response.AnounceMents = srcSession.TransLateText
|
|
|
|
response.AnounceMents = srcSession.TransLateText
|
|
|
|
srcRlt := ResStatus{Count: srcSession.Count + 1, Status: scenario.Action, TransLateText: scenario.AnounceMents}
|
|
|
|
srcRlt := ResStatus{Count: srcSession.Count + 1, Status: scenario.Action, TransLateText: scenario.AnounceMents}
|
|
|
|
s.UpdateSession(request.Token, srcRlt)
|
|
|
|
s.UpdateSession(request.Token, srcRlt)
|
|
|
|