MobicentsSimplePBXExample < Communications < TWiki

TWiki . Communications . MobicentsSimplePBXExample

Simple SIP PBX - An End to End example with Mobicents;


Overview

This end-to-end example will demonstrate Mobicents in the role of a simple PBX, which will connect SIP clients to each other. It will show how two SIP clients can register with the Mobicents server, then locate each other via Mobicents and establish a voice conversation.

Components of this example

This example will involve active interaction between several components: Mobicents SLEE server, JMX Web console, Mobicents SIP RA, and two SIP phones. The following diagram illustrates the participating parties.

Two Phones

One Mobicents Server

The Mobicents server includes a certified JAIN SLEE core engine as well as several extensions such as the SIP Resource Adaptor, SIP registrar service and SIP proxy service.

Mobicents architecture

Mobicents has a very flexible and scalable standards based architecture compliant with JAIN SLEE. The following two diagrams illustrate two alternative views of the architecture:

IP Telephony In the Large

There's two parts to IP Telephony. Call Setup or Signaling and Media. For two phones to communicate, both signaling and media must be standardized. It is important to understand the role of signaling because it is signaling that triggers Services. We will not discuss media in this paper . There are two standardized signaling protocols in wide use in IP Telephony -- SIP and H.323. SIP has gained dominance over H.323 and hence we discuss it here. One should note that the SLEE is able to support a wide variety of signaling protocols including custom protocols such as those used by Asterisk and Skype.

SIP - A HTTP-Like Signaling Protocol

SIP, the Session Initiation Protocol, is a signaling protocol for Internet conferencing, telephony, presence, events notification and instant messaging. SIP was developed within the Internet Engineering Task Force (IETF) MMUSIC (Multiparty Multimedia Session Control) working group, with work proceeding since September 1999 in the IETF SIP working group. SIP is widely deployed. It has been adopted by large coprporations such as Microsoft ( in the MSN Client ) and Cisco and industry consortiums such as 3GPP as the next generation signaling protocol of choice. SIP Can be thought of as a peer to peer adaptation of HTTP / Mail - it borrows headers and mechanisms from these protocols. SIP provides the necessary protocol mechanisms so that end systems and proxy servers can provide services such as call forwarding, personal mobility and terminal capability negotiation. SIP addresses users by an email-like address and re-uses some of the infrastructure of e-mail delivery. SIP addresses (URLs) can also be embedded in web pages.

SLEE

JBoss

Settting up Mobicents

Obtaining, Installing and Starting Mobicents

Follow all of the instructions in the Quick Start Guide for the Eager Contributor, including "How to build and run Mobicents from source code".

Testing the Mobicents server

Make sure that you can see MBeans in the JMX console under the slee domain. To do that, follow these steps:

  1. Point your web browser to http://localhost:8080/jmx-console
  2. In the text box under "ObjectName Filter", enter slee:*
  3. You should see a list of SLEE MBeans. The page should looks like this:

Monitoring the Mobicents console log

Watch the console log. It prints useful information about the behaviour of the server. Most functions of any significance are logged with at least one line and often accompanied by additional information that keeps the status of the server transparent.

Deploying SIP Resource Adaptor

Checkout latest source or package of sip ra 1.2. It contains ra, and sip services. Source can be obtained from svn repo: https://slee-sip-ra.dev.java.net/svn/slee-sip-ra/trunk :

   svn co https://slee-sip-ra.dev.java.net/svn/slee-sip-ra/trunk slee-sip-ra

A package can be donwloaded from here: sf.net

Make sue that everything is set properly, good guide can be found here. Also make sure that env variable MOBICENTS_HOME is set properly. To deploy ra and services simply run ant deployall, this will cause deployment of sip ra and services, console should look like:

$ ant deployall
Buildfile: build.xml

management-init:
     [echo] Mobicents SLEE Management tasks defined

init:

compile-ratype:

compile-ra:

package-ra:
     [copy] Copying 1 file to d:\java\jprojects\slee-sip-ra\stage\ra\META-INF
     [copy] Copying 30 files to d:\java\jprojects\slee-sip-ra\stage\ra
      [jar] Building jar: d:\java\jprojects\slee-sip-ra\stage\sip-resource-adaptor.jar
   [delete] Deleting directory d:\java\jprojects\slee-sip-ra\stage\ra

unit-ra:
     [copy] Copying 1 file to d:\java\jprojects\slee-sip-ra\stage\ra-unit
     [copy] Copying 1 file to d:\java\jprojects\slee-sip-ra\stage\ra-unit\library
     [copy] Copying 1 file to d:\java\jprojects\slee-sip-ra\stage\ra-unit\META-INF
      [jar] Building jar: d:\java\jprojects\slee-sip-ra\stage\sip-local-ra.jar
   [delete] Deleting directory d:\java\jprojects\slee-sip-ra\stage\ra-unit

package-ratype:
     [copy] Copying 1 file to d:\java\jprojects\slee-sip-ra\stage\ratype\META-INF
     [copy] Copying 2 files to d:\java\jprojects\slee-sip-ra\stage\ratype
      [jar] Building jar: d:\java\jprojects\slee-sip-ra\stage\sip-resource-adaptor-type.jar
   [delete] Deleting directory d:\java\jprojects\slee-sip-ra\stage\ratype

package-events:
     [copy] Copying 1 file to d:\java\jprojects\slee-sip-ra\stage\events\META-INF
      [jar] Building jar: d:\java\jprojects\slee-sip-ra\stage\sip-events.jar
   [delete] Deleting directory d:\java\jprojects\slee-sip-ra\stage\events

unit-type:
     [copy] Copying 1 file to d:\java\jprojects\slee-sip-ra\stage\ratype-unit\META-INF
     [copy] Copying 2 files to d:\java\jprojects\slee-sip-ra\stage\ratype-unit
     [copy] Copying 1 file to d:\java\jprojects\slee-sip-ra\stage\ratype-unit\library
      [jar] Building jar: d:\java\jprojects\slee-sip-ra\stage\sip-ra-type.jar
   [delete] Deleting directory d:\java\jprojects\slee-sip-ra\stage\ratype-unit

siprabuild:

deploy:
     [echo] Installing SipRA.
[slee-management] 2007-03-09 17:31:59 org.mobicents.ant.tasks.InstallTask run
[slee-management] INFO: DeployableUnitID[0]
[slee-management] 2007-03-09 17:32:00 org.mobicents.ant.tasks.InstallTask run
[slee-management] INFO: DeployableUnitID[1]
[slee-management] 2007-03-09 17:32:00 org.mobicents.slee.container.management.jmx.SleeCommandInterface invokeOperation
[slee-management] INFO: Loading properties: null
[slee-management] 2007-03-09 17:32:00 org.mobicents.ant.tasks.CreateRaEntityTask run
[slee-management] INFO: No response
[slee-management] 2007-03-09 17:32:00 org.mobicents.ant.tasks.ActivateRaEntityTask run
[slee-management] INFO: No response
[slee-management] 2007-03-09 17:32:00 org.mobicents.ant.tasks.CreateRaLinkTask run
[slee-management] INFO: No response

deployall:

build-sip-proxy-service-jars:
    [mkdir] Created dir: d:\java\jprojects\slee-sip-ra\sip-services\build\sip
      [jar] Building jar: d:\java\jprojects\slee-sip-ra\sip-services\build\sip\registrarsbb.jar
      [jar] Building jar: d:\java\jprojects\slee-sip-ra\sip-services\build\sip\proxysbb.jar
     [copy] Copying 1 file to d:\java\jprojects\slee-sip-ra\sip-services\build\sip
      [jar] Building jar: d:\java\jprojects\slee-sip-ra\sip-services\build\sip\proxyservice.jar
     [move] Moving 1 file to d:\java\jprojects\slee-sip-ra\sip-services\examples
     [echo] SIP Examples Build Dir = ./build/sip

management-init:
     [echo] Mobicents SLEE Management tasks defined

proxy-service-deploy:
[slee-management] 2007-03-09 17:32:01 org.mobicents.ant.tasks.InstallTask run
[slee-management] INFO: DeployableUnitID[2]
     [echo] Proxy Service deployed
[slee-management] 2007-03-09 17:32:01 org.mobicents.ant.tasks.ActivateServiceTask run
[slee-management] INFO: No response
     [echo]  proxy service activated

BUILD SUCCESSFUL
Total time: 4 seconds

Settting up the phones

Obtaining phones

For this example we will use two soft phones - XTen eyeBeam and Microsoft Messenger.

This example has also been tested with regular phones connected to the TCP network via SIP adaptors such as Cisco 186 and Grandstream 486. To learn more about setting up the Cisco adaptor, see the ATA186 manual.

Setting up the first phone

If the settings don�t appear the first time you start , hit the eyeBeam, click the phone GUI with the right button and chose �settings�.

  1. Chose �Add a new SIP Account�;
  2. Enter the info needed in the fields:
  3. At this point your phone should register with Mobicents;

Your eyeBeam setting should look like the ones on the following screenshot:

Setting up the first phone using SJphone

You can download SJphone from here

Follow these steps:

  1. Click on New on Profiles Tab and give Profile name: ivelin Your screen should look like this
  2. Enter the info needed in the fields:

Your SJphone setting should look like the ones on the following screenshot:

Setting up the second phone

Now let's setup Microsoft Messenger (different than MSN Messenger shipping with Windows). It can be downloaded from http://www.microsoft.com/downloads/details.aspx?FamilyID=A8D9EB73-5F8C-4B9A-940F-9157A3B3D774&displaylang=en.

Follow these steps:

  1. Go to SIP settings, Tools/Options/Accounts/SIP.
  2. Choose Configure Settings
  3. Choose UDP
  4. Enter your IP address
  5. Click on OK
  6. Enter "mmsipuser@nist.gov" for Sign-in name
  7. Click OK
  8. Go to File menu, Sign In As: mmsipuser@nist.gov. Click OK.

The mmsipuser should not show online. If MS Messenger brings up an error dialog, then the phone did not register and you will need to troubleshoot.

Your Messenger setting should look like the ones on the following screenshot:

Making the Call

By now you should have two registered SIP phones with Mobicents. If you go to the first phone and dial the address for the second phone, the latter should ring.

Here is how to do it step by step.

  1. In MS Messenger, go to Actions, start Voice Conversation
  2. A dialog may appear with the message "Sorry you have no contacts".
  3. Click on the "Other" tab.
  4. Enter ivelin@nist.gov
  5. Select the SIP service from the drop down menu
  6. Click OK.

After a few seconds the eyeBeam client should begin ringing. Pick up the green hand set and try the voice channel.

You should see something like this on your screen:

mobicents-sip-talk

Analyzing the call

Thanks to the simplicity of the SIP protocol, it is relatively easy to examine the intereaction between the various participating parties in a SIP call. We will use the NIST SIP Trace Vewer to visualize the SIP event sequence.

Using the SIP Trace Viewer

The SIP Trace Viewer is part of the NIST IP Tel project.

The code can be obtained from the Java.net project site: https://jain-sip.dev.java.net/.

There is a good Getting Started page for the viewer. http://snad.ncsl.nist.gov/proj/iptel/src/nist-sip/jain-sip/docs/tools/tracesviewer/README.html

Point the trace viewer to the file debuglog.txt, which can be located in the directory where run.bat (or run.sh) is located. (Yes, this file should be written to the log directory instead. Feel free to submit the patch.)

The trace viewer will generate a diagram, which looks much like a UML sequence diagrams:

Closing remarks

This example demonstrated how Mobicents can be used as a foundation for a simple PBX. Although this is a typical application, it simply scratched the surface of the use cases where Mobicents is applicable. It is intended to show you that it is easy to setup Mobicents for simple applications, however we will leave it to your imagination to explore and innovate with New Generation Intelligent Services (NGIN) on this fine Service Deployment Platform. More documentation on Mobicents, SLEE and SIP can be found at the Mobicents Wiki home.

Where to download the code?

All the code in this example can be downloaded from the public Mobicents CVS repository: https://mobicents.dev.java.net/source/browse/mobicents/

Comments

Comments on how to bind a proxy with an IP other than 127.0.0.1 and change registar from nist.gov as you want Please refer to the pages:
http://forums.java.net/jive/thread.jspa?threadID=16833&tstart=0
http://forums.java.net/jive/thread.jspa?threadID=16625&tstart=0
Changing the file MOBICENTS_HOME/thirdparty/sip-services/src/org/mobicents/slee/services/sip/common/SipConfigImpl.java
String[] getLocalDomainNames () {return new String{host,"nist.gov, "ascc.lucent.com","leon.ascc.lucent.com"};}

For more information:
, please refer to the page:
http://forums.java.net/jive/thread.jspa?threadID=1058&tstart=0

-- IvelinIvanov - 07 Mar 2005

----- Revision r21 - 07 Nov 2007 - 16:55:34 - Main.uwinkler