Open prathibhatvm opened 2 years ago
Take a look at the following method: https://github.com/InnovateAsterisk/Browser-Phone/blob/b4482512bda0e2584564d8d5d86ef1e0810903f1/Phone/phone.js#L2559
it’s consistently called at the end of a call, and it’s used to call the method that saves call recordings. It’s quite reliable to use as it’s responsible to wrapping up each call, in or out.
From there you can choose the development path. Maybe look at some kind of background service, because there may be a race condition at the actual save point. Writing call recordings are async, while cdrs are not.
How to save the call recording at one end. when user1 calls user2 or user2 calls user1, the call recording should always happen at user1?
In SaveCallRecording function, I've added code to save the recorded video in the server. It works fine one way(while calling from user1 to user2).User 2 disconnects the call. I can see the recorded video in the server. But the video is not getting recorded the other way(while calling from user 2 to user 1). User 1 disconnects the call. Video is not saved in the server.
Could you share how to save the recorded video in the server?
if(profileUser == 10100 && session.data.withvideo && session.data.reasonCode != 486) { var did = session.remoteIdentity.uri.user; var callerID = session.remoteIdentity.displayName; // generating a random file name var fileName = getFileName('webm', callerID, did); // we need to upload "File" --- not "Blob" var fileObject = new File([blob], fileName, { type: 'video/webm' }); var formData = new FormData();
// recorded data formData.append('video-blob', fileObject);
// file name formData.append('video-filename', fileObject.name);
uploadToPHPServer(fileObject, function(response, fileDownloadURL) { //alert(response); if(response !== 'ended') { return; }
console.log("Successfully uploaded recorded blob."); alert('Successfully uploaded recorded blob.'); }); }
// this function is used to generate random file name function getFileName(fileExtension, callerID, did) { var d = new Date(); var year = d.getUTCFullYear(); var month = ('0'+(d.getUTCMonth() + 1)).slice(-2); var date = ('0'+d.getUTCDate()).slice(-2); var hour = ('0'+d.getHours()).slice(-2); var minute = ('0'+d.getMinutes()).slice(-2); var seconds = ('0'+d.getSeconds()).slice(-2); return profileUser + '-' + profileName + '-' + did + '-' + callerID
function uploadToPHPServer(blob, callback) { // create FormData var formData = new FormData(); formData.append('video-filename', blob.name); formData.append('video-blob', blob); callback('Uploading recorded-file to server.'); makeXMLHttpRequest('https://bp.erss.in:1443/save.php', formData, function(progress) { if (progress !== 'upload-ended') { callback(progress); return; } var initialURL = 'https://bp.erss.in:1443/uploads/' + blob.name; callback('ended', initialURL); }); }
//Save.php
<?php
header("Access-Control-Allow-Origin: *");
// upload directory $filePath = 'uploads/' . $_POST['video-filename'];
// path to ~/tmp directory $tempName = $_FILES['video-blob']['tmp_name'];
// move file from ~/tmp to "uploads" directory if (!move_uploaded_file($tempName, $filePath)) { // failure report echo 'Problem saving file: '.$tempName; die(); }
// success report echo 'success'; ?>
-- Regards, B.Prathibha
On 06-07-2022 06:15 pm, Leonardo Spricigo wrote:
In SaveCallRecording function, I've added code to save the recorded video in the server. It works fine one way(while calling from user1 to user2).User 2 disconnects the call. I can see the recorded video in the server. But the video is not getting recorded the other way(while calling from user 2 to user 1). User 1 disconnects the call. Video is not saved in the server.
Could you share how to save the recorded video in the server?
— Reply to this email directly, view it on GitHub https://github.com/InnovateAsterisk/Browser-Phone/issues/207#issuecomment-1176178284, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGJHM3X6ZDYDJ3QGNQBNWDDVSV5V5ANCNFSM5OXMNXGQ. You are receiving this because you commented.Web Bug from https://github.com/notifications/beacon/AGJHM3TXKOYDYTR64YA3IA3VSV5V5A5CNFSM5OXMNXG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOIYNQ43A.gifMessage ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/InnovateAsterisk/Browser-Phone/issues/207#issuecomment-1176178284","url": "https://github.com/InnovateAsterisk/Browser-Phone/issues/207#issuecomment-1176178284", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
[ C-DAC is on Social-Media too. Kindly follow us at: Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]
Thanks :)
In SaveCallRecording function, I've added code to save the recorded video in the server. It works fine one way(while calling from user1 to user2).User 2 disconnects the call. I can see the recorded video in the server. But the video is not getting recorded the other way(while calling from user 2 to user 1). User 1 disconnects the call. Video is not saved in the server.