Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 128bac375e | |||
| 4185367a18 | |||
| 2fe9fe0c3e | |||
| 1da72360c2 |
@@ -37,6 +37,7 @@ type CrmInterpreter struct {
|
|||||||
PinViaSMS *bool `gorm:"column:pin_via_sms" json:"pin_via_sms"`
|
PinViaSMS *bool `gorm:"column:pin_via_sms" json:"pin_via_sms"`
|
||||||
VaxFluCheck *bool `gorm:"column:vax_flu_check" json:"vax_flu_check"`
|
VaxFluCheck *bool `gorm:"column:vax_flu_check" json:"vax_flu_check"`
|
||||||
WorkingWithChildren *bool `gorm:"column:working_with_children" json:"working_with_children"`
|
WorkingWithChildren *bool `gorm:"column:working_with_children" json:"working_with_children"`
|
||||||
|
InternalInterpreter *bool `gorm:"column:internal_interpreter" json:"internal_interpreter"`
|
||||||
LastContactAttempt *time.Time `gorm:"column:last_contact_attempt" json:"last_contact_attempt"`
|
LastContactAttempt *time.Time `gorm:"column:last_contact_attempt" json:"last_contact_attempt"`
|
||||||
MigrationYear *time.Time `gorm:"column:migration_year" json:"migration_year"`
|
MigrationYear *time.Time `gorm:"column:migration_year" json:"migration_year"`
|
||||||
FirstName *string `gorm:"column:first_name" json:"first_name"`
|
FirstName *string `gorm:"column:first_name" json:"first_name"`
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ type CallStat struct {
|
|||||||
FirstLanguageId int
|
FirstLanguageId int
|
||||||
LastLanguageId int
|
LastLanguageId int
|
||||||
FirstInterpreter string
|
FirstInterpreter string
|
||||||
|
UtsStartTime *time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (CallStat) TableName() string {
|
func (CallStat) TableName() string {
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ type DBInterpreterProcessed struct {
|
|||||||
BookingReference *int
|
BookingReference *int
|
||||||
BillableInterpreter bool
|
BillableInterpreter bool
|
||||||
BillableTpa bool
|
BillableTpa bool
|
||||||
|
BillableInternal bool
|
||||||
|
|
||||||
// FLAGS / METADATA:
|
// FLAGS / METADATA:
|
||||||
// ---
|
// ---
|
||||||
|
|||||||
242
util/extract.go
242
util/extract.go
@@ -262,125 +262,123 @@ func ExtractLive(base models.NotificationConversationWithAttributes) (models.DBC
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//func ExtractWithAttributes(base models.AnalyticsConversationWithAttributes) (models.DBConversation, []models.DBParticipant, []models.DBSession, []models.DBSegment) {
|
func ExtractWithAttributes(base models.AnalyticsConversationWithAttributes) (models.DBConversation, []models.DBParticipant, []models.DBSession, []models.DBSegment) {
|
||||||
//
|
|
||||||
// var startTime *time.Time
|
var startTime *time.Time
|
||||||
// parsedStartTime, err := time.Parse(time.RFC3339, base.ConversationStart)
|
parsedStartTime, err := time.Parse(time.RFC3339, base.ConversationStart)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// startTime = nil
|
startTime = nil
|
||||||
// } else {
|
} else {
|
||||||
// startTime = &parsedStartTime
|
startTime = &parsedStartTime
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// var endTime *time.Time
|
var endTime *time.Time
|
||||||
// parsedEndTime, err := time.Parse(time.RFC3339, base.ConversationEnd)
|
parsedEndTime, err := time.Parse(time.RFC3339, base.ConversationEnd)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// endTime = nil
|
endTime = nil
|
||||||
// } else {
|
} else {
|
||||||
// endTime = &parsedEndTime
|
endTime = &parsedEndTime
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// divisionIdsBytes, err := json.Marshal(base.DivisionIds)
|
divisionIdsBytes, err := json.Marshal(base.DivisionIds)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// divisionIdsBytes = nil
|
divisionIdsBytes = nil
|
||||||
// }
|
}
|
||||||
// divisionIdsBytesStr := string(divisionIdsBytes)
|
divisionIdsBytesStr := string(divisionIdsBytes)
|
||||||
//
|
|
||||||
// conversation := models.DBConversation{
|
conversation := models.DBConversation{
|
||||||
// DivisionIds: &divisionIdsBytesStr,
|
DivisionIds: &divisionIdsBytesStr,
|
||||||
// End: endTime,
|
End: endTime,
|
||||||
// Id: base.ConversationId,
|
Id: base.ConversationId,
|
||||||
// MinMos: &base.MediaStatsMinConversationMos,
|
MinMos: &base.MediaStatsMinConversationMos,
|
||||||
// MinRFactor: &base.MediaStatsMinConversationRFactor,
|
MinRFactor: &base.MediaStatsMinConversationRFactor,
|
||||||
// OriginatingDirection: &base.OriginatingDirection,
|
OriginatingDirection: &base.OriginatingDirection,
|
||||||
// Start: startTime,
|
Start: startTime,
|
||||||
// }
|
}
|
||||||
// var participants []models.DBParticipant
|
var participants []models.DBParticipant
|
||||||
// var sessions []models.DBSession
|
var sessions []models.DBSession
|
||||||
// var segments []models.DBSegment
|
var segments []models.DBSegment
|
||||||
//
|
|
||||||
// for _, p := range base.Participants {
|
for _, p := range base.Participants {
|
||||||
//
|
|
||||||
// attributesBytes, err := json.Marshal(p.Attributes)
|
attributesBytes, err := json.Marshal(p.Attributes)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// attributesBytes = nil
|
attributesBytes = nil
|
||||||
// }
|
}
|
||||||
// attributesBytesStr := string(attributesBytes)
|
attributesBytesStr := string(attributesBytes)
|
||||||
//
|
|
||||||
// participant := models.DBParticipant{
|
participant := models.DBParticipant{
|
||||||
// ConnectedTime: nil,
|
ConversationId: base.ConversationId,
|
||||||
// ConversationId: base.ConversationId,
|
ExternalContactId: &p.ExternalContactId,
|
||||||
// EndTime: nil,
|
Id: p.ParticipantId,
|
||||||
// ExternalContactId: &p.ExternalContactId,
|
Name: &p.ParticipantName,
|
||||||
// Id: p.ParticipantId,
|
Purpose: &p.Purpose,
|
||||||
// Name: &p.ParticipantName,
|
Attributes: &attributesBytesStr,
|
||||||
// Purpose: &p.Purpose,
|
}
|
||||||
// Attributes: &attributesBytesStr,
|
participants = append(participants, participant)
|
||||||
// }
|
|
||||||
// participants = append(participants, participant)
|
for _, sess := range p.Sessions {
|
||||||
//
|
mediaEndpointStatsBytes, err := json.Marshal(sess.MediaEndpointStats)
|
||||||
// for _, sess := range p.Sessions {
|
if err != nil {
|
||||||
// mediaEndpointStatsBytes, err := json.Marshal(sess.MediaEndpointStats)
|
mediaEndpointStatsBytes = nil
|
||||||
// if err != nil {
|
}
|
||||||
// mediaEndpointStatsBytes = nil
|
|
||||||
// }
|
metricsBytes, err := json.Marshal(sess.Metrics)
|
||||||
//
|
if err != nil {
|
||||||
// metricsBytes, err := json.Marshal(sess.Metrics)
|
metricsBytes = nil
|
||||||
// if err != nil {
|
}
|
||||||
// metricsBytes = nil
|
|
||||||
// }
|
session := models.DBSession{
|
||||||
//
|
Ani: sess.ANI,
|
||||||
// session := models.DBSession{
|
Direction: sess.Direction,
|
||||||
// Ani: sess.ANI,
|
Dnis: sess.DNIS,
|
||||||
// Direction: sess.Direction,
|
EdgeId: sess.EdgeId,
|
||||||
// Dnis: sess.DNIS,
|
Id: fmt.Sprintf("%s_%s", p.ParticipantId, sess.SessionId),
|
||||||
// EdgeId: sess.EdgeId,
|
MediaEndpointStats: string(mediaEndpointStatsBytes),
|
||||||
// Id: fmt.Sprintf("%s_%s", p.ParticipantId, sess.SessionId),
|
MediaType: sess.MediaType,
|
||||||
// MediaEndpointStats: string(mediaEndpointStatsBytes),
|
Metrics: string(metricsBytes),
|
||||||
// MediaType: sess.MediaType,
|
ParticipantId: p.ParticipantId,
|
||||||
// Metrics: string(metricsBytes),
|
ProtocolCallId: sess.ProtocolCallId,
|
||||||
// ParticipantId: p.ParticipantId,
|
Provider: sess.Provider,
|
||||||
// ProtocolCallId: sess.ProtocolCallId,
|
Recording: sess.Recording,
|
||||||
// Provider: sess.Provider,
|
RemoteNameDisplayable: sess.RemoteNameDisplayable,
|
||||||
// Recording: sess.Recording,
|
SessionDnis: sess.SessionDnis,
|
||||||
// RemoteNameDisplayable: sess.RemoteNameDisplayable,
|
}
|
||||||
// SessionDnis: sess.SessionDnis,
|
sessions = append(sessions, session)
|
||||||
// }
|
|
||||||
// sessions = append(sessions, session)
|
for idx, seg := range sess.Segments {
|
||||||
//
|
|
||||||
// for _, seg := range sess.Segments {
|
segmentStart, err := time.Parse(time.RFC3339, seg.SegmentStart)
|
||||||
//
|
if err != nil {
|
||||||
// segmentStart, err := time.Parse(time.RFC3339, seg.SegmentStart)
|
segmentStart = time.Now()
|
||||||
// if err != nil {
|
}
|
||||||
// segmentStart = time.Now()
|
|
||||||
// }
|
segmentEnd, err := time.Parse(time.RFC3339, seg.SegmentEnd)
|
||||||
//
|
if err != nil {
|
||||||
// segmentEnd, err := time.Parse(time.RFC3339, seg.SegmentEnd)
|
segmentEnd = time.Now()
|
||||||
// if err != nil {
|
}
|
||||||
// segmentEnd = time.Now()
|
|
||||||
// }
|
q850ResponseCodesBytes, err := json.Marshal(seg.Q850ResponseCodes)
|
||||||
//
|
if err != nil {
|
||||||
// q850ResponseCodesBytes, err := json.Marshal(seg.Q850ResponseCodes)
|
q850ResponseCodesBytes = nil
|
||||||
// if err != nil {
|
}
|
||||||
// q850ResponseCodesBytes = nil
|
|
||||||
// }
|
segment := models.DBSegment{
|
||||||
//
|
Id: fmt.Sprintf("%s_%s_%d", session.Id, seg.SegmentType, idx),
|
||||||
// segment := models.DBSegment{
|
Conference: seg.Conference,
|
||||||
// Id: fmt.Sprintf("%s_%s", session.Id, seg.SegmentType),
|
DisconnectType: seg.DisconnectType,
|
||||||
// Conference: seg.Conference,
|
Q850ResponseCodes: string(q850ResponseCodesBytes),
|
||||||
// DisconnectType: seg.DisconnectType,
|
SegmentEnd: segmentEnd,
|
||||||
// Q850ResponseCodes: string(q850ResponseCodesBytes),
|
SegmentStart: segmentStart,
|
||||||
// SegmentEnd: segmentEnd,
|
SegmentType: seg.SegmentType,
|
||||||
// SegmentStart: segmentStart,
|
SessionId: sess.SessionId,
|
||||||
// SegmentType: seg.SegmentType,
|
WrapUpCode: seg.WrapUpCode,
|
||||||
// SessionId: sess.SessionId,
|
}
|
||||||
// WrapUpCode: seg.WrapUpCode,
|
|
||||||
// }
|
segments = append(segments, segment)
|
||||||
//
|
}
|
||||||
// segments = append(segments, segment)
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
// }
|
return conversation, participants, sessions, segments
|
||||||
//
|
}
|
||||||
// return conversation, participants, sessions, segments
|
|
||||||
//}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user