Difference between revisions of "IVRS Installation"

From Karnataka Open Educational Resources
Jump to navigation Jump to search
m
 
(42 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
+
[http://karnatakaeducation.org.in/KOER/en/index.php/IVRS ''Go to IVRS Home page'']
 
==About==
 
==About==
  
Line 11: Line 11:
  
 
Step 1: Install ssh, lamp and other required packages
 
Step 1: Install ssh, lamp and other required packages
  sudo apt-get install openssh-client openssh-server
+
  sudo apt update
  sudo apt-get install tasksel
+
  sudo apt install linux-headers-`uname -r` gcc g++ make libnewt-dev libncurses5-dev openssl libssl-dev zlib1g-dev libxml2-dev libjansson-dev uuid-dev libsqlite3-dev git autoconf automake vim
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.
+
Step 2: 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-13.13.1.tar.gz''' file. Run below commands to install it
sudo -s
 
<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
 
  cd /usr/src
  sudo tar -xvzf ~/Downloads/asterisk-1.6.2.23.tar.gz
+
  sudo tar -xvzf ~/Downloads/asterisk-13.13.1.tar.gz
sudo apt-get install ncurses-dev libxml2-dev g++
+
  cd asterisk-13.13.1
  cd asterisk-1.6.2.23
+
  ./configure
  sudo ./configure
 
 
  sudo make clean
 
  sudo make clean
 
  sudo make
 
  sudo make
Line 42: Line 24:
 
  sudo make samples
 
  sudo make samples
  
Step 5: Create new database for swara in mysql
+
Step 3: Download and extract folders from http://karnatakaeducation.org.in/swarabinFiles.zip to /opt/swara/
  /usr/bin/mysql_secure_installation (Answer yes to every question, set a new password for the root user)
+
cd ~/Downloads
  mysql -u root -p
+
  wget http://karnatakaeducation.org.in/swarabinFiles.zip
  mysql>create database swara;
+
  unzip swarabinFiles.zip
  mysql>exit
+
  mv swarabinFiles swara
 +
  sudo cp -r swara /opt/
  
Step 6: Enter superuser mode and run below commands to install and setup Swara
+
Step 4: Set up symlinks and Asterisk configurations
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
+
sudo cp /opt/swara/conf/extensions.conf /opt/swara/conf/sip.conf /etc/asterisk
  
ln -s /opt/swara/web /var/www/html
+
Step 5: Download and install chan_dongle from https://github.com/wdoekes/asterisk-chan-dongle
<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  
 
  cd ~/Downloads  
  tar -xvf chan_dongle-1.1.r14.tgz
+
  git clone https://github.com/wdoekes/asterisk-chan-dongle.git
  cd chan_dongle-1.1.r14
+
  cd asterisk-chan-dongle
  sudo ./configure
+
./bootstrap
  sudo make
+
  ./configure --with-astversion=13.13.1
 +
  make
 
  sudo make install
 
  sudo make install
  
Step 9: Setup chan dongle with Asterisk:
+
Step 6: Setup chan dongle with Asterisk:
  cd ~/Downloads/chan_dongle-1.1.r14/etc/
+
  cd ~/Downloads/asterisk-chan-dongle/etc/
 
  <Copy the dongle.conf file to /etc/asterisk/>  
 
  <Copy the dongle.conf file to /etc/asterisk/>  
  sudo cp ~/Downloads/chan_dongle-1.1.r14/etc/dongle.conf /etc/asterisk/
+
  sudo cp ~/Downloads/asterisk-chan-dongle/etc/dongle.conf /etc/asterisk/
 
  <Open the file /etc/asterisk/dongle.conf and set the IMEI setting with the IMEI number of the dongle>
 
  <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
 
  sudo gedit /etc/asterisk/dongle.conf
 
  <Save and close the dongle.conf file after adding IMEI number of the dongle>
 
  <Save and close the dongle.conf file after adding IMEI number of the dongle>
 
  
Step 10: Setup Asterisk and swara to make calls:
+
Step 7: 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">
 
  <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
 
  sudo gedit /etc/asterisk/dongle.conf
 
  <Save and close the dongle.conf file
 
  <Save and close the dongle.conf file
 
  
Step 11: Download and extract folders from http://karnatakaeducation.org.in/swarabinFiles.zip to /opt/swara/
+
Step 8: Setup Asterisk to use swara configs
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 libs/ /opt/swara/
 
sudo cp -r tools/ /opt/swara/
 
 
 
 
 
Step 12: Setup Asterisk to use swara configs
 
 
  <Edit /etc/asterisk/extensions.conf>
 
  <Edit /etc/asterisk/extensions.conf>
 
  sudo gedit /etc/asterisk/extensions.conf
 
  sudo gedit /etc/asterisk/extensions.conf
Line 128: Line 70:
 
----------------------
 
----------------------
  
  1. Open the terminal. change to root using the command "su -"
+
  1. Open the terminal.
  2. Now run the command "asterisk -vvvvvvc". This should run without fail and the CLI prompt should come
+
  2. Now run the command "sudo 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"
+
  3. Check Dongle is ready "dongle show devices". If you see network provider name here, then the dongle is ready to make calls.
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"
 
  
 
==Sending Voice-SMS==
 
==Sending Voice-SMS==
  
Below steps can be followed to send Voice-SMS with above set-up.
+
Below steps can be followed to send Voice-SMS with above set-up. Get the Voice-SMS GUI from this link http://karnatakaeducation.org.in/VoiceBlast.zip. Extract the file to get VoiceBlast folder inside your Downloads folder. To be able to run IVRS without going to Terminal, please run below comm
 +
 
 +
Open terminal window and type:
 +
 
 +
sudo visudo
 +
 
 +
In the bottom of the file, type the following:
 +
 
 +
ubuntu ALL=(ALL) NOPASSWD: ALL
 +
 
 +
Replace *ubuntu* with your own username. Now press Ctrl+O and then press Enter and then Ctrl+X to come out of editor.
 +
 
 +
Next type below command in Terminal:
 +
 
 +
gedit  ~/Downloads/VoiceBlast/voiceblast.sh
 +
 
 +
This will open edit window, now paste the below code into it and save the file.
 +
 
 +
#!/bin/bash
 +
cd ~/Downloads/VoiceBlast/ && sudo ./VBlast4.py
 +
 
 +
Now go to the file location and right click on it to select Properties. Click on Permissions tab and tick the "Allow executing file as program" checkbox.
 +
 
 +
Right click on Applications, select Edit menu. Click on Office on the left side and click on New Item on the right side. Type IVRS 1 as name and type below command in the Command field:
 +
 
 +
sudo asterisk -vvvvvvc
 +
 
 +
Now tick the Launch in Terminal and Click on OK.
 +
 
 +
Again click on New Item and Type IVRS 2 for Name field. Then in Command field type the following:
 +
 
 +
~/Downloads/VoiceBlast/voiceblast.sh
 +
 
 +
Then tick the Launch in Terminal  and Click on OK.
 +
 
 
  1. Open Voice-SMS window.
 
  1. Open Voice-SMS window.
 
  2. Select your Audio file in *.wav format.
 
  2. Select your Audio file in *.wav format.
Line 156: Line 128:
 
# Hold your phone at exactly 45<sup>0</sup> degree angle and at half-feet distance from your mouth for better audio capture by phone's microphone.(Use earphones if available)
 
# Hold your phone at exactly 45<sup>0</sup> degree angle and at half-feet distance from your mouth for better audio capture by phone's microphone.(Use earphones if available)
 
# Stop the recording when you are done and transfer audio file to your computer.
 
# Stop the recording when you are done and transfer audio file to your computer.
# Use Audocity to remove any noise from the audio file and export it to same *.wav format with 8,000GHz frequency.(Listen to your audio file in earphones if available)
+
# Use Audacity to remove any noise from the audio file and export it to same *.wav format with 8,000GHz frequency.(Listen to your audio file in earphones if available)
 
# Use the exported audio file to send Voice SMS in the IVRS applciation.
 
# Use the exported audio file to send Voice SMS in the IVRS applciation.
  
[[Category:Ubuntu]]
+
==Troubleshooting==
 +
If the IVRS isn't working, it could be because of one or more of the below reasons. Also follow instructions right below which can help to troubleshoot the problem.
 +
 
 +
=== How to Insert Sim card in the dongle ===
 +
* Click on the [http://support.three.co.uk/SRVS/CGI-BIN/WEBISAPI.DLL/,/?New,Kb=Mobile,Ts=Mobile,T=Device,varset_pid=6174,varset_cid=6175,Case=EXT(EM80399) link] to view the steps.
 +
* Click on  the [https://www.youtube.com/watch?v=aRKIZ5VIqfI link] to view a short video to insert the sim.
 +
 
 +
=== ''Using the micro/nano and Jio sim cards'' ===
 +
Data cards used here require full sim cards and if they are cut like in micro/nano card then they are not properly placed in the sim card slot. A new sim card without cutting it can be placed or if they are cut then external card support can be used to fix this issue. Also note that Jio sim cards won't work to make calls on this IVRS.
 +
 
 +
=== ''Data card not detected or not switching to network mode'' ===
 +
'''opentty: unable to open /dev/ttyUSB2: No such file or directory''' error message is generally shown when the data card is not detected or if it's in modem mode. To fix it, below steps can be followed.
 +
# Command used to check the device mode "lsusb".
 +
# Command used to switch the device mode manually.
 +
sudo usb_modeswitch -v 0x12d1 -p 0x1446 -M 55534243000000000000000000000011060000000000000000000000000000 -V 0x12d1 -P 0x1436 -s 30 -m 0x01
 +
A gap of 30 seconds is needed before we see the switch.
 +
 
 +
=== To Resolve the existing call error ===
 +
Command to resolve the error:
 +
sudo rm -rf /var/spool/asterisk/outgoing
 +
 
 +
=== ''Audio quality is bad or nothing is heard'' ===
 +
This could happen because of issues in audio file (.wav). Make sure the frequency of audio file is 8000, track is mono and is saved in 16-bit *.wav format. By default, audacity saves file in 16-bit *.wav format but frequency and track settings have to be confirmed. This will fix the audio issues.
 +
 
 +
== Ubuntu Kalpavriksha(IVRS Pre-installed) ==
 +
Click on the link '''[https://drive.google.com/open?id=1CkIkRv5N2E6ggt2w-KAtb7DhYEKoOGfZ Kalpavriksha(With_IVRS).ISO]''' to download the ISO which includes IVRS1,IVRS2 and Modem switching  shortcuts in the office menu..
 +
 
 +
But need to change the IMEI number,and set it to your dongle IMEI number before launching the IVRS1 and IVRS2.  Command used to change the IMEI number is :
 +
sudo gedit /etc/asterisk/dongle.conf
 +
[[Category:Ubuntu]]

Latest revision as of 09:26, 15 March 2019

Go to IVRS Home page

About

IVRS(Interactive Voice Response System) is commonly used platform to reach people connected through mobile/telephones. This page is about how one can set it up and send Voice SMS at any place with minimal requirements.

Installation and Deployment

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 update
sudo apt install linux-headers-`uname -r` gcc g++ make libnewt-dev libncurses5-dev openssl libssl-dev zlib1g-dev libxml2-dev libjansson-dev uuid-dev libsqlite3-dev git autoconf automake vim

Step 2: 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-13.13.1.tar.gz file. Run below commands to install it

cd /usr/src
sudo tar -xvzf ~/Downloads/asterisk-13.13.1.tar.gz
cd asterisk-13.13.1
./configure
sudo make clean
sudo make
sudo make install
sudo make samples

Step 3: 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
mv swarabinFiles swara
sudo cp -r swara /opt/

Step 4: Set up symlinks and Asterisk configurations

sudo cp /opt/swara/conf/extensions.conf /opt/swara/conf/sip.conf /etc/asterisk

Step 5: Download and install chan_dongle from https://github.com/wdoekes/asterisk-chan-dongle

cd ~/Downloads 
git clone https://github.com/wdoekes/asterisk-chan-dongle.git
cd asterisk-chan-dongle
./bootstrap
./configure --with-astversion=13.13.1
make
sudo make install

Step 6: Setup chan dongle with Asterisk:

cd ~/Downloads/asterisk-chan-dongle/etc/
<Copy the dongle.conf file to /etc/asterisk/> 
sudo cp ~/Downloads/asterisk-chan-dongle/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 7: 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 8: Setup Asterisk to use swara configs

<Edit /etc/asterisk/extensions.conf>
sudo gedit /etc/asterisk/extensions.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.
2. Now run the command "sudo asterisk -vvvvvvc". This should run without fail and the CLI prompt should come
3. Check Dongle is ready "dongle show devices". If you see network provider name here, then the dongle is ready to make calls.

Sending Voice-SMS

Below steps can be followed to send Voice-SMS with above set-up. Get the Voice-SMS GUI from this link http://karnatakaeducation.org.in/VoiceBlast.zip. Extract the file to get VoiceBlast folder inside your Downloads folder. To be able to run IVRS without going to Terminal, please run below comm

Open terminal window and type:

sudo visudo

In the bottom of the file, type the following:

ubuntu ALL=(ALL) NOPASSWD: ALL

Replace *ubuntu* with your own username. Now press Ctrl+O and then press Enter and then Ctrl+X to come out of editor.

Next type below command in Terminal:

gedit  ~/Downloads/VoiceBlast/voiceblast.sh

This will open edit window, now paste the below code into it and save the file.

#!/bin/bash
cd ~/Downloads/VoiceBlast/ && sudo ./VBlast4.py

Now go to the file location and right click on it to select Properties. Click on Permissions tab and tick the "Allow executing file as program" checkbox.

Right click on Applications, select Edit menu. Click on Office on the left side and click on New Item on the right side. Type IVRS 1 as name and type below command in the Command field:

sudo asterisk -vvvvvvc

Now tick the Launch in Terminal and Click on OK.

Again click on New Item and Type IVRS 2 for Name field. Then in Command field type the following:

~/Downloads/VoiceBlast/voiceblast.sh

Then tick the Launch in Terminal and Click on OK.

1. Open Voice-SMS window.
2. Select your Audio file in *.wav format.
3. Select text file with list of numbers to which the message has to be sent.
4. Enter the duration in seconds.
5. Click on Send to start the calls.

Getting Good Quality Audio for Voice-SMS

Usually in school ambiance, it is difficult to get good quality audio recordings for sending Voice SMS. Great quality audio is very essential for your message to reach your intended audience. Below are few steps one can follow to ensure this:

Before proceeding with below steps, please ensure you have the following with you - Android phone, Audacity software, Tape-a-talk app on your Android and earphones if available.

  1. Install Tape-a-talk app on your Android phone.
  2. This IVRS platform requires audio recording in *.wav format, so please record using Tape-a-talk which outputs *.wav format audio by default.
  3. Set frequency in the android app to 8,000GHz which is another requirement for IVRS.
  4. Hold your phone at exactly 450 degree angle and at half-feet distance from your mouth for better audio capture by phone's microphone.(Use earphones if available)
  5. Stop the recording when you are done and transfer audio file to your computer.
  6. Use Audacity to remove any noise from the audio file and export it to same *.wav format with 8,000GHz frequency.(Listen to your audio file in earphones if available)
  7. Use the exported audio file to send Voice SMS in the IVRS applciation.

Troubleshooting

If the IVRS isn't working, it could be because of one or more of the below reasons. Also follow instructions right below which can help to troubleshoot the problem.

How to Insert Sim card in the dongle

  • Click on the link to view the steps.
  • Click on the link to view a short video to insert the sim.

Using the micro/nano and Jio sim cards

Data cards used here require full sim cards and if they are cut like in micro/nano card then they are not properly placed in the sim card slot. A new sim card without cutting it can be placed or if they are cut then external card support can be used to fix this issue. Also note that Jio sim cards won't work to make calls on this IVRS.

Data card not detected or not switching to network mode

opentty: unable to open /dev/ttyUSB2: No such file or directory error message is generally shown when the data card is not detected or if it's in modem mode. To fix it, below steps can be followed.

  1. Command used to check the device mode "lsusb".
  2. Command used to switch the device mode manually.
sudo usb_modeswitch -v 0x12d1 -p 0x1446 -M 55534243000000000000000000000011060000000000000000000000000000 -V 0x12d1 -P 0x1436 -s 30 -m 0x01

A gap of 30 seconds is needed before we see the switch.

To Resolve the existing call error

Command to resolve the error:

sudo rm -rf /var/spool/asterisk/outgoing

Audio quality is bad or nothing is heard

This could happen because of issues in audio file (.wav). Make sure the frequency of audio file is 8000, track is mono and is saved in 16-bit *.wav format. By default, audacity saves file in 16-bit *.wav format but frequency and track settings have to be confirmed. This will fix the audio issues.

Ubuntu Kalpavriksha(IVRS Pre-installed)

Click on the link Kalpavriksha(With_IVRS).ISO to download the ISO which includes IVRS1,IVRS2 and Modem switching shortcuts in the office menu..

But need to change the IMEI number,and set it to your dongle IMEI number before launching the IVRS1 and IVRS2. Command used to change the IMEI number is :

sudo gedit /etc/asterisk/dongle.conf