diff --git a/icsconf/icsconf.go b/icsconf/icsconf.go index 9310d2d..bc7ea7e 100644 --- a/icsconf/icsconf.go +++ b/icsconf/icsconf.go @@ -26,6 +26,7 @@ type IcsConfig struct { AgentConfig []AgentConfig `xml:"AGENT"` SessionExpired SessionExpired `xml:"SESSIONEXPIRED"` DtmfEndSignal DtmfEndSignal `xml:"DTMFEND"` + ExceptTest Except `xml:"EXCEPT"` // 예외처리 HomeDir string ScenarioConfig ScenarioConfig `xml:"SCENARIOORDER"` TimeSleep TimeSleep `xml:"TIMESLEEP"` @@ -154,6 +155,22 @@ type DelConfig struct { 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 { Size string `xml:"size,attr"` Num string `xml:"num,attr"` diff --git a/icshttp/handler.go b/icshttp/handler.go index 1542f9e..36f07ec 100644 --- a/icshttp/handler.go +++ b/icshttp/handler.go @@ -173,10 +173,39 @@ func (s *ScenarioSession) BOTPFunc(w http.ResponseWriter, r *http.Request) { 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] ", request.Method, agent, request.Token) + response := new(Response) + + //////////////////////////////////// + ///////////// EXCEPT /////////////// + //////////////////////////////////// + if conf.ExceptTest.TestInfo.Value { + // eType := conf.ExceptTest.TestInfo.Type + + 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 + // switch eType { + // case "sizeup": + // response.ResultCode = 200 + // response.Token = request.Token + "000000000000000000000000000000" + // response.Action = "" + // response.AnounceMents = "" + // response.Data.BargeIn = "" + // response.Data.RecodingFile = "" + // response.Data.SttMaxTime = 10 + // case "sizedown": + // case "space": + // case "null": + // } + } + //////////////////////////////////// //////// SCENARIO MAPPING/////////// //////////////////////////////////// - response := new(Response) // 현재 들어온 method로 분기 // next 시나리오로 넘겨주기