Compare commits

..

No commits in common. 'e0ca56b93b57a02a422fa193d68d1e865b96b3e0' and 'ad7f4898e188c7558e827048f3f93eb45dcc8c0e' have entirely different histories.

@ -1,7 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}

@ -0,0 +1,93 @@
# VoiceAgent
Voice Agent in golang
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://gitlab.com/-/experiment/new_project_readme_content:e72dfbe5ce686bbb6085424d6a052342?https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://gitlab.com/-/experiment/new_project_readme_content:e72dfbe5ce686bbb6085424d6a052342?https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://gitlab.com/-/experiment/new_project_readme_content:e72dfbe5ce686bbb6085424d6a052342?https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://gitlab.com/ics_cinnamon/voiceagent.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](https://gitlab.com/-/experiment/new_project_readme_content:e72dfbe5ce686bbb6085424d6a052342?https://gitlab.com/ics_cinnamon/voiceagent/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://gitlab.com/-/experiment/new_project_readme_content:e72dfbe5ce686bbb6085424d6a052342?https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://gitlab.com/-/experiment/new_project_readme_content:e72dfbe5ce686bbb6085424d6a052342?https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://gitlab.com/-/experiment/new_project_readme_content:e72dfbe5ce686bbb6085424d6a052342?https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://gitlab.com/-/experiment/new_project_readme_content:e72dfbe5ce686bbb6085424d6a052342?https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://gitlab.com/-/experiment/new_project_readme_content:e72dfbe5ce686bbb6085424d6a052342?https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://gitlab.com/-/experiment/new_project_readme_content:e72dfbe5ce686bbb6085424d6a052342?https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://gitlab.com/-/experiment/new_project_readme_content:e72dfbe5ce686bbb6085424d6a052342?https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://gitlab.com/-/experiment/new_project_readme_content:e72dfbe5ce686bbb6085424d6a052342?https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://gitlab.com/-/experiment/new_project_readme_content:e72dfbe5ce686bbb6085424d6a052342?https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://gitlab.com/-/experiment/new_project_readme_content:e72dfbe5ce686bbb6085424d6a052342?https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://gitlab.com/-/experiment/new_project_readme_content:e72dfbe5ce686bbb6085424d6a052342?https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.

@ -1 +0,0 @@
scp -v -i /home/ljhwan206/etc/key.pem voicegateway ec2-user@15.165.95.232:/home/ec2-user/vgw/svc/icsbot/bin/

@ -5,9 +5,7 @@ import (
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
"os"
"strings" "strings"
"syscall"
"time" "time"
"gitlab.com/cinnamon/voiceagent/icsconf" "gitlab.com/cinnamon/voiceagent/icsconf"
@ -51,8 +49,7 @@ func Init(conf *icsconf.IcsConfig) (e *IcsExec) {
func (exe IcsExec) Execute() *icserror.IcsError { func (exe IcsExec) Execute() *icserror.IcsError {
l := icslog.GetIcsLog() l := icslog.GetIcsLog()
logFile, _ := os.Create("track" + time.Now().Format("20060102_150405") + ".log")
syscall.Dup2(int(logFile.Fd()), 2)
for !exe.service.GetExit() { for !exe.service.GetExit() {
for exe.service.GetStop() { for exe.service.GetStop() {
time.Sleep(time.Millisecond) time.Sleep(time.Millisecond)

@ -26,15 +26,8 @@ type IcsConfig struct {
AgentConfig []AgentConfig `xml:"AGENT"` AgentConfig []AgentConfig `xml:"AGENT"`
SessionExpired SessionExpired `xml:"SESSIONEXPIRED"` SessionExpired SessionExpired `xml:"SESSIONEXPIRED"`
DtmfEndSignal DtmfEndSignal `xml:"DTMFEND"` DtmfEndSignal DtmfEndSignal `xml:"DTMFEND"`
ExceptTest Except `xml:"EXCEPT"` // 예외처리
Dnis []DNIS `xml:"DNIS"`
TimeSleep TimeSleep `xml:"TIMESLEEP"`
ScenarioConfig map[string][]ScenarioConfig
HomeDir string HomeDir string
} ScenarioConfig ScenarioConfig `xml:"SCENARIOORDER"`
type DNIS struct {
Dnis string `xml:"dnis,attr"`
ScenarioConfig []ScenarioConfig `xml:"SCENARIOORDER"`
} }
type InfoConfig struct { type InfoConfig struct {
@ -55,11 +48,6 @@ type DtmfEndSignal struct {
Signal string `xml:"signal,attr"` Signal string `xml:"signal,attr"`
} }
type TimeSleep struct {
Value bool `xml:"value,attr"`
TimeSleep int `xml:"sec,attr"`
}
type VoiceConfig struct { type VoiceConfig struct {
SaveYn string `xml:"SAVEYN"` SaveYn string `xml:"SAVEYN"`
Path string `xml:"PATH"` Path string `xml:"PATH"`
@ -160,22 +148,6 @@ type DelConfig struct {
DelHour int `xml:"hour,attr"` DelHour int `xml:"hour,attr"`
} }
type Except struct {
TestInfo TestInfo `xml:"TESTINFO"`
}
type TestInfo struct {
Value bool `xml:"value,attr"`
Type string `xml:"type,attr"`
ResultCode int `xml:"resultCode,attr"`
Token string `xml:"token,attr"`
Action string `xml:"action,attr"`
Announcement string `xml:"announcement,attr"`
Bargein string `xml:"bargein,attr"`
Recodingfile string `xml:"recodingfile,attr"`
Sttmaxtime int `xml:"sttmaxtime,attr"`
}
type RotateConfig struct { type RotateConfig struct {
Size string `xml:"size,attr"` Size string `xml:"size,attr"`
Num string `xml:"num,attr"` Num string `xml:"num,attr"`
@ -239,11 +211,6 @@ func OpenConfig(ConfigFileName string, homeDir string) (*IcsConfig, *icserror.Ic
return nil, icserror.ICSERRCONFUnmarshal return nil, icserror.ICSERRCONFUnmarshal
} }
conf.ScenarioConfig = make(map[string][]ScenarioConfig)
for _, value := range conf.Dnis {
conf.ScenarioConfig[value.Dnis] = value.ScenarioConfig
}
if !strings.HasPrefix(conf.LogConfig.Path, "/") { if !strings.HasPrefix(conf.LogConfig.Path, "/") {
conf.LogConfig.Path = fmt.Sprintf("%s/%s", homeDir, conf.LogConfig.Path) conf.LogConfig.Path = fmt.Sprintf("%s/%s", homeDir, conf.LogConfig.Path)
} }
@ -347,26 +314,10 @@ func (c IcsConfig) ShowConfig() string {
} }
type ScenarioConfig struct { type ScenarioConfig struct {
Action string `xml:"method,attr"` Order []string `xml:"method,attr"`
AnounceMents string `xml:"value,attr"` Value []string `xml:"value,attr"`
BargeIn string `xml:"bargeIn,attr"` BargeIn []string `xml:"bargeIn,attr"`
SttMaxTime int `xml:"sttMaxTime,attr"` SttMaxTime []int `xml:"sttMaxTime,attr"`
TimeValue bool `xml:"timeValue,attr"`
TimeSleep int `xml:"timesleep,attr"`
EndCharacter string `xml:"endcharacter,attr"`
VoiceName int `xml:"voiceName,attr"`
Speed int `xml:"speed,attr"`
Volume int `xml:"volume,attr"`
Pitch int `xml:"pitch,attr"`
MaxWaitTime int `xml:"maxWaitTime,attr"`
MaxDigit int `xml:"maxDigit,attr"`
DigitTerm int `xml:"digitTerm,attr"`
AudioFilePath string `xml:"apath,attr"`
//maxWaitTime
// VoiceName int `json:"voiceName"`
// Speed int `json:"speed"`
// Volume int `json:"volume"`
// Pitch int `json:"pitch"`
} }
type SimConfig struct { type SimConfig struct {

@ -1,13 +1,12 @@
package icsconf package icsconf
import ( import (
"encoding/json"
"fmt" "fmt"
"testing" "testing"
) )
func TestGetModName(t *testing.T) { func TestGetModName(t *testing.T) {
conf, _ := OpenConfig("/home/icsbot/config/icsbot.xml", "/home/icsvc") conf, _ := OpenConfig("/Users/changsoolee/repository/icssoe/icsvc.xml", "/home/icsvc")
resultJson, _ := json.MarshalIndent(conf, "", " ")
fmt.Println(string(resultJson)) fmt.Println(conf.LicenseConfig)
} }

@ -7,7 +7,6 @@ import (
"io/ioutil" "io/ioutil"
"math/big" "math/big"
"net/http" "net/http"
"strconv"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -39,24 +38,15 @@ type handleInfo struct {
h http.HandlerFunc h http.HandlerFunc
} }
type Request struct { type Resquest struct {
Token string `json:"token"` Token string `json:"token"`
OprMngCode string `json:"oprMngCode"` OprMngCode string `json:"oprMngCode"`
Method string `json:"method"` Method string `json:"method"`
TalkText string `json:"talkText"` TalkText string `json:"talkText"`
CallId string `json:"callId"` CallId string `json:"callId"`
TrunkGroup string `json:"trunkGroup"`
TelNo string `json:"telNo"` TelNo string `json:"telNo"`
Dnis string `json:"dnis"`
MentType string `json:"mentType"` MentType string `json:"mentType"`
RecordFilePath string `json:"recordFilePath"` RecordFilePath string `json:"recordFilePath"`
ServerID string `json:"serverId"`
ServerIP string `json:"serverIp"`
Data json.RawMessage `json:"data"`
}
type Transrate struct {
TargetDnis string `json:"target_dnis"`
} }
type Response struct { type Response struct {
@ -64,7 +54,6 @@ type Response struct {
Token string `json:"token"` Token string `json:"token"`
Action string `json:"action"` Action string `json:"action"`
AnounceMents string `json:"announceMents"` AnounceMents string `json:"announceMents"`
AnnounceFilePath string `json:"announceFilePath"`
Data ResData `json:"DATA"` Data ResData `json:"DATA"`
} }
@ -76,22 +65,12 @@ 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"`
Speed int `json:"speed"`
Volume int `json:"volume"`
Pitch int `json:"pitch"`
EndCharacter []string `json:"endCharacter"`
MaxWaitTime int `json:"maxNoInputTime"`
UUI json.RawMessage `json:"uui"`
} }
type ResStatus struct { type ResStatus struct {
Count int Count int
Status string Status string
NotUnderstand int NotUnderstand int
PreEventNum int
PreEventNum2 int
LoopCount int
} }
type ScenarioSession struct { type ScenarioSession struct {
@ -170,13 +149,15 @@ func TTSFunc4(w http.ResponseWriter, r *http.Request) {
///////////////////////////////////////////// /////////////////////////////////////////////
//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()
conf := icsconf.GetIcsConfig() conf := icsconf.GetIcsConfig()
scnarioConf := conf.ScenarioConfig scnarioConf := conf.ScenarioConfig
// Request json parsing // Request json parsing
request := Request{} request := Resquest{}
resBody, err := ioutil.ReadAll(r.Body) resBody, err := ioutil.ReadAll(r.Body)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
@ -184,71 +165,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) 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] ", request.Method, agent, request.Token)
response := new(Response)
dnis := request.Dnis
s.m.Lock()
////////////////////////////////////
///////////// 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/////////// //////// SCENARIO MAPPING///////////
//////////////////////////////////// ////////////////////////////////////
fmt.Println(request.Method) response := new(Response)
// 현재 들어온 method로 분기
// next 시나리오로 넘겨주기
fmt.Printf("response %+v", request)
if request.Method == "HANGUP" { if request.Method == "HANGUP" {
response.ResultCode = 200 response.ResultCode = 200
response.Token = request.Token response.Token = request.Token
@ -258,402 +190,102 @@ func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) {
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 == "" {
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.Action = "END"
response.AnounceMents = scnarioConf[dnis][s.session[request.Token].Count+1].AnounceMents if s.session[request.Token].NotUnderstand == 3 {
if s.session[request.Token].Count != 0 && dnis == "9012" { response.AnounceMents = "잘 이해하지 못했습니다. 정확한 상담을 위해 매장으로 연결해드릴게요."
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 if dnis == "sim3" {
//시뮬레이터
response.ResultCode = 200
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+1].Action}
} else { } else {
s.session[request.Token] = ResStatus{LoopCount: s.session[request.Token].LoopCount + 1, Count: 1, Status: scnarioConf[dnis][s.session[request.Token].Count].Action} response.AnounceMents = "잘 이해하지 못했습니다. 다시 말씀해주세요."
s.session[request.Token] = ResStatus{Count: 1, Status: scnarioConf.Order[0], NotUnderstand: s.session[request.Token].NotUnderstand + 1}
} }
response.Data.BargeIn = ""
response.Data.RecodingFile = ""
response.Data.SttMaxTime = 10
} else { } else {
response.ResultCode = 200 if request.Method == "HANGUP" {
response.Token = request.Token s.ByeCheck(request.Method, 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()
s.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf[dnis][1].Action}
//s.m.Unlock()
}
} else { } 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" {
dnis = "9014"
}
fmt.Println(scnarioConf[dnis])
switch request.Method { switch request.Method {
case "INIT": case "INIT":
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 = scnarioConf.Order[1]
response.AnounceMents = scnarioConf[dnis][s.session[request.Token].Count+1].AnounceMents response.AnounceMents = scnarioConf.Value[0]
response.Data.Speed = scnarioConf[dnis][s.session[request.Token].Count+1].Speed response.Data.BargeIn = scnarioConf.BargeIn[0]
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" response.Data.RecodingFile = "Y"
//s.m.Lock() response.Data.SttMaxTime = scnarioConf.SttMaxTime[0]
s.session[token] = ResStatus{Count: 1, Status: scnarioConf[dnis][0].Action, NotUnderstand: 0, PreEventNum: 1}
// s.m.Unlock() s.m.Lock()
case "STT", "DTMF", "BOTH", "MEMO", "NONE": s.session[token] = ResStatus{Count: 1, Status: scnarioConf.Order[0], NotUnderstand: 0}
s.m.Unlock()
case "STT":
response.ResultCode = 200 response.ResultCode = 200
response.Token = request.Token response.Token = request.Token
if dnis == "9013" || dnis == "9014" { response.Action = scnarioConf.Order[s.session[request.Token].Count+1]
response.Action = scnarioConf[dnis][s.session[request.Token].Count+1].Action response.AnounceMents = scnarioConf.Value[s.session[request.Token].Count]
response.AnounceMents = scnarioConf[dnis][s.session[request.Token].Count+1].AnounceMents response.Data.BargeIn = scnarioConf.BargeIn[s.session[request.Token].Count]
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"
response.Data.SttMaxTime = scnarioConf.SttMaxTime[s.session[request.Token].Count]
// s.m.Lock() 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.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf.Order[s.session[request.Token].Count+1]}
// s.m.Unlock() s.m.Unlock()
} else { case "DTMF":
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.ResultCode = 200
response.Token = request.Token response.Token = request.Token
response.Action = "TRANSFER" response.Action = scnarioConf.Order[s.session[request.Token].Count+1]
response.AnounceMents = "네. 매장으로 연결해드릴게요." response.AnounceMents = scnarioConf.Value[s.session[request.Token].Count]
response.Data.BargeIn = "" response.Data.BargeIn = "N"
response.Data.RecodingFile = "" response.Data.RecodingFile = "Y"
response.Data.SttMaxTime = 0 response.Data.SttMaxTime = 3
response.Data.TelNo = request.TelNo
// s.m.Lock() 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.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf.Order[s.session[request.Token].Count+1]}
case "TRANSFER": s.m.Unlock()
case "REFER":
response.ResultCode = 200 response.ResultCode = 200
response.Token = request.Token response.Token = request.Token
response.Action = "TRANSFER" response.Action = "END"
response.AnounceMents = "네. 매장으로 연결해드릴게요." response.AnounceMents = "네. 매장으로 연결해드릴게요."
response.Data.BargeIn = "" response.Data.BargeIn = ""
response.Data.RecodingFile = "" response.Data.RecodingFile = ""
response.Data.SttMaxTime = 0 response.Data.SttMaxTime = 0
response.Data.TelNo = request.TelNo response.Data.TelNo = request.TelNo
// s.m.Lock() 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.session[request.Token] = ResStatus{Count: s.session[request.Token].Count + 1, Status: scnarioConf.Order[s.session[request.Token].Count+1]}
// s.m.Unlock() s.m.Unlock()
case "BYE": // 전화 종료 요청
case "TRNASFER2": // 전화 종료 요청
response.ResultCode = 200 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.Token = request.Token
response.Action = "END" response.Action = "END"
response.AnounceMents = "접수가 완료되었습니다." response.AnounceMents = "접수가 완료되었습니다."
response.Data.BargeIn = "N" response.Data.BargeIn = "Y"
response.Data.RecodingFile = "Y" response.Data.RecodingFile = "Y"
response.Data.SttMaxTime = 0 response.Data.SttMaxTime = 0
// case "HANGUP":
// response.ResultCode = 200
// response.Token = request.Token
// response.Action = ""
// response.AnounceMents = ""
// response.Data.BargeIn = ""
// response.Data.RecodingFile = ""
// response.Data.SttMaxTime = 0
// if ByeCheck(request.Method, request.Token) {
// }
} }
}
}
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 // 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))
// 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 // send response
fmt.Fprintln(w, string(resMarshal)) fmt.Fprintln(w, string(resMarshal))
@ -661,9 +293,22 @@ func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) {
func createToken(callId string) string { func createToken(callId string) string {
token := "" token := ""
// length := []int{8, 4, 4, 4, 12}
// codeAlphabet := "abcdefghijklmnopqrstuvwxyz"
// codeAlphabet += "0123456789"
// for i, v := range length {
// fmt.Println(i, v)
// for j := 0; j < v; j++ {
// token += string(codeAlphabet[cryptoRandSecure(int64(len(codeAlphabet)))])
// }
// if v != 12 {
// token += "-"
// }
// }
times := fmt.Sprintf("%d", time.Now().UnixNano()/1000000) times := fmt.Sprintf("%d", time.Now().UnixNano()/1000000)
tokens := strings.Split(callId, "@")[0] + times tokens := strings.Split(callId, "@")[0] + times
token = tokens[0:8] + "-" + tokens[8:10] + "-" + tokens[10:23] token = tokens[0:8] + "-" + tokens[8:12] + "-" + tokens[12:16] + "-" + tokens[16:20] + "-" + tokens[20:32]
return token return token
} }

@ -62,7 +62,6 @@ type DataJSON 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"`
UUI string `json:"uui"`
} }
func NewIcsHttpClient(method, url string, body io.Reader) *IcsHttpClient { func NewIcsHttpClient(method, url string, body io.Reader) *IcsHttpClient {

@ -0,0 +1,28 @@
<?xml version="1.0"?>
<ICSSOE version="1.0.0.0">
<INFO>
<CHANNELID>00001</CHANNELID>
<SERVERID>00</SERVERID>
<SERVERIP>192.168.0.21</SERVERIP>
<HEARTBEAT IP="127.0.0.1" port="7777"/>
<HTTP port="8080" dstIP="127.0.0.1" dstPort="8080"/>
<STT port="22024" dstIP="127.0.0.1" dstPort="22024"/>
<TTS port="9990" dstIP="127.0.0.1" dstPort="9990"/>
<RTP port="22000" range="128"/>
</INFO>
<LICENSE>
<KEY>2CF05DD7C692</KEY>
<CHANNELS>128</CHANNELS>
<EXPIRE>9999</EXPIRE>
</LICENSE>
<LOG>
<PATH>log</PATH>
<DISKLIMIT>100</DISKLIMIT>
<!-- DEBUG2/DEBUG1/DEBUG/INFO/WARN/ERROR/FATAL-->
<LEVEL>DEBUG</LEVEL>
<OUTPUT>file</OUTPUT>
<ROTATE size="100" num="10" yesno="yes"/>
</LOG>
<DNS>
</DNS>
</ICSSOE>

@ -0,0 +1,109 @@
<?xml version="1.0"?>
<ICSVA version="1.0.0.0">
<LICENSE>
<KEY>2CF05DD7C692</KEY>
<CHANNELS>6</CHANNELS>
<EXPIRE>9999</EXPIRE>
</LICENSE>
<INFO>
<CHANNELID>00001</CHANNELID>
<SERVERID>00</SERVERID>
<SERVERIP>192.168.0.21</SERVERIP>
</INFO>
<!--
<AGENT maxnum="10" voiceport="56000"/>
-->
<!--
<VOICEAGENT>
<AGENT callsignalport="57777" voiceport="57778">192.168.0.21</AGENT>
<SERVER port="7777" baseport="7778" range="128">192.168.0.21</SERVER>
</VOICEAGENT>
<PBX>
<IP>192.168.0.222</IP>
<PORT>5090</PORT>
</PBX>
-->
<SERVER>
<WEBSOCKET ip="192.168.0.30" port="48180"/>
<VOICE src="192.168.0.21" port="57778"/>
<CALLSIGNAL port="57777"/>
</SERVER>
<SESSIONEXPIRED sec="300"/> <!-- sec -->
<DTMFEND signal="#"/>
<LOG>
<PATH>/home/icsbot/log</PATH>
<DISKLIMIT>100</DISKLIMIT>
<LEVEL>DEBUG2</LEVEL>
<OUTPUT>file</OUTPUT>
<ROTATE size="100" num="100" yesno="yes"/>
<DELPERIOD day="90" hour="2"/> <!-- day, hour24 -->
</LOG>
<VOICESAVE>
<SAVEYN>Y</SAVEYN>
<PATH>/home/icsva/bin/voice</PATH>
<DELVPERIOD vday="30" vhour="2"/> <!-- day, hour, min, sec -->
</VOICESAVE>
<!-- Listening Port -->
<HEARTBEAT value="false" interval="30" port="55550" srcIP="0.0.0.0"/>
<HTTP value="true" port="8888" srcIP="0.0.0.0"/>
<STT value="false" name="GOOGLE" port="55551" srcIP="0.0.0.0"/>
<!-- <STT value="false" name="SELVAS" port="9500" srcIP="220.86.110.194"/> -->
<!--<STT value="true" name="LGSTT" port="55551" srcIP="0.0.0.0"/>-->
<TTS value="false" name="SELVAS" port="6036" srcIP="211.34.105.117"/>
<!--<TTS value="false" name="GOOGLE" port="55552" srcIP="0.0.0.0"/>-->
<COMMAND value="true" port="55553" srcIP="0.0.0.0"/>
<!-- voice gateway bot-command Port -->
<VGWCOMMAND value="true" ip="192.168.0.21" port="57000"/>
<!-- Set agent info -->
<AGENT name="agent5000" value="true" transport="udp" port="56001" action="voicecapture">
<!-- Destination port -->
<!-- <BOT action="in" ip="127.0.0.1" port="8080" url=""/> -->
<WEBSOCKET ip="15.165.95.232" port="8080" path="ws"/>
<!-- <WEBSOCKET ip="15.165.95.232" port="8888" path="ws"/> -->
</AGENT>
<AGENT name="agent9001" value="true" transport="udp" port="56000" action="voicecapture">
<!-- Destination port -->
<!-- <BOT action="in" ip="127.0.0.1" port="8080" url=""/> -->
<WEBSOCKET ip="15.165.95.232" port="8080" path="ws"/>
<!-- <WEBSOCKET ip="15.165.95.232" port="8888" path="ws"/> -->
</AGENT>
<AGENT name="agent9012" value="true" transport="udp" port="56002" action="voicegateway">
<!-- Destination port -->
<BOT action="out" custtel="0220229012" ip="15.165.95.232" port="8080" url1="/platform/api/call/serviceInfo" url2="/platform/api/call/process"/>
<!-- WEBSOCKET ip="15.165.95.232" port="8880" path="voiceAgent"/> -->
</AGENT>
<AGENT name="agent9013" value="true" transport="udp" port="56003" action="voicegateway">
<!-- Destination port -->
<BOT action="in" custtel="0220229013" ip="15.165.95.232" port="8080" url1="/platform/api/call/serviceInfo" url2="/platform/api/call/process"/>
<!-- WEBSOCKET ip="15.165.95.232" port="8880" path="voiceAgent"/> -->
</AGENT>
<AGENT name="agent9014" value="true" transport="udp" port="56004" action="voicegateway">
<!-- Destination port -->
<BOT action="out" custtel="0220229014" ip="15.165.95.232" port="8080" url1="/platform/api/call/serviceInfo" url2="/platform/api/call/process"/>
<!-- <WEBSOCKET ip="15.165.95.232" port="8880" path="voiceAgent"/> -->
</AGENT>
<AGENT name="agent7000" value="true" transport="udp" port="56005" action="voicegateway">
<!-- Destination port -->
<BOT action="out" custtel="0220227000" ip="15.165.95.232" port="8080" url1="/platform/api/call/serviceInfo" url2="/platform/api/call/process"/>
<!-- <WEBSOCKET ip="15.165.95.232" port="8880" path="voiceAgent"/> -->
</AGENT>
<AGENT name="agent7001" value="true" transport="udp" port="56006" action="voicegateway">
<!-- Destination port -->
<BOT action="out" custtel="0220227001" ip="15.165.95.232" port="8080" url1="/platform/api/call/serviceInfo" url2="/platform/api/call/process"/>
<!-- <WEBSOCKET ip="15.165.95.232" port="8880" path="voiceAgent"/> -->
</AGENT>
<SCENARIOORDER method="INIT" value="안녕하세요. 무인접수봇입니다. 등록하실 서비스명을 말씀해주세요."/>
<SCENARIOORDER method="STT" value="접수하실 제품이 냉장고 맞으신가요. 맞으면 예 아니면 아니오라고 말씀해주세요."/>
<SCENARIOORDER method="STT" value="접수가 완료되었습니다."/>
<SCENARIOORDER method="END" value=""/>
<SCENARIOORDER method="HANGUP" value=""/>
</ICSVA>

@ -0,0 +1,4 @@
#!/usr/bin/sh
BIN=$ICSVA_ROOT/bin
msg=`$BIN/loader`
echo $msg

@ -0,0 +1 @@
sudo LD_LIBRARY_PATH=/usr/local/lib ICSVA_ROOT=/home/icsva /root/go/bin/dlv debug /home/shbaik/dev/work/voiceagent/voiceagent.go

@ -0,0 +1 @@
sudo LD_LIBRARY_PATH=/usr/local/lib ICSVA_ROOT=/home/icsva go run /home/shbaik/dev/work/voiceagent/voiceagent.go

@ -0,0 +1 @@
sudo LD_LIBRARY_PATH=/usr/local/lib ICSVA_ROOT=/home/icsva /home/shbaik/dev/work/voiceagent/voiceagent

@ -0,0 +1,4 @@
#!/usr/bin/sh
HOME=$ICSVA_ROOT
`cat $HOME/voiceagent.pid | xargs kill`
echo "VoiceAgent Stoped..."

@ -2,8 +2,8 @@
package stt package stt
/* /*
#cgo LDFLAGS: -lstdc++ -ldl ./extlib/selvasstt/SDK/LIB/c_linux/x64/libASRLIB.a ./extlib/selvasstt/SDK/OpenSSL/Linux/Linux_x64/libssl.a ./extlib/selvasstt/SDK/OpenSSL/Linux/Linux_x64/libcrypto.a #cgo LDFLAGS: -lstdc++ -ldl /home/leejj9612/dev/voiceagent/extlib/selvasstt/SDK/LIB/c_linux/x64/libASRLIB.a /home/leejj9612/dev/voiceagent/extlib/selvasstt/SDK/OpenSSL/Linux/Linux_x64/libssl.a /home/leejj9612/dev/voiceagent/extlib/selvasstt/SDK/OpenSSL/Linux/Linux_x64/libcrypto.a
#cgo CFLAGS: -I ../extlib/selvasstt/SDK/INCLUDE #cgo CFLAGS: -I /home/leejj9612/dev/voiceagent/extlib/selvasstt/SDK/INCLUDE
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

@ -2,8 +2,8 @@
package tts package tts
/* /*
#cgo LDFLAGS: ./extlib/selvastts/lib/Linux/C/x64/libpttsnet_m.a #cgo LDFLAGS: /home/leejj9612/dev/voiceagent/extlib/selvastts/lib/Linux/C/x64/libpttsnet_m.a
#cgo CFLAGS: -I ../extlib/selvastts/include #cgo CFLAGS: -I /home/leejj9612/dev/voiceagent/extlib/selvastts/include
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <pttsnet.h> #include <pttsnet.h>

Loading…
Cancel
Save