для надежности навесил трекинг на изменения объекта через include Mongoid::History::Trackable
каждая сессия может иметь один и более объектов call - Это ноги самой сессии, в нормальной ситуации их 2 - один звонок на один номер, другой на второй и потом их соеденяет в сессию
/* 1 createdAt:25.08.2021, 10:41:47*/
{
"_id" : ObjectId("6125f43b25930e44e8f71eec"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
},
{
"name" : "calls",
"id" : ObjectId("6125f0a425930e44e8f71e75")
}
],
"scope" : "call",
"original" : {
},
"modified" : {
"duration" : NumberInt(897)
},
"version" : NumberInt(5),
"action" : "update",
"updated_at" : ISODate("2021-08-25T10:41:47.374+03:00"),
"created_at" : ISODate("2021-08-25T10:41:47.374+03:00")
},
/* 2 createdAt:25.08.2021, 10:41:47*/
{
"_id" : ObjectId("6125f43b25930e44e8f71eeb"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
},
{
"name" : "calls",
"id" : ObjectId("6125f0a425930e44e8f71e75")
}
],
"scope" : "call",
"original" : {
"status" : "CONFERENCE (-1)"
},
"modified" : {
"stop" : ISODate("2021-08-25T10:41:47.369+03:00"),
"status" : "OK (0)"
},
"version" : NumberInt(4),
"action" : "update",
"updated_at" : ISODate("2021-08-25T10:41:47.370+03:00"),
"created_at" : ISODate("2021-08-25T10:41:47.370+03:00")
},
/* 3 createdAt:25.08.2021, 10:41:47*/
{
"_id" : ObjectId("6125f43b25930e44e8f71eea"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
}
],
"scope" : "session",
"original" : {
"status" : "EXECUTING"
},
"modified" : {
"status" : "EXECUTED"
},
"version" : NumberInt(7),
"action" : "update",
"updated_at" : ISODate("2021-08-25T10:41:47.357+03:00"),
"created_at" : ISODate("2021-08-25T10:41:47.357+03:00")
},
/* 4 createdAt:25.08.2021, 10:41:47*/
{
"_id" : ObjectId("6125f43b25930e44e8f71ee9"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
}
],
"scope" : "session",
"original" : {
},
"modified" : {
"duration" : NumberInt(920),
"billing_duration" : NumberInt(897),
"cost" : NumberInt(1659)
},
"version" : NumberInt(6),
"action" : "update",
"updated_at" : ISODate("2021-08-25T10:41:47.326+03:00"),
"created_at" : ISODate("2021-08-25T10:41:47.326+03:00")
},
/* 5 createdAt:25.08.2021, 10:41:47*/
{
"_id" : ObjectId("6125f43b25930e44e8f71ee8"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
}
],
"scope" : "session",
"original" : {
},
"modified" : {
"stop" : ISODate("2021-08-25T10:41:47.320+03:00")
},
"version" : NumberInt(5),
"action" : "update",
"updated_at" : ISODate("2021-08-25T10:41:47.321+03:00"),
"created_at" : ISODate("2021-08-25T10:41:47.321+03:00")
},
/* 6 createdAt:25.08.2021, 10:41:47*/
{
"_id" : ObjectId("6125f43b25930e44e8f71ee7"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
},
{
"name" : "calls",
"id" : ObjectId("6125f09c25930e44e8f71e70")
}
],
"scope" : "call",
"original" : {
},
"modified" : {
"duration" : NumberInt(920)
},
"version" : NumberInt(6),
"action" : "update",
"updated_at" : ISODate("2021-08-25T10:41:47.316+03:00"),
"created_at" : ISODate("2021-08-25T10:41:47.316+03:00")
},
/* 7 createdAt:25.08.2021, 10:41:47*/
{
"_id" : ObjectId("6125f43b25930e44e8f71ee6"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
},
{
"name" : "calls",
"id" : ObjectId("6125f09c25930e44e8f71e70")
}
],
"scope" : "call",
"original" : {
"status" : "CONFERENCE (-1)"
},
"modified" : {
"status" : "OK (0)",
"stop" : ISODate("2021-08-25T10:41:47.313+03:00")
},
"version" : NumberInt(5),
"action" : "update",
"updated_at" : ISODate("2021-08-25T10:41:47.314+03:00"),
"created_at" : ISODate("2021-08-25T10:41:47.314+03:00")
},
/* 8 createdAt:25.08.2021, 10:26:51*/
{
"_id" : ObjectId("6125f0bb25930e44e8f71e7a"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
}
],
"scope" : "session",
"original" : {
"status" : "WAITING"
},
"modified" : {
"status" : "EXECUTING"
},
"version" : NumberInt(4),
"action" : "update",
"updated_at" : ISODate("2021-08-25T10:26:51.267+03:00"),
"created_at" : ISODate("2021-08-25T10:26:51.267+03:00")
},
/* 9 createdAt:25.08.2021, 10:26:51*/
{
"_id" : ObjectId("6125f0bb25930e44e8f71e79"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
},
{
"name" : "calls",
"id" : ObjectId("6125f09c25930e44e8f71e70")
}
],
"scope" : "call",
"original" : {
"status" : "OK (0)"
},
"modified" : {
"status" : "CONFERENCE (-1)"
},
"version" : NumberInt(4),
"action" : "update",
"updated_at" : ISODate("2021-08-25T10:26:51.217+03:00"),
"created_at" : ISODate("2021-08-25T10:26:51.217+03:00")
},
/* 10 createdAt:25.08.2021, 10:26:51*/
{
"_id" : ObjectId("6125f0bb25930e44e8f71e78"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
},
{
"name" : "calls",
"id" : ObjectId("6125f0a425930e44e8f71e75")
}
],
"scope" : "call",
"original" : {
"status" : "{unknown}"
},
"modified" : {
"status" : "CONFERENCE (-1)",
"start" : ISODate("2021-08-25T10:26:51.213+03:00")
},
"version" : NumberInt(3),
"action" : "update",
"updated_at" : ISODate("2021-08-25T10:26:51.214+03:00"),
"created_at" : ISODate("2021-08-25T10:26:51.214+03:00")
},
/* 11 createdAt:25.08.2021, 10:26:28*/
{
"_id" : ObjectId("6125f0a425930e44e8f71e76"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
},
{
"name" : "calls",
"id" : ObjectId("6125f0a425930e44e8f71e75")
}
],
"scope" : "call",
"original" : {
},
"modified" : {
"callstart" : ISODate("2021-08-25T10:26:28.315+03:00")
},
"version" : NumberInt(2),
"action" : "update",
"updated_at" : ISODate("2021-08-25T10:26:28.316+03:00"),
"created_at" : ISODate("2021-08-25T10:26:28.316+03:00")
},
/* 12 createdAt:25.08.2021, 10:26:28*/
{
"_id" : ObjectId("6125f0a425930e44e8f71e74"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
},
{
"name" : "calls",
"id" : ObjectId("6125f0a425930e44e8f71e75")
}
],
"scope" : "call",
"original" : {
},
"modified" : {
"status" : "{unknown}"
},
"version" : NumberInt(1),
"action" : "create",
"updated_at" : ISODate("2021-08-25T10:26:28.312+03:00"),
"created_at" : ISODate("2021-08-25T10:26:28.312+03:00")
},
/* 13 createdAt:25.08.2021, 10:26:28*/
{
"_id" : ObjectId("6125f0a425930e44e8f71e73"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
},
{
"name" : "calls",
"id" : ObjectId("6125f09c25930e44e8f71e70")
}
],
"scope" : "call",
"original" : {
"status" : "{unknown}"
},
"modified" : {
"status" : "OK (0)",
"start" : ISODate("2021-08-25T10:26:28.309+03:00")
},
"version" : NumberInt(3),
"action" : "update",
"updated_at" : ISODate("2021-08-25T10:26:28.310+03:00"),
"created_at" : ISODate("2021-08-25T10:26:28.310+03:00")
},
/* 14 createdAt:25.08.2021, 10:26:20*/
{
"_id" : ObjectId("6125f09c25930e44e8f71e71"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
},
{
"name" : "calls",
"id" : ObjectId("6125f09c25930e44e8f71e70")
}
],
"scope" : "call",
"original" : {
},
"modified" : {
"callstart" : ISODate("2021-08-25T10:26:20.288+03:00")
},
"version" : NumberInt(2),
"action" : "update",
"updated_at" : ISODate("2021-08-25T10:26:20.289+03:00"),
"created_at" : ISODate("2021-08-25T10:26:20.289+03:00")
},
/* 15 createdAt:25.08.2021, 10:26:20*/
{
"_id" : ObjectId("6125f09c25930e44e8f71e6f"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
},
{
"name" : "calls",
"id" : ObjectId("6125f09c25930e44e8f71e70")
}
],
"scope" : "call",
"original" : {
},
"modified" : {
"status" : "{unknown}"
},
"version" : NumberInt(1),
"action" : "create",
"updated_at" : ISODate("2021-08-25T10:26:20.286+03:00"),
"created_at" : ISODate("2021-08-25T10:26:20.286+03:00")
},
/* 16 createdAt:25.08.2021, 10:26:20*/
{
"_id" : ObjectId("6125f09c25930e44e8f71e6e"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
}
],
"scope" : "session",
"original" : {
},
"modified" : {
"start" : ISODate("2021-08-25T10:26:20.281+03:00")
},
"version" : NumberInt(3),
"action" : "update",
"updated_at" : ISODate("2021-08-25T10:26:20.282+03:00"),
"created_at" : ISODate("2021-08-25T10:26:20.282+03:00")
},
/* 17 createdAt:25.08.2021, 10:26:20*/
{
"_id" : ObjectId("6125f09c25930e44e8f71e6c"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
}
],
"scope" : "session",
"original" : {
"status" : "CONFIRMED"
},
"modified" : {
"status" : "WAITING"
},
"version" : NumberInt(2),
"action" : "update",
"updated_at" : ISODate("2021-08-25T10:26:20.272+03:00"),
"created_at" : ISODate("2021-08-25T10:26:20.272+03:00")
},
/* 18 createdAt:25.08.2021, 10:26:16*/
{
"_id" : ObjectId("6125f09825930e44e8f71e6a"),
"association_chain" : [
{
"name" : "Session",
"id" : ObjectId("6125f09825930e44e8f71e69")
}
],
"scope" : "session",
"original" : {
},
"modified" : {
"status" : "CONFIRMED",
"billing_type" : "b",
"uid" : NumberInt(6252265)
},
"version" : NumberInt(1),
"action" : "create",
"updated_at" : ISODate("2021-08-25T10:26:16.523+03:00"),
"created_at" : ISODate("2021-08-25T10:26:16.523+03:00")
}