1
votes

I have been working on this little project for a few days now and I just think I need a little push in the right direction since I feel I am just running in circles.

What I am trying to do is; once a client calls my support line and leaves a message, it puts this message into twilios recordings tab. Thats perfect, I believe that is what I want.

The next thing I need though is, I would like to use c# code to grab the recording and send it to multiple phone numbers sort of like a voicemail. It is going to call everyone in the list until one of the people answers the call and listens to the recorded file.

Currently all I have figured out is how to grab the record ID; I feel like this is the wrong way to do it though. How to I grab the said voice recorded file and send it to a cell phone.... Any help is appreciated

 string ACCOUNT_SID = "AC2b69a2a2ef0a6c61674ace79d58737e4";
 string AUTH_TOKEN = "*********************";
 var client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

 var recordings = client.ListRecordings(null,DateTime.Today,null,null);
 foreach (var test in recordings.Recordings) {
      var t = test.Sid;
 }

This portion queries the database with everyone on the list and I just grab their cell numbers.

 //Grabbing all employees on the support list
 List <string> persons = new List<string>();
 using (SqlConnection connection = new SqlConnection("Data Source=server/server;Initial Catalog=CompanyDirectory;Integrated Security=SSPI"))
 using (SqlCommand cmd = new SqlCommand("SELECT Cell FROM EmployeePhoneList WHERE IsEnabled = 1 ORDER BY NextToCall ASC", connection)) {
     connection.Open();
     using (SqlDataReader reader = cmd.ExecuteReader()) {
          if (reader.HasRows) {
              string p = "";
              while (reader.Read()) {
                  p = reader.GetString(reader.GetOrdinal("Cell"));                           
                  persons.Add(p);
              }
          }
     }
 }
1

1 Answers

0
votes

I work at Twilio with the developer community.

It sounds like what you need here is Call Screening. There are also some examples there in C#.

Hope this helps.