TOR in GetSessionRuns, fixes #349

This commit is contained in:
DanB
2016-01-07 19:33:53 +01:00
parent 61897fbaf2
commit 91a249f169
3 changed files with 6 additions and 5 deletions

View File

@@ -402,6 +402,7 @@ func (rs *Responder) GetSessionRuns(ev *CDR, sRuns *[]*SessionRun) error {
}
cd := &CallDescriptor{
CgrId: ev.GetCgrId(rs.Timezone),
TOR: ev.ToR,
Direction: ev.GetDirection(dc.DirectionField),
Tenant: ev.GetTenant(dc.TenantField),
Category: ev.GetCategory(dc.CategoryField),

View File

@@ -153,15 +153,15 @@ func TestResponderGetSessionRuns(t *testing.T) {
&SessionRun{DerivedCharger: extra1DC,
CallDescriptor: &CallDescriptor{CgrId: utils.Sha1("dsafdsaf", time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC).String()), Direction: "*out", Category: "0",
Tenant: "vdf", Subject: "rif", Account: "minitsboy", Destination: "0256", TimeStart: time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC),
ExtraFields: map[string]string{"field_extr1": "val_extr1", "fieldextr2": "valextr2"}}},
TOR: utils.VOICE, ExtraFields: map[string]string{"field_extr1": "val_extr1", "fieldextr2": "valextr2"}}},
&SessionRun{DerivedCharger: extra2DC,
CallDescriptor: &CallDescriptor{CgrId: utils.Sha1("dsafdsaf", time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC).String()), Direction: "*out", Category: "call",
Tenant: "vdf", Subject: "ivo", Account: "ivo", Destination: "1002", TimeStart: time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC),
ExtraFields: map[string]string{"field_extr1": "val_extr1", "fieldextr2": "valextr2"}}},
TOR: utils.VOICE, ExtraFields: map[string]string{"field_extr1": "val_extr1", "fieldextr2": "valextr2"}}},
&SessionRun{DerivedCharger: dfDC,
CallDescriptor: &CallDescriptor{CgrId: utils.Sha1("dsafdsaf", time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC).String()), Direction: "*out", Category: "call",
Tenant: "vdf", Subject: "dan2", Account: "dan2", Destination: "1002", TimeStart: time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC),
ExtraFields: map[string]string{"field_extr1": "val_extr1", "fieldextr2": "valextr2"}}}}
TOR: utils.VOICE, ExtraFields: map[string]string{"field_extr1": "val_extr1", "fieldextr2": "valextr2"}}}}
if err := rsponder.GetSessionRuns(cdr, &sesRuns); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eSRuns, sesRuns) {

View File

@@ -129,7 +129,7 @@ func TestSMGenericEventParseFields(t *testing.T) {
func TestSMGenericEventAsStoredCdr(t *testing.T) {
smGev := SMGenericEvent{}
smGev[utils.EVENT_NAME] = "TEST_EVENT"
smGev[utils.TOR] = utils.VOICE
smGev[utils.TOR] = utils.SMS
smGev[utils.ACCID] = "12345"
smGev[utils.DIRECTION] = utils.OUT
smGev[utils.ACCOUNT] = "account1"
@@ -148,7 +148,7 @@ func TestSMGenericEventAsStoredCdr(t *testing.T) {
smGev["Extra1"] = "Value1"
smGev["Extra2"] = 5
eStoredCdr := &engine.CDR{CGRID: "0711eaa78e53937f1593dabc08c83ea04a915f2e",
ToR: utils.VOICE, OriginID: "12345", OriginHost: "10.0.3.15", Source: "SMG_TEST_EVENT", RequestType: utils.META_PREPAID,
ToR: utils.SMS, OriginID: "12345", OriginHost: "10.0.3.15", Source: "SMG_TEST_EVENT", RequestType: utils.META_PREPAID,
Direction: utils.OUT, Tenant: "cgrates.org", Category: "call", Account: "account1", Subject: "subject1",
Destination: "+4986517174963", SetupTime: time.Date(2015, 11, 9, 14, 21, 24, 0, time.UTC), AnswerTime: time.Date(2015, 11, 9, 14, 22, 2, 0, time.UTC),
Usage: time.Duration(83) * time.Second, PDD: time.Duration(300) * time.Millisecond, Supplier: "supplier1", DisconnectCause: "NORMAL_DISCONNECT",