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:
- Obtaining Netbeans and the Java Runtime libs
- Obtaining the XMS Java Client Library
- Configuring NetBeans and Building the XMS Java Client Library
- Obtaining a sample XMS Java Client Library application
- Configuring NetBeans and Building the EchoTest Demo
- 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.
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
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
Extract the ZIP folder to a directory called XMSClientLibrary.
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
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
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
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:
If those libraries are not listed, right click on the libraries, Select Add JAR/Folder
Next, select all the files inside the jars folder
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
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
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
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:
- Allocate and intialziethe base XMSClienLibrary Objects
- Wait for an inbound call from either from WebRTC or SIP
- Answer an inbound call
- Save the Caller's URI
- Record for 10 seconds
- Disconnect call
- Make an outbound call to the URI Saved
- Playback the recorded file
- Hangup
- 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
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.
Next, confirm that all the Libraries are present by expanding the Libraries list
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
2.All the jar files located in the XMSClientLibrary\jars directory
Click on the image to view it full size
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
At this point, the demo should be built and inside the dist directory
Click on the image to view it full size
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
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
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
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
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
First published: 01-Nov-2013
Open access: Product rule: open; Page rule: Auto