Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 804b9b2792 | |||
| 3be1e46f69 | |||
| 0122b01037 | |||
| d8d857e82e | |||
| ab6b36c12c | |||
| f69b849ed7 |
@@ -19,8 +19,11 @@ type DBConversation struct {
|
|||||||
Start *time.Time `gorm:"index"`
|
Start *time.Time `gorm:"index"`
|
||||||
UtilizationLabelId *string
|
UtilizationLabelId *string
|
||||||
LiveUpdate *time.Time
|
LiveUpdate *time.Time
|
||||||
|
DetailsUpdate *time.Time
|
||||||
SemiLiveUpdate *time.Time
|
SemiLiveUpdate *time.Time
|
||||||
JobUpdate *time.Time
|
JobUpdate *time.Time
|
||||||
|
|
||||||
|
Participants []DBParticipant `gorm:"foreignKey:ConversationId;references:Id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (DBConversation) TableName() string {
|
func (DBConversation) TableName() string {
|
||||||
|
|||||||
67
models/full_conversation.go
Normal file
67
models/full_conversation.go
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type Conversation struct {
|
||||||
|
Address *string
|
||||||
|
DivisionIds *string `gorm:"type:json"`
|
||||||
|
End *time.Time `gorm:"index"`
|
||||||
|
ExternalTag *string
|
||||||
|
Id string `gorm:"primaryKey;index"`
|
||||||
|
MinMos *float32
|
||||||
|
MinRFactor *float32
|
||||||
|
OriginatingDirection *string
|
||||||
|
RecentTransfers *string `gorm:"type:json"`
|
||||||
|
RecordingState *string
|
||||||
|
SecurePause *bool
|
||||||
|
Start *time.Time `gorm:"index"`
|
||||||
|
UtilizationLabelId *string
|
||||||
|
LiveUpdate *time.Time
|
||||||
|
DetailsUpdate *time.Time
|
||||||
|
SemiLiveUpdate *time.Time
|
||||||
|
JobUpdate *time.Time
|
||||||
|
Participants []struct {
|
||||||
|
Address *string
|
||||||
|
Attributes *string `gorm:"type:json"`
|
||||||
|
ConnectedTime *time.Time `gorm:"index"`
|
||||||
|
ConversationId string `gorm:"foreignKey;index"`
|
||||||
|
EndTime *time.Time `gorm:"index"`
|
||||||
|
ExternalContactId *string
|
||||||
|
ExternalContactInitialDivisionId *string
|
||||||
|
Id string `gorm:"primaryKey;index"`
|
||||||
|
MediaRoles *string `gorm:"type:json"`
|
||||||
|
Name *string `gorm:"index"`
|
||||||
|
Purpose *string `gorm:"index"`
|
||||||
|
QueueId *string
|
||||||
|
Wrapup *string `gorm:"type:json"`
|
||||||
|
WrapupExpected *bool
|
||||||
|
WrapupRequired *bool
|
||||||
|
Sessions []struct {
|
||||||
|
Ani string
|
||||||
|
Direction string
|
||||||
|
Dnis string
|
||||||
|
EdgeId string
|
||||||
|
Id string `gorm:"primaryKey;index"`
|
||||||
|
MediaEndpointStats string `gorm:"type:json"`
|
||||||
|
MediaType string
|
||||||
|
Metrics string `gorm:"type:json"`
|
||||||
|
ParticipantId string `gorm:"foreignKey;index"`
|
||||||
|
ProtocolCallId string
|
||||||
|
Provider string
|
||||||
|
Recording bool
|
||||||
|
RemoteNameDisplayable string
|
||||||
|
SessionDnis string
|
||||||
|
Segments []struct {
|
||||||
|
Id string `gorm:"primaryKey;index"`
|
||||||
|
Conference bool
|
||||||
|
DisconnectType string
|
||||||
|
Q850ResponseCodes string `gorm:"type:json"`
|
||||||
|
SegmentEnd time.Time `gorm:"index"`
|
||||||
|
SegmentStart time.Time `gorm:"index"`
|
||||||
|
SegmentType string `gorm:"index"`
|
||||||
|
SessionId string `gorm:"foreignKey"`
|
||||||
|
WrapUpCode string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,6 +20,8 @@ type DBParticipant struct {
|
|||||||
Wrapup *string `gorm:"type:json"`
|
Wrapup *string `gorm:"type:json"`
|
||||||
WrapupExpected *bool
|
WrapupExpected *bool
|
||||||
WrapupRequired *bool
|
WrapupRequired *bool
|
||||||
|
|
||||||
|
Sessions []DBSession `gorm:"foreignKey:ParticipantId;references:Id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (DBParticipant) TableName() string {
|
func (DBParticipant) TableName() string {
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ type DBQueueLog struct {
|
|||||||
ConversationId string `gorm:"primaryKey"`
|
ConversationId string `gorm:"primaryKey"`
|
||||||
Start time.Time `gorm:"index"`
|
Start time.Time `gorm:"index"`
|
||||||
End time.Time `gorm:"index"`
|
End time.Time `gorm:"index"`
|
||||||
Result string `gorm:"type:json"`
|
Duration float64
|
||||||
|
Result string `gorm:"type:json"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (DBQueueLog) TableName() string {
|
func (DBQueueLog) TableName() string {
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
|
type AnalyticsConversationWithAttributesQuery struct {
|
||||||
|
Conversations []AnalyticsConversationWithAttributes `json:"conversations"`
|
||||||
|
Cursor *string `json:"cursor"`
|
||||||
|
}
|
||||||
|
|
||||||
type AnalyticsConversationWithAttributes struct {
|
type AnalyticsConversationWithAttributes struct {
|
||||||
ConversationEnd string `json:"conversationEnd"`
|
ConversationEnd string `json:"conversationEnd"`
|
||||||
ConversationId string `json:"conversationId"`
|
ConversationId string `json:"conversationId"`
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ type DBSession struct {
|
|||||||
Recording bool
|
Recording bool
|
||||||
RemoteNameDisplayable string
|
RemoteNameDisplayable string
|
||||||
SessionDnis string
|
SessionDnis string
|
||||||
|
|
||||||
|
Segments []DBSegment `gorm:"foreignKey:SessionId;references:Id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (DBSession) TableName() string {
|
func (DBSession) TableName() string {
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ func ExtractWithoutAttributes(base models.AnalyticsConversationWithoutAttributes
|
|||||||
}
|
}
|
||||||
divisionIdsBytesStr := string(divisionIdsBytes)
|
divisionIdsBytesStr := string(divisionIdsBytes)
|
||||||
|
|
||||||
currentTime := time.Now()
|
|
||||||
|
|
||||||
conversation := models.DBConversation{
|
conversation := models.DBConversation{
|
||||||
DivisionIds: &divisionIdsBytesStr,
|
DivisionIds: &divisionIdsBytesStr,
|
||||||
End: endTime,
|
End: endTime,
|
||||||
@@ -43,7 +41,6 @@ func ExtractWithoutAttributes(base models.AnalyticsConversationWithoutAttributes
|
|||||||
MinRFactor: &base.MediaStatsMinConversationRFactor,
|
MinRFactor: &base.MediaStatsMinConversationRFactor,
|
||||||
OriginatingDirection: &base.OriginatingDirection,
|
OriginatingDirection: &base.OriginatingDirection,
|
||||||
Start: startTime,
|
Start: startTime,
|
||||||
SemiLiveUpdate: ¤tTime,
|
|
||||||
}
|
}
|
||||||
var participants []models.DBParticipant
|
var participants []models.DBParticipant
|
||||||
var sessions []models.DBSession
|
var sessions []models.DBSession
|
||||||
@@ -78,7 +75,7 @@ func ExtractWithoutAttributes(base models.AnalyticsConversationWithoutAttributes
|
|||||||
Direction: sess.Direction,
|
Direction: sess.Direction,
|
||||||
Dnis: sess.DNIS,
|
Dnis: sess.DNIS,
|
||||||
EdgeId: sess.EdgeId,
|
EdgeId: sess.EdgeId,
|
||||||
Id: sess.SessionId,
|
Id: fmt.Sprintf("%s_%s", p.ParticipantId, sess.SessionId),
|
||||||
MediaEndpointStats: string(mediaEndpointStatsBytes),
|
MediaEndpointStats: string(mediaEndpointStatsBytes),
|
||||||
MediaType: sess.MediaType,
|
MediaType: sess.MediaType,
|
||||||
Metrics: string(metricsBytes),
|
Metrics: string(metricsBytes),
|
||||||
@@ -129,7 +126,6 @@ func ExtractWithoutAttributes(base models.AnalyticsConversationWithoutAttributes
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExtractLive(base models.NotificationConversationWithAttributes) (models.DBConversation, []models.DBParticipant, []models.DBCall) {
|
func ExtractLive(base models.NotificationConversationWithAttributes) (models.DBConversation, []models.DBParticipant, []models.DBCall) {
|
||||||
currentTime := time.Now()
|
|
||||||
|
|
||||||
conversation := models.DBConversation{
|
conversation := models.DBConversation{
|
||||||
Id: base.Id,
|
Id: base.Id,
|
||||||
@@ -138,7 +134,6 @@ func ExtractLive(base models.NotificationConversationWithAttributes) (models.DBC
|
|||||||
RecordingState: &base.RecordingState,
|
RecordingState: &base.RecordingState,
|
||||||
SecurePause: &base.SecurePause,
|
SecurePause: &base.SecurePause,
|
||||||
UtilizationLabelId: &base.UtilizationLabelId,
|
UtilizationLabelId: &base.UtilizationLabelId,
|
||||||
LiveUpdate: ¤tTime,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var participants []models.DBParticipant
|
var participants []models.DBParticipant
|
||||||
@@ -284,8 +279,6 @@ func ExtractWithAttributes(base models.AnalyticsConversationWithAttributes) (mod
|
|||||||
}
|
}
|
||||||
divisionIdsBytesStr := string(divisionIdsBytes)
|
divisionIdsBytesStr := string(divisionIdsBytes)
|
||||||
|
|
||||||
currentTime := time.Now()
|
|
||||||
|
|
||||||
conversation := models.DBConversation{
|
conversation := models.DBConversation{
|
||||||
DivisionIds: &divisionIdsBytesStr,
|
DivisionIds: &divisionIdsBytesStr,
|
||||||
End: endTime,
|
End: endTime,
|
||||||
@@ -294,7 +287,6 @@ func ExtractWithAttributes(base models.AnalyticsConversationWithAttributes) (mod
|
|||||||
MinRFactor: &base.MediaStatsMinConversationRFactor,
|
MinRFactor: &base.MediaStatsMinConversationRFactor,
|
||||||
OriginatingDirection: &base.OriginatingDirection,
|
OriginatingDirection: &base.OriginatingDirection,
|
||||||
Start: startTime,
|
Start: startTime,
|
||||||
JobUpdate: ¤tTime,
|
|
||||||
}
|
}
|
||||||
var participants []models.DBParticipant
|
var participants []models.DBParticipant
|
||||||
var sessions []models.DBSession
|
var sessions []models.DBSession
|
||||||
@@ -336,7 +328,7 @@ func ExtractWithAttributes(base models.AnalyticsConversationWithAttributes) (mod
|
|||||||
Direction: sess.Direction,
|
Direction: sess.Direction,
|
||||||
Dnis: sess.DNIS,
|
Dnis: sess.DNIS,
|
||||||
EdgeId: sess.EdgeId,
|
EdgeId: sess.EdgeId,
|
||||||
Id: sess.SessionId,
|
Id: fmt.Sprintf("%s_%s", p.ParticipantId, sess.SessionId),
|
||||||
MediaEndpointStats: string(mediaEndpointStatsBytes),
|
MediaEndpointStats: string(mediaEndpointStatsBytes),
|
||||||
MediaType: sess.MediaType,
|
MediaType: sess.MediaType,
|
||||||
Metrics: string(metricsBytes),
|
Metrics: string(metricsBytes),
|
||||||
|
|||||||
Reference in New Issue
Block a user