BEA Weblogic SIP server

Bea server is a old SIP servlet container ie application server which is used to embed control logic in a program . It is supported on jdk1.5 hence the system’s environment variables must match . Otherwise in later stages deploying applications throw class version error .

1. Install Bea Weblogic

2. Follow the Installation steps

Make domain

3. Goto the installation directory . Usually C:/bea/user_projects/mydomain/ .

click on startweblogic.cmd in windows. In case the system is linux run startweblogic.sh script

4. Open Web console on url : http://127.0.0.1:7001/console. Enter username password

default username password weblogic , weblogic .

It can also be customized for example my username and password are altanai , tcs@1234

5.  Make Converged SIP Servlet Application in any editor such as notepad , edit+ etc .

The project structure looks like

Call screening
src
build
src
web
build.xml

The SIP servlet are put side directory structure of src

For example : sample application for Call screening

package com.altanai.voice;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.sip.*;
import javax.servlet.sip.Proxy;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.*;
public class CallScreening extends SipServlet
{
private static SipFactory factory;
private static SipApplicationSession sas;
private static Proxy proxy;
public void init(ServletConfig config) throws ServletException
{
System.out.println(“Call screening SIP servlet initiated”);
super.init(config);
}
protected void doInvite(SipServletRequest req) throws java.lang.IllegalArgumentException,java.lang.IllegalStateException,javax.servlet.ServletException,java.io.IOException
{
System.out.println(“Received an Invite Request”);
if(req.getFrom().toString().indexOf(“alice”)!=-1)
{
req.createResponse(406).send();
System.out.println(“User is blocked”);
}
else
{
req.createResponse(200).send();
System.out.println(“User is not blocked”);
}
}
}

6. Build it with ant . For this go inside the application folder and run ant. Output will either be “failed to build “ or “build successfully” .

The ant  command generates the war file from SIP servlet Web application .

7. Incase of successful build . Add the application to Weblogic web console install section and activate it .

I will demonstrate this process in step by step manner . First  click on “ Lock and Edit “ Button on the left panel . Then goto Install button in the centre area and browser to the location of application war or sar we have build through ant ,

8. We can delete an application in exactly the same way . click on “ Lock and Edit “ Button on the left panel . Then goto the delete button after selecting the radio button alongside the application we want to delete.

8. For enhanced application building we can also refer to sample provided along with bea weblogic . file:///C:/bea/sipserver30/samples/sipserver/examples/src/index.html

SIP Servlets – Develop and Deploy

With this article I will outlines the SIP servlet creation and various call routing logic development.

A simple proxy SIP ser vlet application also has 4 parts

Extension SIP servlet Classand global var declaration

public class VoiceCall extends SipServlet{
	public ServletContext context;
	SipApplicationSession sas;
	public SipFactory factory;
	SipServletRequest incoming;
  	public static final Log log = LogFactory.getLog(VoiceCall.class);

2. Init

public void init(ServletConfig config) {
 	try{
	log.info("Init.");
	super.init(config);

	factory = (SipFactory) getServletContext().getAttribute(
			SipServlet.SIP_FACTORY);
	sas=factory.createApplicationSession();
	context=config.getServletContext();
	context.setAttribute("servlet",this);
	//registerWithBroker();
 	}
 	catch(Exception e){
 		log.info("VoiceCall:27 "+e.toString());
 	}
}

3. doRequest

public void doRequest(SipServletRequest req){
	try{
		if(req.getMethod().equals("INVITE") && req.isInitial()){
		SipServletRequest req2=factory.createRequest(sas,"MESSAGE","sip:ser@100.1.1.15:5061","sip:100.1.1.15:2519");
		req2.setHeader("Type","Query");
		req2.send();
		incoming=req;
	}
	else{
		((CallLeg)req.getSession().getAttribute("CALL_LEG")).transferReq(req);
	}
	}
	catch(Exception e){
		log.info("VoiceCall:39 "+e.toString());
	}
}

4. doResponse

public void doResponse(SipServletResponse res){
	try{
	if(res.getRequest().getMethod().equals("MESSAGE") && res.getContent().equals("OK")){			
	System.out.println("Message Reply Recieved "+ res.getContent());
	SipServletRequest req=factory.createRequest(sas,"INVITE","sip:ser@100.1.1.15:5061","sip:1@100.1.1.15:5070");
	CallLeg leg1=new CallLeg(incoming, factory, log);
	CallLeg leg2=new CallLeg(req, factory, log);
	leg1.state="Invited";
	leg1.otherLeg=leg2;
	leg2.otherLeg=leg1;
	leg2.startCall();
	}
	else
	((CallLeg)res.getSession().getAttribute("CALL_LEG")).transferRes(res);
	}
	catch(Exception e){
		log.info("VoiceCall:44 "+e.toString());
	}
}

Githuhb Repo for Source Code of given applications : https://github.com/altanai/sip-servlets

SIP protocol based Surveillance

Stream media from Surveillance camera into mobile by just calling a particular number. The camera also records movements and send a message to user on suspicious activity . This is a user triggered application for security purpose. If an IP camera is installed in secure zone. The user can run the surveillance application on his smart phone. As IP camera detects any motion, immediately this application sends a SMS and a mail having snapshots of scene before and after the suspected motion. The user can directly go to the URL’s obtained from mail and see the suspected event. In addition to this at any point of time he wants to see the captured media feed from the camera he just needs to give a call to the camera .

SIP Trunking

The SIP Trunking can be implemented to deliver a SIP Trunk connection with  any number of IP-based voice “circuits” to each customer site and enabling the multiple SIP Trunks from different sites that can be grouped together so that different premises for a customer can be linked and interconnected.  It includes the functionality of Call control and number translation

Voice Call continuity

In this use case call is established between two users Bob and Alice using PC, if Bob wants to resume call from his mobile, he needs to run the VCC application on his mobile. Bob resumes the call to Alice through his mobile. The former connection is between PC to PC, Later the connection transfers between PC and mobile

Enhanced Call Screening

The use case implements the screening of many SIP users and the user can enable the feature of Do not Disturb for any particular date, time of the day or day of the week. Also every call made or screened is recorded with timestamp

protected void doInvite(SipServletRequest req) throws java.lang.IllegalArgumentException,java.lang.IllegalStateException,javax.servlet.ServletException,java.io.IOException
{
	String scuser=(String)context.getAttribute("ScreenedUser");
	System.out.println("Screened User:"+scuser);
	SipURI from=((SipURI)req.getFrom().getURI());
	if(from.getUser().equals(scuser))
	{
		req.createResponse(487).send();
		System.out.println("User is blocked");
	}
	else
	{
		Proxy px=req.getProxy(true);
		URI sburi=factory.createURI("sip:<x.x.x.x>:5090");
		px.proxyTo(sburi);
		System.out.println("User is not blocked");
	}
}

Basic Calls creening source code – https://github.com/altanai/sip-servlets/tree/master/CallScreening

Auto Attendant

The use case implements the screening of many SIP users and the user can enable the feature of Do not Disturb for any particular date, time of the day or day of the week. Also every call made or screened is recorded with timestamp

Click To Dial

A supervisor can enable the call between any two registered SIP clients via a web based interface.

Develop JSR 116 – SIP Servlet 1.0 API applications

Moe about JSR 116 – SIP SERVLET 1.0 here

SIP Servlet 1.0 API

  • Built into the Servlet container that also hosts portlets and HTTP Servlets.
  • SIP Servlet API developed under the JCP (Java Community Process) as JSR 116 (Java Specification Request), as a set of neutral interfaces

Servlet Container

  • Environment in which a servlet can exist
  • Loads and initializes a servlet
  • Invokes the appropriate methods when SIP messages arrive

Servlets

  • Class with a service method, compiled into a Servlet Archive File (SAR)

Deployment descriptors

  • XML based file with configuration information
  • message matching rules

Screens

Screenshot making a sip servlet . The project is a SAR file

4
3
2
1

Logical Entity diagram for JSR116 , sip servlet version 1.0

jsr116

SIP Response methods and flows

SIP messages life-cycle process , ie init() , service() , destroy()

Bea Weblogic 

J2EE application server and also an HTTP web server by BEA Systems for Unix, Linux, Microsoft Windows, and other platforms,

Supports Oracle, DB2, Microsoft SQL Server, and other JDBC-compliant databases

WebLogic Server supports WS-Security and is compliant with J2EE 1.4

The most reliable server is no doubt BEA’s WebLogic Application Server. It is the only one which can resist to over 3000 concurrent clients without throwing exceptions.

The WebLogic Server is the most reliable server and complex application server and offers the best support for the real-world applications.

•Although it needs a higher level of understanding of the J2EE concepts, has a complex configuration and is very expensive, this server is the best choice for a secure and fault-tolerant application.

weblogic

BEA WebLogic Server is part of the BEA WebLogic Platform™.

The other parts of WebLogic Platform are :

a) Portal, which includes Commerce Server and Personalization Server   (which is built on a BEA-produced Rete rules engine),

b) WebLogic Integration,

c) WebLogic Workshop, an IDE for Java, and d) JRockit, a JVM for Intel CPUs

Brekeke SIP Server – SIP Proxy, Registrar Server

  • Based on the Session Initiation Protocol (SIP), the Brekeke SIP Server provides reliable and scalable SIP communication platform for Enterprises and Service Providers.
  • Brekeke SIP Server provides functionality of SIP Registrar Server, SIP Redirect Server, and SIP Proxy Server.
  • Brekeke SIP Server is a Stateful Proxy that maintain session status therefore performs optimum processing for call control
brekeke

SOFTPHONES  –  X-LITE AND KAPANGA

xlite
kapanga

A soft phone is a software program for making telephone calls over the Internet using a general purpose computer, rather than using dedicated hardware. Often a soft phone is designed to behave like a traditional telephone, sometimes appearing as an image of a phone, with a display panel and buttons with which the user can interact.

To communicate, both end-points must have the same communication protocol and at least one common audio codec. Many service providers use the Session Initiation Protocol (SIP) standardized by the Internet Engineering Task Force (IETF).

X-Lite is a proprietary freeware VoIP soft phone that uses the Session Initiation Protocol.

Kapanga is a Session Initiation Protocol (SIP) software phone capable of voice, fax, and video over IP communications. As a SIP phone, Kapanga can be used on Voice over IP networks to interact with traditional Public Switching Telecommunication Networks (PSTNs) and future IP-based telecommunication devices. This document explains how to use Brekeke SIP Server with the Kapanga Soft Phone.

SIP Application Development Essentials
SIP Application Development Essentials

Figure depicts a typical setup required for any telecom software developer

Orchestration of IN/IMS services

Open Cloud Service broker orchestrates services, by managing the interactions between the services in a centralized middleware layer. The Open Cloud Service Interaction SLEE (SIS) provides service brokering and service interaction functionality for SS7 and IMS networks. We can orchestrate two services such as Call Screening and find-me follow me (fmfm). The usecase is that when the caller calls callee it will be checked if the callee has screened the caller or not, in case the caller is not screened the second service fmfm will be invoked. If the callee has registered from multiple devices, till the call is not picked all the numbers will be tried

Credit Transfer

The Credit Transfer service enables subscribers to transfer credit from their post-paid or pre-paid account to another subscriber’s pre-paid account. For example, a parent can quickly top-up their child’s balance. The donating subscriber can transfer credit using SMS or a USSD menu, or can call an IVR service. When credit has been transferred both the donating subscriber and the credited subscriber receive an SMS detailing the credit transferred.

Call Request

Enables a pre-paid subscriber with low credit to request a contact to call them. The subscriber uses USSD menus or calls a service number and provides the number of their contact. Additionally, the service may also be automatically offered to subscribers attempting to call with insufficient credit.

The service can either simply send a text message to the contact requesting them to call back, or the service may out-dial and interact with the “called” party, asking them to accept the call charges before setting up the call. The service can be configured for use only by pre-paid customers with a balance below a specified threshold, and may be restricted to send call requests only to on-net destinations.

Toll Free Phone Number

The Free-phone Number application enables enterprise subscribers to provide a free-phone number for their business, so their customers can call them for free from land lines and reduced cost from mobile (depending on local practices).
Calls made to the free-phone number are diverted to the enterprise subscriber’s regular number (or any other number they specify). The enterprise pays for the originating and terminating call charges.

Cloud-based PBX

This service, hosted by the network operator, provides enterprises with PBX functionality without needing equipment to be installed on their premises, with opportunities to buy as a monthly subscription rather than as a capital investment.
PBX functions may include: Call forwarding, call transfer, call pick-up, call hold, call screening, hunt groups, call distribution and call queuing, etc.

Code for SIP servlets  : https://github.com/altanai/sip-servlets

Code for JAINSLEE Applications :  https://github.com/altanai/Jaisnlee

Code for SIP WebRTC : https://github.com/altanai/webrtcmetro