0

I am using twilio.js for making a calling app which record outbound calls also, But I am not getting which parameter to pass in Twilio.device.connect(para). I checked its Php code in which its invoked by passing "record": "true" Someone please help or suggest me something.

shanu
  • 76
  • 1
  • 1
  • 11

2 Answers2

0

Twilio developer evangelist here.

You can't pass any params to Twilio.Device.connect that will make it record. Instead, you'll want to use the Record parameter on <Dial> when you forward the call on.

Alternatively, if you just want to record a message from the caller, you'll want <Record>.

Let me know if that helps at all.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • But I am not getting how to use Twiml – shanu Jun 14 '18 at 06:40
  • In that case I would take a look at the [calling tutorials on the Twilio site](https://www.twilio.com/docs/voice/tutorials/how-to-respond-to-incoming-phone-calls). There's a bunch that will teach you how to do more and more complex things. – philnash Jun 14 '18 at 06:47
  • when I call through javascript sdk, In my call log it shows two record for one call, why is it so? – shanu Jun 15 '18 at 06:24
  • I assume that is a call between two people? If so, then what you are seeing is the log for the inbound leg, between the caller and Twilio, and the log for the outbound leg, between Twilio and the person called. – philnash Jun 15 '18 at 06:25
  • can you provide me a code example of outbound calling and hanging up using TWIML and php? It would be appreciable. – shanu Jun 15 '18 at 06:37
  • Not sure what you're after there. There are tutorials on [making an outbound call with PHP](https://www.twilio.com/docs/voice/tutorials/how-to-make-outbound-phone-calls-php) in the Twilio docs, not sure what you mean by calling and hanging up though. You can [use TwiML to ``](https://www.twilio.com/docs/voice/twiml/hangup). – philnash Jun 15 '18 at 07:30
0

For me, I found out the best solution is to get the Call-SID from twilio.js like this:

Twilio.Device.connect(function (conn) {
    var currentCallSid = conn.parameters.CallSid;
    console.log(currentCallSid);
});

And then handover this SID to the call-recording API to trigger call recording with a separate API request. This requests returns the recording-SID which you can use to retrieve eg. the recording .wav/.mp3 file or manipulate the recording.

Micronax
  • 660
  • 13
  • 25