more error loging and fixed select string

This commit is contained in:
Radu Ioan Fericean
2015-10-16 10:45:59 +03:00
parent 09f9233df6
commit 044d4ae7e1
3 changed files with 3 additions and 2 deletions

View File

@@ -70,6 +70,7 @@ func StartEngine(cfgPath string, waitEngine int) (*exec.Cmd, error) {
return nil, err
}
engine := exec.Command(enginePath, "-config_dir", cfgPath)
engine.Stderr = os.Stderr
if err := engine.Start(); err != nil {
return nil, err
}

View File

@@ -855,7 +855,7 @@ func (ms *MongoStorage) GetStoredCdrs(qryFltr *utils.CdrsFilter) ([]*StoredCdr,
if *qryFltr.MaxCost == -1.0 { // Non-rated CDRs
filters["cost"] = bson.M{"$eq": nil} // Need to include it otherwise all CDRs will be returned
} else { // Above limited CDRs, since MinCost is empty, make sure we query also NULL cost
filters["cost"] = bson.M{"$gte": *qryFltr.MinCost, "$lt": *qryFltr.MaxCost}
filters["cost"] = bson.M{"$lt": *qryFltr.MaxCost}
}
}
q := ms.db.C(colCdrs).Find(filters)

View File

@@ -645,7 +645,7 @@ func (self *SQLStorage) GetStoredCdrs(qryFltr *utils.CdrsFilter) ([]*StoredCdr,
// Select string
var selectStr string
if qryFltr.FilterOnRated { // We use different tables to query account data in case of derived
selectTmpl := template.Must(template.New("select").Parse("{{.Pr}}.cgrid,{{.Pr}}.id,{{.Pr}}.tor,{{.Pr}}.accid,{{.Pr}}.cdrhost,{{.Pr}}.cdrsource,{{.Rc}}.reqtype,{{.Rc}}.direction,{{.Rc}}.tenant,{{.Rc}}.category,{{.Rc}}.account,{{.Rc}}.subject,{{.Rc}}.destination,{{.Rc}}.setup_time,{{.Rc}}.answer_time,{{.Rc}}.usage,{{.Rc}}.pdd,{{.Rc}}.supplier,{{.Ex}}.disconnect_cause,{{.Rc}}.extra_fields,{{.Rc}}.runid,{{.Cd}}.cost,{{.Cd}}.tor,{{.Cd}}.direction,{{.Cd}}.tenant,{{.Cd}}.category,{{.Cd}}.account,{{.Cd}}.subject,{{.Cd}}.destination,{{.Cd}}.cost,{{.Cd}}.timespans"))
selectTmpl := template.Must(template.New("select").Parse("{{.Pr}}.cgrid,{{.Pr}}.id,{{.Pr}}.tor,{{.Pr}}.accid,{{.Pr}}.cdrhost,{{.Pr}}.cdrsource,{{.Rc}}.reqtype,{{.Rc}}.direction,{{.Rc}}.tenant,{{.Rc}}.category,{{.Rc}}.account,{{.Rc}}.subject,{{.Rc}}.destination,{{.Rc}}.setup_time,{{.Rc}}.answer_time,{{.Rc}}.usage,{{.Rc}}.pdd,{{.Rc}}.supplier,{{.Rc}}.disconnect_cause,{{.Ex}}.extra_fields,{{.Rc}}.runid,{{.Rc}}.cost,{{.Cd}}.tor,{{.Cd}}.direction,{{.Cd}}.tenant,{{.Cd}}.category,{{.Cd}}.account,{{.Cd}}.subject,{{.Cd}}.destination,{{.Cd}}.cost,{{.Cd}}.timespans"))
var selectBuf bytes.Buffer
selectTmpl.Execute(&selectBuf, &struct {
Pr string