- Php Free Source Code
- Voice Recording Php Source Codec
- Php Open Source Code
- Php Projects With Source Code
- Php Source Code Download
This is the 1st post in our new recording audio in HTML5 series. Next, we’ll cover using WebAudioRecorder, vmsg, the opus-recorder and MediaRecording API.
Web-Based Internship Recording Management System is a straightforward mini project for managing the data of interns. The project incorporates the admin side. The admin can view all of the users and employers. They will add and look at the employer details, however can not delete their accounts. Our Voice Recorder is a convenient and simple online tool that can be used right in your browser. It allows you to record your voice using a microphone and save it as an mp3 file. Voice Recorder is completely free. No hidden payments, activation fees, or charges for extra features. The source code itself should not be infringing as it merely describes possible methods of implementation. Compiling or using mbelib may infringe on patents rights and/or require licensing. It is unknown if DVSI will sell licenses for software that uses mbelib.
Matt Diamond‘s Recorder.js is a popular JavaScript library for recording audio in the browser as uncompressed pcm audio in .wav containers. It is the 1st JS library to deal with audio recording in the browser – the initial commit is from September 2012, almost 6 years ago. Before it the only way was to use Flash.
When used in conjunction with
getUserMedia()
Recorder.js can record audio from a user’s microphone (or other input devices) directly in your web site.Despite its popularity – the project has 2700+ stars on GitHub – the library is not maintained anymore. In July 2016 Matt updated the repository to say that:
This repository is not being actively maintained due to lack of time and interest.
That’s also in part because newer libraries, like Web Audio Recorder, vmsg and opus-recorder, although a lot bigger, can also convert the audio to mp3, Opus or Vorbis.
Nevertheless, if you’re looking to record mono or 2 channel uncompressed pcm audio Recorder.js is still a great choice. Its only 12.7KB (non minified) and 3.2KB when gzipped, you’re spending only 1 HTTP call, and you can load it directly from the Rawgit CDN for production.
Recorder.js is smart in that uses a Web Worker to put together the .wav data so it is not blocking the browser tab or making it unresponsive.
Audio Quality
Recorder.js will record 16bit mono/2 channel audio at the sample rate is set in your OS for your playback device (as per the spec). You’ll most commonly see 44.1 kHz and 48kHz audio recordings.
Despite what’s written in some tutorials I found, Recorder.js does not support mp3 encoding, only wav. It has a neat pause feature though.
Recorder.js in action
To get you started with Recorder.js we’ll build a simple demo that allows you to record a voice message in the browser but also pause & resume the recording process. Here’s the live demo and GitHub project.
Our simple demo will have the following files:
index.html
file to hold the UIjs/app.js
to hold the app code- we’ll load
recorder.js
through Rawgit’s production URLcdn.rawgit.com
.
Our
index.html
file is pretty straightforward:Moving on to
app.js
we start by setting up a few variables, shims, getting references to our UI elements and adding event listeners:The code is then split between 4 important functions:
startRecording()
stopRecording()
pauseRecording()
createDownloadLink(blob)
startRecording()
launches the promise based getUserMedia()
and on success it passes the audio stream to an AudioContext which is then passed to our Recorder.js
object. The actual recording process is triggered by rec.record()
. We’re passing numChannels:1
to force mono sound. Omit the property or set it to 2 to record 2 channel sound. When did pubg mobile come out. Uncompressed 2 channel audio will take twice as much space/memory as mono.pauseRecording()
is pretty straightforward, it uses rec.recording
to determine whether or not a recording is in progress.stopRecording()
stops the recording process, stops the mic access, triggers the wav export, and enables the Record button to allow for subsequent recordings.When the wav export process is complete
createDownloadLink(blob)
is called and receives the wav audio data as a blob. It creates an <audio>
element for playback in the browser and an <a>
link for downloading the pcm audio as a .wav file.You can try the demo in browser here. The entire demo project is available on GitHub.
Uploading the audio file to the server
I’ve seen several demos on StackOverflow using
$.ajax()
to POST the file to a server side script but for that you need to import jQuery . I preferred to use the native XMLHttpRequest
since its just as simple and its supported by all browsers that support getUserMedia()
.Here’s the code I placed in the
createDownloadLink
function above just before the last recordingsList.appendChild(li)
line:The code will create an Upload link which when clicked will POST the blob and filename to the server side
upload.php
script.Here’s the server side
upload.php
:Letting the client control the filename is a rather bad idea and potential security risk. In production, you should generate server side a random file name – restricted to letters and numbers – and use that instead.
Browser support
With the library relying only on the widely available
WebAudioAPI
and getUserMedia()
APIs it is widely supported on desktop and mobile browsers including on Safari on iOS 11 and Safari 11 on macOS (the 1st Safari version to support getUserMedia()) .The Voicent PHP class contains the following functions.
Php Free Source Code
Since all these functions are implemented as a HTTP client communicating directly with Voicent Gateway, they can be run on any machine that has a connection to the host running the gateway. The php interface source code is included at the end of this section.
This PHP interface is developed based on Voicent Gateway Simple Outbound Call Interface.
Work with Interactive Applications
For many applications, it is desirable to get responses from callees in addition to deliver a message. The interaction can be implemented by using the low level gateway VoiceXML interface. However, using the low level API is a time consuming and error prone task. A better solution is to utilize Voicent IVR Studio to create an interactive application, and use the extended Simple Call Interface to trigger a phone call.
- call_text <phoneno> <text message> <selfdelete>
DESCRIPTION Filter app download.
<phoneno> | The phone number to call |
<text message> | The message for the phone call |
<selfdelete> | Ask the gateway to automatically delete the call request after the call is made if it is set to '1' |
The return value is the call request id <reqId>.
EXAMPLE
- call_text('123-4567', 'Hello, how are you doing', 1);
Make a call to phone number '123-4567' and say 'Hello, how are you doing'. Since the selfdelete bit is set, the call request record in the gateway will be removed automatically after the call.- $reqId = call_text('123-4567', 'Hello, how are you doing', 0);
- Make a call to phone number '123-4567' and say 'Hello, how are you doing'. Since the selfdelete bit is not set, the call request record in the gateway will not be removed after the call. You can then use call_status to get the call status, or use call_remove to remove the call record.
- call_audio <phoneno> <audiofile> <selfdelete>
![Voice Recording Php Source Code Voice Recording Php Source Code](https://dq51jve9h21d4.cloudfront.net/sites/default/files/imce/crm_org_crmland_cosmos_of_logos_open_source_final-01_1.png.pagespeed.ce.WkkJJzmnbo.png)
Adobe pdf reader app for pc. DESCRIPTION
<phoneno> | The phone number to call |
<audiofile> | The audio message for the phone call. The format must be PCM 16bit, 8KHz, mono wave file. The audio file must be on the same host as Voicent Gateway. |
<selfdelete> | Ask the gateway to automatically delete the call request after the call is made if it is set to '1' |
The return value is the call request id <reqId>.
EXAMPLE
- call_audio('123-4567', 'C:my audioshello.wav', 1);
Make a call to phone number '123-4567' and play the hello.wav file. Since the selfdelete bit is set, the call request record in the gateway will be removed automatically after the call.- $reqId = call_audio('123-4567', 'C:my audioshello.wav', 0);
- Make a call to phone number '123-4567' and play the hello.wav file. Since the selfdelete bit is not set, the call request record in the gateway will not be removed after the call. You can then use call_status to get the call status, or use call_remove to remove the call record.
- call_status <reqId>
DESCRIPTION
- Check the call status of the call with <reqId>. If the call is made, the return value is 'Call Made', or if the call is failed, the return value is 'Call Failed', and for any other status, the return value is '.
Please note that an empty string is returned if the call is still in progress. You'll need to wait and then poll the status again.
EXAMPLE
- $status = call_status('11234035434');
- call_remove <reqId>
DESCRIPTION
- Remove the call record of the call with <reqId>. If the call is not made yet, it will be removed also.
Voice Recording Php Source Codec
EXAMPLE
- call_remove('11234035434');
![Php Php](https://www.seoclerk.com/pics/314461-2rYV1k1420900843.png)
- call_till_confirm <vcast prog> <vcast doc> <confirmcode> <wavfile>
DESCRIPTION
Keep calling a list of people until anyone enters the confirmation code. The message is the specified audio file. This is ideal for using it in a phone notification escalation process.To use this feature, Voicent BroadcastByPhone Professional version has to be installed. This function is similar to the command line interface BroadcastByPhone has. But since the command cannot be invoke over a remote machine, this perl function uses the gateway to schedule an event, which in turn invokes the command on the gateway host.
The options are:
<vcast prog> | The BroadcastByPhone program. It is usually 'C:Program FilesVoicentBroadcastByPhonebinvcast' on the gateway host. |
<vcast doc> | The BroadcastByPhone call list to use. |
<confirmcode> | The confirmation code use for the broadcast |
<wavfile> | The audio file to use for the broadcast |
EXAMPLE
- call_till_confirm(
'C:Program FilesVoicentBroadcastByPhonebinvcast.exe',
'C:My calllistescalation.voc',
'911911',
'C:My calllistescalation.wav');
Php Open Source Code
This will invoke BroadcastByPhone program on the gateway host and start calling everyone one the call list defined in 'C:My calllistescalation.voc'. The audio message played is 'C:My calllistescalation.wav'. And as soon as anyone on the list enters the confirmation code '911911', the call will stop automatically.
Php Projects With Source Code
Source Code
Php Source Code Download
<?php
class Voicent
{
var $host = 'localhost';
var $port = 8155;
function _call_now($body)
{
$headers = 'POST /ocall/callreqHandler.jsp HTTP/1.1rn' .
'User-Agent: Mozilla/4.0rn' .
'Host: ' . $this->host . 'rn' .
'Content-Type: application/x-www-form-urlencodedrn' .
'Content-Length: ' . strlen($body) . 'rn' .
'rn';
if (! ($sock = fsockopen($this->host, $this->port, $errno, $errstr))) {
echo $errstr;
return false;
}
fwrite($sock, $headers.$body, strlen($headers.$body));
$reqid = ';
while ($line = fgets($sock, 4096)) {
if (preg_match('/[ReqId=(.*)]/', $line, $matches)) {
$reqid = $matches[1];
break;
}
}
fclose($sock);
return $reqid;
}
function call_text($phoneno, $textmsg, $selfdelete)
{
$body = 'info=' . urlencode('call ' . $phoneno) . '&';
$body .= 'phoneno=' . urlencode($phoneno) . '&';
$body .= 'firstocc=10&';
$body .= 'txt=' . urlencode($textmsg) . '&';
$body .= 'selfdelete=' . $selfdelete;
return $this->_call_now($body);
}
function call_audio($phoneno, $audiofile, $selfdelete)
{
$body = 'info=' . urlencode('call ' . $phoneno) . '&';
$body .= 'phoneno=' . urlencode($phoneno) . '&';
$body .= 'firstocc=10&';
$body .= 'audiofile=' . urlencode($audiofile) . '&';
$body .= 'selfdelete=' . $selfdelete;
return $this->_call_now($body);
}
function call_status($reqId)
{
$headers = 'GET /ocall/callstatusHandler.jsp?reqid=' . $reqId . ' HTTP/1.1rn' .
'User-Agent: Mozilla/4.0rn' .
'Host: ' . $this->host . 'rn' .
'rn';
if (! ($sock = fsockopen($this->host, $this->port, $errno, $errstr))) {
echo $errstr;
return false;
}
fwrite($sock, $headers, strlen($headers));
$status = ';
while ($line = fgets($sock, 4096)) {
if (preg_match('/^made^/', $line)) {
$status = 'Call Make';
break;
}
if (preg_match('/^failed^/', $line)) {
$status = 'Call Failed';
break;
}
}
fclose($sock);
return $status;
}
function call_remove($reqId)
{
$headers = 'GET /ocall/callremoveHandler.jsp?reqid=' . $reqId . ' HTTP/1.1rn' .
'User-Agent: Mozilla/4.0rn' .
'Host: ' . $this->host . 'rn' .
'rn';
if (! ($sock = fsockopen($this->host, $this->port, $errno, $errstr))) {
echo $errstr;
return false;
}
fwrite($sock, $headers, strlen($headers));
$line = fgets($sock, 4096);
fclose($sock);
}
function call_till_confirm($vcast, $voc, $confirmcode, $wavefile)
{
$body = 'info=' . urlencode('call till confirm') . '&';
$body .= 'phoneno=0000000' . '&';
$body .= 'firstocc=10&';
$body .= 'startexec=' . urlencode($vcast) . '&';
$body .= 'selfdelete=' . $selfdelete . '&';
$cmdline = '' . $voc . ' -startnow -confirmcode ' . $confirmcode;
$cmdline .= ' -wavfile ' . $wavefile . '';
$body .= 'cmdline=' . urlencode($cmdline);
return $this->_call_now($body);
}
}
# $voicent = new Voicent;
# $id = $voicent->call_text('1234567', 'hello, how are you', '0');
# print $id;
# $id = $voicent->call_audio('1234567', 'C:Tempwelcome.wav', 0);
# print $id;
# print $voicent->call_status('1103704332609');
# $voicent->call_remove('1103704332609');
# print $voicent->call_status('1103704332609');
?>