-
Notifications
You must be signed in to change notification settings - Fork 18
Installing on Ubuntu 11.10
These instructions are deprecated. Please refer to Installation on Ubuntu 12.
Follow these instructions to get Verboice up and running on Ubuntu 11.10. This may work for other versions of Ubuntu as well but it has not been tested.
The following additional dependencies are required to run Verboice:
- lame `# sudo apt-get install lame```
- sox `# sudo apt-get install sox```
# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gz
# tar xvfz asterisk-1.8-current.tar.gz
# cd asterisk-1.8.9.3
# contrib/scripts/get_mp3_source.sh
# ./configure
# make menuconfig
select app_mysql, app_saycountpl, cdr_mysql, format_mp3, res_config_mysql go to Extras Sound Packages Select EXTRAS-SOUNDS-EN-GSM Save & Exit
# make
# sudo make install
# sudo make samples
Adapted from http://www.voip-info.org/wiki/view/Asterisk+non-root and http://www.technicalhowto.com/opensource/asterisk/installing.html
After asterisk has been installed, run the following commands:
# sudo adduser --system --group --home /var/lib/asterisk --no-create-home --gecos "Asterisk PBX" asterisk
# sudo chown --recursive asterisk:asterisk /var/lib/asterisk
# sudo chown --recursive asterisk:asterisk /var/log/asterisk
# sudo chown --recursive asterisk:asterisk /var/run/asterisk
# sudo chown --recursive asterisk:asterisk /var/spool/asterisk
# sudo chown --recursive asterisk:asterisk /usr/lib/asterisk
# sudo chmod --recursive u=rwX,g=rX,o= /var/lib/asterisk
# sudo chmod --recursive u=rwX,g=rX,o= /var/log/asterisk
# sudo chmod --recursive u=rwX,g=rX,o= /var/run/asterisk
# sudo chmod --recursive u=rwX,g=rX,o= /var/spool/asterisk
# sudo chmod --recursive u=rwX,g=rX,o= /usr/lib/asterisk
# sudo chown --recursive root:asterisk /etc/asterisk
# sudo chmod --recursive u=rwX,g=rX,o= /etc/asterisk
# sudo chmod g+w /etc/asterisk/voicemail.conf
# sudo chmod g+w,+t /etc/asterisk
Now edit /etc/asterisk/asterisk.conf
and uncomment the following lines:
;runuser=asterisk
;rungroup=asterisk
Add the following script to `/etc/monit/conf.d/asterisk```
check process asterisk with pidfile /var/run/asterisk/asterisk.pid
start "/usr/sbin/asterisk -U asterisk"
stop "/usr/sbin/asterisk -U asterisk -x 'core stop now'"
group asterisk
To start asterisk manually:
# sudo asterisk -U asterisk
To connect to the asterisk console:
# sudo asterisk -U asterisk -r
To shutdown asterisk (from the asterisk console)
# core stop now
==== Helpful commands ==== From the asterisk console these commands are useful for debugging RTP and SIP problems:
# sip show peers Show all SIP peers (including friends)
# sip show registry Show status of hosts we register with
# sip set debug on Show all SIP messages
# sip reload Reload configuration file
# core set verbose 9999
# rtp set debug on
Follow the directions https://bitbucket.org/instedd/verboice/wiki/Install_FreePBX#!setup-instructions-for-freepbx
# cd path_to_verboice
# sudo cp etc/asterisk/extensions.ael /etc/asterisk
# sudo cp etc/asterisk/sip.conf /etc/asterisk
Edit the file config/asterisk.yml
and change the paths:
sounds_dir: /var/lib/asterisk/sounds
config_dir: /etc/asterisk
ami_port: 5038
call_manager_port: 19000
agi_use_pipe_separator: false
Edit the file /etc/asterisk/extensions_custom.conf
and add:
[verboice]
exten => _X!,1,Answer
exten => _X!,n,Wait(1)
exten => _X!,n,AGI(agi://localhost:19000,,${EXTEN})
[verboice-restart]
exten => _.,1,AGI(agi://localhost:19000,${EXTEN})
Also, add an AMI account for Verboice editing the file at `/etc/asterisk/manager_custom.conf```
[verboice]
secret=verboice
read=all
write=all
Configure the Asterisk SIP configuration in `/etc/asterisk/sip.conf```
Add the following to the bottom of of the file:
[1000]
type=friend
host=dynamic
secret=1234
context=verboice
Note these settings are needed if you are behind a NAT e.g. on Amazon EC2. Place them in the general section.
[general]
context=default
externip=x.x.x.x ; The external ip (e.g. AWS elastic IP) of your NAT'd server
localnet=10.0.0.0/255.0.0.0 ; Your local network address. This mask can be used for all addresses in the 10.x.x.x range
nat=yes
directmedia=yes
# sudo usermod -a -G asterisk <server_user (i.e. the same user who will run /lib/services/verboice_asterisk.rb)>
# sudo chmod g+w /var/lib/asterisk/sounds
Note you may need to restart asterisk after this (see above)
Edit your Gemfile and add the following:
group :production do
gem "passenger"
end
From your app directory
# bundle
Edit /etc/apache2/sites-enables/verboice.conf
and add the following:
<VirtualHost *:80>
PassengerSpawnMethod conservative
ServerName your.servername
DocumentRoot path_to_verboice/public
PassengerEnabled off
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
<Directory path_to_verboice/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
Start passenger manually:
From your verboice directory:
# bundle exec passenger start -a 127.0.0.1 -p 3000 -d -e production
Restart apache
# sudo apache2ctl restart
==== Monit ====
Add the following script to /etc/monit/conf.d/verboice
in order to manage the verboice web service using Monit.
check process verboice_web
with pidfile /path_to_verboice/tmp/pids/passenger.3000.pid
start "/bin/su - <non-root_user> -c {/path_to_verboice/script/verboice_service.sh -c "'passenger start /path_to_verboice -a 127.0.0.1 -p 3000 -d -e production --pid-file /path_to_verboice/tmp/pids/passenger.3000.pid --log-file /path_to_verboice/log/passenger.3000.log'"}"
stop "/bin/su - <non-root_user> -c {/path_to_verboice/script/verboice_service.sh -c "'passenger stop --pid-file /path_to_verboice/tmp/pids/passenger.3000.pid'"}"
group verboice
Note: Change <non-root_user> to the non-root server user and change /path_to_verboice to the verboice directory.
Also note this script uses the Verboice service runner /path_to_verboice/script/verboice_service.sh
. At the time of writing that script is not pulled into the official repo, so if you need it you can use this fork: https://bitbucket.org/dwilkie/verboice
You can run the asterisk adapter manually:
# cd path_to_verboice
# bundle exec lib/services/verboice_asterisk.rb
==== Monit ====
Add the following script to /etc/monit/conf.d/verboice
in order to manage the verboice asterisk adapter using Monit.
check process verboice_asterisk
with pidfile /path_to_verboice/tmp/pids/verboice_asterisk.pid
start "/bin/su - <non-root_user> -c '/path_to_verboice/script/verboice_service.sh verboice_asterisk_ctl.rb start production'"
stop "/bin/su - <non-root_user> -c '/path_to_verboice/script/verboice_service.sh verboice_asterisk_ctl.rb stop production'"
group verboice
Note: Change <non-root_user> to the non-root server user and change /path_to_verboice to the verboice directory.
Also note this script uses the Verboice service runner /path_to_verboice/script/verboice_service.sh
. At the time of writing that script is not pulled into the official repo, so if you need it you can use this fork: https://bitbucket.org/dwilkie/verboice
Open your browser and go to your.verboice.server
Create a new account Create a new application, click "Applications" -> "Create new application" Enter a name and select "Use a custom flow" Select "Answer", "Say" then "Hangup" Enter some text in the "Say" field e.g. "Hello World" Press "Create Application"
Create a new custom channel, click "Channels" -> "Create new... custom channel" Enter a name for the channel and select the application from the previous step
Download a SIP client such as http://icanblink.com/download.phtml
In Blink add an account with SIP address 1000 and password 1234
Then check the channel id you just created in Verboice e.g. hover over the edit channel link in Verboice and note the channel id.
Dial that channel in Blink, e.g. if the channel id is 1 dial 1. You should hear your application running.
Make sure you add a security rule for UDP port 5060 and TCP port 5061 AND from UDP ports from 10000-20000 for RTP (SIP audio)
Using blink connect to the SIPaddress@your-server and dial the channel