Skip to content
This repository has been archived by the owner on Mar 18, 2022. It is now read-only.

Installationinstructions

spawnazzo edited this page May 11, 2012 · 1 revision

Prerequisites

Open WISP User Management System is currently being developed with Ruby on Rails 2.3.5. Being a RoR application, it can be deployed using any of the methods Rails supports. Even so, what we are currently using (and find quite stable) is the following environment:

Downloading

At present time the only way to download Open WISP User Management System is to check out its svn repository

svn co https://spider.caspur.it/svn/owums/trunk owums

Installation

First of all, you should follow the generic "RailsInstallationInstructions":http://openwisp.it/wiki/ow/RailsInstallationInstructions (skip them if you are familiar with rails application deployment).

Once deployed using your favourite environment, you need to configure two deamons Open WISP User Management System needs to perform its usual activities (mainly managing incoming phone calls and deleting users when the registration procedure times out).

To do this, you can use the following @init.d@ script (customization may be needed, this script was coded for @Ubuntu 10.04@).

Startup script

The following script (Ubuntu/Debian style) should be named @owums-daemons@. It assumes Open WISP User Management System is running on @ruby enterprise@ and that the application was deployed to @/var/rails/owums@. Of course you can change any of that to whatever fits your needs.

#!/bin/sh
### BEGIN INIT INFO
# Provides:          owums-daemons
# Required-Start:    $local_fs $network  
# Required-Stop:     $local_fs $network 
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starting owums-daemons
# Description:       Starting owums-daemons
### END INIT INFO#

########## Variables for openwisp-daemons ##########

# The directory in which all the various OpenWisp
# applications are deployed. Generally it's /var/www
# or /var/rails
OPENWISP_BASE_PATH="/var/rails"

# The daemon you wish to start with this script
# (it must have already been deployed of course).
OPENWISP_APP="owums" 

# The Rails environment in which the script must be run.
# It will almost always be set to production.
RAILS_ENV="production" 

####################################################

export PATH RAILS_ENV

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

bundle_exec() {
  cd $1 && bundle exec $2
  return $?
}

openwisp_daemons_start() {
  bundle_exec $OPENWISP_BASE_PATH/$OPENWISP_APP 'rake daemons:start'
}

openwisp_daemons_stop() {
  bundle_exec $OPENWISP_BASE_PATH/$OPENWISP_APP 'rake daemons:stop'
}

openwisp_daemons_restart() {
  bundle_exec $OPENWISP_BASE_PATH/$OPENWISP_APP 'rake daemons:restart'
}

openwisp_daemons_status() {
  bundle_exec $OPENWISP_BASE_PATH/$OPENWISP_APP 'rake daemons:status'
}

case "$1" in
  start)
    log_daemon_msg "Starting OpenWISP daemon" "$NAME" 
    openwisp_daemons_start
    RET="$?" 
    log_end_msg $RET
    return $RET
    ;;
  stop)
    log_daemon_msg "Stopping OpenWISP daemon" "$NAME" 
    openwisp_daemons_stop
    RET="$?" 
    log_end_msg $RET
    return $RET
    ;;
  restart)
    log_daemon_msg "Restarting OpenWISP daemon" "$NAME" 
    openwisp_daemons_restart
    RET="$?" 
    log_end_msg $RET
    return $RET
    ;;
  status)
    openwisp_daemons_status
    RET="$?" 
    return $RET
    ;;
  *)
    echo "Usage: /etc/init.d/$NAME {start|stop|restart|status}" >&2
    exit 1
    ;;
esac

exit 0

As usual, you need to

chmod +x owums-daemons
/etc/init.d/owums-daemons start

and enable the script to be run at boot (e.g.: with the @update-rc.d@ command).

Logs rotation

To enable the rotation of logs it is possible to use following @logrotate@ script (it could be saved as @/etc/logrotate.d/rails@).

/var/rails/*/log/*.log {
	weekly
	missingok
	rotate 52
	compress
	delaycompress
	notifempty
  copytruncate
## It's possible to use the following macros instead of the "copytruncate" option
#	create 660 root www-data
#	sharedscripts
#  postrotate
#    if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
#      /etc/init.d/apache2 reload > /dev/null
#    fi
#    /etc/init.d/owums-daemons restart
#  endscript
}

Media gateway OR SIP proxy/router configuration

The final step is to configure the telephone number your users will use to register themselves. You'll have to create a "static routing" between a PSTN number and Open WISP User Management System voip client (which is called "sip busy machine").

There are many ways for doing this (see below). in every case you'll need to configure the Open WISP User Management System as follow (I'm assuming you're running Open WISP User Management System in production environment):

~# <owums root>/script/console production
Loading production environment (Rails 2.3.5)
>> Configuration.set("verification_numbers", "<TELEPHONE NUMBER>")
>> Configuration.set("sip_listen_address","0.0.0.0")
>> Configuration.set("sip_servers", "<SIP MEDIAGATWAY/PROXY/SERVER IP ADDRESS>")

With OWUMS' current version, instead of using the console, you can also change OWUMS' configuration keys from the admin Operator panel (with url operator/login).

Then restart Open WISP User Management System sip busy machine (for instance with the supplied @init.d@ script)

Now a media gateway or a SIP proxy/router should be properly configured. There are many different softwares or appliances that will do the job. Here follows some examples:

h4. Configuring a Patton Smart Node

A configuration example for the Patton Smart Node is the following:

context cs switch

[...]

 routing-table called-e164 from_pstn_rtable
   route [...]
   route <TELEPHONE NUMBER> dest-interface OWUMS

[...]

 interface sip OWUMS
   bind gateway sip_gw
   route call dest-table drop_rtable
   remote <OWUMS server IP address>

[...]

gateway sip sip_gw
 bind interface LAN router

[...]

Configuring Opensips

If you have a working sip proxy/router like Opensips, it's sufficient to add a permanent user location like so:

opensipsctl ul add <TELEPHONE NUMBER OR SUFFIX> <OWUMS SIP URI>

For instance, assuming owums is running on the host with IP address 192.168.100.100

opensipctl ul add 123 sip:123@192.168.100.100

Configuring SipX

Another sip proxy/router could be SipX. In this case you have to configure something more. We'll use an ITSP phone number, so (i'm assuming you're running a working installation of Sipx) in Devices -> Gateway add a new Sip Trunk and fill:

Name, choose a template or insert the ITSP Address then apply
In ITSP Account -> Username and Password

Now Send Profile and restart the related Services, check the registration status in Diagnostic -> Internal SBC Statistics. Create a New User with the ITSP phone number as User ID (to enable DID) and add a new rule in Call Forwarding to forward after 1 second all incoming calls to "ITSPnum@owumsIP". Uncheck the Voice Mail box in Permissions.

Configuring Audiocodes Mediant 1000

Using the GUI:

  • Go to "Configuration" -> "Protocol Configuration" -> "Routing Table" and select "Tel to IP routing"
  • Insert a new route with appropriate values (destination phone prefix, destination IP address, etc.)