Next we show the steps to follow to send the Voicemail with the transcription of the content. There are two ways to do it, using the Script or doing it step by step.
- Have installed VitalPBX 4 and configured the sending of Email. This is done in ADMIN/System Settings/Email Settings.
- Create an account, if you don't have yet, with Google Cloud. Free trials can be made at https://console.cloud.google.com/freetrial
- Within console.cloud.google.com search for Cloud Speech-to-Text API and enable it
- Have root access to the VitalPBX Server
Install required dependencies.
apt install curl apt-transport-https gnupg jq sox flac dos2unix gnupg
You can acquire the public Key for Google Cloud by executing the following command.
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
Use the following command to add the gcloud CLI distribution URI as a packet source.
echo "deb https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
Run the following command to update and install the gcloud CLI.
apt-get update && sudo apt-get install google-cloud-cli
Use the following command to initialize the gcloud CLI.
gcloud init
Now we are going to authorize the Asterisk user to also have access to Google Cloud. We change user in the Linux console.
su -s /bin/bash asterisk
We now request access to Google Cloud.
gcloud auth login
Finally we do the test and it should give us the same result as before.
gcloud ml speech recognize 'gs://cloud-samples-tests/speech/brooklyn.flac' --language-code='en-US'
Now we download the sendmail-gcloud file and copy it to /usr/sbin/
wget https://raw.githubusercontent.com/VitalPBX/vitalpbx-voicemail-transcription-google-cloud/main/sendmail-gcloud /usr/sbin/
Later we create the file voicemail__60-general.conf in /etc/Asterisk/vitalpbx/ with the following content.
nano /etc/asterisk/vitalpbx/voicemail__60-general.conf
Content
[general](+) ;You override the default program to send e-mail to use the script mailcmd=/usr/sbin/sendmail-gcloud
Now we assign the corresponding permissions
cd /usr/sbin/ chown asterisk:asterisk sendmail-gcloud chmod 744 sendmail-gcloud chmod 777 /usr/bin/dos2unix
Finally we do a reload of the voicemail module
asterisk -rx"module reload app_voicemail.so"
Overall, voicemail transcription can be a useful tool for anyone who receives voicemails regularly, and it can provide several benefits, including time savings, improved accessibility, increased accuracy, and convenience.
For more details about the implementation of Google Cloud VoiceMail Transcription, visit the following Blog:
https://vitalpbx.com/blog/vitalpbx-voicemail-transcription-with-google/