Voicemail

Menu: (System-Voicemail)

Voicemails are listed, played, downloaded and deleted from this page.

Voicemails are shown to the FusionPBX user(s) that have been assigned to an extension. It means that the page will be populated only if the user you are logged in (ex: superadmin), has at least 1 extension assigned. FusionPBX user accounts are created in the User Manager and then are assigned on the Extensions page.

In the following example we have 2 extensions assigned to the user and extension 1001 has a voicemail.

Mailbox: 1000 -  Created    	        Caller ID Name    	   Caller ID Number    	    Folder    	    Length (play)    	Size(download)

Mailbox: 1001 -  Created    	        Caller ID Name    	   Caller ID Number    	    Folder    	    Length (play)    	Size(download) 21 Oct 2010 3:17 am 	Extension 1000 	          1000 	            inbox 	     35 sec  	         567.29 kB 


 * You can play the file by clicking over the Length ( in the example:  35 sec  ).
 * You can download the file by clicking over the Size ( in the example:  567.29 kB  ).

Related

 * Voicemail Status

Voicemail Setup
The voicemail is automatically setup for you when you install Fusionpbx, you only need to personalize it. To setup a voice mail greeting, call *98 from your extension, enter your voice mail PIN ( located in the extension setup screen) and listen to the options available. One of the options is for advanced option (#5) select this option and you will be presented with tools to record your voicemail greeting.

Multiple Email
You can add multiple email addresses in the "Voicemail Mail To:" text box. These should be comma delimited (no spaces). Example: Voicemail Mail To: joe@example.com,joe.sixpack@example.net

Why?
Sending MMS messages to mobile phones without email plans is one reason.

Transcribing Voicemails with google speech API
It's not that great, but it's better than nothing.

You need to install sox on your system, because it only takes flac files. apt-get install sox

And apply this patch to /secure/v_mailto.php - you must be using that to send the voicemail.

It's a little messy - it saves the WAV file again to disk, and then saves it as a flac.. might be able to do it without hitting the disk at all, but I didn't spend the time to figure it out.

Can probably do the wget also via php directly, rather than calling it, but again, I didn't figure out how.

this showed me the basics of how to do this.

This works for most of FusionPBX v2
Code by AviMarcus Index: v_mailto.php

=
====================================================== --- v_mailto.php	(revision 1458) +++ v_mailto.php	(working copy) @@ -39,6 +44,28 @@ ob_end_clean; ob_start; + +function get_transcription($attachment_str){ +	$time=microtime(1); +	$language="en-us"; +	$file_name="/tmp/vm_".$time; +	file_put_contents($file_name.".wav",$attachment_str); +	system("sox $file_name.wav $file_name.flac rate 16k"); +	$result=exec("wget -q -U 'Mozilla/5.0' --post-file $file_name.flac --header='Content-Type: audio/x-flac; rate=16000' -O - 'http://www.google.com/speech-api/v1/recognize?lang=$language&client=chromium'"); +	unlink($file_name.".wav"); +	unlink($file_name.".flac"); +	+	$result=json_decode($result,1); +	if(!is_array($result['hypotheses'])){ +		$transcription ="Free Google Speech API returned: $result"; +		} +	else{ +		$transcription ="Free Google Speech API returned, with a confidence of ".round($result['hypotheses'][0]['confidence']*100)."%"; +		$transcription.="\n".$result['hypotheses'][0]['utterance']; +		} +	return $transcription; +	} + //echo "raw message: \n".$email."\n"; //if there is a carriage return remove it and standardize on line feed @@ -161,6 +188,9 @@ 					$attachment_type = "audio/wav"; $attachment_ext = ".wav"; $attachment_str = trim(substr($mimepart, strlen($subheader), strlen($mimepart))); +					+					$transcription=get_transcription(base64_decode($attachment_str)); +					 					//echo "\n*** begin wav ***\n".$attachment_str."\n*** end wav ***\n"; break; case "audio/mp3;": @@ -201,8 +231,8 @@ 	$mail->From      = $v_smtpfrom; $mail->FromName  = $v_smtpfromname; $mail->Subject   = $var['Subject']; -	$mail->AltBody   = $textplain;   // optional, comment out and test -	$mail->MsgHTML($texthtml); +	$mail->AltBody   = $textplain."\n\n$transcription";   // optional, comment out and test +	$mail->MsgHTML($texthtml." ".nl2br($transcription)); $v_to = $var['To'];

This SHOULD work for FusionPBX v3
Index: v_mailto.php

=
====================================================== --- v_mailto.php       (revision 2811) +++ v_mailto.php       (working copy) @@ -54,6 +54,29 @@       ob_end_clean; ob_start;

+function get_transcription($attachment_str){ +      $time=microtime(1); +      $language="en-us"; +      $file_name="/tmp/vm_".$time; +      file_put_contents($file_name.".wav",$attachment_str); +      system("sox $file_name.wav $file_name.flac rate 16k"); +      $result=exec("wget -q -U 'Mozilla/5.0' --post-file $file_name.flac --header='Content-Type: audio/x-flac; rate=16000' -O - 'http://www.google.com/speech-api/v1/recognize?lang=$language&client=chromium'"); +      unlink($file_name.".wav"); +      unlink($file_name.".flac"); + +      $result=json_decode($result,1); +      if(!is_array($result['hypotheses'])){ +              $transcription ="Free Google Speech API returned: $result"; +              } +       else{ +              $transcription ="Free Google Speech API returned, with a confidence of ".round($result['hypotheses'][0]['confidence']*100)."%"; +              $transcription.="\n".$result['hypotheses'][0]['utterance']; +              } +       return $transcription; +      } + + + //testing show the raw email //echo "Message: \n".$msg."\n";

@@ -209,13 +232,15 @@

//add an attachment $mail->AddStringAttachment($parts_array["Body"],$file,$encoding,$mime_type); +                                       $attachments_array=$mail->GetAttachments; +                                       $transcription=get_transcription($attachments_array[0]); //we shouldn't ever have more than one attachment }               }        }

//add the body to the email -      $mail->AltBody    = $body_plain;   // optional, comment out and test -      $mail->MsgHTML($body); +      $mail->AltBody    = $body_plain."\n\n$transcription"; +      $mail->MsgHTML($body."  ".nl2br($transcription));

//send the email if(!$mail->Send) {

Transcribing Voicemails with Nexiwave's free voicemail-to-text API
http://Nexiwave.com offers a free and much more accurate voicemail-to-text service. After regsiter your free account with Nexiwave, simply swap the url to wget above with something like this: https://api.nexiwave.com/SpeechIndexing/file/storage/user@myemail.com/recording/?authData.passwd=XYZ&syncAttempt=true&response=application/json&externalKey=my_external_key_123 Note: you can skip the flac step, since Nexiwave accepts nearly all audio formats.

For more info, see here: http://nexiwave.com/index.php/site-map/119-integrate-in-5-minutes