public HttpResponseMessage DialQueueOrNumber(DialQueueParameters clientParameters) { var response = new TwilioResponse(); if (string.IsNullOrEmpty(clientParameters.PhoneNumber)) { _logger.Debug($"Dialling queue {clientParameters.QueueName} for client {clientParameters.ClientName}"); var queue = _queueService.ResolveByName(clientParameters.QueueName); var call = _queueProvider.GetFirstCallFromQueue(queue); response.DialQueue(clientParameters.QueueName, new { record = "record-from-answer" }); _queueStateHandler.DecreaseQueueByName(clientParameters.QueueName); _callService.FlagCallConnected(call.Sid, clientParameters.ClientName); } else { var agentName = ""; var agent = new Agent(); string number; if (!string.IsNullOrEmpty(clientParameters.From)) { agentName = clientParameters.From.Split(':')[1]; var agentNamePeriod = agentName.Replace("_", "."); agent = _agentService.GetAgentByAgentEmail(agentNamePeriod + "@letme.com"); } if (agent.TeamId == "10") //Lead gen { number = WebConfigurationManager.AppSettings["TwilioNumberLeadGen"]; } else if (agent.TeamId == "12") { number = WebConfigurationManager.AppSettings["TwilioNumberPM"]; } else { number = WebConfigurationManager.AppSettings["TwilioNumber"]; } var callId = _callService.LogOutboundCall(new Call { Dialled = clientParameters.PhoneNumber, CallStatus = CallStatus.Initiated, DateReceived = DateTime.Now, ClientName = agentName }).CallId; var attributes = new { callerId = number, record = "record-from-answer", action = $"/api/CallStatus/Update?callId={callId}" }; response.Dial(clientParameters.PhoneNumber, attributes); } return Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter()); }
public bool Register(string email, string firstName, string lastName, string password, string queueId, string teamId) { var agent = new Agent { Email = email, FirstName = firstName, LastName = lastName, Password = password, //not assigning queues for the time being QueueId = null, TeamId = teamId }; return _agentAuthenticationService.RegisterAgent(agent); }
public bool RegisterAgent(Agent agent) { using (var db = _dbFactory.GetDatabase()) { try { db.Execute(new RegisterAgent(agent)); return true; } catch (Exception ex) { _logger.Error($"Error registering user {agent.Email} - {ex}"); return false; } } }
public Agent GetAgentByAgentEmail(string agentEmail) { var agent = new Agent(); using (var db = _dbFactory.GetDatabase()) { try { agent = db.Query(new GetAgentByEmail(agentEmail)); } catch (Exception ex) { _logger.Error($"Error occured executing GetAgentByEmail {agentEmail}. {ex}"); } return agent ?? new Agent(); } }
public AgentQueueRouteBuilder(Agent agent, Queue queue, string url) { _agent = agent; _queue = queue; _url = url; }
public void Logout(Agent agent) { }
public RegisterAgent(Agent agent) { _agent = agent; }
public bool RegisterAgent(Agent agent) { _logger.Debug($"Registering agent {agent.Email}"); agent.Credentials = _saltedHasher.CreateSaltedHash(agent.Password); return _agentAuthenticationRepository.RegisterAgent(agent); }