The following notes provide some tips for installing the OpenSIPS Sip Router with PostgreSQL on FreeBSD
For additional tips on using OS X see the "Various Tidbits on Apple Macintosh OS X and OS X Server" page.
So why put OpenSIP on FreeBSD?
I will not argue for merits of the various *nix flavous, but I have been using FreeBSD since version around 1995, when it was distributed via Walnut Creek CD, so it is the easiset of the various *nix flavors for me plus:
The disadvantage of these selections is that much of the available documentation assumes a combination of Linux & MySQL, hence my collection of notes to help others who want to use OpenSIPS on FreeBSD and PostgreSQL.
To build a full OpenSIP installation, including all the modules (with one exception....) and additional adminstration tools requires that you prepare a number of dependent modules.
The following are the headlines items that we will be building (using FreeBSD Ports libraries):
The following instructions provide the instructions and links to help you with your installation.
Install PostgreSQL, Apache (with multi-thread Perl library) & SSL by following the instructions here
Start by building the SSL library and selecting the multi-threaded option, this will ensure that thread support is propogated across, the various Perl,Apache, PostgreSQL and PHP builds.
NOTE 1: When building the Apache Runtime Library I selected support for Berkeley DB (needed later by OpenSIPS), Threads & PostgreSQL. There is no need for other DB support.
NOTE 2: When building Apache 2.4 I removed the dbm authenticaion support as there is no need for this, but included DBD (which uses the APR build before Apache).
The Ports locations are:
Build the libraries needed for a full build of OpenSIPS Proxy.
The modules required are:
The following additional programs are also required to setup up robust SIP proxy solution:
Get OpenSIPS source code via GIT, svn or as a tarball.
I used version current stable release version: 1.10.0
I wanted to build all modules (with exception of the database specific ones).
Easiest way to build the system is to edit: Makefile and Make.conf
To build with TLS support edit Makefile and uncomment out the line:
Based on the libraries included in step 2 above, you can build everything but edit Make.def to exclude the following:
The OSP module can be included if you build the "OSP Toolkit" (OSP - Open Settlement Protocol). I have not managed to get this built (and do not need it so have excluded it).
The other exclusion worthmentioning is sngtc (Sangoma Voice Transcoding Module), which requires special hardware and was introduced with version 1.10 of OpenSIPS Proxy.
You need to use gmake (GNU Make) build tool and as per FreeBSD convention do build to install in /usr/local.
Configure the various services:
1. Edit /etc/rc.conf to start the various daemon on bootup
2. Initiatlise the PostgreSQL database
3. Create the OpenSIPS DB tables
a. Edit opensipsctrc & osipconsolerc to have correct domain and point to the PostgreSQL database (files are in /usr/local/etc/opensips and change DBENGINE=PGSQL and other DBxxx config variables).
b. Run the opensips db control to create the database tables.
c. Change the table, sequence & view owner to pgopensips (in the case where you did not use pgopensips as the creating user within the prior configuration)
NOTE 1: The ownership altering script is from here (with thanks).
[4. Optionally update the missed_calls (this is to maintain capability with the opensips.cfg routing script that is part of the OpenSIPS Live VM (with thanks), which is a good way to start with a working basis routing configuration).
I do this via phpPgAdmin (installed earlier) but the same can be achived via SQL commands:
alter table missed_calls add column caller_id character varying(64) constraint default null;
alter table missed_calls add column callee_id character varying(64) constrain default null;
5. Set up the monit script
Here is my sample which is based the script from the Live VM (with thanks)
6. Setup the opensips.cfg routing script.
Here is my sample, which is based on the script from the Live VM (with thanks)
7. Add opensips start script into /usr/local/etc/rd.d
Here is my simple and minimal opensips script to start/stop opensips proxy running
Install OpenSIPS Control Panel with PostgreSQL support (see here for basic installation steps).
1. Create the admin tables within the opensips database
2. Add admin account
3. Create the CDR Viewer record, but edit the cdrs.pgsql script to change DEFAULT from: '0000:00:00 00:00:00' to '-infinity'.
4. Update /etc/crontab to add the cron jobs
5. Add the monitoring tables (config/tool/system/smonitor/tables.pgsql)
6. Edit the config files..: (config/db.inc.php)
7. Link the opensips control panel /web directory to www/apache34/data/cp
8. Fix nathelper table configuration to point to rtpproxy_sockets
9. Fix fifo socket identifer config for dialog. dispatcher
10.If you want to use the permissions & siptrace tools then you also need to ensure you have loaded the "permissions.so" and "siptrace.so" modules within the opensips.cfg file
Testing the configuration
1. Test that OpenSIPS Control Panel is working and add the domains via the system functions.
2. Add Users via OpenSIPS Control panel
3. Add DialPlan via OpenSIPS Control panel. Note that you must have at least a local call dial plan at minimum to get calls to work.
The OpenSIPS Control panel needs to be changed to allow correct dial plan editing. It is simpler to just use phpPgAdmin and directly edit the dialplan tables within the opensips database. The "attrs" column is where you set the selection of the routing:
'userloc' -- means call is assumed to be internally destined
'pstn' -- direct call to external gateway
All materials are copyright (C) 2011, 2012, 2013 Graphica Software/Dokmai Pty Ltd
Send any questions or comments regarding this
site to info at graphica.com.au
Last Updated: Sunday 30 December, 2013.