Archive for the ‘Unix area’ Category

OpenSER/OpenSIPS is well known as a robust, powerful SIP server. But one big lack of OpenSER/OpenSIPS is that it doesn’t have a gateway interface to PSTN network. In this case, you’ll have some options. You can use a router with an FXS/FXO card or using Asterisk with Digium cards as a gateway server.

If you’re choosing to use Asterisk with Digium cards as a gateway server, you’ll need to route certain calls destination (such as to PSTN) to this server to be forwarded to PSTN network later. To add a route in OpenSER/OpenSIPS, you can edit openser.cfg or opensips.cfg.

Don’t be afraid editing these files, but don’t forget to always make a backup 😀

Openser.cfg or opensips.cfg consists of four main parts:

Global parameter

This section is used to set common configuration such as logging, debugging, fork

Module loading

OpenSER/OpenSIPS modules will be loaded here

Module parameter

Each module have parameters which will be configured here


Routing section is used to configure routing of incoming SIP messages

Route certain calls will be added in routing section. Because SIP uses INVITE to initiate a call, you’ll need to find this line:

# account only INVITEs

if (is_method(“INVITE”)) {

setflag(1); # do accounting


We will use prefix based routing to difference calls. For example, if you use destination number with prefix of 8 to be routed to Asterisk with IP address, the routing script will be like this:

if (is_method(“INVITE”)) {

if(uri=~”^sip:[8] @*”) {




setflag(1); # do accounting


The function rewritehostport is used to replace the destination host and port of an SIP message header. The uri=~”^sip:[8] @*” will be match to any calls to destination number with prefix of 8 and any SIP server host.

Better try to know more 😀

This is long time draft before being published,,,,

You may known that OpenSIPS is the project continuation of OpenSER, tough Kamailio is said to be closer to OpenSER. But after all, it’s all about taste,,lol 😀

OpenSIPS will be best deployed on Sun machine running Solaris OS to obtain it’s best performance. But installing on Debian or Ubuntu machine will much easier. OpenSIPS modules depend on various package which is hard to get for Solaris. Debian or Ubuntu will be the best OS for installing practice. To get familiar with OpenSIPS, you’ll may need to practice installing too :D.

OpenSIPS is recommended to install with DNS. So that you wouldn’t have a lot of changes to move the system from a machine to another. These steps I’ve used to build a presence system server with TLS enabled. If you don’t need any presence enabled, you may leave mi_xmlrpc, xcap_client, presence, presence_xml, presence_mwi, presence_dialoginfo, pua, pua_bla, pua_mi, pua_usrloc, pua_xmpp,  pua_dialoginfo, and TLS=1 commented.
It’s hard to find a good OpenSIPS installation tutorial, so I try to write these steps which is work for me. Hopefully these steps will help you much 😀

1. sudo apt-get install bison bison++ bisonc++
2. sudo apt-get install flex
3. sudo apt-get install libsctp1
4. sudo apt-get install mysql-server
5. sudo apt-get install libmysqlclient-dev
6. sudo apt-get install libxml2-dev
7. sudo apt-get install libexpat1-dev
8. sudo apt-get install libradius-ng2 libradius-ng-dev
9. sudo apt-get install libcurl3-dev
10. sudo apt-get install libxmlrpc-c3 libxmlrpc-c3-dev
11. sudo apt-get install libperl-dev
12. sudo apt-get install libsnmp-dev
13. sudo apt-get install libconfuse0 libconfuse-dev
14. sudo apt-get install build-essential
15. sudo tar xvfz opensips-1.5.0-tls_src.tar.gz
16. edit opensips-1.5.0-tls/Makefile/
change : #TLS=1
to : TLS=1
remove : – jabber
– cpl-c
– xmpp
– rls
– mi_xmlrpc
– xcap_client
– db_mysql
– presence
– presence_xml
– presence_mwi
– presence_dialoginfo
– pua
– pua_bla
– pua_mi
– pua_usrloc
– pua_xmpp
– pua_dialoginfo
– perl
– snmpstats
– peering
– carrierroute
from : exclude_modules=
17. sudo make
18. sudo make install
19. sudo cp opensips-1.5.0-tls/packaging/debian-etch/opensips.default /etc/default/opensips
sudo cp opensips-1.5.0-tls/packaging/debian-etch/opensips.init /etc/init.d/opensips
20. sudo nano /etc/default/opensips
change : RUN_OPENSIPS=no
21. sudo nano /etc/init.d/opensips
change : DAEMON=/usr/sbin/opensips
to : DAEMON=/usr/local/sbin/opensips
22. sudo chmod +x /etc/init.d/opensips
23. sudo groupadd opensips
sudo useradd -g opensips opensips
24. sudo mkdir /var/run/opensips
sudo chmod 777 /var/run/opensips
25. sudo chmod 777 /usr/local/etc/opensips/
26. sudo apt-get install bind9
27. sudo nano /etc/bind9/named.conf
add : zone “” {
type master;
file “/etc/bind/db.opensips”;

zone “” {
type master;
file “/etc/bind/db.18.14.10″;
28. Create new RR file

sudo nano /etc/bind9/db.opensips
write :

; BIND data file for
$TTL 604800
@ IN SOA (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
29.  Create new RR file

sudo nano /etc/bind9/db.18.14.10
add :

; BIND data file for
$TTL 604800
@ IN SOA (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
30. sudo nano /etc/bind9/named.conf.option
add : recursion no;
in : option { }
31. sudo /etc/init.d/bind9 restart
32. sudo nano /usr/local/etc/opensips/opensipsctlrc
uncomment : #
# DBHOST=localhost
# DBNAME=opensips
# DBRWUSER=opensips
# DBRWPW=”opensipsrw”
# DBROUSER=opensipsro
# DBROPW=opensipsro
# USERCOL=”username”
uncomment and change :
# PID_FILE=/var/run/
to : PID_FILE=/var/run/opensips/
33. sudo mysqladmin -u root password ‘root’
34. sudo opensipsdbctl create
35. sudo nano /usr/local/etc/opensips/opensips.cfg
uncomment : #loadmodule “”
#loadmodule “”
#loadmodule “”

#modparam(“usrloc”, “db_mode”, 2)
#modparam(“usrloc”, “db_url”,
# “mysql://opensips:opensipsrw@localhost/opensips”)

#modparam(“auth_db”, “calculate_ha1”, yes)
#modparam(“auth_db”, “password_column”, “password”)
#modparam(“auth_db”, “db_url”,
# “mysql://opensips:opensipsrw@localhost/opensips”)

comment : modparam(“usrloc”, “db_mode”, 0)
36. sudo nano mysql -u root -p
mysql> GRANT ALL PRIVILEGES ON *.* TO opensips@localhost IDENTIFIED BY ‘opensipsrw’;
mysql> GRANT ALL PRIVILEGES ON *.* TO opensips@ IDENTIFIED BY ‘opensipsrw’;
37. start opensips, choose one of these method:
1. sudo opensipsctl start
2. sudo /etc/init.d/opensips start
38. sudo opensipsctl add 1001 1001

You can use any kind of SIP client you have. These install will be default enable your SIP chat.

Comment me if you have any error on installation. Feel free to try 😀

I have just installed MySQL 5.1.33 sucessfully on my Solaris 10u6 running on Sparc Ultra IIIi machine. Firstly, I tought that newest version of MySQL must be fixed from bugs found before. But, this version comes up with new bugs too,,,LOL 😀

To begin install MySQL, you can download either binary package or tarbal source from here. It’s easier to install binary package, but you’ll feel more free with tarbal source. I prefer binary package first. Download the package and save wherever you like. I usually put additional software source on /opt.

Here are the steps to install:

1. Create mysql user and group

#groupadd mysql

#useradd -g mysql mysql

2. Extract and install the package

#gunzip -d mysql-5.1.34-solaris10-sparc-64bit.pkg.gz

#pkgadd -d mysql-5.1.34-solaris10-sparc-64bit.pkg

You will be asked to create installation directory. Answer with yes to continue installation. The installation process will put the files on /opt/mysql/mysql.

3. You will need to do these command to change file/folders permission

#chown -R mysql:mysql /opt/mysql/mysql

#chown -R mysql:mysql /var/lib/mysql

#chmod -R 550 /opt/mysql/mysql

4. Binary files will be located in /opt/mysql/mysql/bin after installation. Install mysql database with this command


4.  Usually, we start the server with this command

#/opt/mysql/mysql/bin/mysqld_safe –user=mysql &

But, MySQL 5.1.33 has a bug on this. Here the bug is: Installation process put data files on /var/lib/mysql, while default mysqld_safe command will look forward to /opt/mysql/mysql/data/. We can fix this by adding –datadir option. To start the server, the complete command will be like this

#/opt/mysql/mysql/bin/mysqld_safe –user=mysql –datadir=/var/lib/mysql &

5. Don’t forget to create mysql root password

#/opt/mysql/mysql/bin/mysqladmin -u root password ‘your new password’
Actually there are still many bugs in this release. But this one is the most significant one -in my opinion indeed 😀 – that the server will not be running without fixing it.

Comment please 😀

Sign up for PayPal and start accepting credit card payments instantly.

OpenSIPS is implementation of SIP server based on RFC 3261. OpenSIPS is a robust SIP server which has powerful-customized routing engine. OpenSIPS components implemented as modular element which are not depends each other. OpenSIPS is formerly the Openser -Open SIP Express Router. The Openser project stops and continue into two branches: OpenSIPS (Open SIP Server) and Kamailio. Both new projects are mainly has the same components as Openser.

We will discuss Opensips this time -Kamailio next time maybe 😀 .

Opensips will be fits in these scenarios:

  • VoIP service providers (residential)
  • SIP trunking
  • SIP load-balancing
  • SIP front-end (for SIP termination)
  • white-label solutions
  • enterprise services
  • SIP router (LCR for multi GWs)

Opensips can play many roles in VoIP network:

  • SIP registrar server
  • SIP router / proxy (lcr, dynamic routing, dialplan features)
  • SIP redirect server
  • SIP presence agent
  • SIP IM server (chat and end-2-end IM)
  • SIP to SMS gateway (bidirectional)
  • SIP to XMPP gateway for presence and IM (bidirectional)
  • SIP load-balancer or dispatcher
  • SIP front end for gateways/asterisk
  • SIP NAT traversal unit
  • SIP application server

OpenSIPS has much more features compared with another SIP server. Full documentation about OpenSIPS features can be found here. Mainly, these are the OpenSIPS features

  • robust and performant SIP (RFC3261) Registrar server, Location server, Proxy server and Redirect server
  • support for UDP/TCP/TLS/SCTP transport layers
  • IPv4 and IPv6
  • IP Blacklists
  • flexible and powerful scripting language for routing logic
  • management interface via FIFO file and unix sockets
  • authentication, authorization and accounting (AAA) via database (MySQL, Postgress, text files), RADIUS and DIAMETER
  • digest and IP authentication
  • Presence Agent support (many additional integration features)
  • XCAP support for Presence Agent
  • SNMP – interface to Simple Network Management Protocol
  • management interface (for external integration) via FIFO file, XMLRPC or Datagram (UDP or unixsockets)
  • NAT traversal support for SIP and RTP traffic
  • ENUM support
  • PERL Programming Interface – embed your extensions written in Perl
  • Java SIP Servlet Application Interface – write Java SIP Servlets to extent your VoIP services and integrate with web services
  • load balancing with failover
  • modular architecture – plug-and-play module interface to extend the server’s functionality
  • gateway to sms (AT based)
  • multiple database backends – MySQL, PostgreSQL, Oracle, Berkeley, flat files and other database types which have unixodbc drivers
  • XMPP gateway-ing ( transparent server-to-server translation)
  • OpenSIPS can run on embedded systems, with limited resources – the performances can be up to hundreds of call setups per second
  • used a load balancer in stateless mode, OpenSIPS can handle over 5000 call setups per second
  • on systems with 4GB memory, OpenSIPS can serve a population over 300 000 online subscribers

OpenSIPS deal with low resource usage, but still hampered in interconnection to PSTN network. Unlike Digium which give full support to Asterisks as PSTN gateway with Digium cards, OpenSIPS doesn’t have that support yet. But OpenSIPS developer still working hard to make interconnection to PSTN network possible with OpenSIPS.

Let’s hope their work finish soon…  😀

Sign up for PayPal and start accepting credit card payments instantly.

This is the counter for my recent post, LOL… 😀
Nano is one of friendly text editor usually included on most Linux distribution. Nano is not included on Solaris 10 installation -tough you do entire disk install, LOL. But, nano can be installed later manually. These few simple steps will make your nano home 😀 :

1. Go to, choose your Solaris version and machine platform. Machine platform could be x86 or SPARC. Choose the right one

2. Once you choosen your Solaris version and machine platform, you will be entering new page with suitable to your OS and platform

3. Left-click on nano package

4. I assume you use SPARC machine. This is the view after you click on nano package

5. Click on nano package to download it

6. Click on dependencies needed based on the notes above (ncurses, libiconv, libintl, libgcc-3.4.6)

7. Install the dependencies first:

#gunzip -d ncurses-5.6-sol10-sparc-local.gz

#pkgadd -d ncurses-5.6-sol10-sparc-local

#gunzip -d libiconv-1.11-sol10-sparc-local.gz

#pkgadd -d libiconv-1.11-sol10-sparc-local

#gunzip -d libintl-3.4.0-sol10-sparc-local.gz

#pkgadd -d libintl-3.4.0-sol10-sparc-local

#gunzip -d libgcc-3.4.6-sol10-sparc-local.gz

#pkgadd -d libgcc-3.4.6-sol10-sparc-local

8. Finally, install the nano package

#gunzip -d nano-2.0.9-sol10-sparc-local.gz

#pkgadd -d nano-2.0.9-sol10-sparc-local

9. Next, you can’t use your nano yet untill you add your PATH variables

#export PATH=$PATH:/usr/local/bin

This is because nano installation put it’s binary files on /usr/local/bin which Solaris default PATH is not included it in.

Enjoy your nano 😀 !

Sign up for PayPal and start accepting credit card payments instantly.

VI? what do i do with this old-style editor? LOL…don’t underestimate VI. Not because this editor has something special,but this is the only editor i knew included in Solaris installation with no graphical mode. This troublesome editor -confusing in control keys- will be usefull to edit your configuration files. These are usefull vi commands:

* vi filename edit filename starting at line 1
vi -r filename recover filename that was being edited when system crashed

To Exit vi

Usually the new or modified file is saved when you leave vi. However, it is also possible to quit vi without saving the file.
Note: The cursor moves to bottom of screen whenever a colon (:) is typed. This type of command is completed by hitting the <Return> (or <Enter>) key.
* 😡<Return> quit vi, writing out modified file to file named in original invocation
:wq<Return> quit vi, writing out modified file to file named in original invocation
:q<Return> quit (or exit) vi
* :q!<Return> quit vi even though latest changes have not been saved for this vi call

Moving the Cursor

Unlike many of the PC and MacIntosh editors, the mouse does not move the cursor within the vi editor screen (or window). You must use the the key commands listed below. On some UNIX platforms, the arrow keys may be used as well; however, since vi was designed with the Qwerty keyboard (containing no arrow keys) in mind, the arrow keys sometimes produce strange effects in vi and should be avoided.
If you go back and forth between a PC environment and a UNIX environment, you may find that this dissimilarity in methods for cursor movement is the most frustrating difference between the two.
In the table below, the symbol ^ before a letter means that the <Ctrl> key should be held down while the letter key is pressed.
* j or <Return> [or down-arrow] move cursor down one line
* k [or up-arrow] move cursor up one line
* h or <Backspace> [or left-arrow] move cursor left one character
* l or <Space> [or right-arrow] move cursor right one character
* 0 (zero) move cursor to start of current line (the one with the cursor)
* $ move cursor to end of current line
w move cursor to beginning of next word
b move cursor back to beginning of preceding word
:0<Return> or 1G move cursor to first line in file
:n<Return> or nG move cursor to line n
:$<Return> or G move cursor to last line in file

Screen Manipulation

The following commands allow the vi editor screen (or window) to move up or down several lines and to be refreshed.
^f move forward one screen
^b move backward one screen
^d move down (forward) one half screen
^u move up (back) one half screen
^l redraws the screen
^r redraws the screen, removing deleted lines

Adding, Changing, and Deleting Text

Unlike PC editors, you cannot replace or delete text by highlighting it with the mouse. Instead use the commands in the following tables.
Perhaps the most important command is the one that allows you to back up and undo your last action. Unfortunately, this command acts like a toggle, undoing and redoing your most recent action. You cannot go back more than one step.
* u UNDO WHATEVER YOU JUST DID; a simple toggle
The main purpose of an editor is to create, add, or modify text for a file.

Inserting or Adding Text

The following commands allow you to insert and add text. Each of these commands puts the vi editor into insert mode; thus, the <Esc> key must be pressed to terminate the entry of text and to put the vi editor back into command mode.
* i insert text before cursor, until <Esc> hit
I insert text at beginning of current line, until <Esc> hit
* a append text after cursor, until <Esc> hit
A append text to end of current line, until <Esc> hit
* o open and put text in a new line below current line, until <Esc> hit
* O open and put text in a new line above current line, until <Esc> hit

Changing Text

The following commands allow you to modify text.
* r replace single character under cursor (no <Esc> needed)
R replace characters, starting with current cursor position, until <Esc> hit
cw change the current word with new text, starting with the character under cursor, until <Esc> hit
cNw change N words beginning with character under cursor, until <Esc> hit; e.g., c5w changes 5 words
C change (replace) the characters in the current line, until <Esc> hit
cc change (replace) the entire current line, stopping when <Esc> is hit
Ncc or cNc change (replace) the next N lines, starting with the current line, stopping when <Esc> is hit

Deleting Text

The following commands allow you to delete text.
* x delete single character under cursor
Nx delete N characters, starting with character under cursor
dw delete the single word beginning with character under cursor
dNw delete N words beginning with character under cursor; e.g., d5w deletes 5 words
D delete the remainder of the line, starting with current cursor position
* dd delete entire current line
Ndd or dNd delete N lines, beginning with the current line; e.g., 5dd deletes 5 lines

Cutting and Pasting Text

The following commands allow you to copy and paste text.
yy copy (yank, cut) the current line into the buffer
Nyy or yNy copy (yank, cut) the next N lines, including the current line, into the buffer
p put (paste) the line(s) in the buffer into the text after the current line

Other Commands

Searching Text

A common occurrence in text editing is to replace one word or phase by another. To locate instances of particular sets of characters (or strings), use the following commands.
/string search forward for occurrence of string in text
?string search backward for occurrence of string in text
n move to next occurrence of search string
N move to next occurrence of search string in opposite direction

Determining Line Numbers

Being able to determine the line number of the current line or the total number of lines in the file being edited is sometimes useful.
:.= returns line number of current line at bottom of screen
:= returns the total number of lines at bottom of screen
^g provides the current line number, along with the total number of lines, in the file at the bottom of the screen

Saving and Reading Files

These commands permit you to input and output files other than the named file with which you are currently working.

:r filename<Return> read file named filename and insert after current line (the line with cursor)
:w<Return> write current contents to file named in original vi call
:w newfile<Return> write current contents to a new file named newfile
:12,35w smallfile<Return> write the contents of the lines numbered 12 through 35 to a new file named smallfile
:w! prevfile<Return> write current contents over a pre-existing file named prevfile

Sign up for PayPal and start accepting credit card payments instantly.

Few days ago I have been sucessfully Solaris 10u6 on Sun Sparc v240 machine. It takes me few hours to be familiar with the machine.  V240 machine is one which has no graphic adapter (VGA) by its package. You cannot do installation by direct management. But don’t worry. V240 – just like other server machines –  is built up with one ethernet management port. We need one ethernet to RS232 cable to remote this machine using HyperTerminal. Here are the steps:

1. Make sure you have proper ethernet to RS232 cable and one PC/Laptop with RS232 connector

2. Connect the cable to the management port on v240 and another end to the RS232 connector on PC/laptop

3. Turn on the server, turn on HyperTerminal on PC/Laptop

4. Create new connection on HyperTerminal. Enter connection name and choose one icon you like. Choose proper port used by RS232 connection, klik restore default to use default connection preference

5. While the HyperTerminal connecting to the machine, insert Solaris 10 installation DVD to v240 dvd-rom

6. At anytime after HyperTerminal successfull connect to v240,  press ctrl+break

7. Wait ok prompt emerge. OK prompt will looked like this: OK>

8. Enter command for rebooting the machine with installation dvd with this command: boot cdrom

9. Wait until system reboot and search boot sequence to cdrom.

10. Follow installation instruction, use F2 to go to the next screen.

Sign up for PayPal and start accepting credit card payments instantly.