Technical Helpweb

Dialogic® PowerMedia™ Extended Media Server (PowerMedia XMS) - more articles

Getting Started with XMS REST Application Development using Sample XMS Java Client Library

Introduction:

This article will guide you though using the sample XMS Java client library with Dialogic® PowerMedia™ Extended Media Server (PowerMedia XMS) 2.1:

  1. Obtaining Netbeans and the Java Runtime libs
  2. Obtaining the XMS Java Client Library
  3. Configuring NetBeans and Building the XMS Java Client Library
  4. Obtaining a sample XMS Java Client Library application 
  5. Configuring NetBeans and Building the EchoTest Demo
  6. Running the EchoTestDemo


Background:  

The XMS Java Client Library is a sample java client side library for the PowerMedia XMS platform.  The XMS Java Client library can used to develop basic "proof of concept" demos or trialing basic features. This library uses the PowerMedia XMS REST interface and can answer SIP or WebRTC calls.


Procedure: 

Step 1: Obtaining Netbeans and the Java Runtime Libs

The Library provides the project files for the Netbeans compiler; however, another Java development environment  can be used.  For this example, we will show how to use Netbeans 7.2 and the Java Developer Kit (JDK).

Click here to obtain the package containing both the JDK and Netbeans.

 JDK_NETBEANS_Download

 

Note: Select the version that best matches your development system.

If you already have the JDK installed, you can obtain the latest version of NetBeans from this link.

Once downloaded, follow the install wizard and complete the installation.

Step 2- Obtaining the XMS Client Library

This library is available on GitHub at this link.    Once at the site, you can click on the "Download Zip"  button to download the latest snapshot.  

Click on the image to view it full size

 CL Github download page.png

Note: You can use the GitHub Desktop client as well to subscribe or contribute to this project.  Also you can clone the project with Subversion, SSH or HTTP by using this address (https://github.com/Dialogic/XMSClientLibrary.git).

When you click on the link, you will download the file.  For this note, the Documents->GitHub->Dialogic directory was selected.

Click on the image to view it full size

CL Download location.png

Extract the ZIP folder to a directory called XMSClientLibrary.

CL extract.png

Step 3- Configuring NetBeans and Building the Client Library

Run the NetBeans IDE.

Once started, select `Open Project` from the File Menu.

Click on the image to view it full size

NB - Open Project.png

Here you will need to navigate to the location where you uncompressed the XMS Java Client Library.  Inside that directory, you will see a XMSClientLibrary-master directory.  NetBeans should detect the project inside this folder and have the "java" icon on it.  Select it and click `open project`

Click on the image to view it full size

NB - CL project.png

At this point, NetBeans should open the project inside the Project Window on the right navigation panel.

Click on the image to view it full size

NB - CL project list.png

Now that the project is loaded, confirm that the libraries are correctly loaded.  Click on the + next to the libraries folder to see this listing:

NB - CL libs.png

If those libraries are not listed, right click on the libraries, Select Add JAR/Folder 

NB - CL AddJar.png

Next, select all the files inside the jars folder

NB - CL Jars.png

Once all the libraries are in place, the listing should match the libraries listing above.  Now right-click on the project and select Clean and Build. 

Click on the image to view it full size

NB - CL Clean and build.png

After a few seconds, in the lower half of the screen, it should say "Build Successful" in the IDE.log window and "Finished Building XMSClient Library" in the lower left corner.

Click on the image to view it full size

NB - CL Success Build.png

At this point, the XMSClientLibrary is built and the jar file should be located in the dist directory.  This is the lib file that you will need to include in the other sample application

Click on the image to view it full size

 NB - CL Finished.png

 Step 4 - Obtaining a sample Client Library application

There are many sample Client Library applications also available up at the GitHub repository.  You can view the list here.  

For this tutorial  we will be using the simple EchoTest demo.  


This application will:

  1. Allocate and intialziethe base XMSClienLibrary Objects
  2. Wait for an inbound call from either from WebRTC or SIP
  3. Answer an inbound call 
  4. Save the Caller's URI
  5. Record for 10 seconds
  6. Disconnect call
  7. Make an outbound call to the URI Saved
  8. Playback the recorded file
  9. Hangup
  10. Exit

This demo, as well as several others, can be downloaded as a zip file from here.

Once downloaded, extract the contents to the Documents\GitHub\Dialogic\XMSEchoTest directory

Click on the image to view it full size

NB - ET 2 Saved and extracted.png

Step 5 - Configuring NetBeans and Building the Demo  

Open NetBeans and open the XMSEchoTest in the same fashion as above.  

You should see both projects in your listings.

NB - ET 3 Project view.png

Next, confirm that all the Libraries are present by expanding the Libraries list

NB - ET 4 Libs list.png

If the list is empty, you will need to add the libraries.

Note: you will need to obtain the libraries from the XMSClientLibrary above.  

You will need to add

1. The XMSClientLibrary.jar that is located in the dist directory above

Click on the image to view it full size

NB - ET 5 XMSClientLib add.png

2.All the jar files located in the XMSClientLibrary\jars directory

Click on the image to view it full size

NB - ET 6 other Libs add.png



  Once the libraries are added, you can then select the "Clean and Build" similar to the above

Click on the image to view it full size
NB - ET 7 Clean and build.png

At this point, the demo should be built and inside the dist directory

 Click on the image to view it full size

NB - ET 8 exe.png

 

Step 6 - Running the Demo 

There are two ways to run the demos: via the jar file or via the NetBeans IDE.

Setting the Configuration file.

The XMS Java Client Library uses a configuration file to tell the Demo/Library the address for the PowerMedia XMS server.  This configuration file must be updated with the IP address of the PowerMedia XMS server.

For this demo, the file is called XMSConnectorConfig.xml and is located in the root directory for the project

 Click on the image to view it full size

run 2 - Config location.png

To open this file, it is recommended that you right-click the file and select 'edit' otherwise it will likely open in read only mode inside the default web browser.  Any text editor can be used to edit this file.

The setting you will need to change is the IP address located inside the base_url

run 3 - File Edit.png

Once done, save the file.

If you are running from inside the IDE, the files can stay in this location as this is the working directory for the project.

However, if you are going to run directly from the jar file you will need to copy the XMSConnectorConfig.xml and the log4j.properties into the same file location as the jar executable.

Click on the image to view it full size

run 4 - config copy.png

At this point, you are ready to run.  You can run from inside NetBeans by right-clicking on the project and then selecting run.

Click on the image to view it full size

run 1- NB Run.png

At this point, you can dial into the demo; but remember that the demo will exit after a single call.

For SIP, you can use a softphone like LINPhone or Bria to dial into sip:app@<XMS IP Address>

For WebRTC, you can use the sample demo at  <XMS IP Address>:1080/webrtc.html

Product List

Dialogic® PowerMedia™ Extended Media Server 2.1

Legal Note

This document discusses one or more open source products, systems and/or releases. Dialogic is not responsible for your decision to use open source in connection with Dialogic products (including without limitation those referred to herein), nor is Dialogic responsible for any present or future effects such usage might have, including without limitation effects on your products, your business, or your intellectual property rights


See also:
XMSEchoTest - XMS Java Client Library Sample - for REST Application Development
How to create JAXB classes in Client Library using msml xsd file
How to Run the Sample XMS Java Client Library in Eclipse


Feedback

Please rate the usefulness of this page:  
0 - not useful at all
1 - potentially useful
2 - quite useful
3 - very useful
4 - exactly the information I needed     

Please enter a comment about this page:

First published: 01-Nov-2013
Open access: Product rule: open; Page rule: Auto