The Guru Of Tech - Gobind

Asterisk Insall, Codec Install, Vicidial Install.

Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS

Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS

Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS

Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS.

Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS

Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS.

Wednesday, November 30, 2011

Install And Maintain Kamailio (OpenSER) v3.0.x From GIT on CentOS 5.x

Install And Maintain Kamailio (OpenSER) v3.0.x From GIT on CentOS 5.x

Main author:

   Elena-Ramona Modroiu <ramona (at) asipto.com>

This is a step by step tutorial about how to install and maintain Kamailio (OpenSER) using the sources from GIT on CentOS 5.x.

Using the GIT, you get access to the latest code very quickly.

This document focuses on Kamailio (OpenSER) v3.0.x with MySQL support, using CentOS 5.5 system - should works more or less in the same way with CentOS 5.3 or 5.4.

Kamailio 3.0.0 was released on January 11, 2010:

Prerequisites

GIT

You need git 1.5.x at least and might not be available on your CentOS installation, if it is too old. In case git is not available on your yum repository, then install Fedora repository for enterprise release.

On CentOS i386, do:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

On CentOS x86_64, do:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm

Then install suing yum:

yum install git

Of course, as alternative, you can install it from sources, download it from:

Then compile and make install.

Dependencies

  • gcc
  • make
  • flex
  • bison
  • mysql-server
  • mysql-client
  • mysql-devel

Download sources

Create the directory on the file system where to store the sources.

  mkdir -p /usr/local/src/kamailio-3.0

  cd /usr/local/src/kamailio-3.0

Download the sources from GIT using the following commands.

  git clone --depth 1 git://git.sip-router.org/sip-router kamailio

  cd kamailio

  git checkout -b kamailio_3.0 origin/kamailio_3.0

Installation

Generate the config for Makefile system and include MySQL connector module for installation:

make include_modules="db_mysql" cfg

If you want other modules which are not enabled by default to be compiled, add them in include_modules, separated by whitespace.

Compile and install:

make all

make install

Installation details

The binaries and executable scripts were installed in:

  /usr/local/sbin

These are:

  • kamailio - Kamailio (OpenSER) server
  • kamdbctl - script to create and manage the Databases
  • kamctl - script to manage and control Kamailio (OpenSER) server
  • sercmd - CLI - command line tool to interface with Kamailio (OpenSER) server

To be able to use the binaries from command line, make sure that '/usr/local/sbin' is set in PATH environment variable. You can check that with 'echo $PATH'. If not and you are using 'bash', open '/root/.bash_profile' and at the end add:

  PATH=$PATH:/usr/local/sbin

  export PATH

Kamailio (OpenSER) modules are installed in:

  /usr/local/lib/kamailio/modules/

  /usr/local/lib/kamailio/modules_k/

The documentation and readme files are installed in:

  /usr/local/share/doc/kamailio/

The man pages are installed in:

  /usr/local/share/man/man5/

  /usr/local/share/man/man8/

The configuration file was installed in:

  /usr/local/etc/kamailio/kamailio.cfg

MySQL database

To create the MySQL database, you have to use the database setup script:

  /usr/local/sbin/kamdbctl create

In order to create the database you need to specify the wanted db type (DBENGINE=MYSQL) in the

  /usr/local/etc/kamailio/kamctlrc

file. Call this script without any parameter to get some help for the usage. You will be asked for the domain name Kamailio (OpenSER) is going to serve (e.g., mysipserver.com) and the password of the 'root' MySQL user. The script will create a database named 'openser' containing the tables required by Kamailio (OpenSER). You can change the default settings in the kamctlrc file mentioned above.

The script will add two users in MySQL:

- openser - having the password 'openserrw', user which has full access rights to 'openser' database

- openserro - having the password 'openserro', user which has read-only access rights to 'openser' database

Do change the passwords for these two users immediately after the database is created.

Configuration file

To fit your requirements for the VoIP platform, you have to edit the configuration file.

  /usr/local/etc/kamailio/kamailio.cfg

Follow the instruction in the comments to enable usage of MySQL. Basically you have to add several lines at the top of config file, like:

#!define WITH_MYSQL

#!define WITH_AUTH

#!define WITH_USRLOCDB

 

init.d script

The init.d script can be used to start/stop the Kamailio (OpenSER) server in a nicer way. A sample of init.d script for Kamailio (OpenSER) is provided at:

copy the init scripts :

#cp /usr/local/src/kamailio-3.1.2/pkg/kamailio/rpm/kamailio.init /etc/init.d/kamailio
#chmod 755 /etc/init.d/kamailio
#cp /usr/local/src/kamailio-3.1.2/pkg/kamailio/rpm/kamailio.default /etc/default/kamailio

#vi /etc/default/kamailio and set RUN_KAMAILIO=yes

#vi /etc/init.d/kamailio and update :
KAM=/usr/local/sbin/kamailio

/usr/local/etc/kamailio/kamailio.cfg edit this file to fit your requirements.

 

 

 

 

SIREMIS: Open Source Web Management Interface for SIP Routing Engines:

 

SIREMIS: Open Source Web Management Interface for SIP Routing Engines:

  • Kamailio (OpenSER)
  • SIP-Router.org

Download

Latest version of SIREMIS 2.x is available at:

Untar the archive on the local file system (e.g., in your web server root folder):

  • cd /var/www
  • tar xvfz siremis-x.y.z.tgz

Web Server Setup

If you want to setup an alias for Apache 2.x, you can run 'make apache-conf' and you get the config snippet printed:

siremis-2.0# make apache-conf

# siremis apache conf snippet ...

 

        Alias /siremis "/var/www/siremis-2.0/siremis"

        <Directory "/var/www/siremis-2.0/siremis">

               Options Indexes FollowSymLinks MultiViews

               AllowOverride All

               Order allow,deny

               Allow from all

               <FilesMatch "\.xml$">

                       Order deny,allow

                       Deny from all

               </FilesMatch>

               <FilesMatch "\.inc$">

                       Order deny,allow

                       Deny from all

               </FilesMatch>

        </Directory>

You can copy&paste it to Apache conf file (e.g., for Apache2 on Debian/Ubuntu: /etc/apache2/sites-available/default).

This will make SIREMIS available under http://yourwebserver.com/siremis/. If you want to use a different alias, edit Makefile and change the value of URLBASE

Local Configuration

Next step is to create .htaccess and Siremis configuration files, you have to run 'make prepare':

siremis-2.0# make prepare

updating htaccess file...

updating app.inc file...

done

Make sure that following directories have write access for web server user:

  • siremis/log
  • siremis/session
  • siremis/files
  • siremis/themes/default/template/cpl

Do not forget to restart the web server after doing the changes in its configuration file.

Database Configuration

Database server to be used is MySQL.

You have to create a MySQL user that has access to Siremis database, for example:

GRANT ALL PRIVILEGES ON siremis.* TO siremis@localhost IDENTIFIED BY 'siremisrw';

This user will be needed later during the installation, of course, you can use an existing MySQL user that has enough privileges.

Also, you have to create Kamailio database with kamdbctl tool, if you don't have it already:

kamdbctl create

You don't need to do anything else to setup the database of Siremis 2.0, the rest of the process is down via web installation wizard.

Web Installation Wizard

Once you have done the steps above, access the web page:

Step 1

First step shows the status of required items. You have to update local configuration until all the items are checked ok.

 

Step 2

In the second step you have to introduce the details to access Kamailio and Siremis database.

When you install Siremis first time, you probably have to check:

  • Create Siremis Database - this create database 'siremis'
  • Import Default Data - this imports initial data into database 'siremis'
  • Update SIP Database - this updates the structure of Kamailio database for accounting and charts modules
  • Replace DB Config - this updates Siremis configuration file with the details to access databases

Step 3

This page presents a status report of installation, showing whether the required directories have writable access and summary of database access details.

Step 4

This is the end of installation, presenting the username and password to login to Siremis. This page is automatically redirected to login page after a short period of time.

Login Page

The login page has a protection for blocking login bots, asking to enter a code printed in an image.

After first login, do not forget to update the password for user admin.

 

Post Installation

  • remove the install directory: siremis/install

If you want to run again installation wizard:

  • restore directory: siremis/install
  • remove file: siremis/install.lock

 

 

 

Tuesday, November 29, 2011

Set New Password for MYSQL

SET PASSWORD FOR root@localhost=PASSWORD('YOUR-PASSWORD');

QUIT;

Thursday, November 17, 2011

Make Custom Ring in Asterisk

Locate chan_dahdi.conf

Searh for :

You can define your own custom ring cadences here. You can define up to 8
; pairs. If the silence is negative, it indicates where the caller ID spill is
; to be placed. Also, if you define any custom cadences, the default cadences
; will be turned off.
;
; This setting is global, rather than per-channel. It will not update on
; a reload.
;
; Syntax is: cadence=ring,silence[,ring,silence[...]]



; These are the default cadences:
;cadence=silence
cadence=125,125,2000,-4000
cadence=250,250,500,1000,250,250,500,-4000
cadence=125,125,125,125,125,-4000
cadence=1000,500,2500,-5000 (r5 for this cadence)(Change/Modify)


extensions.conf

exten => 109,1,Dial(DAHDI/07r5,20,tT)

 

Save and Exit..

 

DONE!!

Taking MySQL Backup [with mysqldump utility]

mysqldump -u cron -p -h IP astguiclient > FullBackup.sql


[-h :- for host. This is optional if you are creating backup of localhost]


To Restore from the created dump(*.sql) file:-

mysql -u cron -p astguiclient < FullBackup.sql

Tuesday, November 15, 2011

Showing running queries in MySQL

The syntax is simply:
show processlist;

The "info" column shows the query being executedm or NULL if there's nothing currently happening. When running "show processlist" it will only show the first 100 characters of the query. To show the full query run "show full processlist" instead.
Running the above command from the MySQL command line interface with a ; delimiter can make it difficult to read the output, especially if the queries are long and span multiple lines. Using the \G delimiter instead will show the data in what is often a more readable format, although it consumes more rows in your terminal. This is espcially useful when running "show full processlist" because some of the queries displayed may be quite long.
mysql> show processlist\G
 
*************************** 1. row ***************************
     Id: 454543
   User: root
   Host: localhost
     db: NULL
Command: Query
   Time: 0
  State: NULL
   Info: show processlist
*************************** 2. row ***************************
     Id: 454547
   User: test
   Host: localhost
     db: test
Command: Query
   Time: 3
  State: sending the query
   Info: select * from calls
2 rows in set (0.00 sec)



If you want to KILL the Thread ID

KILL [CONNECTION | QUERY] thread_id

KILL QUERY terminates the statement that the connection is currently executing, but leaves the connection itself intact.

Example:

Mysql> KILL 454547;

Monday, November 14, 2011

Google's latest Easter egg

STEPS:

 

First-> Go to Google

Second-> Type “Do a Barrel Roll

Third-> Wait & Watch ..

 

Google's "Do a Barrel Roll" OR “Z or R twice” search trick went viral on Thursday after bored users tweeted about the cool trick to their friends. The barrel roll trick isn't the only Easter egg Google's hidden in its site.

 

Here are seven other Google tricks.

 

Be warned that they only work if your turn off the "instant search" feature.

 

Gravity. Type in "Google gravity" in the search bar, hit the "I'm feeling lucky" button and watch your screen succumb to gravity.

 

Askew.  Simply type in the word "askew" in the search bar.

 

Epic. Make Google's font size bigger. Type Epic Google in the search bar and look at the epic-ness.

 

Weenie. Epic Google's smaller cousin. Type Weenie Google and feel sorry for the little guy.

 

Flight Simulator. Google incorporated this popular Easter egg as a permanent feature in Google Earth. Click on Tools > Enter Flight Simulator, and you're off and zooming around the world.

 

Dragon. In Google Docs, open any spreadsheet and if you press Shift+F12, a message will pop up announcing "Dragon slain! Congratulations, you've slain the dragon!"

 

 

 

Do a barrel roll: Google's best Easter eggs

It takes care of more than 1billion searches worldwide every day but Google still finds time to make our lives more fun. In a week when its latest hidden Easter egg has been the talk of the internet, Metro takes a look at other examples of Google quirkiness that will give you a smile at your computer screen.


Since its humble beginnings as a college research project 15 years ago, Google has always done its best to show its lighter side.

Guess the Google Doodle of the day is a regular bit of fun. They first appeared in 1998, as an out-of-office message honouring the Burning Man Festival in Nevada, which Google founders Larry Page and Sergey Brin had gone off to attend.

The Google Doodles come thick and fast these days but tech-savvy users get a bigger kick out of the search engine’s more hidden treats.

An ‘Easter egg’ came along recently that turned Google upside down – type ‘do a barrel roll’ into the search bar and the results page will turn through 360 degrees. Pointless? Of course. Flipping good fun for a few seconds in your otherwise dour day stuck in front of a computer? Almost definitely.

The phrase quickly proved it was popular by – what else? – becoming a trend on Twitter, while perceptive gamers of a certain age were quick to point out its origins.

The phrase is an established internet meme from Nintendo video game Star Fox 64, released in 1997, where the character Peppy Hare orders you to ‘do a barrel roll!’ by hitting the Z or R buttons on the joypad twice.

Someone at Google is obviously a fan of the flying game – typing ‘Z or R twice’ also tips Google around in a circle on your screen. The barrel roll is a showcase for the CSS3 (Cascading Style Sheets 3), the latest CSS version used to design web pages.

In the past, Google has done everything from put ninjas in its Reader and spam recipes in its Gmail spam folders in order to enhance users’ experience. ‘Easter eggs are simply little fun surprises to be discovered by our users to make their Google experiences even more fun and put a smile on their face,’ a spokesman said.

Two of Google’s most innovative search projects were carried out by Ricardo Cabello, also known as Mr.doob. Cabello, 29, from Barcelona, is a wizard in HTML5 – the latest language of the web – which Google is keen to experiment with through its Chrome web browser.

Mr.doob is the developer behind Google Gravity – type the phrase into the search engine and watch as everything tumbles to the bottom of the screen. He was also commissioned to produce Google Sphere based on his own idea. It is an image search where Google’s home page becomes a moving ball of picture-based info.

Mr.doob said code used in the Google Sphere project was later used to power indie band Arcade Fire’s multimedia video.

Asked why Google did quirky experiments like this, he replied: ‘I don’t think it’s important. But it’s always good to have a sense of humour.’

If you’re trying a few of these out over your lunch break, best hope your boss has one, too.



 

 

Sunday, November 13, 2011

How to find the RSS feed for any Twitter user


Last month, without warning, Facebook and Twitter killed-off access to RSS feeds. With the launch of the new Twitter interface, you could only access RSS feeds on Twitter if you were logged out of your account. Now, it seems you can't access them at all.

Whether intentional or not, this is not a surprising move on Twitter's part. It has been hard at work ensuring that any interaction with its services adheres to a particular vision. Twitter has been cracking down on third-party apps, or simply buying them out, all in an effort to streamline the Twitter experience, it would seem.

While Facebook quickly reinstated the RSS feeds as quietly as they took them away, Twitter doesn't appear to have followed suit.

Luckily, there is a very easy-to-use workaround that will give you instant access to Twitter RSS feeds, although it may only be a matter of time before Twitter kills that off too.

To access the RSS feed of any user, use the following link:

    http://api.twitter.com/1/statuses/user_timeline.rss?screen_name={USERNAME}

So for example, if you want to access the RSS feed of The Next Web's Twitter account, you would use the following link:

    http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=thenextweb

The process doesn't work in all instances. Google Reader was unable to recognize the RSS feed. On the other hand, it worked flawlessly with the WordPress RSS widget, giving you an easy way to get your latest Tweets onto your WordPress blog.

Have you found another workaround for Twitter's RSS blockade? Let us know in the comments.

Sunday, November 6, 2011

How to Hide, Disable or Remove Blogger Blogspot NavBar?

Please note that according to the term and condition of blogger.com, you're not allowed to remove or disable the navbar from your blogspot template unless you host your blog under your own server. This tutorial is meant for those that host their blog outside of blogger.com, but the code does work for blogs hosted with blogger.com. Backup your blogspot post.
Step 01
This tutorial is on how to hide,disable or remove the blogger navbar (also known as the navigation bar) from your blog. First go to 'Layout' –> 'Edit html'.
Step 02
Copy and paste the code provided below (as shown in the image below) and insert it into the template, the code can be inserted anywhere in the template.
#navbar-iframe{height:0px}
OR
#navbar {
height: 0px;
visibility: hidden;
display: none;
}

Enjoy!!!

Saturday, November 5, 2011

Asterisk AGI php example source code

Example for Asterisk IVR

 

 

;*****************************START context1***********************************

 

[context1]

;exten => 1234,1,Answer()

exten => 1234,1,Playback(/var/lib/asterisk/sounds/custom/folder-name/filename)

exten => 1234,n,Set(i=1)

exten => 1234,n,Set(x=1)

exten => 1234,n,Set(y=1)

exten => 1234,n,Set(z=1)

exten => 1234,n,GoTo(context2,1234,1)

 

 

;*****************************END context1***********************************

 

 

;****************START context2 (For authenticate the data provided by user)**********************

[context2]

exten => 1234,1(start),GoToIf($[${i}<3]?minloop:sorry,000,sorry)

exten => 1234,n(minloop),Read(userinput,/var/lib/asterisk/sounds/custom/folder-name/B,4)

exten => 1234,n,Set(value-captured=${userinput})

exten => 1234,n,GoToIf($[${ISNULL(${value-captured})}=1]?novaluecontext2,111,1)

exten => 1234,n,Set(UNIQUE=${UNIQUEID})

exten => 1234,n,Gosub(subthankucontext2,222,confirmation)

exten => 1234,n,GoToif($[${entered}=1]?goodcontext2,444,1)

exten => 1234,n,GoToif($[${entered}!=1]?wrongvaluecontext2,111,1)

exten => 1234,n,GoToIf($[${ISNULL(${entered})}=1]?novaluecontext2,111,1)

exten => 1234,n,Set(i=$[${i}+1])

exten => 1234,n,Goto(end-message,333,end)

exten => 1234,n,hangup()

 

 

[novaluecontext2]

exten => 111,1,Set(i=$[${i}+1])

exten => 111,n,Playback(/var/lib/asterisk/sounds/custom/folder-name/filename)

exten => 111,n,Goto(context2,1234,start)

 

 

[subthankucontext2]

exten => 222,1(confirmation),Playback(/var/lib/asterisk/sounds/custom/folder-name/filename)

exten => 222,n,SayDigits(${userinput})

exten => 222,n,Read(entered,/var/lib/asterisk/sounds/custom/folder-name/C2,1)

exten => 222,n,Return()

 

 

[goodcontext2]

exten => 444,1,Set(i=$[${i}+1])

exten => 444,n,AGI(data-verify.php,${value-captured},${UNIQUE})   //working with PHP-AGI below is the example of data-verify.php (will return the value in booleon)

exten => 444,n,Set(correct-data=${data-exists})

exten => 444,n,GoToif($[${correct-data}=0]?context2,1234,start)

exten => 444,n,Goto(next-context,1234,start)

 

[wrongvaluecontext2]

exten => 111,1,Set(i=$[${i}+1])

exten => 111,n,GoToif($[${entered}=2]?context2,1234,start)

exten => 111,n,GoToif($[${entered}!=2]?badvaluecontext2,666,1)

 

 

[badvaluecontext2]

exten => 666,1,Playback(/var/lib/asterisk/sounds/custom/folder-name/filename)

exten => 666,n,Goto(context2,1234,1)

 

 

;***************************END context2***********************************

 

 

;**************************STARTCOMMON******************************************

[sorry]

exten => 000,1(sorry),Playback(/var/lib/asterisk/sounds/custom/folder-name/filename)

exten => 000,n,Goto(end-message,333,1)

 

[end-message]

exten => 333,1(end),Playback(/var/lib/asterisk/sounds/custom/folder-name/filename)

exten => 333,n,hangup()

 

 

;**************************END COMMON******************************************

 

 

The info passed by Asterisk is:

  • agi_request - The filename of your script
  • agi_channel - The originating channel (your phone)
  • agi_language - The language code (e.g. "en")
  • agi_type - The originating channel type (e.g. "SIP" or "ZAP")
  • agi_uniqueid - A unique ID for the call
  • agi_callerid - The caller ID number (or "unknown")
  • agi_calleridname - The caller ID number (or "unknown")
  • agi_callingpres - The presentation for the callerid in a ZAP channel
  • (only for PRI Channels)
  • agi_dnid - The dialed number id
  • agi_rdnis - The referring DNIS number
  • agi_context - Origin context in extensions.conf
  • agi_extension - The called number
  • agi_priority - The priority it was executed as in the dial plan
  • agi_enhanced - The flag value is 1.0 if started as an EAGI script
  • agi_accountcode - Account code of the origin channel

 

 

example of Data-verify.php (File Permissions

Remember to make your files executable with chmod 755 /var/lib/asterisk/agi-bin/*.php .)

_________________

 

#!/usr/bin/php -q

<?php

require 'phpagi.php';

error_reporting(E_ALL);

$agi = new AGI();

ob_implicit_flush(true);

set_time_limit(6);

 

function connect_db() {

$db_connection = mysql_connect ('localhost', 'user', 'password') or die (mysql_error());

$db_select = mysql_select_db('database-name') or die (mysql_error());

}

 

// main program

$value-captured = $argv[1];

connect_db();

$result = mysql_query("SELECT  *  FROM  tablename WHERE value='$value-captured ");

$num_rows = mysql_num_rows($result);

$value_exists = $num_rows > 0 ? 1 : 0;

$agi->set_variable("valueexists", $value_exists);

 

exit;

?>

Friday, November 4, 2011

Active calls on an Asterisk

Command:
watch -n 1 "sudo asterisk -vvvvvrx 'core show channels' | grep call"

Watch active calls on an Asterisk PBX

Show active calls as the happen on an Asterisk server. Note that the Asterisk command (in single quotes) is formatted for Asterisk 1.6. Use the -n flag on the watch command to modify the refresh period (in seconds - default is 2 seconds).

Grant Permission to the particular USER on particular TABLES

Mysql> use mysql;


create user 'username'@'%' identified by 'any_password';
grant select on reports to 'username'@'%' identified by 'any_password';
grant all on school to 'username'@'%' identified by 'any_password';

flush privileges;

Resetting MySQL root Password [In case You forgot password]

[root ~]# mysqld_safe --skip-grant-tables
Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysqld/mysqld.pid
110416 12:11:00 mysqld ended

[root ~]# mysql


mysql>update user set Password=PASSWORD('new-password') where user='root';
mysql>flush privileges;
mysql>exit;

Error too many connection in mysql

Default connection for mysql for client is maximum 100.

When connection exceed from 100, it will not accept another connection. In this case mysql throw error of too many connections. And to increase the limit of connections.

You need to do setting for attribute max_connections  increase the connection limit.
Linux:

/etc/my.cnf

max_connections=250

or whatever you want the limit

 

ViciDial Basic Queries

1)      Calls Recording location and how agents can extract recordings.

 

Calls recordins are stored at /var/spool/asterisk/monitorDONE/,

 

 

2)      Procedure of uploading leads and format.

 

You can uploaded leads from admin panel -> Lists -> Load New Leads
You have to select list id which you want to use for leads and also set
country code in Phone Code Override,
So it will load that country code for all leads,

 

3)      Agent webinterface outbound calls dialplan management.

 

You can set dialplans from vicidial admin -> Admin -> Carriers ->
your provider name.
Here you have to set dialplans to use your trunk which you have set in this
provider.

 

 

4)      Barging and Whispering of calls.

 

You can do barging and whispering from the realtime screen of the
admin portal for the campaign.

 

 

5)      How an agent can transfer the call to another agent.

 

When you get live call on agent screen after that by just input
agent's ext. no. and then dial with customer, it will transfer the live call
to agent which you have entered for transfer.

 

 

6)      Proceedure of restarting the dialer and other services.

 

 

All services are set already in startup so, normally it will work
while restarting server without any issue,
But if you want to do manuall restart then you can stop asterisk and then
server will automatically stop other services
and then you can go for reboot.

 

How To install ViciDial/astGUIclient 2.2.1 With Asterisk 1.4.21.2 On CentOS

You must login as root to install the following software.

Make sure you update the system first, then reboot if you installed an updated kernel.

#yum -y update
#reboot


* Install the following software *

#yum install gcc gcc-c++ php php-devel php-gd gd-devel php-mbstring php-mcrypt php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel httpd libpcap libpcap-devel ncurses ncurses-devel screen sox mysql-server mysql-devel ntp kernel-devel mutt



* Setup MySQL *


* Setup default MySQL tables, start MySQL and configure root password
Replace "mypassword" with your real password. *

#mysql_install_db
# /etc/init.d/mysqld start
#/usr/bin/mysqladmin -u root password 'mypassword'



Update the time zone Configure the system time and update it. (I set the server time zone to Arizona, so this is how I did it)

# rm /etc/localtime
#ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
#rdate -s time-a.nist.gov

Changes take effect immediately after you run the rdate command.

Turn off ntpd and remove it from bootup runlevels. You will be running ntpdate from cron instead.

#service ntpd stop
#chkconfig ntpd off



* Setup CPAN and install some modules ,Run the following command *

#perl -MCPAN -e shell



You will then go through CPAN setup, just hit ENTER for most prompts except
for the mirrors list, you will want to select at least 4 mirrors

* yes for manual configuration
* enter for the next 18 prompts
* for the "make install" option, it's a good idea to add UNINST=1
* enter for the next 4 prompts
* select your continent and country
* select a few cpan mirrors
* enter for the next 2 prompts

Once you see the cpan> prompt you can begin installing modules.
This may take a while.

cpan>install MD5
cpan>install Digest::MD5
cpan>install Digest::SHA1
cpan>install readline
cpan>install Bundle::CPAN
cpan>reload cpan
cpan>install DBI
cpan>force install DBD::mysql
cpan>install Net::Telnet
cpan>install Time::HiRes
cpan>install Net::Server
cpan>install Switch
cpan>install Mail::Sendmail
cpan>install Unicode::Map
cpan>install Jcode
cpan>install Spreadsheet::WriteExcel
cpan>install OLE::Storage_Lite
cpan>install Proc::ProcessTable
cpan>install IO::Scalar
cpan>install Spreadsheet::ParseExcel
cpan>install Curses
cpan>install Getopt::Long
cpan>install Net::domain
cpan>install Term::ReadKey
cpan>install Term::ANSIColor
cpan>quit

In the end, I usually run all these commands once again to make sure its all installed.

Installing the Asterisk-Perl module

NOTE: Do NOT use the 0.09 or any newer version, they do not work with ViciDial.

#cd /usr/src
#wget http://asterisk.gnuinter.net/files/asterisk-perl-0.08.tar.gz[/url]
#tar -zxf asterisk-perl-0.08.tar.gz
#cd asterisk-perl-0.08
#perl Makefile.PL
#make all
#make install

Installing additional software from source (optional, but highly recommended)
Next, you will download, compile and install the following software.

* lame
* ttyload
* iftop
* mtop
* mytop
* sipsak
* ploticus

* LAME: *
LAME is an MP3 encoder used to convert audio files from WAV to MP3. Some prefer GSM usually, but others have standardized on MP3 so you would need this utility to be loaded to use that option.

#cd /usr/src
#wget http://downloads.sourceforge.net/project/lame/lame/3.98.2/lame-398-2.tar.gz
#tar -zxf lame-398-2.tar.gz
#cd lame-398-2
#./configure
#make
#make install


* TTYLOAD: *
ttyload is a simple terminal application that shows the processor load in a graphical time-based scrolling graph. I use it to view how loaded the system is and it visualizes load spikes very well.

#cd /usr/src
#wget http://www.daveltd.com/src/util/ttyload/ttyload-0.5.tar.gz
#tar -zxf ttyload-0.5.tar.gz
#cd ttyload-0.5
#make
#ln -s /usr/src/ttyload-0.5/ttyload /usr/bin/ttyload


* IFTOP: *
iftop is a good console bandwidth visualization tool that shows you active connections, where they are going to/from and how much of your precious bandwidth they are using.

#cd /usr/src
#wget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz
#tar -zxf iftop-0.17.tar.gz
#cd iftop-0.17
#./configure
#make
#make install


* MTOP: *
mtop is a great utility for real-time monitoring of mysql and the queries that are running in it.
Note: the root mysql password must be blank before installing this

#cd /usr/src
#wget http://downloads.sourceforge.net/project/mtop/mtop/v0.6.6/mtop-0.6.6.tar.gz
#tar -zxf mtop-0.6.6.tar.gz
#cd mtop-0.6.6
#perl Makefile.PL
#make
#make install

* MYTOP: *
mytop is is an optional utility for monitoring the threads and overall performance of mysql
Note: the root mysql password must be blank before installing this


cd /usr/src
wget http://jeremy.zawodny.com/mysql/mytop/mytop-1.6.tar.gz
tar -zxf mytop-1.6.tar.gz
cd mytop-1.6
perl Makefile.PL
make
make test
make install

* SIPSAK: *
sipsak is an optional utility that VICIDIAL can use to send messages to an agent's SIP-based phone(like the Snom 320) to display text on their LCD screen.

#cd /usr/src
#wget http://download.berlios.de/sipsak/sipsak-0.9.6-1.tar.gz
#tar -zxf sipsak-0.9.6-1.tar.gz
#cd sipsak-0.9.6
#./configure
#make
#make install
#/usr/local/bin/sipsak --version


* PLOTICUS: *
ploticus is a free graph creation package that allows you to create line graphs within PNG files simply by creating a config file and a data file. ViciDial uses this package to generate server performance graphs that can be displayed real-time within the ViciDial reports page.

#cd /usr/src
#wget http://downloads.sourceforge.net/project/ploticus/ploticus/2.41/pl241src.tar.gz
#tar -zxf pl241src.tar.gz
#cd pl241src/src/
#make clean
#make
#make install
#mkdir -p /var/www/html/vicidial/ploticus/
#cp pl /var/www/html/vicidial/ploticus/



* Installing eAccelerator for PHP ,Install the php module *

#cd /usr/src
#wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.zip
#unzip eaccelerator-0.9.5.3.zip
#cd eaccelerator-0.9.5.3
#export PHP_PREFIX="/usr"
#$PHP_PREFIX/bin/phpize
#./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
#make
#make install


* Configure php.ini *

# vim /etc/php.ini

* You will want to make sure NOTICE logging is turned off: *

error_reporting = E_ALL & ~E_NOTICE ( Line no.360 )
memory_limit = 48M ( Line no.314 )
short_open_tag = On ( Line no.141 )
max_execution_time = 330 ( Line no.312 )
max_input_time = 360 ( Line no.313 )
post_max_size = 48M ( Line no.477 )
upload_max_filesize = 42M ( Line no.582 )
default_socket_timeout = 360 ( Line no.599 )


* Add the following lines to the dynamic extensions section of php.ini: *

* Note: For CentOS 32-bit, use this below: zend_extension="/usr/lib/php/modules/eaccelerator.so" *

zend_extension="/usr/lib64/php/modules/eaccelerator.so"
;For CentOS 32-bit: zend_extension="/usr/lib/php/modules/eaccelerator.so"
eaccelerator.shm_size="48"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"


#mkdir /tmp/eaccelerator
#chmod 0777 /tmp/eaccelerator
#php -v

* You should see something like this: *

PHP 5.1.6 (cli) (built: Jan 13 2010 17:09:42)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator



* Editing the Apache config file *

vim /etc/httpd/conf/httpd.conf


* To disable logging, change: *


CustomLog logs/access_log common

to this:

CustomLog /dev/null common


* To enable web browsing of Recordings on Asterisk server, add this: *


Alias /RECORDINGS/ "/var/spool/asterisk/monitorDONE/"


Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all

Forcetype application/forcedownload



* Restart the Apache web server to apply the changes *

#/etc/init.d/httpd restart

* Installing Asterisk *

At the time of this writing, you cannot install the latest version of Asterisk 1.6 or 1.8.
ViciDial 2.2.1 is currently compatible with Asterisk 1.4.21.2. This version of Asterisk also needs to be patched to work with vicidial correctly.

#mkdir /usr/src/asterisk
#cd /usr/src/asterisk
#wget http://download.vicidial.com/required-apps/asterisk-1.4.27.1-vici.tar.gz
#wget http://downloads.digium.com/pub/zaptel/zaptel-1.4.12.1.tar.gz
#wget http://downloads.asterisk.org/pub/telephony/libpri/releases/libpri-1.4.10.1.tar.gz
#tar xzf asterisk-1.4.27.1-vici.tar.gz
# tar xzf zaptel-1.4.12.1.tar.gz
#tar xzf libpri-1.4.10.1.tar.gz
#cd libpri-1.4.10.1
#make clean
#make
#make install
#cd ../zaptel-1.4.12.1
#./configure
#make menuconfig
#make
#make install
#make config
#cd ../
#mv asterisk-1.4.27.1-vici asterisk-1.4.27.1
#cd asterisk-1.4.27.1
# ./configure
#make menuselect
#make
#make install
#make samples
#asterisk -vvgc
> core show version
> dahdi show status
> core show application meetme
> stop now


* Installing Sound files , Download the sound files *

#cd /usr/src
#wget http://downloads.digium.com/pub/telephony/sounds/asterisk-core-sounds-en-ulaw-current.tar.gz
#wget http://downloads.digium.com/pub/telephony/sounds/asterisk-core-sounds-en-wav-current.tar.gz
#wget http://downloads.digium.com/pub/telephony/sounds/asterisk-core-sounds-en-gsm-current.tar.gz
#wget http://downloads.digium.com/pub/telephony/sounds/asterisk-extra-sounds-en-ulaw-current.tar.gz
#wget http://downloads.digium.com/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz
#wget http://downloads.digium.com/pub/telephony/sounds/asterisk-extra-sounds-en-gsm-current.tar.gz
#wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-moh-opsound-gsm-current.tar.gz
#wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-moh-opsound-ulaw-current.tar.gz
#wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-moh-opsound-wav-current.tar.gz

* Set the sounds in place *

#cd /var/lib/asterisk/sounds
#tar -zxf /usr/src/asterisk-core-sounds-en-gsm-current.tar.gz
#tar -zxf /usr/src/asterisk-core-sounds-en-ulaw-current.tar.gz
#tar -zxf /usr/src/asterisk-core-sounds-en-wav-current.tar.gz
#tar -zxf /usr/src/asterisk-extra-sounds-en-gsm-current.tar.gz
#tar -zxf /usr/src/asterisk-extra-sounds-en-ulaw-current.tar.gz
#tar -zxf /usr/src/asterisk-extra-sounds-en-wav-current.tar.gz

#mkdir /var/lib/asterisk/mohmp3
#mkdir /var/lib/asterisk/quiet-mp3
#mkdir /var/lib/asterisk/default
#cd /var/lib/asterisk
#ln -s mohmp3 default
#ln -s moh mohmp3
#cd mohmp3
#tar -zxf /usr/src/asterisk-moh-opsound-gsm-current.tar.gz
#tar -zxf /usr/src/asterisk-moh-opsound-ulaw-current.tar.gz
#tar -zxf /usr/src/asterisk-moh-opsound-wav-current.tar.gz
#rm CHANGES*
#rm LICENSE*
#rm CREDITS*
#cd /var/lib/asterisk/moh
#rm CHANGES*
#rm LICENSE*
#rm CREDITS*
#cd /var/lib/asterisk/sounds
#rm CHANGES*
#rm LICENSE*
#rm CREDITS*
#cd /var/lib/asterisk/quiet-mp3


#sox ../mohmp3/macroform-cold_day.wav macroform-cold_day.wav vol 0.25
#sox ../mohmp3/macroform-cold_day.gsm macroform-cold_day.gsm vol 0.25
#sox -t ul -r 8000 -c 1 ../mohmp3/macroform-cold_day.ulaw -t ul macroform-cold_day.ulaw vol 0.25
#sox ../mohmp3/macroform-robot_dity.wav macroform-robot_dity.wav vol 0.25
#sox ../mohmp3/macroform-robot_dity.gsm macroform-robot_dity.gsm vol 0.25
#sox -t ul -r 8000 -c 1 ../mohmp3/macroform-robot_dity.ulaw -t ul macroform-robot_dity.ulaw vol 0.25
#sox ../mohmp3/macroform-the_simplicity.wav macroform-the_simplicity.wav vol 0.25
#sox ../mohmp3/macroform-the_simplicity.gsm macroform-the_simplicity.gsm vol 0.25
#sox -t ul -r 8000 -c 1 ../mohmp3/macroform-the_simplicity.ulaw -t ul macroform-the_simplicity.ulaw vol 0.25
#sox ../mohmp3/reno_project-system.wav reno_project-system.wav vol 0.25
#sox ../mohmp3/reno_project-system.gsm reno_project-system.gsm vol 0.25
#sox -t ul -r 8000 -c 1 ../mohmp3/reno_project-system.ulaw -t ul reno_project-system.ulaw vol 0.25
#sox ../mohmp3/manolo_camp-morning_coffee.wav manolo_camp-morning_coffee.wav vol 0.25
#sox ../mohmp3/manolo_camp-morning_coffee.gsm manolo_camp-morning_coffee.gsm vol 0.25
#sox -t ul -r 8000 -c 1 ../mohmp3/manolo_camp-morning_coffee.ulaw -t ul manolo_camp- morning_coffee.ulaw vol 0.25

* Installing Astguiclient 2.2.1. *

Note: the installer will ask where your web root is located. I use /var/www/html as my web root. This is where the installer will put your web-facing files.

#mkdir /usr/src/astguiclient
#cd /usr/src/astguiclient
#wget http://downloads.sourceforge.net/project/astguiclient/astguiclient_2.2.1.zip
#unzip astguiclient_2.2.1.zip
#perl install.pl

* check *
server webroot path or press enter for default: /var/www/html


* Download and copy a gsm file *

#cd /var/lib/asterisk/sounds
#wget http://astguiclient.sf.net/conf.gsm
#cp conf.gsm park.gsm

* Create the database and import the sample data First, login to mysql to run some commands *

#mysql


* Enter these MySQL commands: *

mysql >CREATE DATABASE `asterisk` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
mysql >GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@'%' IDENTIFIED BY '1234';
mysql >GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@localhost IDENTIFIED BY '1234';
mysql >GRANT RELOAD ON *.* TO cron@'%';
mysql >GRANT RELOAD ON *.* TO cron@localhost;

mysql >flush privileges;
mysql >SET GLOBAL connect_timeout=60;

mysql >use asterisk;

mysql >\. /usr/src/astguiclient/extras/MySQL_AST_CREATE_tables.sql
mysql >\. /usr/src/astguiclient/extras/sip-iax_phones.sql
mysql >\. /usr/src/astguiclient/extras/first_server_install.sql
mysql >quit

* In the Linux terminal, enter these commands *

#/usr/share/astguiclient/ADMIN_area_code_populate.pl
#cp /usr/src/astguiclient/extras/performance_test_leads.txt /usr/share/astguiclient/LEADS_IN/
#/usr/share/astguiclient/VICIDIAL_IN_new_leads_file.pl --forcelistid=107 --forcephonecode=1



* Make several entries in the rc.local of your system: *

#vim /etc/rc.d/rc.local

### sybsys local login
touch /var/lock/subsys/local

# OPTIONAL enable ip_relay(for same-machine trunking and blind monitoring)
# /usr/share/astguiclient/ip_relay/relay_control start 2>/dev/null 1>&2

# Disable console blanking and powersaving
/usr/bin/setterm -blank
/usr/bin/setterm -powersave off
/usr/bin/setterm -powerdown

### start up the MySQL server
/etc/init.d/mysqld start

### start up the apache web server
/etc/init.d/httpd start

### roll the Asterisk logs upon reboot
/usr/share/astguiclient/ADMIN_restart_roll_logs.pl

### clear the server-related records from the database
/usr/share/astguiclient/AST_reset_mysql_vars.pl

### load zaptel drivers
modprobe zaptel
modprobe ztdummy
/sbin/ztcfg -vvvvvvvvvvvv

### sleep for 20 seconds before launching Asterisk
sleep 20

### start up asterisk
/usr/share/astguiclient/start_asterisk_boot.pl



* Make several entries in the crontab of your system: *

#crontab -e

### recording mixing/compressing/ftping scripts
0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51, 54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_1_move_mix.pl
#0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51 ,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_1_move_mix.pl --MIX
#0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51 ,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_1_move_VDonly.pl
1,4,7,10,13,16,19,22,25,28,31,34,37,40,43,46,49,52 ,55,58 * * * * /usr/share/astguiclient/AST_CRON_audio_2_compress.pl --GSM
#2,5,8,11,14,17,20,23,26,29,32,35,38,41,44,47,50,5 3,56,59 * * * * /usr/share/astguiclient/AST_CRON_audio_3_ftp.pl --GSM

### keepalive script for astguiclient processes
* * * * * /usr/share/astguiclient/ADMIN_keepalive_ALL.pl

### kill Hangup script for Asterisk updaters
* * * * * /usr/share/astguiclient/AST_manager_kill_hung_congested.pl

### updater for voicemail
* * * * * /usr/share/astguiclient/AST_vm_update.pl

### updater for conference validator
* * * * * /usr/share/astguiclient/AST_conf_update.pl

### flush queue DB table every hour for entries older than 1 hour
11 * * * * /usr/share/astguiclient/AST_flush_DBqueue.pl -q

### fix the vicidial_agent_log once every hour and the full day run at night
33 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl
50 0 * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --last-24hours
## uncomment below if using QueueMetrics
#*/5 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --only-qm-live-call-check

## uncomment below if using Vtiger
#1 1 * * * /usr/share/astguiclient/Vtiger_optimize_all_tables.pl --quiet

### updater for VICIDIAL hopper
* * * * * /usr/share/astguiclient/AST_VDhopper.pl -q

### adjust the GMT offset for the leads in the vicidial_list table
1 1,7 * * * /usr/share/astguiclient/ADMIN_adjust_GMTnow_on_leads.pl --debug

### reset several temporary-info tables in the database
2 1 * * * /usr/share/astguiclient/AST_reset_mysql_vars.pl

### optimize the database tables within the asterisk database
3 1 * * * /usr/share/astguiclient/AST_DB_optimize.pl

## adjust time on the server with ntp
30 * * * * /usr/sbin/ntpdate -u pool.ntp.org 2>/dev/null 1>&2

### VICIDIAL agent time log weekly and daily summary report generation
2 0 * * 0 /usr/share/astguiclient/AST_agent_week.pl
22 0 * * * /usr/share/astguiclient/AST_agent_day.pl

### VICIDIAL campaign export scripts (OPTIONAL)
#32 0 * * * /usr/share/astguiclient/AST_VDsales_export.pl
#42 0 * * * /usr/share/astguiclient/AST_sourceID_summary_export.pl

### remove old recordings more than 7 days old
#24 0 * * * /usr/bin/find /var/spool/asterisk/monitorDONE -maxdepth 2 -type f -mtime +7 -print | xargs rm -f

### roll logs monthly on high-volume dialing systems
#30 1 1 * * /usr/share/astguiclient/ADMIN_archive_log_tables.pl

### remove old vicidial logs and asterisk logs more than 2 days old
28 0 * * * /usr/bin/find /var/log/astguiclient -maxdepth 1 -type f -mtime +2 -print | xargs rm -f
29 0 * * * /usr/bin/find /var/log/asterisk -maxdepth 3 -type f -mtime +2 -print | xargs rm -f
30 0 * * * /usr/bin/find / -maxdepth 1 -name "screenlog.0*" -mtime +4 -print | xargs rm -f


* Run this perl script to update the server_ip fields in the asterisk tables (copy the command as-is) *

#/usr/share/astguiclient/ADMIN_update_server_ip.pl --old-server_ip=10.10.10.15

* Update music on hold configuration *

#vim /etc/asterisk/musiconhold.conf

;
; Music on Hold -- Sample Configuration
;

[default]
mode=files
directory=/var/lib/asterisk/mohmp3

[quiet]
mode=files
directory=/var/lib/asterisk/quiet-mp3

#include musiconhold-vicidial.conf



#reboot

#chmod 777 /var/www/html
#chmod 777 /var/www/html/agc
#chmod 777 /var/www/html/vicidial
Diagnostics

After reboot, check your logs for any errors, make sure asterisk is up and running. Be proactive and look for problems before you start configuring vicidial.

* Run these commands to view log files: *

* tail -f -n 50 /var/log/asterisk/messages
* tail -f -n 50 /var/log/messages
* more /var/log/dmesg
* tail -f -n 40 /etc/httpd/logs/error_log
* tail -f -n 40 /var/log/maillog
* tail -f -n 40 /var/log/cron

Run this command:

#screen -ls

The output should look similar to this:

There are screens on:
4090.asterisk (Detached)
4077.ASTfastlog (Detached)
8325.ASTsend (Detached)
8322.ASTupdate (Detached)
4004.astshell20110228193500 (Detached)
8334.ASTVDremote (Detached)
8328.ASTlisten (Detached)
12192.ASTVDadapt (Detached)
8331.ASTVDauto (Detached)
9 Sockets in /var/run/screen/S-root.



Start using vicidial

Login to vicidial and configure it.

Add users, campaigns, in-group, DID's, server, etc....

Go to: http://youripaddress/vicidial/admin.php

The default username is: 6666 and the password is: 1234


How-To-install-ViciDial-astGUIclient-2.2.1-With-Asterisk-1.4.21.2-On-CentOS-5.5
http://ray-solomon.com/vicidial.html