private string GetDisplayName(RegisteredSipDetails registeredSip) { var sipDomain = _settingsManager.SipDomain; return(DisplayNameHelper.GetDisplayName( registeredSip.DisplayName, registeredSip.UserDisplayName, string.Empty, registeredSip.Sip, string.Empty, string.Empty, sipDomain)); }
public IHttpActionResult GetRegisteredSipInfo(Guid id) { // Called when the user clicked on a codec in the GUI to show // detailed information, including codec control GUI, for the codec. RegisteredSipDetails regSipDetails = _registeredSipDetailsRepository.GetRegisteredSipById(id); if (regSipDetails == null) { return(NotFound()); } var call = _callRepository.GetCallBySipAddress(regSipDetails.Sip); var model = new RegisteredSipInfoViewModel { IsAuthenticated = User.Identity.IsAuthenticated, Id = regSipDetails.Id, Sip = regSipDetails.Sip, CodecControl = ShouldShowCodecControlView(regSipDetails), Comment = regSipDetails.Comment, DisplayName = GetDisplayName(regSipDetails), Ip = regSipDetails.Ip, UserAgentHeader = regSipDetails.UserAgentHeader, Registrar = regSipDetails.Registrar, Image = regSipDetails.Image, ActiveX = regSipDetails.ActiveX, Width = regSipDetails.Width, Height = regSipDetails.Height, UserInterfaceLink = regSipDetails.UserInterfaceLink, UserInterfaceIsOpen = regSipDetails.UserInterfaceIsOpen, UseScrollbars = regSipDetails.UseScrollbars, Inputs = regSipDetails.Inputs, InputMaxDb = regSipDetails.InputMaxDb, InputMinDb = regSipDetails.InputMinDb, InputGainStep = regSipDetails.InputGainStep, Lines = regSipDetails.Lines, CodecPresets = regSipDetails.CodecPresets, LocationName = regSipDetails.LocationName, LocationComment = regSipDetails.LocationComment, CityName = regSipDetails.CityName, RegionName = regSipDetails.RegionName, InCall = call != null, InCallWithName = call != null?GetInCallWith(regSipDetails, call) : string.Empty }; return(Ok(model)); }
private string GetInCallWith(RegisteredSipDetails registeredSip, Call call) { var sipDomain = _settingsManager.SipDomain; string inCallWith; if (call.FromSip == registeredSip.Sip) { inCallWith = call.To != null?DisplayNameHelper.GetDisplayName(call.To, sipDomain) : call.ToSip; } else { inCallWith = call.From != null?DisplayNameHelper.GetDisplayName(call.From, sipDomain) : call.FromSip; } return(DisplayNameHelper.AnonymizeDisplayName(inCallWith)); }
private RegisteredSipDetails MapToRegisteredSipDetails(Entities.RegisteredSipEntity rs) { if (rs == null) { return(null); } var model = new RegisteredSipDetails { Id = rs.Id, Sip = rs.SIP, DisplayName = rs.DisplayName, Ip = rs.IP, UserAgentHeader = rs.UserAgentHeader, Registrar = rs.Registrar != null ? rs.Registrar : string.Empty, Comment = rs.User != null ? rs.User.Comment : string.Empty, UserDisplayName = rs.User != null ? rs.User.DisplayName : string.Empty, Api = rs.UserAgent != null ? rs.UserAgent.Api ?? string.Empty : string.Empty, Image = rs.UserAgent?.Image ?? string.Empty, ActiveX = rs.UserAgent != null && rs.UserAgent.Ax, Width = rs.UserAgent?.Width ?? 1000, Height = rs.UserAgent?.Height ?? 1000, UserInterfaceLink = rs.UserAgent != null ? rs.UserAgent.UserInterfaceLink ?? "" : String.Empty, UserInterfaceIsOpen = rs.UserAgent != null && rs.UserAgent.UserInterfaceIsOpen, UseScrollbars = rs.UserAgent != null && rs.UserAgent.UseScrollbars, Inputs = rs.UserAgent?.Inputs ?? 0, NrOfGpos = rs.UserAgent?.NrOfGpos ?? 0, InputGainStep = rs.UserAgent?.InputGainStep ?? 0, InputMaxDb = rs.UserAgent?.MaxInputDb ?? 0, InputMinDb = rs.UserAgent?.MinInputDb ?? 0, Lines = rs.UserAgent?.Lines ?? 0, CodecPresets = rs.UserAgent != null?rs.UserAgent.CodecPresets.Select(MapToCodecPreset).ToList() : new List <CodecPreset>(), LocationName = rs.Location != null ? rs.Location.Name : string.Empty, LocationComment = rs.Location != null ? rs.Location.Comment : string.Empty, CityName = rs.Location?.City != null ? rs.Location.City.Name : string.Empty, RegionName = rs.Location?.Region != null ? rs.Location.Region.Name : string.Empty, }; return(model); }
private bool ShouldShowCodecControlView(RegisteredSipDetails registeredSip) { return((User.IsInRole(Roles.Admin) || User.IsInRole(Roles.Remote)) && !string.IsNullOrWhiteSpace(registeredSip.Api) && _settingsManager.CodecControlActive); }