Friday, December 31, 2010

Asterisk Voicemail

Password protected Separate away and unavailable greetings Default or custom greetings Multiple mail folders Web interface for checking of voicemail E-mail notification of voicemail with audio file attachment Voicemail forwarding Visual message waiting indicator (MWI) Message waiting stutter dialtone
The number of messages for each voicemailbox is limited to 99 messages. Starting with Asterisk 0.7.1 the system now plays a prompt warning the user that the mailbox is full and cannot record any more messages. New features (as of April 28, 2004)
Option to have the CID of the caller heard before the voicemail Option to allow an operator to be reached after leaving a voicemail Option to review, rerecord, or save voicemails after leaving them Option to review, rerecord, or save busy, unavailable, and name prompts. Option to allow dialing out from within voicemail Option to allow calling back of the person who left voicemail (with the correctly formatted contexts in extensions.conf) Group voicemail (voicemail broadcast)
The context defined in the voicemail.conf corresponds to entries in the channel configuration file, i.e. zapata.conf and sip.conf which require the context to be appended to the mailbox when using VoiceMail2.

Configuration lines for a voicemailbox in voicemail.conf:
[YourVoicemailContext]
210 => 5555,John Smith,jsmith@yourdomain.com

Line in zapata.conf or sip.conf:
mailbox=210@YourVoicemailContext


The location of saved messages also changes with the context:
 /var/spool/asterisk/voicemail/YourVoicemailContext/210/INBOX


When listening to a message you'll hear when it was recorded. Voicemails are saved on the server in all formats specified in voicemail.conf, but only the first format specified is sent as an attachment to the email. The /contrib/scripts directory of /usr/src/asterisk contains a Perl script that can be applied to regularly expire too old voicemail messages
You can follow this article Asterisk - Setup voicemail to send email with mp3 attachment to get a detailed explaination how to setup Asterisk to send voicemail by email with mp3 audio attachment. This method uses only bash script and usual linux tools.

note: my is /var/lib, some peoples will be /usr/share.
1. ensure "attachfmt=wav" and "format=wav|gsm"
2. Put the below script in: //asterisk/agi-bin/mp3vm.pl
3. chmod a+rx mp3vm.pl
4. modify mailcmd=perl //asterisk/agi-bin/mp3vm.pl
5. install lame if you don't already have it
6. check the path to perl, base64, dos2unix and lame and modify the script and mailcmd as needed. (If you are getting 0kb files, your path to lame is likely wrong.)

#!/usr/bin/perlopen(VOICEMAIL,"|/usr/sbin/sendmail -t");open(LAMEDEC,"|/usr/bin/dos2unix|/usr/bin/base64 -di|/usr/local/bin/lame --quiet --preset voice - /var/spool/asterisk/tmp/vmout.$$.mp3");open(VM,">/var/spool/asterisk/tmp/vmout.debug.txt"); my $inaudio = 0;loop: while(<>){ if(/^\.$/){ last loop; } if(/^Content-Type: audio\/x-wav/i){ $inaudio = 1; } if($inaudio){ while(s/^(Content-.*)wav(.*)$/$1mp3$2/gi){} if(/^\n$/){ iloop: while(<>){ print LAMEDEC $_; if(/^\n$/){ last iloop; } } close(LAMEDEC); print VOICEMAIL "\n"; print VM "\n"; open(B64,"/usr/bin/base64 /var/spool/asterisk/tmp/vmout.$$.mp3|"); while(){ print VOICEMAIL $_; print VM $_; } close(B64); print VOICEMAIL "\n"; print VM "\n"; $inaudio = 0; } } print VOICEMAIL $_; print VM $_;}print VOICEMAIL "\.";print VM "\.";close(VOICEMAIL);close(VM);#CLEAN UP THE TEMP FILES CREATED#This has to be done in a separate cron type job#because unlinking at the end of this script is too fast,#the message has not even gotten piped to send mail yet

2 comments:

  1. This would definitely increase a company's progression and profitability.

    ReplyDelete
  2. This Asterisk Voicemail would definitely increase a company's progression and profitability.

    ReplyDelete