public async Task DeleteRecordingAsync(string pathSid, string pathAccountSid) { var twilioRestClient = GetTwilioRestClient(); await RecordingResource.DeleteAsync(pathSid, pathAccountSid, twilioRestClient).ConfigureAwait(false); _logger.LogInformation("Deleted Recording PathSid={PathSid} PathAccountSid={PathAccountSid}", pathSid, pathAccountSid); }
public async Task <bool> RemoveItemByIdentityAsync(int id) { VoiceMailData origData = Auditing.Active ? await GetItemByIdentityAsync(id) : null; if (!await DataProvider.RemoveByIdentityAsync(id)) { return(false); } await SetupClient(); try { if (YetaWFManager.IsSync()) { RecordingResource.Delete(pathSid: origData.RecordingSid); } else { await RecordingResource.DeleteAsync(pathSid : origData.RecordingSid); } } catch (Exception) { } await Auditing.AddAuditAsync($"{nameof(VoiceMailDataProvider)}.{nameof(RemoveItemByIdentityAsync)}", Dataset, Guid.Empty, $"Remove Voice Mail Entry {id}", DataBefore : origData, DataAfter : null ); return(true); }
/// <summary> /// Delete all recordings for given call sid. /// </summary> /// <param name="callSid">the SID of the Twilio call resource the recordings are associated with.</param> /// <param name="log">A logger instance.</param> /// <returns>A Task returning true if successful and false if failed.</returns> public async Task <bool> DeleteRecordingsAsync(string callSid, ILogger log) { log.LogInformation($"Attempting to retrieve Twilio recordings for call resource '{callSid}'..."); ICollection <RecordingResource> recordings = await FetchRecordingsAsync(callSid, log); bool hasError = false; log.LogInformation($"Received {recordings.Count} recordings. Enumerating..."); foreach (RecordingResource recording in recordings) { string recordingSid = recording.Sid; log.LogInformation($"Attempting to delete recording '{recordingSid}' from Twilio..."); bool result = await RecordingResource.DeleteAsync(recordingSid, client : _twilioClient); if (result) { log.LogInformation($"Recording '{recordingSid}' deleted successfully."); } else { log.LogError($"Failed to delete recording '{recordingSid}'."); hasError = true; } } return(!hasError); }
// delete a recording given an SID // If successful, DELETE returns HTTP 204 (No Content) with no body public async Task DeleteRecordingAsync(string rid) { // Start initiate a twilio client TwilioClient.Init(_accountSid, _authToken); Console.WriteLine("The following rid will be deleted " + rid); // Deletes the recording resource with specified rid from Twilio cloud var response = await RecordingResource.DeleteAsync(pathSid : rid); // response should be true if recording was deleted Debug.Assert(response == true); Console.WriteLine(rid + " has been deleted."); }