user8463320
user8463320

Reputation: 1

recording chunks with twilio

New to twilio. I am trying to make a twilio call to my company's IVR and record the voice chunks. For example, when I dial the IVR, I get: Hello, welcome to ... Press 1 for ... Our menu has recently changed, for ... Press 1

I can dial using:

static void Main(string[] args) 
{
string accountSid = "xxxxxxxx";
string authToken = "xxxxxxx";
Twilio.TwilioClient.Init(accountSid, authToken);
var call = CallResource.Create( 9876543210, 1234567890,
                                record: true,
                                recordingChannels: "dual",
                                url: new Uri("http://www.mycompany.com/DialOption"),
                                sendDigits: "wwww1234wwww1234567890")
 }

On my webserver, I have:

public class DialOptionController : TwilioController
    {

        [HttpPost]
        public TwiMLResult Index(VoiceRequest request)
        {  
            var response = new VoiceResponse();           
            response.Pause(19);
            response.Play(digits: "1");           

            response.Pause(19);
            response.Play(digits: "1");

            response.Pause(9);
            response.Play(digits: "1");

            return TwiML(response);
        }
    }

How do I get the recording to give me the chunks before I select the option and not the whole recording in one file?

Upvotes: 0

Views: 139

Answers (1)

Racil Hilan
Racil Hilan

Reputation: 25351

I believe you cannot get the call recording in chunks. You only get a link to the entire recording at the end of the call.

The only recording that you can get in chunks is the recording during the Gather verb if you select input=speech or input=speech dtmf instead of the default input=dtmf, and provide a value for the partialResultCallback parameter. Example:

var response = new VoiceResponse();
var gather = new Gather(input: "speech",
                        action: new Uri("/completed"),
                        partialResultCallback: new Uri("/partial"));
gather.Say("Welcome to Twilio, please tell us why you're calling");
response.Append(gather);
Console.WriteLine(response.ToString());

Upvotes: 1

Related Questions