public async Task <Call> UpdateCall(string callSid) { var call = await CallRepository.GetCall(callSid); // TODO: update CallCudOperation?.Invoke(this, new ResourceCudOperationEventArgs <Call>(call, ResourceCudOperation.Update)); return(call); }
public async Task DeleteCall(string callSid) { var call = await CallRepository.GetCall(callSid); if (call.Status == "in-progress") { throw new InvalidOperationException("Can't delete a call which is in progress"); } await CallRepository.DeleteCall(call.Sid); CallCudOperation?.Invoke(this, new ResourceCudOperationEventArgs <Call>(call, ResourceCudOperation.Delete)); }
public async Task <Call> CreateIncomingCall(string from, string to, string url, string method) { var call = new Call() { AccountSid = AccountRepository.GetAccountSid(), DateCreated = DateTime.UtcNow, DateUpdated = DateTime.UtcNow, Direction = "inbound", From = from, PhoneNumberSid = await AccountRepository.GetPhoneNumberSid(to), Sid = TwilioUtils.CreateSid("CA"), Status = "ringing", To = to }; await CallRepository.CreateCall(call); CallCudOperation?.Invoke(this, new ResourceCudOperationEventArgs <Call>(call, ResourceCudOperation.Create)); CallHandler(url, method, call.Sid); return(call); }
public async Task <Call> CreateCall(string accountSid, string apiVersion, string from, string method, string to, string url) { var call = new Call() { AccountSid = accountSid, ApiVersion = apiVersion, DateCreated = DateTime.UtcNow, DateUpdated = DateTime.UtcNow, Direction = "outbound-api", From = from, PhoneNumberSid = await AccountRepository.GetPhoneNumberSid(from), Sid = TwilioUtils.CreateSid("CA"), Status = "queued", To = to }; await CallRepository.CreateCall(call); CallCudOperation?.Invoke(this, new ResourceCudOperationEventArgs <Call>(call, ResourceCudOperation.Create)); CallHandler(url, method, call.Sid); return(call); }
public async Task ClearDatabase() { await AccountRepository.Clear(); await CallRepository.Clear(); CallCudOperation?.Invoke(this, new ResourceCudOperationEventArgs <Call>(null, ResourceCudOperation.Reset)); await ConferenceRepository.Clear(); ConferenceCudOperation?.Invoke(this, new ResourceCudOperationEventArgs <Conference>(null, ResourceCudOperation.Reset)); await ConferenceParticipantRepository.Clear(); ConferenceParticipantCudOperation?.Invoke(this, new ResourceCudOperationEventArgs <ConferenceParticipant>(null, ResourceCudOperation.Reset)); await AlertRepository.Clear(); AlertCudOperation?.Invoke(this, new ResourceCudOperationEventArgs <Alert>(null, ResourceCudOperation.Reset)); await ActivityLogRepository.Clear(); ActivityLogCudOperation?.Invoke(this, new ResourceCudOperationEventArgs <ActivityLog>(null, ResourceCudOperation.Reset)); }