public void StartOutboundCall(long customerId, long prospectCustomerId, long callQueueCustomerId) { var organizationRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; var callId = _outboundCallQueueService.SetCallDetail(organizationRoleUserId, customerId); var guid = Guid.NewGuid().ToString(); var registrationFlow = new RegistrationFlowModel { GuId = guid, CallId = callId, CallQueueCustomerId = callQueueCustomerId }; var callQueueCustomer = _callQueueCustomerRepository.GetById(callQueueCustomerId); callQueueCustomer.Status = CallQueueStatus.InProcess; callQueueCustomer.DateModified = DateTime.Now; callQueueCustomer.ModifiedByOrgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; _callQueueCustomerRepository.Save(callQueueCustomer); var callQueueCustomerCall = new CallQueueCustomerCall { CallQueueCustomerId = callQueueCustomerId, CallId = callId }; _callQueueCustomerCallRepository.Save(callQueueCustomerCall); Session[guid] = registrationFlow; if (customerId == 0 && prospectCustomerId > 0) { UpdateContactedInfo(prospectCustomerId); registrationFlow.ProspectCustomerId = prospectCustomerId; Response.RedirectUser("/App/CallCenter/CallCenterRep/BasicCallInfo.aspx?guid=" + guid); } else if (customerId > 0) { var customer = _customerRepository.GetCustomer(customerId); var prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(customerId); if (prospectCustomer != null) { UpdateContactedInfo(prospectCustomer.Id); registrationFlow.ProspectCustomerId = prospectCustomer.Id; } Response.RedirectUser("/App/CallCenter/CallCenterRep/CustomerVerification.aspx?CustomerID=" + customerId + "&Zip=" + customer.Address.ZipCode.Zip + "&guid=" + guid); } }
public long StartCallAndUpdateCallAttemptTable(long callQueueCustomerId, long callAttemptId, string calledGlocomNumber, string patientPhoneNumber, string callQueueCategory) { var callQueueCustomer = _callQueueCustomerRepository.GetById(callQueueCustomerId); var prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(callQueueCustomer.CustomerId.Value); var oldCustomerGlocomNumber = _customerAccountGlocomNumberRepository.GetByCustomerIdAndGlocomNumber(callQueueCustomer.CustomerId.Value, calledGlocomNumber.Replace("-", "")); var incomingPhoneLine = calledGlocomNumber.Replace("-", ""); var callersPhoneNumber = patientPhoneNumber.Replace("-", ""); var customer = _customerRepository.GetCustomer((long)callQueueCustomer.CustomerId); using (var scope = new TransactionScope()) { var organizationRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; var callStatus = CallType.Existing_Customer.ToString().Replace("_", " "); var eventId = callQueueCustomer.EventId.HasValue && callQueueCustomer.EventCustomerId.HasValue ? callQueueCustomer.EventId.Value : 0; var callId = _outboundCallQueueService.SetCallDetail(organizationRoleUserId, callQueueCustomer.CustomerId.Value, incomingPhoneLine, callersPhoneNumber, callStatus, callQueueCustomer.CampaignId, callQueueCustomer.HealthPlanId, null, callQueueCustomer.CallQueueId, eventId: eventId, callQueueCategory: callQueueCategory, ProductTypeId: customer.ProductTypeId); UpdateContactedInfo(prospectCustomer.Id, callId); _customerCallQueueCallAttemptService.SetCallIdCallAttempt(callAttemptId, callId); var callQueueCustomerCallModel = new CallQueueCustomerCall(); callQueueCustomerCallModel.CallId = callId; callQueueCustomerCallModel.CallQueueCustomerId = callQueueCustomerId; _callQueueCustomerCallRepository.Save(callQueueCustomerCallModel); var customerAccountGlocomNumber = new CustomerAccountGlocomNumber { CallId = callId, CustomerId = callQueueCustomer.CustomerId.Value, GlocomNumber = calledGlocomNumber, CreatedDate = DateTime.Now, IsActive = true }; var editmodel = new CallQueueCustomerCallDetailsEditModel { CallQueueCustomerId = callQueueCustomerId, Disposition = string.Empty, CallStatusId = (long)CallStatus.Initiated, IsCallSkipped = false, ModifiedByOrgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId, Attempt = 0, CallQueueStatus = (long)CallQueueStatus.Initial, CallDate = DateTime.Today.AddDays(30), CallQueueId = callQueueCustomer.CallQueueId }; _callQueueCustomerRepository.UpdateCallqueueCustomerByCustomerId(editmodel, callQueueCustomer.CustomerId.Value); if (oldCustomerGlocomNumber != null) { oldCustomerGlocomNumber.IsActive = false; _customerAccountGlocomNumberRepository.Update(oldCustomerGlocomNumber); } _accountCheckoutPhoneNumberService.SaveAccountCheckoutPhoneNumber(customerAccountGlocomNumber); scope.Complete(); return(callId); } }
public long SaveGmsDialerCall(GmsDialerCallModel model, long orgRoleUserId, ILogger logger) { var callDateTime = Convert.ToDateTime(model.CallDate + " " + model.CallTime); long status = 0; var disposition = string.Empty; if (model.CallDisposition.ToUpper() == "ANS.MACH")//Left Voice mail { status = (long)CallStatus.VoiceMessage; } else if (model.CallDisposition.ToUpper() == "NO.ANS") //No Answer/Busy/Mail Full { status = (long)CallStatus.NoAnswer; } else if (model.CallDisposition.ToUpper() == "BUSY") //No Answer/Busy/Mail Full { status = (long)CallStatus.NoAnswer; } else if (model.CallDisposition.ToUpper() == "DEAD") { //Incorrect Phone number status = (long)CallStatus.TalkedtoOtherPerson; disposition = ProspectCustomerTag.IncorrectPhoneNumber_TalkedToOthers.ToString(); } var callQueue = _callQueueRepository.GetCallQueueByCategory(HealthPlanCallQueueCategory.MailRound); long customerId = Convert.ToInt64(model.CustomerId); var customer = _customerRepository.GetCustomer(customerId); var healthPlanId = _corporateAccountRepository.GetHealthPlanIdByAccountName(model.HealthPlan); if (healthPlanId == 0) { logger.Info(string.Format("Unable to parse for Customer Id : {0}. Healthplan not found by Name : {1}", model.CustomerId, model.HealthPlan)); return(0); } var calledNumber = !string.IsNullOrEmpty(model.PhoneHome) ? model.PhoneHome : !string.IsNullOrEmpty(model.PhoneOffice) ? model.PhoneOffice : model.PhoneCell; var callQueueCustomer = _callQueueCustomerRepository.GetCallQueueCustomerByCustomerIdAndHealthPlanId(customerId, healthPlanId, HealthPlanCallQueueCategory.MailRound); if (callQueueCustomer == null) { logger.Info(string.Format("Unable to parse for Customer Id : {0}. Call Queue Customer not found.", model.CustomerId)); return(0); } bool?isContacted = false; if (callQueue.Category == HealthPlanCallQueueCategory.AppointmentConfirmation) { isContacted = null; } else { isContacted = (status == (long)CallStatus.Attended || status == (long)CallStatus.VoiceMessage || status == (long)CallStatus.LeftMessageWithOther); } var call = new Call() { CallDateTime = callDateTime, StartTime = callDateTime, EndTime = callDateTime, CallStatus = CallType.Existing_Customer.GetDescription(), IsIncoming = false, CalledCustomerId = customerId, Status = status, CreatedByOrgRoleUserId = orgRoleUserId, IsNewCustomer = false, DateCreated = callDateTime, DateModified = callDateTime, ReadAndUnderstood = true, HealthPlanId = healthPlanId, CallQueueId = callQueue.Id, DialerType = (long)DialerType.Gms, CalledInNumber = model.CallerId, CallerNumber = calledNumber, CallBackNumber = calledNumber, IsContacted = isContacted, Disposition = disposition, ProductTypeId = customer.ProductTypeId }; call = _callCenterCallRepository.Save(call); if (status == (long)CallStatus.TalkedtoOtherPerson && disposition == ProspectCustomerTag.IncorrectPhoneNumber_TalkedToOthers.ToString()) { _customerService.UpdateIsIncorrectPhoneNumber(customerId, true, orgRoleUserId); } var callQueueCustomerCall = new CallQueueCustomerCall { CallQueueCustomerId = callQueueCustomer.Id, CallId = call.Id }; _callQueueCustomerCallRepository.Save(callQueueCustomerCall); var customerAccountGlocomNumber = new CustomerAccountGlocomNumber { CallId = call.Id, CustomerId = customerId, GlocomNumber = PhoneNumber.ToNumber(model.CallerId), CreatedDate = callDateTime, IsActive = true }; _customerAccountGlocomNumberService.SaveAccountCheckoutPhoneNumber(customerAccountGlocomNumber); bool removeFromCallQueue = status == (long)CallStatus.TalkedtoOtherPerson; var callQueueStatus = CallQueueStatus.Initial; if (removeFromCallQueue) { callQueueStatus = CallQueueStatus.Removed; } callQueueCustomer.Disposition = disposition; _callQueueCustomerContactService.SetCallQueueCustomerStatus(callQueueCustomer, callQueueStatus, orgRoleUserId, false, status, callDateTime); var prospectCustomerId = callQueueCustomer.ProspectCustomerId ?? 0; if (prospectCustomerId == 0) { var prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(customerId); if (prospectCustomer != null) { prospectCustomerId = prospectCustomer.Id; } } _callQueueCustomerRepository.UpdateOtherCustomerAttempt(callQueueCustomer.Id, customerId, prospectCustomerId, orgRoleUserId, callQueueCustomer.CallDate, removeFromCallQueue, callQueueCustomer.CallQueueId, status, callDateTime, isForParsing: true, disposition: disposition); return(call.Id); }
private void SaveCallQueueCustomerCall(CallQueueCustomer callQueueCustomer, Call call) { _callQueueCustomerCallRepository.Save(new CallQueueCustomerCall { CallId = call.Id, CallQueueCustomerId = callQueueCustomer.Id }); }