Skip to content

Script to transcribe voicemail and convert voicemail recordings to MP3

License

Notifications You must be signed in to change notification settings

westparkcom/FreePBX-VM-Transcription

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FreePBX-VM-Transcription

Script to transcribe voicemail and convert voicemail recordings to MP3

Installation

Pull the repo to your server

git clone https://github.com/westparkcom/FreePBX-VM-Transcription.git

Install the scripts:

cd FreePBX-VM-Transcription
cp emailproc /usr/local/bin
cp sttparse /usr/local/bin
chmod +x /usr/local/bin/emailproc
chmod +x /usr/local/bin/sttparse

Install the appropriate python version

yum install python36u python36u-pip python36u-devel

Install the necessary python libraries

pip3.6 install ffmpy google-cloud-speech

Modify the "globalconfig" function parameters in the file /usr/local/bin/sttparse to suit your needs. The defaults are:

'vm_transcription' : True, # Transcribe voicemail to text (requires Microsoft Azure Cognitive services subscription)
'transcription_string' : '{{{{TRANSCRIPTION}}}}', # String to search for in the email which will be replaced by the transcribed text
'creds_file': '/path/to/creds.json', # Path to credentials json file, generated by Google
'speech_language' : 'en-US', # Language for speech recognition
'vm_to_mp3' : True, # Convert voicemail audio to MP3
'temp_dir': '/tmp', # Temp location for MP3 conversion. MUST BE WRITABLE!
'check_html' : True # Check to see if message is HTML and set mimetype accordingly

A Google cloud services API JSON key is required for transcription and can be acquired from Google. Please refer to this page for instructions on generating an API key JSON file. You will then copy this file to your FreePBX server and place in an appropriate location, such as /usr/local/etc

FreePBX Setup

In FreePBX browse to Settings -> Voicemail Admin -> Settings -> Email Config then add the transcription tag {{{{TRANSCRIPTION}}}} to the Email Body. The script will search for this tag to replace with the transcription text. You can also use HTML and the script will automatically change the content type to text/html. Here is a sample html email:

<html>
<body>
<p>${VM_NAME},
<br><br>
There is a new voicemail in mailbox ${VM_MAILBOX}:</p>
<p>
<table>
  <tr>
    <th align="left">From (Name):</th>
    <td>${VM_CIDNAME}</th>
  </tr>
  <tr>
    <th align="left">From (Number):</td>
    <td><a href="tel:https://${VM_CIDNUM}">${VM_CIDNUM}</a></td>
  </tr>
  <tr>
    <th align="left">Length:</td>
    <td>${VM_DUR} seconds</td>
  </tr>
  <tr>
    <th align="left">Date:</td>
    <td>${VM_DATE}</td>
  </tr>
  <tr>
    <th align="left">Transcription:</td>
    <td>{{{{TRANSCRIPTION}}}}</td>
  </tr>
</table></p>
<p>Dial *98 to access your voicemail by phone.<br>
Visit <a href="https://your.pbxaddress.tld">https://your.pbxaddress.tld</a> to check your voicemail with a web browser.</p>
</body>
</html>

Finally, set the Mail Command value to /usr/local/bin/emailproc

About

Script to transcribe voicemail and convert voicemail recordings to MP3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published