twilio-labs / call-gpt

Generative AI phone call toolkit using Twilio Media Streams.
MIT License
273 stars 114 forks source link

<Record> Flag on TwiML not working. #34

Closed mercuryyy closed 3 months ago

mercuryyy commented 4 months ago

So i tried few combination from - https://www.twilio.com/docs/voice/twiml/stream

I tried having the flag set in different location while editing app.js, either errors the app, or does not record on Twilio.

app.post('/incoming', (req, res) => {
  res.status(200);
  res.type('text/xml');
  res.end(`
  <Response>
    // tried here
    <Connect>
      // tried here
      <Stream url="wss://${process.env.SERVER}/connection" Record="true" />
      <Record transcribe="true" playBeep="false" />
    </Connect>
  </Response>
  `);
}); 
cweems commented 3 months ago

@mercuryyy I've incorporated call-recording functionality into the project now. The <Record> TwiML verb is more like "Voicemail recording" functionality that stops the rest of the call instructions while the users speaks. In this case we would update the in-progress call to start recording while the media stream is executing: https://www.twilio.com/docs/voice/api/recording

You can use this now by adding RECORDING_ENABLED='true' in the .env file. Be sure to note the legal implications of call recording listed in the .env file. You will also need to set your Twilio Account SID and Auth Token in the .env.