-
Notifications
You must be signed in to change notification settings - Fork 18
Installing on Elastix 2.3.0 2.4.0
This page is outdated and this might not work with the latest Verboice versions. Please use instructions described here: Install Verboice on Ubuntu 12.04
Follow these steps to get Verboice running on top of Elastix 2.3.0 or 2.4.0 which runs on CentOS 5.7. These instructions assume that you already have Elastix installed and running, and you are able to login as root to run these shell commands. Prerequisites
There are some libraries and packages needed to run Verboice.
Ruby Version Manager is the most convenient way to run the required version of Ruby. First, git package must be installed:
-- wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm -- wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm -- sudo rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm -- yum install git
After that we can proceed with RVM installation:
-- curl -L get.rvm.io | bash -s stable
For more details about RVM setup read: https://rvm.io/rvm/install/.
Now we can install the required version of Ruby:
-- yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison -- reboot -- rvm install 1.9.3
Run these commands to install other Verboice dependencies:
-- yum install mercurial libxml2-devel libxslt-devel mysql-devel curl-devel festival
Also, lame must be installed from sources (it is not available as a package)
-- wget http://sourceforge.net/projects/lame/files/lame/3.98.4/lame-3.98.4.tar.gz -- tar xvfz lame-3.98.4.tar.gz -- cd lame-3.98.4 -- ./configure --prefix=/ -- make -- make install
Login to the MySQL console with the root user and the password set during FreePBX setup:
-- mysql -u root -p
Now run the following commands to create the database for Verboice:
mysql> create database verboice; mysql> create user 'verboice'@'localhost'; mysql> grant all on verboice.* to 'verboice'@'localhost'; mysql> exit
Checkout Source Code
Let's checkout Verboice code:
-- cd /opt -- hg clone https://bitbucket.org/instedd/verboice -r default -- my hg did not have the option -b, so I took the branch url directly -- hg clone -b default https://bitbucket.org/instedd/verboice -- cd verboice (accept rvm security message here) -- rvm gemset create verboice -- bundle install --deployment --path .bundle --without development test -- Here in Gemfile I had to change source 'http://rubygems.org' to httpS, i.e. source 'https://rubygems.org' -- rake assets:precompile -- rvm wrapper 1.9.3@verboice "" bundle
Now edit the database configuration file (config/database.yml) and set the username and password for the production database:
production: adapter: mysql2 encoding: utf8 reconnect: false database: verboice pool: 5 username: verboice password:
Load the database schema: rake db:schema:load RAILS_ENV=production
Edit the file at config/asterisk.yml and change the paths: sounds_dir: /var/lib/asterisk/sounds config_dir: /usr/local/asterisk/etc/asterisk ami_port: 5038 call_manager_port: 19000 agi_use_pipe_separator: true
We will use standalone Passenger to run the web frontend:
-- gem install passenger -- you can download the gem and then use gem install --local path_to_gem/filename.gem -- rvm wrapper 1.9.3@verboice "" passenger
Ensure the log file is accessible by Passenger:
-- touch log/production.log -- chmod 0666 log/production.log
Check if it works fine. It'll probably compile the runtime the first time it runs, let it compile, when it says you can stop Phussion Passenger Standalone, then stop with Ctrl+C:
-- passenger start -e production
If you get the error Could not find passenger (>= 0) amongst, then do cd ..
and then run the command
Get nginx 1.2.4 source code http://nginx.org/download/nginx-1.2.4.tar.gz
Uncompress to /opt/nginx-1.2.4
tar xvfz nginx-1.2.4.tar.gz
yum install pcre-devel
Configure with necessary module (here you'll have to change the local repository of passenger)
Copy /opt/nginx/conf/nginx.conf to nginx.conf.original
Place this Installing Verboice on Elastix 2.3.0 attached to this page changing the values which have
./configure --prefix=/opt/nginx --with-http_ssl_module --with-http_gzip_static_module --with-cc-opt=-Wno-error --with-pcre=./auto/lib/pcre/ --with-zlib=./auto/lib/zlib/ --add-module=/usr/local/rvm/gems/ruby-1.9.3-p385/gems/passenger-3.0.19/ext/nginx
./configure
make
make install
Monit will be used for starting, stopping and monitoring the Verboice processes:
-- yum install monit
Edit the Monit configuration file (/etc/monit.conf) and uncomment these lines:
set httpd port 2812 and use address localhost -- only accept connection from localhost allow localhost -- allow localhost to connect to the server and
Enable monit to start on boot:
-- chkconfig --add monit -- chkconfig monit on
Create a new Monit configuration file for Veboice at /etc/monit.d/verboice with the content:
NOTE: Please check the exact Ruby version and patch level (1.9.3-p194), it might be different by the time of your setup. You need to check rvm list to see the correct level, this time it was 1.9.3-p385
check process verboice-nginx with pidfile /opt/nginx/logs/nginx.pid start "/usr/sbin/nginx" stop "/usr/sbin/nginx -s stop" group verboice
check process verboice-broker with pidfile /opt/verboice/tmp/pids/verboice_broker.pid start "/usr/bin/env BUNDLE_GEMFILE=/opt/verboice/Gemfile /usr/local/rvm/wrappers/ruby-1.9.3-p385@verboice/bundle exec /opt/verboice/lib/services/broker_ctl.rb start -- production" stop "/usr/bin/env BUNDLE_GEMFILE=/opt/verboice/Gemfile /usr/local/rvm/wrappers/ruby-1.9.3-p385@verboice/bundle exec /opt/verboice/lib/services/broker_ctl.rb stop -- production" group verboice
check process verboice-delayed-job with pidfile /opt/verboice/tmp/pids/delayed_job.pid start "/usr/bin/env BUNDLE_GEMFILE=/opt/verboice/Gemfile RAILS_ENV=production /usr/local/rvm/wrappers/ruby-.9.3-p385@verboice/bundle exec /opt/verboice/script/delayed_job start -- production" stop "/usr/bin/env BUNDLE_GEMFILE=/opt/verboice/Gemfile RAILS_ENV=production /usr/local/rvm/wrappers/ruby-1.9.3-p385@verboice/bundle exec /opt/verboice/script/delayed_job stop -- production" group verboice
Create virtual links for sbin -- ln -s /opt/nginx/sbin/nginx /usr/sbin/nginx
Create necessary directories
-- mkdir /opt/verboice/tmp /opt/verboice/tmp/pids
-- chmod ugo+rwx /opt/verboice/tmp
Redo rake in Verboice directory
-- rake assets:precompile
Now restart Monit and start Verboice services:
-- /etc/init.d/monit restart -- monit -g verboice start all
To check if it's running you can do -- monit summary
Some configuration files has to be changed by hand to connect Asterisk with Verboice. Let's add a custom context for Verboice. 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
Now we are ready to set FreePBX to comunicate with Verboice. Create Custom Destination
To do this, in Elastix, Security -> Advanced Settings -> Enable direct access
The user is admin and the password is in /etc/amportal.conf ARI_ADMIN_PASSWORD.
Then go to PBX, -> Unembedded freeBPX
For each Verboice channel we must create a custom destination. For this go to "Tools > Custom Destinations" and add a new destination with the address: "verboice,,1", where is the ID of the channel created in the Verboice interface. Route calls from outside
For calls coming from outside the Asterisk box (FXO or E1 cards for example) go to "Setup > Inbound Routes" and create a route using the Custom Destination created before as the destination of this route. Route calls from inside
For calls generated from inside the Asterisk box (calls made from soft phones) go to "Setup > Misc Applications" and create a new application with any desired feature code number and using the Custom Destination created before as the destination of this application.
install epel repository if don't have it already
yum install fail2ban
nano /etc/fail2ban/filter.d/asterisk.conf
-- /etc/fail2ban/filter.d/asterisk.conf
-- Fail2Ban configuration file
--
--
-- $Revision: 250 $
--
[INCLUDES]
-- Read common prefixes. If any customizations available -- read them from
-- common.local
--before = common.conf
[Definition]
--_daemon = asterisk
-- Option: failregex
-- Notes.: regex to match the password failures messages in the logfile. The
-- host must be matched by a group named "host". The tag "<HOST>" can
-- be used for standard IP/hostname matching and is only an alias for
-- (?:::f{4,6}:)?(?P<host>\S+)
-- Values: TEXT
--
failregex = NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Wrong password
NOTICE.* .*: Registration from '.*' failed for '<HOST>' - No matching peer found
NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Username/auth name mismatch
NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Device does not match ACL
NOTICE.* .*: <HOST> failed to authenticate as '.*'$
NOTICE.* .*: No registration for peer '.*' (from <HOST>)
NOTICE.* .*: Host <HOST> failed MD5 authentication for '.*' (.*)
NOTICE.* .*: Failed to authenticate user .*@<HOST>.*
-- Option: ignoreregex
-- Notes.: regex to ignore. If this regex matches, the line is ignored.
-- Values: TEXT
--
ignoreregex =
--
Modify the [default] ignoreip section and Add the [asterisk-iptables] section to your /etc/fail2ban/jail.conf file (careful that they are in two different places:
--/etc/fail2ban/jail.conf
[DEFAULT]
ignoreip = 127.0.0.1 192.168.0.0/16 10.0.0.0/8 172.16.0.0/16
[asterisk-iptables]
enabled = true
filter = asterisk
action = iptables-allports[name=ASTERISK, protocol=all]
sendmail-whois[name=ASTERISK, dest=dev@ehs.cl, sender=info@ehs.cl]
logpath = /var/log/asterisk/fail2ban
maxretry = 5
bantime = 600
We'll backup the logger.conf file to logger.conf.bak and create a new one
-- /etc/fail2ban/filter.d/asterisk.conf
-- Fail2Ban configuration file
--
--
-- $Revision: 250 $
Reload logger module in Asterisk, asterisk -rx "module reload logger"
Add Fail2ban to the list of startup services, chkconfig fail2ban on
Start Fail2ban, /etc/init.d/fail2ban start
Check if fail2ban is showing up in iptables, iptables -L -v
You should see "fail2ban-ASTERISK" in your iptables output.
Any hackers that try to brute-force your SIP passwords will now be banned after 5 attempts for 600 seconds (see jail.conf if you want to change these values)
Check that postfix is working to send email
Send a test email
echo "Testing" | mail -s "Email from tendo" user@youremailaddress.com
To see the regular and error logs tail -f /var/log/mail.log tail -f /var/log/mail.err
If there's an error you should Check that the appropriate ports are open, port 25 for non-encrypted email, 587 or another for encripted email sudo /usr/sbin/postfix set-permissions sudo chmod -R ugo+rwx /var/spool/postfix
- monit stop all
- ir a la carpeta de verboice (probablemente /opt/verboice)
- hacer "hg pull" para bajar la ultima version
- hacer "hg update" para sincronizar con esa copia bajada
- Si hay errores puede ponerse "hg update --clean"
- Modificar config/verboice.yml poniendo formato de wav
- Modificar config/database.yml poniendo nombre de usuario verboice
- Modificar config/asterisk.yml poniendo sounds_dir: /var/lib/asterisk/sounds
- correr bundle install --deployment --path .bundle --without development test
- correr bundle exec rake db:migrate RAILS_ENV=production ** para ejecutar las migraciones de base de datos, si es que hubo
- monit start all
Voces estan en /opt/verboice/app/models/tts/i_speech_voices.yml
Despues qu