Pseudo Code
FOR EACH CallType 1 or 167 CDR
  IF ExpectedCount = ActualCount
      
    GET CallStart, CallEnd, ClearDown, TTA from CallType 1 or 167 record.
    IF CallType 7 Exists     
           
      GET ClearDown from the last CallType 2 CDR
	IF ROWCOUNT > 0
      IF ClearDown = 17 CallClearDownResult = Engaged
      ELSE IF ClearDown = 19 CallClearDownResult = Unanswered
      ELSE IF ClearDown = 16 CallClearDownResult = Unanswered
      ELSE CallClearDownResult = Other
ELSE
	CallClearDownResult = Unanswered
       Duration = (CallEnd - CallStart) – TTA from the CallType 1 or 167 CDR
    ELSE
      IF ClearDown <> 16
        IF ClearDown = 17 CallClearDownResult = Engaged
        ELSE IF ClearDown = 19 CallClearDownResult = Unanswered
        ELSE CallClearDownResult = Other
        
        Duration = (CallEnd - CallStart) – TTA from the CallType 1 or 167 CDR
      ELSE
        IF (TTA > 0) OR (CDR’s exist that are not CallType 1, 2, 167)
          Duration = (CallEnd - CallStart) – TTA from the CallType 1 or 167 CDR
          IF (CDR’s exist where CallType = 2 AND TTA > 0) OR Type IN (26, 27)
            CallClearDownResult = Answered
          ELSE
            CallClearDownResult = Unanswered
        ELSE
          IF CDR’s exists where CallType = 2 AND TTA > 0
CallClearDownResult = Answered
TTA = SUM(CallStart - CallEnd) CallType = 2 ClearDown = 19
TTA = TTA + TTA of the first CallType 2 WHERE TTA > 0
Duration = (CallEnd - CallStart) – TTA
          ELSE
CallClearDownResult = Unanswered
Duration = 0
TTA = 0
Last updated
Was this helpful?