Thursday, August 27, 2009

Porting openSER 0.9.5 Server on LN2410 baord

About SIP

SIP is an application-layer protocol used to establish, modify, and terminate sessions or multimedia calls. These sessions can be conferences, e-learning, telephony over the Internet, and similar applications.


The SIP protocol supports five features for establishing and closing multimedia sessions.

  • User location: Determines the endpoint address used for communication.

  • User parameters negotiation: Determines the media and parameters to be used.

  • User availability: Determines if the user is available or not to establish a session.

  • Call establishment: Establishes the parameters for caller and callee, and informs on call progress (ringing, ringback, congestion) to both parties.

  • Call management: Session transfer and closing.

SIP Operation Theory

The entire SIP signaling flows through the SIP proxy server. On the other hand, the media signaling, transported by the RTP protocol, flows directly from one endpoint to another.


SIP Entities

  • UAC (user agent client)—Client or terminal that starts the SIP signaling.

  • UAS (user agent server)—Server that responds to the SIP signaling coming from a UAC.

  • UA (user agent)—SIP terminal (IP phone, ATA, softphone).

  • Proxy Server—It receives requests from a UA and transfers them to another SIP proxy if this specific terminal requested is not under its domain.

  • Redirect Server—This receives requests and sends back to the caller including data about the destination, instead of sending directly to the callee.

  • Location Server—This provides the callee's contact addresses to Proxy and Redirect Servers.



Openser-0.9.5 is older version of opensips and is compatible with gcc 2.95 cross compiler used for building the filesystem of LN2410, hence this version is used for porting openser on LN2410 board

Requirements
----------------
a. cross-2.95.3.tar.bz2(gcc cross compiler version 2.95)
b. Openser-0.9.5
c. flex 2.5.33

Flex cross compilation
a. Download flex source code and follow the steps to configure and build the library.
(It is assumed that cross compiler is installed and path is set in shell enviroment.)
tar -zxvf flex-2.5.4a.tar.gz (http://flex.sourceforge.net/)
cd flex-2.5.4
mkdir /home/guest/flex_lib
this folder is used save flex library.
b. ./configure --prefix=/home/guest/flex_lib --build=i686-pc-linux-gnu --host=arm-linux --target=arm-linux CC=arm-linux-gcc
c. Changes in Makefile
CC = arm-linux-gcc
AR = arm-linux-ar
RANLIB = arm-linux-ranlib

d. make prefix=/home/guest/flex_lib all
e. make prefix=/home/guest/flex_lib install

openser-0.9.5 cross compilation

a. download openser-0.9.5 and perform the steps to cross compile and build the executable
tar -zxvf openser-0.9.5_src.tar.gz (http://www.openser-project.org/pub/openser/)
b. Changes in Makefile.def
RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
OS = linux
ARCH = arm
OSREL = 2.6.13.2
#set some vars from the environment (and not make builtins)
CC := arm-linux-gcc
line # 301
DEFS+= $(extra_defs) \
-DNAME='"$(MAIN_NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
-DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"' -D__CPU_$(ARCH) -D__OS_$(OS) \
-DCFG_DIR='"$(cfg-target)"'\
-DPKG_MALLOC \
-DSHM_MEM -DSHM_MMAP\

line# 847
LIBS= -L/home/guest/flex_lib/lib/ -L /lib -lfl -ldl -lresolv
c. mkdir /openser_lib
d. make prefix=/openser_lib skip_modules="mysql" modules
e. make prefix=/openser_lib install
f. copy the /openser_lib to LN2410 filesystem
cp /openser_lib /media/disc/ -rf

g. changes in /etc/openser/openser.cfg

# ----------- global configuration parameters ------------------------

debug=3 # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=no # (cmd line: -E)


check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
port=5060
children=4
fifo="/tmp/openser_fifo"

h. run openser on LN2410
./openser_lib/sbin/openser -m 8
you check the server process using the ps command

Using the server
There are plenty of soft-phone available on the net(e.g ekiga,twinkle) you can select any one of them,install on the PC, for windows user you can use windows messenger client to communicate with other softphone.

Communication can achived in siple steps.
1. Register the Softphones to server.
2. call the other softphone using the uri (sip:2000@192.168.1.103)
note: The server configuration allows registeration is without authentication hence you can register using any user id.

Kermit for Serial communication

Kermit handles both modem and TCP/IP connections,I have used it for serial communication on LN2410,it is simple configure and use compared to minicom.

Download Kermit from below link.
http://www.columbia.edu/kermit/ck80.html#source

To build and install follow the steps below.
1. mkdir Kermit
2. mv /path-tokermit-source/cku211.tar.gz Kermit
3. tar -zxvf cku211.tar.gz
4. make linux
5. make install

create a file ".kermrc" in /root/ folder with the following details and save it.

Contents of ".kermrc" file begins
set line /dev/ttyS0 /* Kermit uses Serial port 0*/
set speed 115200 /* Baud rate on which this operate*/
set carrier­watch off
set handshake none
set flow­control none
robust
set file type bin
set file name lit
set rec pack 1000
set send pack 1000
set window 5

Contents of ".kermrc" file ends

Now connect LN2410 board to PC and type kermit on command line. type connect on command line to get the uboot shell type 'Ctrl' + '\' and 'u' keys to return to kermit prompt

To send a file to LN2410 type 'send /filename' on command promt

Running Telnet daemon on LN2410

The Telnet protocol is one of the simplest ways to log into a remote network host. Consequently, it’s the easiest way to access your target system once it is connected to a network. To enable remote login, your target must run a Telnet daemon. There are two main Telnet daemons available for use in embedded Linux systems: telnetd, which is part of the netkit packages mentioned earlier, and utelnetd, which is maintained by Robert Schwebel of Pengutronix.

The utelnetd package provides a small and efficient stand alone
telnet server daemon. The utelnetd package is small and compact, and
uses less resources than a traditional telnet server daemon, making
it ideal for use on embedded systems, or systems where memory is
limited.

Download utelnet from the link below

http://www.filewatcher.com/m/utelnetd­0.1.6.tar.gz.13869.0.0.html
Extract the Source file from the tarball.
tar ­-zxvf utelnetd­0.1.6.tar.gz

Change the cc option to the cross compiler in the Makefile.
CC = arm­-linux­-gcc
Now compile the file using the make command.

Copy the binaries(utelnetd) to root file system's /bin folder
Now boot the kernel and filesystem up.
Now run the utelnetd server on the board,you can access the board
using the telnet IP Address command from the host PC.


Note:

The Telnet daemon uses pseudoterminal devices, called pty for short,
to provide a terminal for the shell and other programs to run in,
when invoked from the network via this daemon. One of the most common
pitfalls for novice embedded Linux system builders regarding the
Telnet service is to neglect some configuration detail related to
ptys that prevents users from logging in to the system via Telnet.
If the Telnet daemon is running and networking is otherwise working
(you can, for example, ping other hosts), make sure of the following:

The /dev/ptmx exists and that it is a character device file with a
major number of 5 and a minor of 2; if not, create it using the
command:
$ mknod /dev/ptmx c 5 2
• Support for the devpts pseudofilesystem is enabled in the kernel by
looking for the devpts entry in the /proc/filesystems file, or add
the support by turning on the
CONFIG_UNIX98_PTYS Linux kernel build option.
• The /dev/pts directory exists and that the devpts pseudofilesystem
is mounted on it correctly, either by issuing the mount command and
looking for the devpts entry or mounting it using the command:
$ mkdir /dev/pts && mount ­t devpts none /dev/pts