private Credentials FindCredentials(SipMessageReader reader, out IAccount account, out bool proxy) { for (int i = 0; i < reader.Count.AuthorizationCount; i++) { if (reader.Authorization[i].AuthScheme == scheme) { account = accounts.GetAccount(GetDomain(reader.Authorization[i].Targetname)); if (account != null) { proxy = false; return(reader.Authorization[i]); } } } for (int i = 0; i < reader.Count.ProxyAuthorizationCount; i++) { if (reader.ProxyAuthorization[i].AuthScheme == scheme) { account = accounts.GetAccount(GetDomain(reader.ProxyAuthorization[i].Targetname)); if (account != null) { proxy = true; return(reader.ProxyAuthorization[i]); } } } account = null; proxy = false; return(new Credentials()); }
private void Users_Reset(int accountId, IUsers users) { var account = accounts.GetAccount(accountId); if (account != null) { ResetUsers(users, account); } }
private void ProccessService(AcceptedRequest tu, IncomingMessageEx request) { var account = accounts.GetAccount(request.Reader.RequestUri.Hostport.Host); var writer = GetWriter(); if (account != null) { var outContent = serviceSoap.ProcessRequest <IAccount>(request.Content, Search, account); writer.WriteStatusLine(StatusCodes.OK); writer.CopyViaToFromCallIdRecordRouteCSeq(request.Reader, StatusCodes.OK); writer.WriteContentType(type, subtype); writer.WriteCustomHeaders(); writer.WriteContentLength(); writer.WriteCRLF(); writer.Write(outContent.GenerateToByteArray()); writer.RewriteContentLength(); } else { writer.WriteStatusLine(StatusCodes.NotFound); writer.CopyViaToFromCallIdRecordRouteCSeq(request.Reader, StatusCodes.NotFound); writer.WriteContentLength(0); writer.WriteCRLF(); } tu.SendResponse(request, writer); }
public IActionResult GetAccounts() { try { string username = HttpContext.User.Claims.FirstOrDefault(x => x.Type.Equals(ClaimTypes.NameIdentifier)).Value; if (string.IsNullOrEmpty(username)) { return(BadRequest("No username was specified.")); } return(Ok(_accounts.GetAccount(username))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
protected override IEnumerable <Entry> GetEntries(ByteArrayPart username, ByteArrayPart domain) { var account = accounts.GetAccount(domain); if (account != null) { for (int i = 0; i < userz.Count; i++) { int count = userz[i].GetCount(account.Id); var users = userz[i].GetUsers(account.Id, 0, count); for (int j = 0; j < users.Count; j++) { var user = users[j]; yield return(new Entry("sip:" + user.Name + "@" + account.DomainName, user.DisplayName)); } } } }
public async Task <Accounts> GetAccount(int accountID) { return(await iaccounts.GetAccount(accountID)); }