As from the question it is quite clear what I am trying to achieve. What I had tried till now to achieve the said is:
dailcall.php
$call = $twilio->calls
->create($to, // to
$from, // from
[
"method" => "GET",
"url" => "https://twilioxxxx.tk/api/araonvlad_bot/recording.php",
"record" => true,
'transcribe' => true,
"StatusCallbackMethod" => "POST",
"StatusCallbackEvent" => array("in-progress completed"),
]
);
recording.php
use Twilio\Rest\Client;
require DIR . '/vendor/autoload.php';
$twilio = new Client("AC8b2cc96be2a8dbc059f29xxxxx", "88db8eeb71124a3effd6c19681xxxx");
if($_REQUEST['CallStatus'] == 'in-progress') {
file_put_contents('request.log', "\n" .json_encode($_REQUEST). ' - in-progress recording start now : - ' . "\n", FILE_APPEND);
$callSid = $_REQUEST['CallSid'];
$recording = $twilio->calls($callSid)
->recordings
->create([
"recordingStatusCallback" => "https://twilioxxxxxx.tk/api/araonvlad_bot/read_Recording.php",
"recordingStatusCallbackEvent" => ["completed"],
"recordingChannels" => "dual",
'transcribe' => 'true'
]
);
file_put_contents('request.log', "\n" .json_encode($recording). ' - in-progress recording variable : - ' . "\n", FILE_APPEND);
}
read_Recording.php
require __DIR__ . '/vendor/autoload.php';
use Twilio\Rest\Client;
$twilio = new Client("AC8b2cc96be2a8dbc059f2908e8xxxxx", "88db8eeb71124a3effd6c196xxxx");
file_put_contents('request.log', "\n" .json_encode($_REQUEST). ' - read Recording File: - ' . "\n", FILE_APPEND);
if I set transcribe= true in the dailcall.php it shows 500 error. how I can start recording in recording.php file as I am getting error. All three files are on same level with vendor folder added with composer.
How I can get the recording download mp3 file and the transcribtion of recording. I have recording just about 30 seconds max.
I had read the documentations:
https://www.twilio.com/docs/voice/tutorials/how-to-record-phone-calls/php
https://www.twilio.com/docs/voice/api/recording#fetch-recording-metadata
https://www.twilio.com/docs/voice/api/recording-transcription