Thursday, September 13, 2012

Chocolatey: apt-get for windows

From the website:  Chocolatey NuGet is a Machine Package Manager, somewhat like apt-get, but built with windows in mind.

You can even build your own packages and submit them.  I really like the concept and can see myself using this technology as a free alternative to Microsoft System Center.

Website: http://chocolatey.org/
Github Page: https://github.com/chocolatey/chocolatey/wiki


Monday, September 10, 2012

AsteriskNOW 2.0.2 64-bit WAV to MP3

I recently revamped our PBX and installed AsteriskNOW 2.0.2 64-bit (http://www.asterisk.org/downloads).  There were lots of tutorials online dealing with setup and i was able to get the server and 15 Polycom 501 handsets setup in about 3 days.  Because i am often traveling or away from my desk for long periods of time I rely heavily on the voicemail to email feature. The problem was that the .wav files were not opening on my Android Phone. After doing some research i found out that the file was in an odd format (wav|gsm).  I had two options at this point:  I could either pay a couple bucks for an android app that would play this format or i would reconfigure my server to use another format like mp3 for free.

Being a self proclaimed saver and always looking for a challenge, I decided to search the internet for tutorials.  I found a great tutorial outlining the process found here:   http://pcaddicts.ca/rc/2011/06/26/asterisknow-freepbx-mp3-voicemail/.

As i started through the process i quickly realized that this tutorial was written for an x86 setup and not an x64 setup.  Below is the steps i used on my x64 CentOS 5.8 final AsteriskNOW 2.0.2 64-bit setup.

1) Login into your box

2) Goto your home directory
cd /home/

3) Download the lastest version of lame from here http://pkgs.repoforge.org/lame/
wget http://pkgs.repoforge.org/lame/lame-3.97-1.el5.rf.x86_64.rpm

4) install rpm
rpm -Uvh lame-3.97-1.el5.rf.x86_64.rpm

5) Create the following script as /usr/sbin/sendmp3voicemail.pl
nano /usr/sbin/sendmp3voicemail.pl
#!/usr/bin/perl
open(VOICEMAIL,"|/usr/sbin/sendmail -t");
open(LAMEDEC,"|/usr/bin/dos2unix|/usr/bin/base64 -di|/usr/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


6) Make the script executable
chmod 775 /usr/sbin/sendmp3voicemail.pl

7)Change default voicemail format to uncompressed WAV (which will be converted to MP3) and set mailcmd script.
FreePBX -> Voicemail Admin -> Settings

Changes:

format= wav
mailcmd= /usr/sbin/sendmp3voicemail.pl


8) Restart Asterisk and test
service asterisk restart

Thursday, September 6, 2012

Thoughts about article "Time to Give Java the Boot?"

I started reading an article titled "Time to Give Java the Boot?" found here:

http://www.pcworld.com/article/261843/time_to_give_java_the_boot.html

I almost stopped reading this article once they made the following statement: "The Mac operating system has been near-bulletproof to vulnerabilities...".

As most system admins know, the only reason that the Mac operating system has been "near-bulletproof" is because until recently they didn't have enough market share to matter to virus/malware authors.  Now that they do, this perception is changing.  Apple itself has had to remove statements like "It doesn't get PC viruses" from their website because it actually does get viruses... see http://www.pcmag.com/article2/0,2817,2406275,00.asp.

I am not an Apple hater.  I use my ipad almost daily but it is statements like this that make people complacent about their security and leave them vulnerable to attack. If technical writes at pcworld believe the apple marketing hype then i can only image what the general public must think.

As far as the point of the article, i agree that java is becoming less important for end users and i believe browser based technologies like HTML 5 will eventually replace java on the desktop but on the server JAVA and the JVM are here to stay.


Phoenix

I am resurrecting this tech blog for notes related to Azure Logic Apps with SAP.