mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-13 02:56:24 +05:00
Add test for SessionSv1.ProcessEvent with *cdrs flag
This commit is contained in:
@@ -394,30 +394,31 @@ func testSSv1ItProcessEventTerminateSession(t *testing.T) {
|
||||
}
|
||||
|
||||
func testSSv1ItProcessCDRForSessionFromProcessEvent(t *testing.T) {
|
||||
args := utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "testSSv1ItProcessCDRForSessionFromProcessEvent",
|
||||
Event: map[string]interface{}{
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.ToR: utils.VOICE,
|
||||
utils.OriginID: "testSSv1ItProcessEvent",
|
||||
utils.RequestType: sSV1RequestType,
|
||||
utils.Account: "1001",
|
||||
utils.Subject: "ANY2CNT",
|
||||
utils.Destination: "1002",
|
||||
utils.SetupTime: time.Date(2018, time.January, 7, 16, 60, 0, 0, time.UTC),
|
||||
utils.AnswerTime: time.Date(2018, time.January, 7, 16, 60, 10, 0, time.UTC),
|
||||
utils.Usage: 10 * time.Minute,
|
||||
args := &sessions.V1ProcessEventArgs{
|
||||
Flags: []string{utils.MetaCDRs},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "testSSv1ItProcessCDRForSessionFromProcessEvent",
|
||||
Event: map[string]interface{}{
|
||||
utils.Tenant: "cgrates.org",
|
||||
utils.ToR: utils.VOICE,
|
||||
utils.OriginID: "testSSv1ItProcessEvent",
|
||||
utils.RequestType: sSV1RequestType,
|
||||
utils.Account: "1001",
|
||||
utils.Subject: "ANY2CNT",
|
||||
utils.Destination: "1002",
|
||||
utils.SetupTime: time.Date(2018, time.January, 7, 16, 60, 0, 0, time.UTC),
|
||||
utils.AnswerTime: time.Date(2018, time.January, 7, 16, 60, 10, 0, time.UTC),
|
||||
utils.Usage: 10 * time.Minute,
|
||||
},
|
||||
},
|
||||
}
|
||||
var rply string
|
||||
if err := sSv1BiRpc.Call(utils.SessionSv1ProcessCDR,
|
||||
args, &rply); err != nil {
|
||||
var reply sessions.V1ProcessEventReply
|
||||
if err := sSv1BiRpc.Call(utils.SessionSv1ProcessEvent,
|
||||
args, &reply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if rply != utils.OK {
|
||||
t.Errorf("Unexpected reply: %s", rply)
|
||||
}
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
|
||||
|
||||
@@ -3234,6 +3234,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.ClientConnector,
|
||||
rply.StatQueueIDs = &sIDs
|
||||
}
|
||||
if argsFlagsWithParams.HasKey(utils.MetaCDRs) {
|
||||
var rplyCDR string
|
||||
cgrID := GetSetCGRID(ev)
|
||||
s := sS.getRelocateSession(cgrID,
|
||||
ev.GetStringIgnoreErrors(utils.InitialOriginID),
|
||||
@@ -3251,7 +3252,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.ClientConnector,
|
||||
&engine.ArgV1ProcessEvent{
|
||||
Flags: []string{utils.MetaRALs},
|
||||
CGREvent: *args.CGREvent,
|
||||
ArgDispatcher: args.ArgDispatcher}, rply)
|
||||
ArgDispatcher: args.ArgDispatcher}, &rplyCDR)
|
||||
}
|
||||
|
||||
// Use previously stored Session to generate CDRs
|
||||
@@ -3273,7 +3274,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.ClientConnector,
|
||||
argsProc.Flags = append(argsProc.Flags, fmt.Sprintf("%s:true", utils.MetaRALs))
|
||||
}
|
||||
if err = sS.connMgr.Call(sS.cgrCfg.SessionSCfg().CDRsConns, nil, utils.CDRsV1ProcessEvent,
|
||||
argsProc, rply); err != nil {
|
||||
argsProc, &rplyCDR); err != nil {
|
||||
utils.Logger.Warning(
|
||||
fmt.Sprintf("<%s> error <%s> posting CDR with CGRID: <%s>",
|
||||
utils.SessionS, err.Error(), cgrID))
|
||||
|
||||
Reference in New Issue
Block a user