IVRS

From Karnataka Open Educational Resources
Revision as of 08:38, 18 July 2016 by yogesh (talk | contribs) (Created page with "This page helps anyone to deploy IVRS to send voice SMS from your Kalpavriksha(Ubuntu) machine with a data card. Call charges as per network would apply. Belo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This page helps anyone to deploy IVRS to send voice SMS from your Kalpavriksha(Ubuntu) machine with a data card. Call charges as per network would apply. Below instructions were modified from Mojolab site where this was used to install Swara software. This was tested on Kalpavriksha(Ubuntu) with Huwawei E173 and is currently used in Government High School, Domlur. An opensource IVRS program called Asterisk is used to run Swara software.

Make sure each step below is successful without errors:


Step 1: Install ssh, lamp and other required packages

sudo apt-get install openssh-client openssh-server
sudo apt-get install tasksel
sudo tasksel install lamp-server
sudo apt-get install ncurses-dev libxml2-dev g++
sudo apt-get install lame mysql-server wget gcc g++ bison zlib1g zlib-bin openssl php5-mysql php5 apache2 python-mysqldb

Step 2: Enter superuser mode and run below commands to install python packages required for asterisk.

su -
<Enter your password>
apt-get install python-setuptools
easy_install MySQL-Python
easy_install tweepy
easy_install oauth2
easy_install stopwatch
easy_install simplejson

Step 3: Disabling your firewall

sudo ufw disable


Step 4: Installing asterisk. Note install only this version of asterisk in this way only. Go to http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/ link and download asterisk-1.6.2.23.tar.gz file. Run below commands to install it

cd /usr/src
sudo tar zxvf ~/Downloads/asterisk-1.6.2.23.tar.gz
sudo apt-get install ncurses-dev libxml2-dev g++
cd asterisk-1.6.2.23
sudo ./configure
sudo make clean
sudo make
sudo make install
sudo make samples

Step 5: Create new database for swara in mysql

/usr/bin/mysql_secure_installation (Answer yes to every question, set a new password for the root user)
mysql -u root -p
mysql>create database swara;
mysql>exit

Step 6: Enter superuser mode and run below commands to install and setup Swara

wget https://github.com/ccidmysore/swara/tarball/developers
mv developers /opt/swara.tgz
cd /opt
tar xvzf swara.tgz
mv ccidmysore-swara-1cc734f swara
cd /var/www/
ln -s /opt/swara/web /var/www/swara

Step 7: Set up symlinks and Asterisk configurations

ln -s /opt/swara/web /var/www/html
<create folder name as asterisk in /usr/share>
ln -s /opt/swara/bin /usr/share/asterisk/agi-bin
ln -s /opt/swara/bin /usr/share/asterisk/sounds
cp /opt/swara/conf/extensions.conf /opt/swara/conf/sip.conf /etc/asterisk
cd /usr/share/asterisk 
mkdir orig && mv sounds agi-bin orig/
ln -s /opt/swara/bin agi-bin && ln -s /opt/swara/sounds sounds
cd /opt/swara/conf
<Edit swara.conf and put in your database password>
sudo gedit swara.conf
cp swara.conf /etc
cp extensions.conf /etc/asterisk
cp sip.conf /etc/asterisk
mysql -u root -p swara < swaradb.sql
cd /opt/swara/web
mkdir /opt/swara/sounds/web && ln -s /opt/swara/sounds/web audio
ln -s /opt/swara/sounds/web upload
chmod a+rwx -R /opt/swara
touch /var/log/swara.log
chmod a+rwx -R /var/log/swara.log

Step 8: Download and install chan_dongle-1.1.r14.tgz from https://code.google.com/archive/p/asterisk-chan-dongle/downloads

cd ~/Downloads 
tar -xvf chan_dongle-1.1.r14.tgz
cd chan_dongle-1.1.r14
sudo ./configure
sudo make
sudo make install

Step 9: Setup chan dongle with Asterisk:

cd ~/Downloads/chan_dongle-1.1.r14/etc/
<Copy the dongle.conf file to /etc/asterisk/> 
sudo cp ~/Downloads/chan_dongle-1.1.r14/etc/dongle.conf /etc/asterisk/
<Open the file /etc/asterisk/dongle.conf and set the IMEI setting with the IMEI number of the dongle>
sudo gedit /etc/asterisk/dongle.conf
<Save and close the dongle.conf file after adding IMEI number of the dongle>

Step 10: Setup Asterisk and swara to make calls:

<Open the file "/etc/asterisk/dongle.conf" and set the values for Context as "from-sip" and exten as "swara-local">
sudo gedit /etc/asterisk/dongle.conf
<Save and close the dongle.conf file

Step 11: Download and extract folders from http://karnatakaeducation.org.in/swarabinFiles.zip to /opt/swara/

cd ~/Downloads
wget http://karnatakaeducation.org.in/swarabinFiles.zip
unzip swarabinFiles.zip
cd swarabinFiles/
sudo cp -r bin/ /opt/swara/
sudo cp -r conf/ /opt/swara/
sudo cp -r lib/ /opt/swara/
sudo cp -r tools/ /opt/swara/


Step 12: Setup Asterisk to use swara configs

<Edit /etc/asterisk/extension.conf>
sudo gedit /etc/asterisk/extension.conf
<Under [from-sip], change>
exten => swara-local,n,AGI(menu_system_localized.py)
to
exten => swara-local,n,AGI(/opt/swara/bin/menu_system_localized1.py)
<Save and close the file after changing as shown above>


Installation is now completed. Now to run the IVRS and send voice-sms, connect the USB dongle to the USB drive and follow below steps:


1. Open the terminal. change to root using the command "su -"
2. Now run the command "asterisk -vvvvvvc". This should run without fail and the CLI prompt should come
3. On the CLI command prompt run the command "agi set debug on"
4. Call to the number and you should hear the IVR prompt
5. Stop to this run "core stop gracefully"
6. Stop and Restart " core restrat gracefully"
7. check Dongle is ready "dongle show devices"