Archive for December 2014

Post Archives
Archive for December, 2014

Asterisk Sounds Transcode WAV to g729 Codec

December 31st, 2014 No comments

I was sooo surprised I couldn’t find anything decent on google to transcode asterisk sounds from WAV to g729 codec that I decided to post what I’ve done.

Asterisk already has a “file convert” cli command, which does exactly that… convert files from one codec to another.  All one needs to do is write a little shell script to be able to do it in bulk for multiple files.  So here is the shell script that will do it for you.  Just put that into a .sh file, chmod it to 755 and run it with the appropriate arguments.

#!/bin/bash

echo ""
echo "ASTERISK TRANSCODER"
echo ""

if [ $# -ne 3 ]
then
        echo "Usage:"
        echo "$0 FROM_FORMAT TO_FORMAT FILE_PATH"
        echo ""
        echo "FROM_FORMAT - The format from which to make the coversion e.g. wav, ulaw, gsm, g729, etc."
        echo "TO_FORMAT - The format to which to make the conversion e.g. wav, ulaw, gsm, g729, etc."
        echo "FILE_PATH - The location where the file are located and where the new files will be created."
        echo ""
        echo "NOTE: The FROM_FORMAT and TO_FORMAT codecs must be installed and working in Asterisk."
        echo "Use 'core show translation recalc 10' in Asterisk CLI to confirm which codecs are installed."
        echo ""
        exit 1
fi

from_format=($1)
to_format=($2)
file_path=($3)

read -p "Transcode all files in $file_path from $from_format to $to_format? Press  to proceed or  to cancel."

echo ""

for file in $file_path/*.$from_format;
do
        asterisk -rx "file convert $file ${file%.$from_format}.$to_format"
done
Share
Categories: Asterisk PBX Tags:

Installing / Updating PHP to PHP 5.4 PHP 5.5 or PHP 5.6 on Webmin / Virtualmin

December 31st, 2014 No comments

We use Webmin / Virtualmin to simplify management of our development and test servers with cPanel used to run the production servers. Most of the php software we develop and CMSes we use either require or prefer to have php 5.4+. However Webmin / Virtualmin come with PHP 5.1 and PHP 5.3 for CentOS 5 and CentOS 6 respectively. Obviously these are VERY outdated version that are end of life and as such should really be updated to something later. The problem is however there is no information on webmin / virtualmin website on how to do this properly. The information is pretty poor on this topic in general.

The reality is this process is extremely simple and there is nothing that special about a CentOS system running Webmin / Virtualmin to help with management compared to a standard CentOS system (at least as far as PHP is concerned).

What you basically need to do is:

  1. Install a yum repo that has php 5.4 or whatever version you are after
  2. Run yum update to update to the appropriate version

The are two up-to-date yum repos out there:

  • Remi – http://blog.famillecollet.com/pages/English-site-introduction
  • Webtatic – https://webtatic.com/

Both websites have information on how to install the repos and if you’ve found yourself here you should take a bit of time and learn about yum repo management and what remi and webtatic are by going to those sites (which is why I’m not copy pasting how to install the repos here).

After that you will need to run yum –enablerepo=appropriate-repo update php\*.  For remi you can read more about it on the following page http://blog.famillecollet.com/post/2014/06/27/PHP-5.4.30-and-5.5.14

Hope this helps someone trying to do the same thing.

Share
Categories: PHP Tags: