Build Low-cost Call Center using Elastix and Asterisk (Part 2)

This post is continuation of the previous post:

Now we should have our PBX ready to receive call. But we are not yet configure on how to manage calls and agents. We should have a system to monitor agent’s activities. We can achieve this by using Call Center module inside Elastix. Install it by go to Elastix > Addons > Call Center > Install. Wait for a while until the process finish.

Configure Call Center

1. Create agent. Agent is the person who will need to login into the call center system and answer the call in queue. Go to Elastix > Call Center > Agent Options > Show Filter > New Agent. Enter agent’s details, example as below:

Agent Number: 501
Agent Name: Mark Derp
Password: 123456
Retype Password: 123456

Click Save and add another agent details:

Agent Number: 502
Agent Name: Karim Benz
Password: 121212
Retype Password: 121212

2. Create Group. We need to allow agents to login into our Elastix system to view the agent’s console. This console will tell the agent which incoming queue coming from, how long is the call durations, what type of calls that coming in and much more. This will be configured later. Go to Elastix > System > Users > Groups > Create New Groups. Enter information as below:

Group: Agent
Description: Call Center Agents

3. Assign Agent Console to Agent group. Go to Elastix > System > Users > Group Permissions > go to page 4 > tick on Agent Console > Save Selected as Accessible.

4. Create user. This will be used by call center agents to login into Elastix system to view campaign, calls and also view the phone book. Go to Elastix > System > Users > Create New User and enter agent #1 details as below:

Login: mark
Name: Mark Derp
Password: q1w2e3
Retype Password: q1w2e3
Group: Agent
Extension: 201

Click Save and create another user for Agent #2 as below:

Login: karim
Name: Karim Benz
Password: hgp4ss
Retype Password: hgp4ss
Group: Agent
Extension: 202

5. Create Form. This form will be used to enter customer’s details when they call in. This is required for reporting. We will do this so agent can fill up some details on the call description and remark. Go to Elastix > Call Center > Forms > Show Filter > Create New Form. Enter details as screenshot below:


6. Select Queue. We need to select which queue that will be used inside our call center and activate it. I will activate my SalesCallQueue which has been created on previous post. Go to Elastix > Ingoing Calls > Queues > Show Filter > Select Queue > Select Queue > 301 SalesCallQueue and click Save.

7. Now we can create campaign. Every incoming calls and outgoing calls that agents will call/receive need to be through a campaign. Inside this campaign, we will insert which queue, which form and some description for the caller’s type. Go to Elastix > Call Center > Ingoing Calls > Ingoing Campaigns > Show Filter > Create New Campaign and enter required details as screenshot below:

Click Save and you are done on configuring call center agents, call route, IVR and call queue. We can now proceed to this call center with our call center agents.


Install & Configure Softphone (SIP Client)

There will be a lot of SIP clients available which you can used for this purpose. I am going to use X-Lite. You can download the software here:

1. Login into the call center agent’s PC and proceed to download and install the software. We will be using this application to connect to PBX server which it will route the call to your PC based on extension number. For agent #1 PC, login as extension 201 with password [email protected] as below:

For agent #2 laptop, login as extension 202 with password [email protected] similar to screen shot above. You should now has log into your extension (consider your phone) into the PBX system.

NOTES: You are not login as agent yet in this step! You just login your phone. Just think that this softphone as your normal phone.

2. Login into Elastix’s Agent Console at and use login as created in step #4 under Configure Call Center section.

3. Now select the Agent Number and Extension number that has been setup in the PC for agent #1 as screen shot as below:

4. After you click Enter, you should receive a call from the PBX server (the Caller ID will be Anonymous) and you will be asked to enter the agent’s password. Now enter the password that you have setup for this agent as in step #1 under Configure Call Center section by pressing the PC keyboard and press ‘#’ (shift + 3) button. You will now login as agent and will be redirected to the console as below:


Testing and Costing

Now call the number that associated with the direct line from mobile phone. You will then be entertained by a digital receptionist with IVR menu. Select the appropriate options and your call will be put on queue. Then automatically your call center agent will get the respective call and hear your voice. The ‘Hangup’ and ‘Transfer’ button in agent console will only available if the agent is having active calls.

As for total cost of this call center, here is my calculation:

Stuff                |   Cost (MYR)
Phone line setup fee |   50 x 4
Phone line rental    |   800/month (200/month x 4)
Server Hardware      |   1400
Telephony Card       |   1980
Agent's Phone        |   0
Agent's Headset      |   250 x 2
PBX system           |   0
Call center system   |   0
Total                |   4080

As what I stated in the subject of this post, I have achieved my objective in building a call center/centre with lowest cost possible using mostly open-source tools. My total setup cost is only MYR 4080 or around ~USD $1330 with monthly cost for calls by telco which is MYR 800/month or around ~USD $261/month.

Build Low-cost Call Center using Elastix and Asterisk (Part 1)

My company requires me to build a simple call centre whereby:

  • It can receive incoming call from customers
  • Digital receptionist with interactive voice response (IVR)
  • Make outgoing call
  • Call queue
  • 2 call center agents workings to attend all calls

In order to achieve this, we need to know how many concurrent calls that we usually get during peak hours. In my case, we will usually get/make 3 concurrent calls in a same time. We will require 4 direct line from the Telco provider. The steps will be as below:

  1. Apply 4 direct phone lines from the Telco provider.
  2. Apply another toll-free number to be mapped to this 4 direct phone lines. Example: 1-800-88-1919.
  3. Prepare a server to control this communication aka PBX server.
  4. Buy a telephony interface card to be attached into PBX server.
  5. Install Elastix.
  6. Configure Elastix (extension, call route, IVR, queue).
  7. Install and configure Softphone in agents’ PC. This is the tool that call center agents used to communicate with customer.
  8. Buy a headphone set for call center agents usage.

I will not going to cover whole steps in this post. I am assume that step 1 and 2 has been done by your side. So I will start on step 3 and so on. The architecture that we are going to setup will be as below:


I will be using following variables:

Operating System: Elastix 2.3.0 Stable
PBX Server:
PBX Hostname:


Prepare the PBX Server

1. Get a server. I will be using simple Core i3 server with 250 GB HDD and 2GB RAM.

2. Download Elastix ISO from here: During this writing, I will download the 64bit version of Elastix 2.3.0 Stable.

3. Burn the ISO into a CD. We will use this CD to install the Elastix operating system.

4. Start the installation process by boot the CD. Follow all required steps until finish. Make sure you do not miss steps on setting up MySQL root password and Elastix administrator password.


Telephony Interface Card

After the installation finish and before we configure Elastix, we need to buy a telephony interface card which not usually available in normal IT store. This card usually being produced by PBX company like Digium, Sangoma and Rhino.

Make sure you understand the difference between FXO and FXS before you buy the telephony card. Since I will be using Softphone for all call agents, I will need to buy 4 FXO port (for direct line) with no FXS port (for station line). You may refer to here for further explanation:

For me I am going to buy this analog telephony card from Digium:


Configure Elastix

1. Now login into the Elastix server using web browser as admin. As for me, I will be login to .

2. We need to detect the telephony card before start configuring the PBX server. Make sure the direct phone lines has been attached to the back of the telephony card port. Go to Elastix > System > Hardware Detector > Detect New Hardware. You should see something like below:

This picture shows that only 1 direct phone line is detected and connected to the server. If you attached more than 1 line, you should see the respective port will turn into green.


3. Lets start configuring Elastix. The most basic things that we need to have is extension. Go to Elastix > PBX > PBX Configuration > Extensions. Select Generic SIP Device and click Submit. Fill up required data as below for Agent 1:

  • Under ‘Add Extension’
    • User Extension: 201
    • Display Name: Agent 1
  • Under ‘Device Options’
  • Under ‘Voicemail & Directory’
    • Status: Enabled

Click Submit. Now for Agent 2 repeat similar steps and add information as below:

  • Under ‘Add Extension’
    • User Extension: 202
    • Display Name: Agent 2
  • Under ‘Device Options’
  • Under ‘Voicemail & Directory’
    • Status: Enabled


4. Create queue. This will define the incoming call to be queue and which agent will required to communicate with them. I will need to create 2 group of queue which is Sales queue and CustomerService queue. Go to Elastix > PBX > PBX Configuration > Queues and enter following details:

  • Under ‘Add Queue’:
    • Queue Number: 301
    • Queue Name: SalesCallQueue
    • Static Agents: A201,0
Click Submit. Now for customer service queue, repeat similar steps and add information as below:
  • Under ‘Add Queue’:
    • Queue Number: 302
    • Queue Name: CustomerServiceCallQueue
    • Static Agents: A202,0


5. We need to create some recordings. We will use the voice recording to welcome every incoming call using IVR. You can refer to following video on how to use System Recordings:

As for me, I will be using Text to Wav features under Elastix > PBX > Tools > Text to Wav to create a simple welcoming voice.


6. From the voice recording on previous steps, we will need to configure IVR so our digital receptionist could route the call correctly. Go to Elastix > PBX > PBX Configuration > IVR and enter details as screen shot below:


7. We then need to configure the Inbound Routes. This will tell PBX on what is the first thing to do when receiving calls. Go to Elastix > PBX > PBX Configuration > Inbound Routes and enter following details:

  • Under ‘Add Incoming Route’:
    • Description: IncomingLine
  • Under ‘Options’:
    • CID name prefix: IncomingCall
  • Under ‘Set Destination’:
    • IVR: Welcome
Click Submit and also click the notification: Apply Configuration Changes Here.
This post continues at part 2 on how to install Call Center modules in Elastix and configure the call center agents’ PC to to use Softphone.

Fixing Auto Start and Auto Shutdown Issue in VMware ESXi 5.0

I am a free VMware ESXi 5.0.0 user. The biggest problem with this release is the failure of auto-start and auto-shutdown for VM after/before the hardware node reboot. Whenever you start or restart the ESXi node, you will need to manually turn on every single virtual machine inside it. This has caused a lot of inconvenience especially when your ESXi was in production server line.

VMware has described this bug in details as refer to this link:

1. As for me, I will need to download the patch for ESXi 5.0.0. Go to this page: and login into your VMware account. Search with following criteria in that page:


I will be downloading this into my Windows 7 PC and will be using SSH method to apply the patch.


2. Enable SSH. Go to vSphere Client > ESXi host > Configuration > Security Profile > Services > Properties and make sure SSH is running as screenshot below:


3. Go to vSphere Client > ESXi host > Configuration > right click storage > Browse Datastore. Create a new folder called ‘update’ inside the datastore and upload the patch as screenshot below:


4. Login into the ESXi server using SSH. Run following command to verify the image profiles:

$ esxcli software sources profile list --depot=[datastore1]/update/
Name                              Vendor        Acceptance Level
--------------------------------  ------------  ----------------
ESXi-5.0.0-20120701001s-standard  VMware, Inc.  PartnerSupported
ESXi-5.0.0-20120704001-no-tools   VMware, Inc.  PartnerSupported
ESXi-5.0.0-20120701001s-no-tools  VMware, Inc.  PartnerSupported
ESXi-5.0.0-20120704001-standard   VMware, Inc.  PartnerSupported


5. Put the host into maintenance mode. Go to vSphere client > right click to the ESXi node > Enter Maintenance Mode > Yes.


6. Start the update process by running following command. We will use profile ESXi-5.0.0-20120701001s-standard for this update:

$ esxcli software profile update --depot=[datastore1]/update/ --profile=ESXi-5.0.0-20120701001s-standard


7. Reboot the ESXi node using command line or using vSphere client. Once up, exit the maintenance mode and you can verify whether it is fixed by enabling Virtual Machine Startup/Shutdown options under vSphere client > ESXi node > Configuration > Software >  Virtual Machine Startup/Shutdown > Properties and enable the VM auto start as screen shot below:



Done. Try to reboot the ESXi host and you should see something like below on your vSphere client:


Linux: Add New User and Group into .htpasswd

We have several directories which have been restricted to some users in our company. Since they will need to authenticate before able to access the directory via web browser, I need to manage simple Apache user authentication using htpasswd.

User Authentication

To create new password protected directory under /home/website/public_html/secure1, create a new .htaccess file:

$ vim /home/website/public_html/secure1/.htaccess

And enter following line:

AuthUserFile /home/website/.htpasswd
AuthType Basic
AuthName "User Authentication"
Require valid-user

This will tell Apache to refer to .htpasswd for the user authentication data. Now let create a user to be inserted into .htpasswd file:

$  htpasswd -c /home/website/.htpasswd myfirstuser
New password:
Re-type new password:
Adding password for user myfirstuser

Format: htpasswd [options] [location of .htpasswd to be create] [username]

Now you can try to access the secure directory using  website: You should able to see login box pop out asking for username and password.

To add another user:

$ htpasswd /home/website/.htpasswd myseconduser

This will insert another line into .htpasswd file. If you see the current value, it should be:

$ cat /home/website/.htpasswd
myfirstuser: Ob5Y/eFTeSXEw
myseconduser: 9oopndPXV7sdE

Group Authentication

In some cases, I need to have a group of people able to access some secure folders. Lets say we have following users:

 David    | IT        | /home/website/public_html/secure-it
 Nade     | IT        | /home/website/public_html/secure-it
 Mike     | Admin     | /home/website/public_html/secure-admin
 Seth     | Boss      | /home/website/public_html/secure-boss

1. Insert the users into htpasswd file. I will put this under /home/website/.htpasswd:

$ htpasswd -c /home/website/.htpasswd david
$ htpasswd /home/website/.htpasswd nade 
$ htpasswd /home/website/.htpasswd mike
$ htpasswd /home/website/.htpasswd seth

2. Create a htgroup file. This will describe the group for every user. Create a new file /home/website/.htgroup and add following line. Boss group can access all secure directories and others can only access their respective directories:

it: david nade seth
admin: mike seth
boss: seth

3. Apply the access into htacess files for every directories that you want to secure.

For IT group, create new .htaccess file:

$ vim /home/website/public_html/secure-it/.htaccess

And add following line:

AuthUserFile /home/website/.htpasswd
AuthGroupFile /home/website/.htgroup
AuthName "User Authentication"
AuthType Basic
Require group it

For admin group, create new file:

$ vim /home/website/public_html/secure-admin/.htaccess

And add following line:

AuthUserFile /home/website/.htpasswd
AuthGroupFile /home/website/.htgroup
AuthName "User Authentication"
AuthType Basic
Require group admin

For Boss group, create new file:

$ vim /home/website/public_html/secure-boss/.htaccess

And add following line:

AuthUserFile /home/website/.htpasswd
AuthGroupFile /home/website/.htgroup
AuthName "User Authentication"
AuthType Basic
Require group boss

CentOS: Integrate ClusterControl into Existing MySQL Galera Cluster

I am going to integrate Severalnines’s ClusterControl into my existing MySQL Galera cluster which currently being used by our development team. ClusterControl allow us to manage, control and monitor our MySQL cluster from single point.

Actually, you can use their installer script to install a complete MySQL Galera suite as refer to this post.

In this case, I already have a set of MySQL Galera Cluster running for our development team which has been installed using the hard way as similar to this post. So my mission is to integrate this great tool into my existing MySQL Galera cluster.


  • 3 servers which already synced into a Galera cluster
  • 1 server for ClusterControl
  • No firewall and SELINUX enabled
  • The value inside /etc/hosts for all servers should be as below:    galera1.local galera1    galera2.local galera2    galera3.local galera3    clustercontrol.local clustercontrol

ClusterControl Server

1. ClusterControl required all servers to use passwordless SSH. We need to setup the SSH key to all of Galera nodes. Lets generate the key as user root:

$ ssh-keygen -t rsa

Notes: Just accept default value by pressing Enter until finish.

2. Copy the public key that we just created to all Galera nodes:

$ ssh-copy-id -i ~/.ssh/id_rsa root@galera1
$ ssh-copy-id -i ~/.ssh/id_rsa root@galera2
$ ssh-copy-id -i ~/.ssh/id_rsa root@galera3

Notes: You may need to enter the root password of the destination server each time you execute the command.

3. Download the bootstrap script from Severalnines page here. This script will help us a lot for this integration:

$ cd /usr/local/src
$ wget
$ tar -xzf cc-bootstrap-1.1.34.tar.gz

4. Before we start, we might need to make sure several package is installed using yum. Sudo and crond are required:

$ yum install cronie sudo -y

5. Run the bootstrap script for controller. This will configure and install all required package in order to run ClusterControl:

$ cd cc-bootstrap-1.1.34
$ bin/

Notes: During installation you might see the installer will try to regenerate the RSA key. Just choose ‘N’.

Is this your Controller host IP, [Y/n]: Y
What is your username [ubuntu] (e.g, ubuntu or root for RHEL): root
Where do you want to have the ClusterControl config files [/root/s9s]:
Where is your ssh key [/root/.ssh/id_rsa]:
Enter a MySQL root password to be set for the MySQL server on the Controller host [password]:
* On debian/ubunu when installing the MySQL server please enter the above root password when prompted
What is your DB cluster type [galera] (mysqlcluster|replication|galera|mysql_singl):
Where are your DB hosts [ip1 ip2 ip3 ... ipN]:
Enter the MySQL root password on the agent/DB hosts [password]: MyDBp4ss67
Thank you...
Install a MySQL Server and rrdtools? [Y/n]: Y
Install ClusterControl Controller? [Y/n]: Y
Install apache2 and php5 [Y/n]: Y
Install ClusterControl's Web application? [Y/n]: Y

6. Once done, we need to run the bootstrap script for agents. This will remotely install and configure required package in order to control Galera cluster from the ClusterControl server:

$ bin/

7. Install the JPgraph. This is required for ClusterControl to view graph correctly:

$ bin/

8. If you already configured your MySQL Galera cluster configuration under /etc/my.cnf, we need to copy the file into ClusterControl server under directory /root/s9s/mysql/config. As for me, I skip this steps because I have nothing configured inside /etc/my.cnf in cluster nodes.

$ scp root@galera1:/etc/my.cnf /root/s9s/mysql/config

9. Start cmon service, cron and enable cron on startup:

$ service cmon start
$ chkconfig crond on
$ service crond start

10. Installation done. Login into ClusterControl page at We need to change the cluster name to Galera cluster name. You can retrieve this using following command inside any Galera nodes:

$ mysql -e 'show variables' | grep wsrep_cluster_name
wsrep_cluster_name      my_wsrep_cluster

So my Galera cluster name is my_wsrep_cluster.

Go to ClusterControl > Galera Cluster ‘default_cluster_1′(1/0) > Administration > Cluster Settings and change the Cluster Name as below:

Save the changes and you are done. Just wait for a while and you will notice that your Galera cluster nodes will be counted as 1/3 at the Dashboard similar as below:

You do not even need to login into your Galera cluster nodes in order to complete this integration process. Believe me, this tool is a must if you have MySQL Galera cluster setup. I will start integrating ClusterControl into all of my Galera cluster set ASAP!

MailMe: Simple Bash to Notify Your Command Status via Email

I usually having problem whereby I always forgot to check what happen to my copying or downloading progress in the server. This has gives me idea to create a script to notify me via email once the command executed and completed.

For example, I usually download a big installer file which usually make me constantly check the download progress. I just need an alert to be send to me once the respective command completed whether it is failed or succeed. Another case is when I am running a big migration. I need to copy the whole /home directory to external hard disk in this will takes days to complete. Using MailMe will definitely increase my works efficiency. I just need to run the respective command and wait for the notification email. Thats all.

1. Install sendmail and mailx using yum. Mailx is required. You can use Postfix or any other SMTP server to send the email instead of sendmail:

$ yum install sendmail mailx -y

2. Start the sendmail service:

$ chkconfig sendmail on
$ service sendmail start

3. Download and integrate the script into environment. We will need to place the script under /usr/local/bin directory.

$ wget -P /usr/local/bin
$ chmod 755 /usr/local/bin/mailme

4. We need to change the MAILTO value so the script will send the notification automatically to your email. Open the script using text editor:

$ vim /usr/local/bin/mailme

And change following line:

Done. Now you can integrate mailme into your command. Example as below:

– Download the CentOS 6.3 64bit ISO:

$ mailme 'wget'

– Rsync the whole backup directory to another server:

$ mailme 'rsync -avzP /backup/*.tar.gz [email protected]:/backup'

Once the command executed successfully, you will get simple email notification like below:

Subject: MailMe Command Notification:
Command: wget
Date/Time: Mon Oct 1 11:14:54 MYT 2012