public static RegisteredSipOverviewDto MapToDto(RegisteredSipDto regSip, string sipDomain)
        {
            return(new RegisteredSipOverviewDto
            {
                InCall = regSip.InCall,
                Sip = regSip.Sip,
                Id = regSip.Id,
                //DisplayName = regSip.DisplayName,


                DisplayName = DisplayNameHelper.GetDisplayName(regSip.DisplayName, regSip.UserDisplayName,
                                                               string.Empty, regSip.UserName, regSip.Sip, "", sipDomain),


                Location = regSip.LocationName,
                LocationShortName = regSip.LocationShortName,
                Comment = regSip.Comment,
                Image = regSip.Image,
                CodecTypeName = regSip.CodecTypeName,
                CodecTypeColor = regSip.CodecTypeColor,
                UserName = regSip.UserName,
                UserDisplayName = regSip.UserDisplayName,
                UserComment = regSip.Comment,
                InCallWithId = regSip.InCallWithId,
                InCallWithSip = DisplayNameHelper.AnonymizePhonenumber(regSip.InCallWithSip),
                InCallWithName = DisplayNameHelper.AnonymizeDisplayName(regSip.InCallWithName),
                RegionName = regSip.RegionName,
                Updated = regSip.Updated
            });
        }
Ejemplo n.º 2
0
        private OnGoingCall MapToOngoingCall(CallEntity dbCall, string sipDomain, bool anonymize)
        {
            // TODO: Fix this mapping, and maybe redo the query?
            var fromDisplayName = CallDisplayNameHelper.GetDisplayName(dbCall.FromSip, dbCall.FromDisplayName, dbCall.FromUsername, sipDomain);
            var toDisplayName   = CallDisplayNameHelper.GetDisplayName(dbCall.ToSip, dbCall.ToDisplayName, dbCall.ToUsername, sipDomain);

            var onGoingCall = new OnGoingCall
            {
                CallId                = GuidHelper.GuidString(dbCall.Id),
                Started               = dbCall.Started,
                FromId                = GuidHelper.GuidString(dbCall.FromId),
                FromSip               = anonymize ? DisplayNameHelper.AnonymizePhonenumber(dbCall.FromUsername) : dbCall.FromUsername,
                FromDisplayName       = anonymize ? DisplayNameHelper.AnonymizeDisplayName(fromDisplayName) : fromDisplayName,
                FromCodecTypeColor    = dbCall.FromSip != null && dbCall.FromSip.User != null && dbCall.FromSip.User.CodecType != null ? dbCall.FromSip.User.CodecType.Color : string.Empty,
                FromCodecTypeName     = dbCall.FromSip != null && dbCall.FromSip.User != null && dbCall.FromSip.User.CodecType != null ? dbCall.FromSip.User.CodecType.Name : string.Empty,
                FromComment           = dbCall.FromSip != null && dbCall.FromSip.User != null ? dbCall.FromSip.User.Comment : string.Empty,
                FromLocationName      = dbCall.FromSip != null && dbCall.FromSip.Location != null ? dbCall.FromSip.Location.Name : string.Empty,
                FromLocationShortName = dbCall.FromSip != null && dbCall.FromSip.Location != null ? dbCall.FromSip.Location.ShortName : string.Empty,
                FromRegionName        = dbCall.FromSip != null && dbCall.FromSip.Location != null && dbCall.FromSip.Location.Region != null ? dbCall.FromSip.Location.Region.Name : string.Empty,
                ToId                = GuidHelper.GuidString(dbCall.ToId),
                ToSip               = anonymize ? DisplayNameHelper.AnonymizePhonenumber(dbCall.ToUsername) : dbCall.ToUsername,
                ToDisplayName       = anonymize ? DisplayNameHelper.AnonymizeDisplayName(toDisplayName) : toDisplayName,
                ToCodecTypeColor    = dbCall.ToSip != null && dbCall.ToSip.User != null && dbCall.ToSip.User.CodecType != null ? dbCall.ToSip.User.CodecType.Color : string.Empty,
                ToCodecTypeName     = dbCall.ToSip != null && dbCall.ToSip.User != null && dbCall.ToSip.User.CodecType != null ? dbCall.ToSip.User.CodecType.Name : string.Empty,
                ToComment           = dbCall.ToSip != null && dbCall.ToSip.User != null ? dbCall.ToSip.User.Comment : string.Empty,
                ToLocationName      = dbCall.ToSip != null && dbCall.ToSip.Location != null ? dbCall.ToSip.Location.Name : string.Empty,
                ToLocationShortName = dbCall.ToSip != null && dbCall.ToSip.Location != null ? dbCall.ToSip.Location.ShortName : string.Empty,
                ToRegionName        = dbCall.ToSip != null && dbCall.ToSip.Location != null && dbCall.ToSip.Location.Region != null ? dbCall.ToSip.Location.Region.Name : string.Empty
            };

            return(onGoingCall);
        }
Ejemplo n.º 3
0
 private OldCall MapToOldCall(CallHistoryEntity dbCall, bool anonymize)
 {
     return(new OldCall
     {
         CallId = GuidString(dbCall.CallId),
         Started = dbCall.Started.ToLocalTime(),
         Ended = dbCall.Ended.ToLocalTime(),
         Duration = dbCall.Ended.Subtract(dbCall.Started).ToString(@"dd\d\ hh\:mm\:ss"),
         IsPhoneCall = dbCall.IsPhoneCall,
         FromId = GuidString(dbCall.FromId),
         FromSip = anonymize ? DisplayNameHelper.AnonymizePhonenumber(dbCall.FromUsername) : dbCall.FromUsername,
         FromCodecTypeColor = dbCall.FromCodecTypeColor,
         FromCodecTypeName = dbCall.FromCodecTypeName,
         FromComment = dbCall.FromComment,
         FromDisplayName = anonymize ? DisplayNameHelper.AnonymizeDisplayName(dbCall.FromDisplayName) : dbCall.FromDisplayName,
         FromLocationName = dbCall.FromLocationName,
         FromLocationShortName = dbCall.FromLocationShortName,
         FromRegionName = dbCall.FromRegionName,
         ToId = GuidString(dbCall.ToId),
         ToSip = anonymize ? DisplayNameHelper.AnonymizePhonenumber(dbCall.ToUsername) : dbCall.ToUsername,
         ToCodecTypeColor = dbCall.ToCodecTypeColor,
         ToCodecTypeName = dbCall.ToCodecTypeName,
         ToComment = dbCall.ToComment,
         ToDisplayName = anonymize ? DisplayNameHelper.AnonymizeDisplayName(dbCall.ToDisplayName) : dbCall.ToDisplayName,
         ToLocationName = dbCall.ToLocationName,
         ToLocationShortName = dbCall.ToLocationShortName,
         ToRegionName = dbCall.ToRegionName
     });
 }
Ejemplo n.º 4
0
        public void should_handle_empty_string()
        {
            var s      = string.Empty;
            var result = DisplayNameHelper.AnonymizePhonenumber(s);

            Assert.AreEqual(s, result);
        }
Ejemplo n.º 5
0
        public void should_not_anonymize_standard_sipaddresses()
        {
            var s      = "*****@*****.**";
            var result = DisplayNameHelper.AnonymizePhonenumber(s);

            Assert.AreEqual(s, result);
        }
Ejemplo n.º 6
0
        public void should_show_internal_number_without_host()
        {
            var s      = "*****@*****.**";
            var result = DisplayNameHelper.AnonymizePhonenumber(s);

            Assert.AreEqual("840200", result);
        }
Ejemplo n.º 7
0
        public void should_hide_external_numbers()
        {
            var s      = "*****@*****.**";
            var result = DisplayNameHelper.AnonymizePhonenumber(s);

            Assert.AreEqual("Externt nummer", result);
        }