How to make an IVR system using Bluetooth?

How to make an IVR system using Bluetooth. This article is based on how you can design an IVR system using Bluetooth.
In this article, I will explain How to make an IVR system using Bluetooth.
IVR system using Bluetooth

Firstly, I did the installation of the Ubuntu operating system. After that, I have done the update and upgrade of the Ubuntu system. Then, I have proceeded to the installation process of Asterisk which is mentioned below.

What is the IVR System?

IVR full form is an Interactive voice response. An interactive voice response system (IVR) is a system where the customer's call is received by the pre-recorded message on the system which is configured. This message helps the client who is calling to reach a particular solution. 

IVR system allows customers to interact with a company's host system through a keyboard for voice recognition or telephone, after which they can answer their questions.

Technologies Used in IVR  

DTMF ( Dual-tone multiple frequencies), you may have noticed when you call a customer care helpline a recorded voice guide you to press buttons like "press 1 to proceed 2 to repeat". So, you might wonder how your customer support knows about which buttons you are pressing that's where DTMF technology works each key is configured with certain frequency or tones which are sent in the form of signals which are then decoded by your service provider & sent to the precise location where it needs to be sent.

Two main varieties of speech recognition are used in IVR: First is based on predefined values grammars (used in "direct" dialogues) and Secondly is based on statistically formed linguistic models (used in "natural language" dialogues).

Brief description of this IVR system using Bluetooth technology

This IVR system is based on Bluetooth your phone needs to be paired with the Ubuntu system. After you configure the Asterisk server your IVR system will be ready. When someone calls on that phone which is paired via Bluetooth with the Ubuntu system will be able to hear the prompts & recorded voice using DTMF technology with the inputs configured. In this IVR system, it is very much important that your phone must be configured properly with the Ubuntu system & especially the Bluetooth connectivity. IVR system is designed using the PHP AGI algorithm. I haven't used any dedicated server, in place of that I used my laptop to configure everything.

What is Asterisk?

Asterisk is an open-source framework that helps to convert an ordinary computer as a server that can be used for communication, also it can be used to build IVR. Asterisk is powerful for developers and integrators to create advanced communication solutions for free.

Note: To start with this project you need to have the Ubuntu Operating System installed.

Step By Step tutorial for making this IVR system using Bluetooth:

1. Ubuntu commands used while making an IVR system:

> Firstly press ctrl alt t together to open the terminal.

> ls: Used to list structure.

> cd: Changes directory.

> cd..: Useful when needed to come out from one folder.

> Mkdir: Used to create a new folder.

> gedit a. txt: Used to create a text file, where ‘a’ is the name of the file.

> cat a. txt: Used to see the content of the file.

> rm a.txt: Used to remove the text file.

> vi a.txt: Used to create a text file.

> ESC : wq: Used to save or delete the file, ‘w’ for save and ‘q’ for quit.

> PWD: Used to see the location of the folder.

> date: Used to see the date.

> cal: Used to see the calendar.

> whoami: Used to see the user of the pc.

> rmdir: Used to remove the directory.

> rm –r: Used to remove all in the directory.

> cd directory1: Used to go inside of the folder, where directory 1 is the folder.

> cp: Used to copy a folder. Eg: cp (folder name)/home/(name of the pc)/downloads, where downloads are the destination to the copy folder.

> cp -r (file name1) (filename2)/(folder to where we want to copy): Used to copy the two folders.

> mv (folder1)/(to where we want to move): Used for moving a folder. Eg: mv folder1/downloads. Where say, folder1 is on the desktop, that folder we have moved to the downloads folder.

> mv ../downloads/folder1: Used for moving the folder from downloads to desktop.

> ls –a: Used to see the hidden file.

2. Installation of all dependent software for Asterisk 

Asterisk needs following dependent software’s, open ubuntu terminal & type all the following commands:

A. apt-get install gcc.

B. apt-get install g++.

C. apt-get install automake.

D. apt-get install autoconf.

E. apt-get install libtool.

F. apt-get install make.

G. apt-get install libncurses5-dev.

H. apt-get install flex.

I. apt-get install bison.

J. apt-get install patch.

K. apt-get install linux-headers-$(uname-r).

L. apt-get install ssh.

M. apt-get install vim.

N. apt-get install php5.

O. apt-get install festival.

3. Installing Asterisk Package

Packages consists of four different modules:

1. Bluetooth driver add-ons.

2. Dahdi Linux complete package.

3. Asterisk add-ons for mobiles.

4. Asterisk 1.8 package.

4. Installation of Bluetooth driver add-ons

The following Bluetooth driver add-ons to install, type the following commands on ubuntu terminal as above:

a) apt-get install bluez-utils bluez-hcidump.

b) apt-get install libbluetooth-dev.

c) gedit /etc/bluetooth/hcid.conf.

Click here to view the code & paste it to (hcid.conf) and save it.

5. Installation of Dahdi Linux complete package

Get the Dahdi Linux complete package.

Extract it and keep it in usr/src and run the following commands in terminal:

A. cd usr/src/dahdi-linux-complete(version)/.

B. make.

Here are some files that need to be downloaded manually and then copy and extract it in the following directory.


> re-run make.

> make install.


The solution to manually download problem if you are using any kind of proxy:

1. Enter in superuser mode by typing sudo su.

2. Export below two lines.

export http_proxy=http:// youruserid:yourpassword@

export https_proxy=https:// youruserid:yourpassword@

3. This will only be valid for that terminal session. 

6. Installation of asterisk add-ons for mobiles

Type in the terminal:

A. apt-get build-dep asterisk-mobile.

Here need to put India phone extension 91, by default it is 61( Australia ).

B. apt-get -b source asterisk-mobile.

7. Installation of asterisk package

Get the asterisk package from their website.

Extract it and keep it in usr/src and run the following commands in terminal:

A. cd usr/src/asterisk(version).

B. ./configure.

C. make menuselect.

Select chan_mobile module in the first line of the main menu and save it by pressing enter after that type the following commands:

> make.

> make install.

> make samplesPART.

8. Configuration of Asterisk Server

> gedit /etc/asterisk/chan_mobile.conf.

In this configuration file system, you have to enter Bluetooth details and the mobile phone Bluetooth details you want to connect should be added.

Brief description of what to add:

Your system Bluetooth mac address to be put. For getting this address in the terminal run the command “ hcitool dev ”.

Add below two lines to the file chan_mobile.conf :


address=CC:52:AF:15:46:7D (Put your mac address here).

Here in the address, you put the mac address you get by executing the command “ hcitool dev ”.

Have to define an id for the adapter, put the line below the next two addresses.

id=laptop ;adapter to use.

The id can be anything save the file and close.

9. Running the asterisk server 

Open new terminal & type:

A. asterisk.

B. asterisk –cdvvvvr.

C. mobile search.

It will display all Bluetooth devices present in 10 m distance from Your system and with a port.

Note your mobile mac address and port number.

10. Stop asterisk server

> core stop gracefully. ( Type in the existing terminal where you have started Asterisk server).

Open the chan_mobile.conf file again by typing the following command:

A. gedit /etc/asterisk/chan_mobile.conf.

B. Set your mobile device name.

[your mobile name ]; it can be anything.

C. Put your mobile mac address like:

address=AC:93:2F:EF:20: EE (Put your mac address here);

obtained by using the command "mobile search" in the CLI prompt or type hcitool scan in the terminal.

D. Put port obtained by using the mobile search command:

port=port number; obtained by using the mobile search command

E. Put context by entering:


You can enter anything in place of “IVR”.

F. Put adapter as below:


It must be same as id used in the above steps for laptop mac address

G. Put group equal to one as given below.


H. Save the chan_mobile.conf file.

Finally the chan_mobile.conf file should look like below:


address=CC:52:AF:15:46:7D ; the address of the
adapter(laptop); obtained by using the command "hcitool dev" in the terminal.

id=laptop; adapter to use;;; this context is the details of
the mobile device we are using

[name of the mobile]

address=AC:93:2F:EF:20:EE ; the address of the adapter ;
obtained by using the command mentioned above.

[Change your mac address according to your devices by using the above command mentioned].

> "mobile search" in the CLI prompt OR type hcitool scan in the terminal.

> port=2; the port number; obtained by using the mobile search.

> context=ivr ; dialplan context ;use the required context.

> adapter=laptop ; adapter to use.

> group=1; this phone is under group 12. 

> gedit /etc/asterisk/extensions.conf.

This file needs to add a system dial plan structure.

Brief description of what to add:

1. Context same as you define in chan_mobile.conf

[ivr] ; IVR use as context in chan_mobile.conf.

2. Then below two lines are to append below the context to receive a call after predefine response time.

exten => s,1,Answer

exten => s,n,Set(TIMEOUT(response)=20) ; Set Response Timeout to 20 seconds

3. This line is not necessary .it is used to play a welcome message to the system.

exten => s,n,Background(/home/spkrverprompt1) ; welcome wav

4. This line is used to call the system IVR program.

exten => s,n,AGI(/home/voice-mail/inbound.php) ; call the call flow program

5. This line is used to inform the system to wait for next call:

exten => s,n,WaitExten

Finally the extension.conf file should look like this:

[ivr] exten => s,1,Answer exten => s,n,Set(TIMEOUT(response)=20) ; Set Response Timeout to 20 Seconds exten => s,n,Background(/home/spkrverprompt1) ; welcome wav exten => s,n,AGI(/home/voice-mail/inbound.php) ; call the call flow Program exten => s,n,WaitExtenPART  

11. Start Asterisk Server

Type in terminal:

1. Asterisk.

2. Asterisk -cdvvvr.

3. dialplan reload (if any changes are done in extension.conf file).

12. Stop Asterisk Server

> Core stop gracefully. ( Type in the particular terminal where you have started the Asterisk server in order to stop it).

Useful commands:

> mobile search – it will display all Bluetooth devices present in 10 m distance from your system and with a port.


1. Before running “ make install ” make sure that you're in superuser mode and else type:

sudo make install.

2. Some times PHP and asterisk CLI integration to be done then php5-cli need to install.

sudo apt-get install php5-cli.

After installing all packages the result will be obtained by starting the Asterisk server as given above and by running all the commands. Make sure you keep your phone connected to Bluetooth with your laptop so that IVR configuration works properly. Sometimes Bluetooth connection creates issues in Ubuntu with an internal adapter, it disconnects automatically or doesn't show up, in that case, try using an external Bluetooth adapter it works for me or else check-in network settings also check on additional drivers.

In case of any issues contact me I will be happy to help.

An Engineer by passion and Technology Enthusiast.


  1. please provide WhatsApp number or mail id to contact
    i want to as how my actual number call being forwarded according to ivr and recording of those calls on server
If you have any doubts, please let me know! Do not Post Any Spam Link!