tag:blogger.com,1999:blog-46709643551478264802024-03-05T07:15:40.096+00:00Alexandre MendonçaAlexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-4670964355147826480.post-81694063423203235762013-02-05T10:33:00.000+00:002013-02-05T10:33:25.568+00:00SCTP Support in Mobicents Diameter 1.5.0.FINAL!Mobicents Diameter 1.5.0.FINAL has been released last week (<a href="http://goo.gl/V1GhM" target="_blank">announcement</a>) and as it's main highlight is the addition of Stream Control Transmission Protocol (SCTP, <a href="http://tools.ietf.org/html/rfc2960" target="_blank">RFC 2960</a>).<br />
<br />
SCTP was designed to transport PSTN signaling messages over IP Networks, but become a general purpose protocol. It brings features from both UDP and TCP protocols with important additions. The two main improvements over traditional transport protocols are:<br />
<ul>
<li><b>Multi-homing</b>: instead of a single IP:port connection, an SCTP connection can make use of several IP addresses, if available at the endpoint, providing physical interface fault tolerance and higher availability.</li>
<li><b>Multi-streaming</b>: While in TCP if there's a loss at the head of line, all subsequent packets must be delayed until a re-transmission (Head-of-Line Blocking), SCTP supports multiple streams (up to 64K) each one with it's own ordering, not causing a delay in other streams when there are losses.</li>
</ul>
<div>
It also provides many other interesting improvements (SYN-flood protection, preserved message boundaries, built-in heartbeat, etc.) that make SCTP a great transport protocol!<br />
<br />
The integration of SCTP in Mobicents Diameter Stack was a contribution from <a href="http://www.smilecoms.com/" target="_blank">Smilecoms</a> with the Mobicents team support and by using the <a href="http://code.google.com/p/sctp/" target="_blank">Mobicents SCTP Library</a>. The requirements for using it are an operating system which supports SCTP (either natively or through third-party libraries) and JDK7.
<div><br/></div></div>
<div>
You can enable it in Mobicents Diameter by adding the following to your jdiameter-config.xml:
<br />
<pre class="brush: xml; highlight: [7,8,17,18,19]"><?xml version="1.0"?>
<Configuration xmlns="http://www.jdiameter.org/jdiameter-server">
...
<Network>
<Peers>
...
<-- For SCTP we have to add portRange, a port range to use for establishing connections -->
<Peer name="aaa://127.0.0.1:1218" portRange="25000-35000" attempt_connect="false" rating="1" />
...
</Peers>
...
</Network>
...
<Extensions>
<-- Set SCTP classes as extension points for Connection and Network Guard -->
<Connection value="org.jdiameter.client.impl.transport.sctp.SCTPClientConnection" />
<NetworkGuard value="org.jdiameter.server.impl.io.sctp.NetworkGuard" />
</Extensions>
</Configuration>
</pre>
<br />
So, as you see in line 8, there's a new parameter that has to be added to the peer definition, which is the portRange. Such parameter is also available for TCP but it's usage is optional, while for SCTP it is mandatory as there's no wildcard value for picking any available port.<br />
<br />
At lines 18 and 19, it's the extension point definition, so the stack uses SCTP connection client and Network Guard instead of the default TCP.<br />
<br />
This is it.. as simple as it gets! Hope to get some feedback on this first version of Mobicents Diameter SCTP support. Feel free to leave comments on this post or at the <a href="http://code.google.com/p/jdiameter/issues/detail?id=2" target="_blank">feature issue</a>.<br />
<br />
Also, make sure to check all the other enhancements in Mobicents Diameter 1.5.0.FINAL!</div>Alexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com9tag:blogger.com,1999:blog-4670964355147826480.post-53040433474951463812012-12-17T12:03:00.000+00:002012-12-17T12:03:06.034+00:00Build your own Mobicents Dashboard in 15 Minutes!<p>
The Mobicents suite is growing everyday, from the early days of the initial JAIN SLEE container project, a lot of new fronts have been going on, such as SIP Servlets, Diameter Stack, Media Server, SS7 Stack, Restcomm, etc.
</p>
<p>
With such a vaste suite of projects, the need for common management and monitoring tools is a major concern we have been facing, as each project having it's own set of tools is not a optimal solution. At least a common framework/interface is desired.
</p>
<p>
JMX is a standard for monitoring and managing JVMs, but it's connector uses RMI, which is not the sexiest protocol these days. In that sense, we have searched for a JMX <=> HTTP bridge to use a REST-like protocol as a frontend to the JMX server. This brought us to <a href="http://www.jolokia.org/">Jolokia</a>. With such bridge, we can easily extend our choices of management frameworks outside Java. Plus, it brings many other goodies, such as being firewall friendly (HTTP is allowed anywhere), security (filter what is accessible), support for bulk requests, etc.
</p>
<h4>
Installing Jolokia </h4>
Jolokia is very simple to install in the JBoss AS container:
<br />
<ol>
<li>Download Jolokia from <a href="http://www.jolokia.org/download.html">here</a>. Select the binary package.</li>
<li>Extract the zip file.</li>
<li>Copy the jolokia.war from the <i>agents</i> sub-directory to your JBoss AS deploy directory.</li>
<li>If the JBoss AS is not running already, start it.</li>
</ol>
<br />
You should now be able to issue HTTP requests to Jolokia agent. Using <a href="http://curl.haxx.se/">curl</a> (or pointing your browser to the URL), you can do:<br />
<pre class="brush: bash; gutter: false;">$ curl http://localhost:8080/jolokia/read/java.lang:type=Memory/HeapMemoryUsage/used
{"timestamp":1355453720,"status":200,"request":{"mbean":"java.lang:type=Memory","path":"used",
"attribute":"HeapMemoryUsage","type":"read"},"value":310667560}
</pre>
<p>
This is how we read a value, returned in a JSON format, using Jolokia REST API. The format used is the following: <i><base-url>/read/<mbean name>/<attribute name>/<inner path></i>. You can learn more reading the <a href="http://www.jolokia.org/reference/html/index.html">Jolokia Reference Manual</a>.
</p>
<p>
So, now that we have this working, lets make some good use of it. Graphs are the best way to show this data over time. Looking for a good JavaScript graphs library, there are several options such as <a href="https://developers.google.com/chart/">Google Chart Tools</a>, <a href="http://www.highcharts.com/">HighCharts</a>, <a href="http://www.jqplot.com/">jqPlot</a>, <a href="http://yuilibrary.com/yui/docs/charts/">YUI Charts</a>, etc. For this demo we will be using HighCharts. It is not completely free, but it is a very good and feature rich chart library, plus there's this <a href="nurkiewicz.blogspot.com/2011/03/jolokia-highcharts-jmx-for-human-beings.html">great article</a> by <a href="http://nurkiewicz.blogspot.com/">Tomasz Nurkiewicz</a> to help us getting started.
</p>
<p>
So, let's start to build our dashboard. Create an HTML file in your favorite editor and, here we go:
</p>
<pre class="brush: js; html-script: true;">
<html>
<body>
<div id="chart" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.js"></script>
<script src="http://jolokia.org/dist/1.0.6/js/jolokia.js"></script>
<script src="http://jolokia.org/dist/1.0.6/js/jolokia-simple.js"></script>
<script src="http://code.highcharts.com/highcharts.src.js"></script>
<script id="source" language="javascript" type="text/javascript">
$(document).ready(function() {
var jolokia = new Jolokia("http://localhost:8080/jolokia");
var chart = new Highcharts.Chart({
chart: {
renderTo: 'chart',
defaultSeriesType: 'spline',
events: {
load: function() {
var series = this.series[0];
setInterval(function() {
var x = (new Date()).getTime();
var memoryUsed = jolokia.getAttribute("java.lang:type=Memory", "HeapMemoryUsage", "used");
series.addPoint({
x: new Date().getTime(),
y: parseInt(memoryUsed)
}, true, series.data.length >= 50);
}, 1000);
}
}
},
title: {
text: 'HeapMemoryUsage'
},
xAxis: {
type: 'datetime'
},
yAxis: {
title: { text: 'HeapMemoryUsage' }
},
series: [{
data: [],
name: 'Used Memory'
}]
});
});
</script>
</body>
</html>
</pre>
<p>
These 50 lines of HTML/JavaScript code already produce a very nice chart:<br />
<img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJKh5GjiNd_lweyKpaj6Il7SUr1txD3pYhLFizZohtpklKvA_KtzWKOOS4h7fvPpYqWpl3Mws-8OfnOV8ab1R2RyK4dWmjSmxy8gTCPdMiLiJIEcvGT8rM56Ih3EO4_QdGpPhvAwZX7_8/s1600/simple-chart.png" />
</p>
<p>
This is as easy as it gets! We may now add a lot of other extras, make it more generic to handle several charts, several data sources per chart, make use of jQuery UI Sortable to make a portlet-like dashboard, where it is possible to group and arrange those charts as desired, etc. Ready? Let's go!
</p>
<pre class="brush: js; html-script: true;">
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/black-tie/jquery-ui.css"/>
<style>
.column { width: 400px; float: left; padding-bottom: 10px; }
.portlet { margin: 0 1em 1em 0; }
.portlet-header { margin: 0.3em; padding-bottom: 4px; padding-left: 0.2em; }
.portlet-header .ui-icon { float: right; }
.portlet-content { padding: 0.4em; }
.ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; height: 238px !important; }
.ui-sortable-placeholder * { visibility: hidden; }
</style>
</head>
<body style="background-color: #EEE; font-family: Verdana; font-size: small;">
<!-- The template to be used for new portlets -->
<div style="display: none;">
<div class="portlet ui-widget-content ui-helper-clearfix ui-corner-all" id="portlet-template" style="">
<div class="portlet-header ui-widget-header ui-corner-all">
<span class='ui-icon ui-icon-minusthick'></span>
<span class="title"> </span>
</div>
<div class="portlet-content"></div>
</div>
</div>
<div><h2 style="text-align: center;">.:[ MOBICENTS DASHBOARD ]:.</h2></div>
<hr />
<div id="charts" class="column" /></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.js"></script>
<script src="http://jolokia.org/dist/1.0.6/js/jolokia.js"></script>
<script src="http://jolokia.org/dist/1.0.6/js/jolokia-simple.js"></script>
<script src="http://code.highcharts.com/highcharts.src.js"></script>
<script id="source" language="javascript" type="text/javascript">
$(document).ready(function() {
jolokia = new Jolokia({url: "http://localhost:8080/jolokia", fetchInterval: 1000});
var factory = new JmxChartsFactory();
factory.create([
{
type: 'read',
name: 'org.mobicents.slee:name=EventRouterStatistics',
attribute: 'AverageEventRoutingTime'
}
]);
factory.create([
{
type: 'read',
name: 'org.mobicents.slee:name=EventRouterStatistics',
attribute: 'ActivitiesMapped'
}
]);
executors = []
numExecutors = jolokia.getAttribute("org.mobicents.slee:name=EventRouterConfiguration","EventRouterThreads");
for (var i = 0; i < numExecutors; i++) {
executors[i] = {
type: 'exec',
name: 'org.mobicents.slee:name=EventRouterStatistics',
operation: 'getAverageEventRoutingTime(int)',
args: [i]
}
}
factory.create(executors);
factory.create([
{
type: 'read',
name: 'java.lang:type=Memory',
attribute: 'HeapMemoryUsage',
path: 'committed'
},
{
type: 'read',
name: 'java.lang:type=Memory',
attribute: 'HeapMemoryUsage',
path: 'used'
}
]);
factory.create(
{
type: 'read',
name: 'java.lang:type=OperatingSystem',
attribute: 'SystemLoadAverage'
}
);
factory.create(
{
type: 'read',
name: 'java.lang:type=Threading',
attribute: 'ThreadCount'
}
);
});
function JmxChartsFactory(keepHistorySec, pollInterval, columnsCount) {
var series = [];
var monitoredMbeans = [];
var chartsCount = 0;
// if not given a value for number of columns, use what fits.
columnsCount = columnsCount || Math.floor($(window).width()/$(".column").width());
// poll interval, defaults to 1000ms
pollInterval = pollInterval || 1000;
// how many data points to show in the graphs, defaults to 30
var keepPoints = (keepHistorySec || 30) / (pollInterval / 1000);
setupPortletsContainer(columnsCount);
setInterval(function() {
pollAndUpdateCharts();
}, pollInterval);
this.create = function(mbeans) {
mbeans = $.makeArray(mbeans);
series = series.concat(createChart(mbeans).series);
monitoredMbeans = monitoredMbeans.concat(mbeans);
};
function pollAndUpdateCharts() {
var requests = prepareBatchRequest();
var responses = jolokia.request(requests);
updateCharts(responses);
}
function createNewPortlet(name) {
return $('#portlet-template')
.clone(true)
.appendTo($('.column')[chartsCount++ % columnsCount])
.removeAttr('id')
.find('.title').text((name.length > 50 ? '...' : '') + name.substring(name.length - 50, name.length)).end()
.find('.portlet-content')[0];
}
function setupPortletsContainer() {
var column = $('.column');
for(var i = 1; i < columnsCount; ++i){
column.clone().appendTo(column.parent());
}
$(".column").sortable({
connectWith: ".column"
});
$(".portlet-header .ui-icon").click(function() {
$(this).toggleClass("ui-icon-minusthick").toggleClass("ui-icon-plusthick");
$(this).parents(".portlet:first").find(".portlet-content").toggle();
});
$(".column").disableSelection();
}
function prepareBatchRequest() {
return $.map(monitoredMbeans, function(mbean) {
switch(mbean.type) {
case 'read':
return {
type: mbean.type,
opts: mbean.args,
mbean: mbean.name,
attribute: mbean.attribute,
path: mbean.path
};
break;
case 'exec':
return {
type: mbean.type,
arguments: mbean.args,
mbean: mbean.name,
operation: mbean.operation,
path: mbean.path
};
break;
}
});
}
function updateCharts(responses) {
var curChart = 0;
$.each(responses, function() {
var point = {
x: this.timestamp * 1000,
y: parseFloat(this.value)
};
var curSeries = series[curChart++];
curSeries.addPoint(point, true, curSeries.data.length >= keepPoints);
});
}
function createChart(mbeans) {
return new Highcharts.Chart({
chart: {
renderTo: createNewPortlet(mbeans[0].name),
height: 200,
defaultSeriesType: 'spline',
},
title: { text: null },
xAxis: { type: 'datetime' },
yAxis: { title: { text: mbeans[0].attribute || mbeans[0].operation } },
legend: {
enabled: true,
borderWidth: 0
},
credits: {enabled: false},
series: $.map(mbeans, function(mbean) {
return {
data: [],
name: mbean.path || mbean.attribute || mbean.args
}
})
})
}
}
</script>
</body>
</html>
</pre>
<p>
A bit more of code than previously, but with this we added 6 different graphs, some with more than one data series, we added portlet behavior... in my opinion, it is still quite simple for the output we get of it:
</p>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOazXPTWRYjGKPy7BNc3QqDjt6j1RhkuF1UKJe5kX4WIXGNqOYDVP1IN84Yv93RDNSo8kKEhRloe7V2ovdN9lzYWIeYroAcNtY-ezAjsWax7xcUyUxdYf1-JIPy7T-TRS8lgDUtVItx7Y/s1600/dashboard.png" imageanchor="1" style=""><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOazXPTWRYjGKPy7BNc3QqDjt6j1RhkuF1UKJe5kX4WIXGNqOYDVP1IN84Yv93RDNSo8kKEhRloe7V2ovdN9lzYWIeYroAcNtY-ezAjsWax7xcUyUxdYf1-JIPy7T-TRS8lgDUtVItx7Y/s670/dashboard.png" /></a>
<p>
Is it cool or what? And all of this in a single static html file. Personally, I love it.
</p>
<p>
And this is the way we are heading with Mobicents Monitoring and Management... adding some extras such as thresholds with some kind of alarms/notifications, more customization like easily adding/removing charts at runtime through web interface, add some persistence to remember history and preferences, and many more to make this a solid tool to keep your Mobicents suite under control!
</p>
Alexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com2tag:blogger.com,1999:blog-4670964355147826480.post-966433993619498882012-08-18T01:55:00.000+01:002012-08-18T01:56:46.385+01:00Mac OSX / Terminal Tip : Naming your terminal windows and tabsI'm a huge fan for those little tips that can save you some time and frustration.<br />
<div>
<br /></div>
<div>
Recently working with several terminal windows and tabs, I've been finding myself wandering around them to find the right terminal where I wanted to land on. All added up, it was a significant penalty in my "performance" and, even worse, made me mad!</div>
<div>
<br /></div>
<div>
I was already using different color schemes for the different terminal windows, by contexts, so I could quickly identify what was in each terminal once I see it. But since having 6+ terminal windows and colors is not practical, I group some in the same window, again, by context.</div>
<br />
<div>
<div style="margin-left: 1em; margin-right: 1em;">
<img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjr8YJSA4BzF4vwaIVBruk3Dsly70nkdBlYK8mH9WaWMnXfGVSosiIafGF-aytKZWOSlWGW88v9yt3HyjcZhzKmwmqHDEKx6Bo3ysjRlOM02gw3NcnzKNL75sIhVSh3fOS68yuZAVc_5gA/s1600/untitled_terminals.png" /></div>
<br />
I've decided to look for a way to name the terminal window and/or tabs so I can quickly get to the one I needed. It's actually quite simple, just type (in the desired terminal tab):</div>
<span style="font-size: large;"><pre class="brush: js">echo -n -e "\033]0;Your Title Goes Here\007"</pre></span>
<div>
et voilà! Precious time saved!<br />
<br />
<div style="margin-left: 1em; margin-right: 1em;">
<img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiSbZG5wpVoiYi8Vp68CdpDOr2DX75ADgJgg_ilptM73_9aejt0tSGVU-Kn2hBO6pamWSwE-lrVfZ968pn5brgZugqCvAgDaPIYogc-2quTXL8OlidOxlnGaM3_05eMc7sAUooR5Tv3aE/s1600/titled_terminals.png" /></div></div>Alexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com2tag:blogger.com,1999:blog-4670964355147826480.post-58761226389696660172012-07-04T01:12:00.001+01:002012-07-04T12:41:17.037+01:00Mobicents Diameter has a new home.. powered by git!Due to the increasingly number and complexity of sub-projects, Mobicents has been splitting it's projects under independent project homes.<br />
<br />
We are now at a transition stage, where each project lead will migrate his project at the appropriate time. For Diameter, after our major release (1.4.0.FINAL), it seemed the best time to do this migration.<br />
<br />
The new home of the Mobicents Diameter project is located at <a href="http://code.google.com/p/jdiameter/">http://code.google.com/p/jdiameter/</a>. Feel free to visit us!<br />
<br />
With this change, we have also taken the chance to move to a "better" and more powerful version control system, so we have changed from SVN to Git. We hope this will ease the contributions, which have been happening more often, thanks to out thriving community!<br />
<br />
Despite being a allegedly better VCS, Git also has it's own shortcomings, such as not being able to checkout a single folder. The lack of this feature has impacted our structure, since it makes it impossible to independently release sub-components in the same Git repository.<br />
<br />
While digging for a solution, I've came across the "sparse checkout" feature. While this may work for checking out only some folder(s), it is not supported by maven release plugin, thus not fixing the main problem. Another possible (and probably more correct) solution would be to use the "sub-repository" approach, where we'd split the components into different sub-repositories.<br />
<br />
We actually did this on a first phase, but after realizing the big changes it would imply and being aware that google code messes with the automatic revision links (<a href="http://code.google.com/p/support/issues/detail?id=3245">http://code.google.com/p/support/issues/detail?id=3245</a>) we have decided to revert back to the single repository approach and abdicate from the release independency for each component. We have barely used it, anyway. The only exception is for the <strike>Jopr</strike> RHQ Plugin, so it got it's own sub-repository.<br />
<br />
As a reference for someone going through the same process of moving from a [googlecode] SVN repository to a [googlecode] git repository, I'll leave a summary of the commands used for the move (please keep in mind that I'm totally new to git, so these may not be the optimal way, feel free to comment):<br />
<br />
0. (optional) Since SVN only lists the username and git uses the email as well, the migration will cause weird authors such as "brainslog <brainslog@bf0df8d0-2c1f-0410-b170-bd30377b63dc>" it may be good to sanitize the authors. For that I've used the following script in the SVN repository:<br />
<span style="color: lime; font-family: 'Courier New', Courier, monospace;"><b style="background-color: #666666;">svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors.txt</b></span><br />
<br />
And then I've fixed the outcome in authors.txt to the correct: username = Full Name .<br />
<br />
1. Clone the new (and probably empty) repository<br />
<span style="background-color: #666666; color: lime; font-family: 'Courier New', Courier, monospace;"><b>git clone https://@code.google.com/p/jdiameter/ git-jdiameter</b></span><br />
<br />
2. Clone from SVN (with authors fixed) to the cloned git repository, with full history, tags and branches<br />
<span style="background-color: #666666; color: lime; font-family: 'Courier New', Courier, monospace;"><b>git svn clone -A authors.txt -Ttrunk/servers/diameter -ttags/servers/diameter -bbranches/servers/diameter https://mobicents.googlecode.com/svn git-jdiameter</b></span><br />
<br />
Where -A points to the authors file, -T to the trunk of the SVN repository, -t to the tags and -b to the branches. Use only what you need, I didn't needed the branches part as we don't have any.<br />
<br />
3. Enter the local git repository<br />
<span style="background-color: #666666;"><span style="color: lime; font-family: 'Courier New', Courier, monospace;"><b>cd git-jdiameter</b></span></span><br />
<br />
4. Push!<br />
<span style="color: lime; font-family: 'Courier New', Courier, monospace;"><b style="background-color: #666666;">git push --all</b></span><br />
<br />
5. Create the git tags from SVN tags (I know this can be automatized but I needed to make some customizations to existing tags, as not all were correct)<br />
<span style="background-color: #666666; color: lime; font-family: 'Courier New', Courier, monospace;"><b>git tag "1.0.0.BETA1" "refs/remotes/tags/jdiameter-1.0.0.BETA1"</b></span><br />
<span style="background-color: #666666; color: lime; font-family: 'Courier New', Courier, monospace;"><b>...</b></span><br />
<span style="background-color: #666666; color: lime; font-family: 'Courier New', Courier, monospace;"><b>git tag "1.0.0.FINAL" "refs/remotes/tags/1.0.0.FINAL"</b></span><br />
<br />
6. Push.. again!<br />
<span style="background-color: #666666; color: lime; font-family: 'Courier New', Courier, monospace;"><b>git push --tags</b></span><br />
<br />
These are the 7 magical steps! In case that you don't care about history, simply do a "<span style="font-family: 'Courier New', Courier, monospace;">svn export --force http://mobicents.googlecode.com/svn/trunk/servers/diameter/ git-jdiameter</span>" and push it, nothing else. Also, as mentioned, I did not had branches but I suppose they'd make it in the #4 push.<br />
<br />
Mobicents Diameter users working with <strike>trunk</strike> master, must now switch to this new repository as the SVN will not be updated anymore! Do a "<span style="font-family: 'Courier New', Courier, monospace;">git clone https://code.google.com/p/jdiameter/</span>" and hack away!Alexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com2tag:blogger.com,1999:blog-4670964355147826480.post-27813337896435592572012-06-04T17:47:00.000+01:002012-06-04T17:47:07.191+01:00Mobicents Diameter 1.4.0.FINAL Released!The Mobicents Diameter 1.4.0.FINAL has been released today (<a href="https://groups.google.com/group/mobicents-public/browse_thread/thread/3b668a03d1da05ec">announcement</a>), and it represents the last mile in a long enhancement, refactoring and improvement journey. A lot of features have been added along the way:<br />
<ul>
<li>Improved Cluster Support with fine-grained data per Diameter Application;</li>
<li>Support for more 3GPP Applications (Gq', Rx, Gx, S6a) and improved/updated existing;</li>
<li>Support for Diameter RELAY / PROXY / REDIRECT Agents;</li>
<li>Performance improvement of over 9 times (now handling up to 9000 requests/second in Dev Machine, C2D @ 3.06GHz / 4GB RAM, no special setup);</li>
<li>Added several configuration parameters to optimize for different scenarios (regular usage vs high load vs small footprint, etc);</li>
<li>100+ miscellaneous fixes to improve overall compliance and stability of the Mobicents Diameter Stack and it's JAIN SLEE Resource Adaptors;</li>
<li>Also important, <a href="http://ammendonca.blogspot.pt/2011/03/mobicents-is-now-lgpl-21.html">Mobicents (including Diameter) license has changed from GPL to LGPL</a>, which is generally good news for the users!</li>
</ul>
<div>
Still, there's a lot of work and improvements to be done for the upcoming 1.4.x series. To name a few:</div>
<div>
<ul>
<li>Support for TLS security in Mobicents Diameter Stack (existing in 1.4.0.FINAL as experimental);</li>
<li>Support for SCTP transport in Mobicents Diameter Stack (initial patch already contributed);</li>
<li>Support pluggable Load Balancing algorithms for Mobicents Diameter Stack; Integrate with Mobicents Load Balancer;</li>
<li>Create integration/real-world examples, eg, integrate with Mobicents JAIN SLEE B2BUA, continue work on Mobicents HSS and integrate it with Mobicents SIP Presence;</li>
<li>Improve documentation for developers using Mobicents Diameter Stack;</li>
</ul>
<div>
As you can see, there's a lot that has been improved but there's also a lot more to improve on, with our ambition aiming higher. Feel free to help us with your feedback and contributions to a better Mobicents Diameter!</div>
</div>Alexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com0tag:blogger.com,1999:blog-4670964355147826480.post-45349237468881311932011-07-11T13:16:00.002+01:002011-07-11T13:19:02.746+01:00Mobicents Diameter 1.4.0.BETA2 is out!<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">It's been a while since the last Mobicents Diameter release, but it's finally here, the latest and greatest! This is a special release as it is the one with the most community contribution. Thanks to all the contributors for showing the value of open-source!</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">- <b>Enhanced Stability</b>: 30+ issues regarding stack functionality were identified and fixed, providing a more stable and usable stack;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">- <b>Improved Compliance</b>: Better and stricter compliance to specifications, resulting in a more compatible and strict stack;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">- <b>Gq' Application Support</b>: Another valuable 3GPP application, Gq', is now supported both in Diameter Stack and in Mobicents JAIN SLEE, with it's Resource Adaptor. Thanks to Yulian Oifa for his contribution;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"> - <b>Better Cluster Support</b>: Improved cluster support by updating to the latest Mobicents Cluster framework and fixed replication related issues; </span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"> - <b>Experimental Agent Support</b>: Initial support for experiments with supporting RELAY, PROXY and REDIRECT agents;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"> - <b>Extended Testsuite</b>: Over 100 new JUnit tests were added to the testsuite in order to guarantee the best compliance and continuous regression testing.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Note: This is a BETA release as there are API and deep core changes happening, but it's been thoroughly tested, with the testsuite extended to cover more than ever, including message flows for all applications both in standalone and cluster mode!</span><br />
<div><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Full release notes <a href="http://groups.google.com/group/mobicents-public/browse_thread/thread/a241f74bd9cba3e6?pli=1">here</a>.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Visit Mobicents Diameter website <a href="http://www.mobicents.org/diameter/">here</a>.</span></div>Alexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com0tag:blogger.com,1999:blog-4670964355147826480.post-15772542655347439822011-03-02T12:16:00.000+00:002011-03-02T12:16:58.585+00:00Mobicents is now LGPL 2.1After several discussions and shared thoughts between the Mobicents team and the community, it has been decided to align the Mobicents license with the remaining JBoss projects, changing to the LGPL 2.1 Open Source license!<br />
<br />
Mobicents SIP Servlets was already using such license, but now it is applied to <b>ALL</b> Mobicents Projects (Diameter, JAIN SLEE, Media Server, SS7, etc), effective March 1, 2011.<br />
<br />
We hope the community enjoys the change!Alexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com0tag:blogger.com,1999:blog-4670964355147826480.post-74853350748118122252011-01-24T15:01:00.003+00:002011-01-26T14:39:49.358+00:00Developing an Offline Charging Application with Mobicents Diameter<div><br />
<b><span class="Apple-style-span" style="font-size: large;"><u>Introduction</u></span></b></div>A couple of months ago, the Mobicents Diameter Team decided to start a series of educational posts regarding Diameter development using Mobicents Diameter solution.<br />
<div><br />
</div><div>Bartosz Baranowski has kicked-off with the "<a href="http://baranowb.blogspot.com/2010/11/diameter-educational-series-creating.html">Creating a "Hello World" Application with Mobicents Diameter</a>" article where two things were addressed:</div><div><ul><li>Explaining some basics of the Diameter protocol such as Diameter Nodes, Realms, Applications, Messages, AVPs, Sessions and all those fundamental concepts that hopefully helps to make sense out of this;</li>
<li>A step-by-step example on how to create server and client instances for a Diameter Application (a fictitious Application was used to exemplify) using Mobicents Diameter. It includes detailed code explanation and it's a good read as a preparation for this one if you're new on the subject.</li>
</ul><div><span class="Apple-style-span">In this second post, we will learn how easy it is to create an Offline Charging Application using Mobicents Diameter. Also, for those not familiar with what is Offline Charging (and Online Charging as well) a brief introduction will be provided.</span></div></div><div><br />
</div><div>Fasten your seatbelt, the ride is about to begin!</div><div><br />
</div><div><b><u><span class="Apple-style-span" style="font-size: large;">Offline and Online Charging. What's that about?</span></u></b></div><div></div><div>Online Charging is the name used by 3GPP for pre-paid charging in the IMS scope. It is the charging which occurs in real-time, where the service cost is deducted from the user balance (which has been previously loaded by the user) while the service is going on. In IMS this is the Ro interface, and is defined by <a href="http://ftp.3gpp.org/specs/html-info/32299.htm">3GPP TS 32.299</a> (and extending <a href="http://tools.ietf.org/html/rfc4006">RFC 4006</a> - Diameter Credit Control Application).</div><div><br />
</div><div>On the other hand, Offline Charging is the 3GPP name for post-paid charging, where the provided services are not paid at the time of their usage but rather in a periodic manner, such as at the end of each month. However, while the service is on course, it's usage is logged as a Call Detail Record (CDR) that will be processed later by a Billing system. This corresponds to the IMS interface Rf, defined also by <a href="http://ftp.3gpp.org/specs/html-info/32299.htm">3GPP TS 32.299</a> (inheriting from Diameter Base Accounting in <a href="http://tools.ietf.org/html/rfc3588">RFC 3588</a>).</div><div><br />
</div><div>The CDR generation is the responsibility of an Offline Charging Server.</div><div><br />
</div><div>Please keep in mind that while we are using the Online/Offline terminology introduced by 3GPP for IMS, this post does not intend to focus on IMS details, and so, we will only use the Diameter Base Accounting Application, allowing to simplify the exchanged messages and provide a more straightforward tutorial.</div><div><br />
</div><div><b><u><span class="Apple-style-span" style="font-size: large;">The Messages and AVPs</span></u></b></div><div></div><div>The messages exchanged for offline charging, as defined in RFC 3588 - Section 9.7, are only two: Accounting-Request (ACR) and Accounting-Answer (ACA), with Command-Code 271.</div><div><br />
</div><div>While only a pair of Request/Answer is defined, it can be used with different purposes, depending on the value of the Accounting-Record-Type AVP (code 480). This AVP can have the following values:</div><div><ul><li>EVENT_RECORD (1) - Defines that this is charging for a one-time event, such as a sent SMS;</li>
<li>START_RECORD (2) - In a service with a measurable length (eg: voice call) this value defines that such service has started;</li>
<li>INTERIM_RECORD (3) - In a service with the above characteristics, this ACR type provides cumulative accounting information;</li>
<li>STOP_RECORD (4) - This is used to inform that a service with measurable length has terminated and to provide cumulative accounting information regarding it.</li>
</ul><div>Another meaningful AVP is the Acct-Interim-Interval AVP (code 85) where it is specified the interval at which intermediate records should be produced, by sending ACR messages with Accounting-Record-Type set to INTERIM_RECORD. The absence of it, or a value of 0, means that no intermedite records are needed.</div></div><div><br />
</div><div>An important note is that Base Accounting does not define any service-specific AVPs, as it is not intended to be a usable Application but rather the base for the ones being defined. As such, we will 'abuse' from User-Name AVP, and piggyback the Subscription and Service identifiers into it, in the form "<subscription-id>.<service-id>@mobicents.org".</service-id></subscription-id><br />
<div><br />
</div></div><div><b><u><span class="Apple-style-span" style="font-size: large;">Putting it all together!</span></u></b></div><div>Assuming you already know how to configure and set up the stack in your Java project (which has been explained by Bartosz on the <a href="http://baranowb.blogspot.com/2010/11/diameter-educational-series-creating.html">first post of these educational series</a>), let's start by defining the interface for our Charging Client enabler, to be used by the applications:<br />
<pre class="brush: java">package org.mobicents.diameter.simulator.client;
public interface OfflineChargingClient {
// Accounting-Record-Type Values --------------------------------------------
static final int ACCOUNTING_RECORD_TYPE_EVENT = 1;
static final int ACCOUNTING_RECORD_TYPE_START = 2;
static final int ACCOUNTING_RECORD_TYPE_INTERIM = 3;
static final int ACCOUNTING_RECORD_TYPE_STOP = 4;
/**
* Sends an Accounting-Request with Accounting-Record-Type set to "2" and the
* corresponding Subscription-Id and Service-Id AVPs filled accordingly.
*
* @param subscriptionId the String value to be used for Subscription-Id AVP
* @param serviceId the String value to be used for Service-Id AVP
* @throws Exception
*/
public abstract void startOfflineCharging(String subscriptionId, String serviceId)
throws Exception;
/**
* Sends an Accounting-Request with Accounting-Record-Type set to "3" and the
* corresponding Subscription-Id and Service-Id AVPs filled accordingly.
*
* @param subscriptionId the String value to be used for Subscription-Id AVP
* @param serviceId the String value to be used for Service-Id AVP
* @throws Exception
*/
public abstract void updateOfflineCharging(String subscriptionId, String serviceId)
throws Exception;
/**
* Sends an Accounting-Request with Accounting-Record-Type set to "4" and the
* corresponding Subscription-Id and Service-Id AVPs filled accordingly.
*
* @param subscriptionId the String value to be used for Subscription-Id AVP
* @param serviceId the String value to be used for Service-Id AVP
* @throws Exception
*/
public abstract void terminateOfflineCharging(String subscriptionId, String serviceId)
throws Exception;
/**
* Sends an Accounting-Request with Accounting-Record-Type set to "1" and the
* corresponding Subscription-Id and Service-Id AVPs filled accordingly.
*
* @param subscriptionId the String value to be used for Subscription-Id AVP
* @param serviceId the String value to be used for Service-Id AVP
* @throws Exception
*/
public abstract void eventOfflineCharging(String subscriptionId, String serviceId)
throws Exception;
/**
* Sets the listener to receive the callbacks from this charging client.
* @param listener an OfflineChargingClientListener implementor to be the listener
*/
public abstract void setListener(OfflineChargingClientListener listener);
}
</pre>Also, we will need the applications to implement the Listener interface, in order to receive the callbacks from the Offline Charging Enabler. The interface to be implemented is quite simple, with only one method for the callback:<br />
<pre class="brush: java">package org.mobicents.diameter.simulator.client;
/**
* Listener interface to be implemented by applications
* wanting to have Offline Accounting
*/
public interface OfflineChargingClientListener {
/**
* Callback method invoked by Offline Charging Client to deliver answers
*
* @param subscriptionId the String value identifying the user
* @param serviceId the String value identifying the service
* @param sessionId a String value identifying the accounting session
* @param accountingRecordType the type of Accounting Record the answer refers to
* @param accountingRecordNumber the Accounting Record number the answer refers to
* @param resultCode the Result-Code value obtained from the answer
* @param acctInterimInterval the interval in seconds to send updates
*/
public void offlineChargingAnswerCallback(String subscriptionId,
String serviceId, String sessionId, int accountingRecordType,
long accountingRecordNumber, long resultCode, long acctInterimInterval);
}
</pre>The implementation for the OfflineChargingClient (not complete, just the basics to understanding) is the following:<br />
<pre class="brush: java">public class OfflineChargingClientImpl implements OfflineChargingClient,
NetworkReqListener, EventListener<Request, Answer>,
StateChangeListener<AppSession>, ClientAccSessionListener {
// Application Id -----------------------------------------------------------
private static final ApplicationId ACCOUNTING_APPLICATION_ID =
ApplicationId.createByAccAppId(0, 3);
// Configuration Values -----------------------------------------------------
private static final String SERVER_HOST = "127.0.0.1";
private static String REALM_NAME = "mobicents.org";
private SessionFactory sessionFactory;
private AccSessionFactoryImpl accountingSessionFactory;
private OfflineChargingClientListener listener;
private ConcurrentHashMap<String, ClientAccSession> acctSessions =
new ConcurrentHashMap<String, ClientAccSession>();
private ConcurrentHashMap<String, Integer> acctRecNumberMap =
new ConcurrentHashMap<String, Integer>();
public OfflineChargingClientImpl() throws Exception {
// Initalize Stack
...
}
</pre><span class="Apple-style-span">At this point we just define some constants, configuration values and variables to be used later. We define two maps to allow us to keep sessions and Accounting-Record-Number values stored in the enabler. This could be moved client-side if desired.</span><br />
<span class="Apple-style-span">We will next define some auxiliary methods to assit in common operations, such as creating Accounting-Requests, retrieving the appropriate Accounting-Record-Number, etc.</span><br />
<pre class="brush: java">// Aux Methods --------------------------------------------------------------
/**
* Gets an accounting record number for the specified user+service id
* @param identifier the user+service identifier
* @param isStart indicates if it's an initial record, which should be set to 0
* @return the accounting record number to be used in the AVP
*/
private int getAccountingRecordNumber(String sessionId, boolean isStart) {
// An easy way to produce unique numbers is to set the value to 0 for
// records of type EVENT_RECORD and START_RECORD, and set the value to 1
// for the first INTERIM_RECORD, 2 for the second, and so on until the
// value for STOP_RECORD is one more than for the last INTERIM_RECORD.
int accRecNumber = 0;
if(!isStart) {
accRecNumber = acctRecNumberMap.get(sessionId);
accRecNumber = accRecNumber++;
}
acctRecNumberMap.put(sessionId, accRecNumber);
return accRecNumber;
}
/**
* Creates an Accounting-Request with the specified data.
*
* @param session the session to be used for creating the request
* @param accRecordType the type of Accounting Record (Event, Start, Interim, Stop)
* @param username the value to be used in the User-Name AVP
* @return an AccountRequest object with the needed AVPs filled
* @throws InternalException
*/
private AccountRequest createAccountingRequest(ClientAccSession session,
int accRecordType, int accRecNumber, String username) throws InternalException {
AccountRequest acr = new AccountRequestImpl(session, accRecordType, accRecNumber,
REALM_NAME, SERVER_HOST);
// Let's 'abuse' from User-Name AVP and use it for identifying user@service
AvpSet avps = acr.getMessage().getAvps();
avps.addAvp(Avp.USER_NAME, username, false);
return acr;
}
/**
* Method for creating and sending an Accounting-Request
*
* @param identifier the user+service identifier to be used in the User-Name AVP
* @param accRecType the type of Accounting Record (Event, Start, Interim, Stop)
* @throws Exception
*/
private void sendAccountingRequest(ClientAccSession session, String identifier,
int accRecType, int accRecNumber) throws Exception {
// Create Accounting-Request
AccountRequest acr = createAccountingRequest(session, accRecType, accRecNumber,
identifier);
// Send it
session.sendAccountRequest(acr);
}
/**
* Aux method for generating a unique identifier from subscription and service ids
* @param subscriptionId the subscription id to be used
* @param serviceId the service id to be used
* @return the generated unique identifier
*/
private String getIdentifier(String subscriptionId, String serviceId) {
return subscriptionId + "." + serviceId + "@" + REALM_NAME;
}
</pre><span class="Apple-style-span">And finally we can do the real implementation for the Offline Charging Client which, hopefully, became a bit simpler.</span><br />
<pre class="brush: java">// Offline Charging Client Implementation -----------------------------------
public void setListener(OfflineChargingClientListener listener) {
this.listener = listener;
}
public void startOfflineCharging(String subscriptionId, String serviceId)
throws Exception {
// Create new session to send start record
ClientAccSession session = (ClientAccSession) accountingSessionFactory.
getNewSession(null, ClientAccSession.class, ACCOUNTING_APPLICATION_ID,
new Object[]{});
// Store it in the map
acctSessions.put(session.getSessionId(), session);
// Get the account record number
int accRecNumber = getAccountingRecordNumber(session.getSessionId(), true);
sendAccountingRequest(session, getIdentifier(subscriptionId, serviceId),
ACCOUNTING_RECORD_TYPE_START, accRecNumber);
}
public void interimOfflineCharging(String subscriptionId, String serviceId,
String sessionId) throws Exception {
// Fetch existing session to send interim record
ClientAccSession session = this.acctSessions.get(sessionId);
// Get the account record number
int accRecNumber = getAccountingRecordNumber(session.getSessionId(), false);
sendAccountingRequest(session, getIdentifier(subscriptionId, serviceId),
ACCOUNTING_RECORD_TYPE_INTERIM, accRecNumber);
}
public void stopOfflineCharging(String subscriptionId, String serviceId,
String sessionId) throws Exception {
// Fetch existing session (and remove it from map) to send stop record
ClientAccSession session = this.acctSessions.remove(sessionId);
// Get the account record number (and remove)
int accRecNumber = getAccountingRecordNumber(session.getSessionId(), false);
this.acctRecNumberMap.remove(session.getSessionId());
sendAccountingRequest(session, getIdentifier(subscriptionId, serviceId),
ACCOUNTING_RECORD_TYPE_STOP, accRecNumber);
}
public void eventOfflineCharging(String subscriptionId, String serviceId)
throws Exception {
// Create new session to send event record
ClientAccSession session = (ClientAccSession) accountingSessionFactory.
getNewSession(null, ClientAccSession.class, ACCOUNTING_APPLICATION_ID,
new Object[]{});
// No need to store Session or Accounting-Record-Number as it's a one-shot.
sendAccountingRequest(session, getIdentifier(subscriptionId, serviceId),
ACCOUNTING_RECORD_TYPE_EVENT, 0);
}
// Client Acc Session Listener Implementation -------------------------------
public void doAccAnswerEvent(ClientAccSession appSession, AccountRequest request,
AccountAnswer answer) throws InternalException, IllegalDiameterStateException,
RouteException, OverloadException {
// Extract interesting AVPs
AvpSet acaAvps = answer.getMessage().getAvps();
String subscriptionId = null;
String serviceId = null;
try {
String username = acaAvps.getAvp(Avp.USER_NAME).getUTF8String();
// It's in form subscription.service@REALM_NAME
String[] identifiers = username.replaceFirst("@" + REALM_NAME, "").split("\\.");
subscriptionId = identifiers[0];
serviceId = identifiers[1];
}
catch (Exception e) {
e.printStackTrace();
}
// Get the session-id value
String sessionId = appSession.getSessionId();
// We must be able to get this, it's mandatory
int accRecType = -1;
try {
accRecType = answer.getAccountingRecordType();
}
catch (Exception e) {
e.printStackTrace();
}
// We must be able to get this, it's mandatory
long accRecNumber = -1L;
try {
accRecNumber = answer.getAccountingRecordNumber();
}
catch (Exception e) {
e.printStackTrace();
}
// If we can't get it we'll fallback to DIAMETER_UNABLE_TO_COMPLY (5012)
long resultCode = 5012L;
try {
resultCode = answer.getResultCodeAvp().getUnsigned32();
}
catch (AvpDataException e) {
e.printStackTrace();
}
// Here we fallback to 0, it means the same as omitting
long acctInterimInterval = 0;
try {
acctInterimInterval = acaAvps.getAvp(Avp.ACCT_INTERIM_INTERVAL).getUnsigned32();
}
catch (AvpDataException e) {
e.printStackTrace();
}
// Invoke the callback to deliver the answer
listener.offlineChargingAnswerCallback(subscriptionId, serviceId, sessionId,
accRecType, accRecNumber, resultCode, acctInterimInterval);
}
public void doOtherEvent(AppSession appSession, AppRequestEvent request,
AppAnswerEvent answer) throws InternalException, IllegalDiameterStateException,
RouteException, OverloadException {
// We can ignore this
}
</pre><span class="Apple-style-span">Given the above implementation of what can be seen as the enabler for offline charging, now our Example Application should implement the following state machine using the enabler:</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifynX0WY9FbzUBH_ko0zrN9nUh8v9MzEzb8zrndVxKai1qXGhpWPo1TRNZ7oOPSUgzgECnw9QDUgcQimAtTd6lpNIobSWiia4-fWetCBBnL1i9GHvoOTIeivleiPh0J4TqJdicI8xfvCg/s1600/OCC_State_Machine.png" imageanchor="1" style="margin-left: 0.5em; margin-right: 0.5em;" rel="lightbox" title="Offline Charging Client Application State Machine"><img border="0" height="309" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifynX0WY9FbzUBH_ko0zrN9nUh8v9MzEzb8zrndVxKai1qXGhpWPo1TRNZ7oOPSUgzgECnw9QDUgcQimAtTd6lpNIobSWiia4-fWetCBBnL1i9GHvoOTIeivleiPh0J4TqJdicI8xfvCg/s640/OCC_State_Machine.png" width="600" /></a></div><br />
<span class="Apple-style-span">So let's get our hands dirty with the example application implementation, which should implement the above specified listener interface:</span><br />
<pre class="brush: java">package org.mobicents.diameter.simulator.client;
import static org.mobicents.diameter.simulator.client.OfflineChargingClient.*;
public class ExampleApplication implements OfflineChargingClientListener {
// Internal Client State Machine --------------------------------------------
private static final int STATE_IDLE = 0;
private static final int STATE_START_ACR_SENT = 2;
private static final int STATE_START_ACA_SUCCESS = 4;
private static final int STATE_INTERIM_ACR_SENT = 6;
private static final int STATE_INTERIM_ACA_SUCCESS = 8;
private static final int STATE_STOP_ACR_SENT = 10;
private static final int STATE_STOP_ACA_SUCCESS = 12;
private static final int STATE_EVENT_ACR_SENT = 14;
private static final int STATE_EVENT_ACA_SUCCESS = 16;
private static final int STATE_END = 18;
private static final int STATE_ERROR = 99;
private int currentState = STATE_IDLE;
public static void main(String[] args) throws Exception {
ExampleApplication app = new ExampleApplication(new OfflineChargingClientImpl());
app.occ.startOfflineCharging("", "");
}
private OfflineChargingClient occ;
public ExampleApplication(OfflineChargingClient occ) {
this.occ = occ;
occ.setListener(this);
}
public void offlineChargingAnswerCallback(String subscriptionId, String serviceId,
String sessionId, int accountingRecordType, long accountingRecordNumber,
long resultCode, long acctInterimInterval) {
// Handle the EVENT situation
if(accountingRecordType == ACCOUNTING_RECORD_TYPE_EVENT) {
if(this.currentState == STATE_EVENT_ACR_SENT) {
if(resultCode == 2001) {
this.currentState = STATE_EVENT_ACA_SUCCESS;
System.out.println("(((o))) Event Offline Charging for user '"+ subscriptionId +
"' and service '" + serviceId + "' completed! (((o)))");
// and now just to be correct...
this.currentState = STATE_END;
}
}
else {
this.currentState = STATE_ERROR;
throw new RuntimeException("Unexpected message received.");
}
}
// Handle START / INTERIM / STOP situation
else {
switch(this.currentState) {
// Receiving an Answer at any of these states is an error
case STATE_IDLE:
case STATE_EVENT_ACA_SUCCESS:
case STATE_START_ACA_SUCCESS:
case STATE_INTERIM_ACA_SUCCESS:
case STATE_STOP_ACA_SUCCESS:
// At any of these states we don't expect to receive an ACA, move to error.
this.currentState = STATE_ERROR;
break;
// We've sent ACR EVENT
case STATE_START_ACR_SENT:
if(accountingRecordType == ACCOUNTING_RECORD_TYPE_START) {
if(resultCode >= 2000 && resultCode < 3000) {
// Our event charging has completed successfully. We're done!
System.err.println("(((o))) Offline Charging for user '" + subscriptionId +
"' and service '" + serviceId + "' started... (((o)))");
if(acctInterimInterval > 0) {
try {
// Let's sleep until next interim update...
Thread.sleep(acctInterimInterval * 1000);
// We send an update at the correct time
occ.interimOfflineCharging(subscriptionId, serviceId, sessionId);
}
catch (Exception e) {
this.currentState = STATE_ERROR;
throw new RuntimeException("Unable to schedule/send interim update.", e);
}
}
}
else {
// It failed
System.err.println("(((x))) Offline Charging for user '" + subscriptionId +
"' and service '" + serviceId + "' failed with Result-Code="+ resultCode +
"! (((x)))");
}
}
else {
this.currentState = STATE_ERROR;
throw new RuntimeException("Unexpected message received.");
}
break;
// We've sent ACR START
case STATE_INTERIM_ACR_SENT:
if(accountingRecordType == ACCOUNTING_RECORD_TYPE_INTERIM) {
if(resultCode >= 2000 && resultCode < 3000) {
// Our offline charging has started successfully...
System.out.println("(((o))) Offline Charging for user '" + subscriptionId +
"' and service '" + serviceId + "' updated... (((o)))");
if(acctInterimInterval > 0) {
try {
// Let's sleep until next interim update...
Thread.sleep(acctInterimInterval);
// We send an update at the correct time
occ.interimOfflineCharging(subscriptionId, serviceId, sessionId);
}
catch (Exception e) {
this.currentState = STATE_ERROR;
throw new RuntimeException("Unable to schedule/send interim update.", e);
}
}
}
else {
// It failed, let's warn the application
System.out.println("(((x))) Offline Charging for user '" + subscriptionId +
"' and service '" + serviceId + "' failed to start with Result-Code=" +
resultCode + "! (((x)))");
}
}
else {
this.currentState = STATE_ERROR;
throw new RuntimeException("Unexpected message received.");
}
break;
case STATE_STOP_ACR_SENT:
if(accountingRecordType == ACCOUNTING_RECORD_TYPE_INTERIM) {
if(resultCode >= 2000 && resultCode < 3000) {
// Our offline charging has started successfully...
System.out.println("(((o))) Offline Charging for user '" + subscriptionId +
"' and service '" + serviceId + "' stopped! (((o)))");
}
else {
// It failed, let's warn the application
System.out.println("(((x))) Offline Charging for user '" + subscriptionId +
"' and service '" + serviceId + "' failed to stop with Result-Code=" +
resultCode + "! (((x)))");
}
}
else {
this.currentState = STATE_ERROR;
throw new RuntimeException("Unexpected message received.");
}
break;
default:
this.currentState = STATE_ERROR;
throw new RuntimeException("Unexpected message received.");
}
}
}
}
</pre><span class="Apple-style-span">As it can be seen it turns to be really simple to implement such Application using Offline Charging in this way. The above application also provides an enhancement, which is to automatically wait and send the interim ACR updates (lines 73-85 and 107-119). That obviously is a design choice, which can be changed if control over that behavior is intended.</span><br />
<br />
<b><span class="Apple-style-span" style="font-size: large;"><u>Conclusion</u></span></b><br />
<span class="Apple-style-span">As this article was meant to demonstrate it's simple to add Offline Accounting to your applications using Mobicents Diameter solution. Several options (and scenarios) were simplified in order to keep the example easier to understand and follow the steps, as well as to give a better understanding of the Mobicents Diameter solution, while still rendering a completely functional solution.</span><br />
<br />
<span class="Apple-style-span">You can learn more about Mobicents Diameter at <a href="http://www.mobicents.org/diameter/">http://www.mobicents.org/diameter/</a>.</span></div>Alexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com12tag:blogger.com,1999:blog-4670964355147826480.post-72553887374101057422010-10-16T00:28:00.001+01:002010-10-18T16:06:53.454+01:00Mobicents Team Meeting 2010 @ Antalya, Turkey<div style="clear: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTwosN4gZEHKK8JOVUrWTIruWRe3m9G3Q6U2QK30Lga2I6NJ5N0VG-ZXi5JZiNRa4jYvwjqCAfK1zcjHHCnfhzs5MA8SmTqaNf10YFVYhS2eZVdLoCSMBLdR9K0dc6uPIFS6S5ohG-HsM/s1600/mobicents_antalya_1.jpg" /></div><br />
<div style="text-align: left;">Yes, this paradisal venue (Alva Donna Resort & SPA at Belek, Antalya, Turkey) was where the 2010 Mobicents Face-to-Face Meeting was held, 24th - 30th September. Thanks to <a href="http://emmartins.blogspot.com/">Eduardo Martins</a> for arranging the trip, it was the best <b>_ever_</b> for several reasons: It was the first time we managed to gather all the team together, ranging from a couple of hours travelling to some doing it in a day and half! But I'm sure it worth every minute!<br />
<br />
Also, this was the first (and certainly not the last!) time we had customers and community users joining our technical meetings and providing the most valuable feedback for our products and their roadmap. It's a whole new perspective and for that, we can only say: <b>Thank You!</b></div><br />
<div class="separator" style="clear: both; text-align: left;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5JQVhyphenhyphenUiUN0BspyHuBm7is5szniGll_pTZM1BZnhvDLVTN3LGlB6XSy3Up3QJ9aJ8mjVAGzoOuJHzvmcATUv7t1JjfzX-6bEE07Qc0x7g3d1Tahl6y0knVru421e01azSP9wG-xnHOjg/s1600/mobicents_antalya_2" /></div><br />
It was also the one we had more entertainment available, from the first day rafting to the resort's nightly shows, several swimming pools, sliders, jetski, bowling, etc etc. It sure was a lot of fun!<br />
<br />
<div class="separator" style="clear: both; text-align: left;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhO6CyTKp_BbBqAQ-eIVqSrY0AEamslje5o8GBV6xsoFnSeUncNomrfcveTPv8lo88MELOlIKsEc0i_6ixGqAtJYdxvGmpgHR5AVMiitrK3Q76RKxHIpcwTeg9ej5VlnlWKE22_ActF78E/s1600/mobicents_antalya_3" /></div><br />
But we had to work too (a lot :-)) between all this fun. We had presentations for the main Mobicents projects, mostly regarding the past, present and future of each project, ie, what we achieved in the last year, the current status of each project in terms of stability, performance and features and the plans for the upcoming year. Also we had some project-wide presentations, such as clustering which affects most of the projects.<br />
<br />
<div class="separator" style="clear: both; text-align: left;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3hfPFUJaAReWO69uxOeeTV9HdQKctkGhTblaqswGJvAMZqceXlhqhcfiPJOUna1QGzShtGmBIIQForER77DnM_ndOJ8dy5km46JKhNos_joXfq8mrKjDh-8YBRDpMStA_lvOAFCXHWcI/s1600/mobicents_antalya_4" /></div><br />
<br />
For my main project, Mobicents Diameter, we had a crash course to give a quick introduction to what it is all about and it's role in the telco world (something to be explored here too, promised!) presented by <a href="http://baranowb.blogspot.com/">Bartosz Baranowski</a> and after, I did the presentation regarding the achievements and roadmap. In sum, this was a great year for Mobicents Diameter:<br />
<br />
<ul><li>8 Releases, 3 of them being major ones, with important features introduced (JBoss 5 support; JAIN SLEE 1.1 Resource Adaptors; High-Availability/Fault-Tolerant Stack and Resource Adaptors)</li>
<li>Management Console based on RHQ</li>
<li>400% Performance improvement ( > 800 requests/second )</li>
<li>Complete User Guide Documentation</li>
<li>.. and some more!</li>
</ul><div>We had quite a good set of achievements, I would say! But we have a lot more to achieve in the future. We are focusing on the stability and performance of our solution, extend the testsuite and interop with other Diameter products to ensure complete compliance with the protocol and applications. We have defined two different goals:</div><div><ul><li>Continue work on the 1.x.y series, providing it with stability and better performance;</li>
<li>Start a 2.x.y series, where we intend to change several internal components as well as redesigning the API to make it more easy and intuitive to work with, probably also providing a high-level abstraction to the Diameter protocol to provide simple charging. This is something to be discussed among the community to understand the direction to follow</li>
</ul><div>You can find the Diameter presentation <a href="https://docs.google.com/leaf?id=0AZBg4V7zCLK2ZGN4bmZ6dGNfNDZjcWZ0aHRoYw&sort=name&layout=list&num=50">here</a>.</div><div><br />
</div><div>Regarding the other project where I participate, Mobicents JAIN SLEE, we had also an excellent year of work, with great achievements. You can read more in detail on Eduardo's <a href="http://emmartins.blogspot.com/2010/10/mobicents-team-meeting-2010-antalya.html">post</a>.</div></div><div><br />
</div><div>So, this was it. It was a blast! Counting the days for the next meeting, looking forward to see even more community users joining us!</div><div><br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: left;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXNTCbIBlImMeSXSmFDzcuU1e0sLD6TMTnWd5s37NxuRsasZdYIohmVw2V6ejQqeW4O6Eb1Pb6WNPdS0dOB113sySr2LfuOOETGQC9MKXw1CvsqGYkvAEaU33rRP2AyAWzeLUOAykuGQA/s1600/mobicents_antalya_5" /></td></tr>
<tr><td style="text-align: center;">The Greatest (Vladimir and Tom are missing :-\) -- Görüşmek üzere! (See you soon, in Turkish ;-))</td></tr>
</tbody></table><br />
<br />
</div><div><br />
</div>Alexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com1tag:blogger.com,1999:blog-4670964355147826480.post-71464253375927175672010-09-16T20:25:00.000+01:002010-09-16T20:25:41.013+01:00User Survey: Help improving Mobicents Platform!As you (should) know a Mobicents Face-to-Face meeting is about to happen (you can still join us!) and we would like to have some input from our community on what Mobicents products they are using, what they think about them, what they would like to have in future versions, etc.<br />
<br />
It's a great chance for you to be able to participate in the future of Mobicents platform, don't miss it! How can you do that? By simply filling a quick 5-minute survey where you can make your opinion count and affect the roadmaps!<br />
<br />
Without further delays, head your browser to the survey at <a href="https://spreadsheets.google.com/viewform?formkey=dHk2ZGVQZ21zSG9sbXVJRUJzX2dNaXc6MQ">https://spreadsheets.google.com/viewform?formkey=dHk2ZGVQZ21zSG9sbXVJRUJzX2dNaXc6MQ</a><br />
<br />
Please provide information as accurate and detailed as possible.<br />
<br />
Thanks for your time and support!<br />
The Mobicents TeamAlexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com0tag:blogger.com,1999:blog-4670964355147826480.post-48832053116478412452010-07-21T02:05:00.003+01:002010-07-27T15:06:34.463+01:00Installing Jopr/RHQ and Mobicents JAIN SLEE (or Diameter) PluginAs it seems that some users don't find the task of installing and configuring Mobicents JAIN SLEE / Diameter Management consoles as plugins for Jopr/RHQ easy, I've decided to make a blog post explaining how to do it.<br />
<br />
But if an image worths more than 1.000 words, how many words can a video worth? :) Hopefully, a lot, because I've just recorded one that I hope it helps to better understand how it should be done.<br />
<br />
Still, I will point the main actions to be executed and the time they occur at the video, for faster reference.<br />
<br />
Here it is, right from the <a href="http://vimeo.com/channels/mobicents">Mobicents Channel</a> @ Vimeo:<br />
<object height="250" width="400"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=13500737&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=00ADEF&fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=13500737&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=00ADEF&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="250"></embed></object><br />
<a href="http://vimeo.com/13500737"><span class="Apple-style-span" style="font-size: x-small;">Installing Jopr/RHQ and Mobicents JAIN SLEE 2.x Plugin</span></a><span class="Apple-style-span" style="font-size: x-small;"> (click to watch in HD)</span><br />
<br />
<ol><li>[00:00] Download RHQ Server from <a href="http://www.rhq-project.org/">http://www.rhq-project.org/</a> and Unzip rhq-server-3.0.0.zip to any directory of your choice;</li>
<li>[00:50] In a terminal, go to "rhq-server-3.0.0/bin" inside the extracted folder and run "<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">rhq-server.[bat|sh] console</span>", depending on your OS;</li>
<li>[01:30] Go to <a href="http://127.0.0.1:7080/">http://127.0.0.1:7080/</a> and install the server (don't forget to select your database);</li>
<li>[03:15] Login with default credentials (rhqadmin/rhqadmin), go to Downloads and Download the "Agent Installer";</li>
<li>[04:00] In a new terminal, go to the directory where the Agent Installer was downloaded and issue the command "<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">java -jar rhq-enterprise-agent-3.0.0.jar --install</span>" to install it;</li>
<li>[04:35] In the same terminal go to rhq-agent/bin (where it was installed) and run "<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">rhq-agent.[bat|sh] --clean</span>" (use --clean to make sure you will use a fresh configuration). Default values should be fine;</li>
<li>[05:30] In the web interface, go to <i>Administration > System Configuration > Plugins</i>, click "<i>Add</i>" and browse to the Mobicents JAIN SLEE / Diameter Plugin location and click "<i>Upload</i>". When done, click "<i>Scan for Updates</i>";</li>
<li>[07:45] If not yet running, start yout JAIN SLEE / Diameter Server;</li>
<li>[09:30] In the RHQ Agent terminal, issue "<i>plugins update</i>" to update the agent plugins (download the JAIN SLEE / Diameter plugin to the agent);</li>
<li>[11:10] Now that the plugins are updated, and with the JAIN SLEE / Diameter Server running, in the Agent terminal issue the "<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">discovery</span>" command to find new resources;</li>
<li>[11:35] In the web interface, go to <i>Overview > Auto Discovery Queue</i>, locate the Server, check it and click "<i>Import</i>"</li>
<li>[12:45] Still at the webpage, head to <i>Resources > Servers</i>. Click on the server entry to manage it. Enjoy!</li>
</ol><div><br />
</div><div>Simple, isn't it ? Hope it is now.. It's time to have fun, managing and monitoring Mobicents Servers via Jopr/RHQ ;-)</div><div><br />
</div><div>For details on what you can do with these plugins, please refer to the documentation found in the binaries releases of the servers.</div>Alexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com0tag:blogger.com,1999:blog-4670964355147826480.post-87503586246846496392010-02-26T11:49:00.004+00:002010-02-26T11:57:13.381+00:00Mobicents Diameter 1.1.2.GA: Introducing Diameter Jopr PluginWe've just released a new spin for Mobicents Diameter, v1.1.2.GA.<br />
<br />
It happened on 21st of February and along with the usual bug fixing and improvements, there's a great addition to the suite: The Mobicents Diameter Jopr Plugin.<br />
<br />
<a href="http://www.jboss.org/jopr" target="_blank">Jopr</a> is an enterprise management solution which provides administration, monitoring, alerting, operational control and configuration in an enterprise setting with fine-grained security and an advanced extension model.<br />
<br />
The Mobicents Diameter Jopr Plugin provides the following functionalities:<br />
<br />
<ul><li><b>Stack configuration and management</b></li>
<ul><li>Provides means of changing stack parameters, such as various timeout values, duplicate protection, accept undefined peers, thread pools size, etc.;</li>
<li>Start/Stop stack, Enable/Disable validation</li>
</ul>
<li><b>Local peer configuration and statistics</b></li>
<ul><li>Allows change of local peer IP Address and URI, Realm name, supported Application-Ids, etc.;</li>
<li>Real time statistics regarding memory usage</li>
</ul>
<li><b>Network Peers management and statistics</b></li>
<ul><li>Provides ability to add and remove Network Peers;</li>
<li>Statistics regarding requests/answer sent and/or received (total and per minute), Average time for message processing, Number of messages waiting on queue, number of messages failed to send/receive, etc.</li>
</ul>
<li><b>Realms configuration and management</b></li>
<ul><li>Allow runtime realm configuration, ie, change realm name, Peers list, Application Ids, etc.;</li>
<li>Add and remove Realms</li>
</ul></ul><br />
All these functionalities plus the added value by Jopr, which provides availability for each component (Stack, Local Peer, Network Peers and Realms), alert configuration, intuitive graphs and some more cool and intuitive features makes this a great companion for the Diameter suite!<br />
<br />
Regarding installation and configuration of Jopr and the plugin, while we are working at the documentation for it, you can follow <a href="http://www.mobicents.org/slee/docs.html" target="_blank">JAIN SLEE Jopr Plugin User Guide</a> (Installing Jopr and Mobicents JAIN SLEE Plugin chapter) since it's the exact same procedure.<br />
<br />
Here are some screenshots of the plugin in action:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq8ykuxxfgJXiOtEQItR2R9_J6eP-VwNjTNqegJnCcz_1ZfJTlAT1POToQWgaKSXBywQLBw3-5R-7hDJ6iRKvr06JKrbp0MgI5Ez13E2KnWmepUVZGpduKkxKKxDyXDOoA2UV0OC2IQsU/s1600-h/Diameter_LocalPeer_Main.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="123" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq8ykuxxfgJXiOtEQItR2R9_J6eP-VwNjTNqegJnCcz_1ZfJTlAT1POToQWgaKSXBywQLBw3-5R-7hDJ6iRKvr06JKrbp0MgI5Ez13E2KnWmepUVZGpduKkxKKxDyXDOoA2UV0OC2IQsU/s200/Diameter_LocalPeer_Main.png" width="200" /></a> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3Fv8jDcLQ-cY3Gy9xwrBskmYdZ9jYJiQ30g2VPr2_nLiwt1-d__F7HpUWbTcYMttVH2oCJTCf7AJUjfQDlYAWYy9li7OM6nGPBaRUZynWfgF49_JZnQ1htKVMr3owhfFWV0LBncWXkxQ/s1600-h/Diameter_Stack_Configuration.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="123" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3Fv8jDcLQ-cY3Gy9xwrBskmYdZ9jYJiQ30g2VPr2_nLiwt1-d__F7HpUWbTcYMttVH2oCJTCf7AJUjfQDlYAWYy9li7OM6nGPBaRUZynWfgF49_JZnQ1htKVMr3owhfFWV0LBncWXkxQ/s200/Diameter_Stack_Configuration.png" width="200" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqARChKZouvrOQI2J5KhEjRRQPlGvhRxDAMG9_xvPiO-l1hWgpoYFL6dKciPBBaFGtdgwOIMxqZkzDjEj0dm7V7LucLtRx9FYVIAyqTy8yfHDEsT__SOZ7RrRtEdrhVi2SWfSOI76MzIE/s1600-h/Diameter_Inventory.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="123" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqARChKZouvrOQI2J5KhEjRRQPlGvhRxDAMG9_xvPiO-l1hWgpoYFL6dKciPBBaFGtdgwOIMxqZkzDjEj0dm7V7LucLtRx9FYVIAyqTy8yfHDEsT__SOZ7RrRtEdrhVi2SWfSOI76MzIE/s200/Diameter_Inventory.png" width="200" /></a> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGmYaDfWzwkTNSOP8TTanWps6vGrOrP00uD3y3IUGZX7azY6DPLYwhBZBmlvWNnf5yc9KFj-crziNkBny73uy_2D8MaKmPLS2TOad0cGYsUz47aFhvEschNwkaI9bZ0IL9aS0zw4qg18A/s1600-h/Diameter_NetworkPeer_Monitor.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="123" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGmYaDfWzwkTNSOP8TTanWps6vGrOrP00uD3y3IUGZX7azY6DPLYwhBZBmlvWNnf5yc9KFj-crziNkBny73uy_2D8MaKmPLS2TOad0cGYsUz47aFhvEschNwkaI9bZ0IL9aS0zw4qg18A/s200/Diameter_NetworkPeer_Monitor.png" width="200" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWlXdJgFmJwei4oVYXRP8xTyVL25vzUqqSTmbMbWXIIYHb9yKK1uzBYmgThv_cZQbojuQVPTPD9qZv66tfvc-DbIPMKmjejUxnkCQ6kXUb9B9mZ6Mwwit0YYIqgq5l4klameA_TmJ1xiI/s1600-h/Diameter_AverageMessageProcessing.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="123" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWlXdJgFmJwei4oVYXRP8xTyVL25vzUqqSTmbMbWXIIYHb9yKK1uzBYmgThv_cZQbojuQVPTPD9qZv66tfvc-DbIPMKmjejUxnkCQ6kXUb9B9mZ6Mwwit0YYIqgq5l4klameA_TmJ1xiI/s200/Diameter_AverageMessageProcessing.png" width="200" /></a> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvlSnsWzE6UOS0w1Ar5hrgBvZxdZy8HFrd2NdMk0Q_yWCpxR3jLff4r5g-BGyoCrECaPCT7rpI5zeOQ1AbFPiwRz9WmLty1OtEnpHkwnKQLj9GLAZifzrEgzB3PdyytstRTEExkuh62BQ/s1600-h/Diameter_NetworkPeer_MultiGraphs.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="123" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvlSnsWzE6UOS0w1Ar5hrgBvZxdZy8HFrd2NdMk0Q_yWCpxR3jLff4r5g-BGyoCrECaPCT7rpI5zeOQ1AbFPiwRz9WmLty1OtEnpHkwnKQLj9GLAZifzrEgzB3PdyytstRTEExkuh62BQ/s200/Diameter_NetworkPeer_MultiGraphs.png" width="200" /></a></div><br />
Enjoy!Alexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com0tag:blogger.com,1999:blog-4670964355147826480.post-14307581840927926862009-11-22T04:29:00.009+00:002009-11-22T12:45:36.739+00:00Installing Seagull on Mac OS XAhh... Nothing like a rainy Saturday to get in the mood for some tasks that were delayed for too long!<br />
<br />
As I was getting ready to watch the soccer match between <a href="http://www.fcporto.pt/">FC Porto</a> (my team) and Oliveirense, at Oliveirense's stadium, the referee decided that there were no conditions (really bad pitch, also due to the rain) for the game to happen... well, I had to do something... :-)<br />
<br />
Installing <a href="http://gull.sourceforge.net/">Seagull</a> (the network traffic generator, useful for my Diameter tests) in my iMac was one of those tasks that I could never find the time, and today it seemed a good day. I knew it was not going to be a simple task, as I've tried sometime ago to install (ie, build from source) under Ubuntu or some other Linux distro and never made it... but I didn't tried hard either, as there are RHEL/Fedora binaries I just setup a VM with it.<br />
<br />
OK.. So, first step was to look for someone who had already done the job... couldn't find any, seems like Mac's are not chosen as dev machines very often. No binaries, no instructions. I'm on my own.<br />
<br />
The INSTALL.TXT has some instructions on how to build it... the commands to run. I'll do it as I like to: run until it crashes and see what's wrong after. First instruction is:<br />
<blockquote><span style="font-family: 'Courier New', Courier, monospace;">Edit build.conf to fit your needs (default should be OK)</span><br />
</blockquote><br />
If it says it should be OK, it should be OK. Let's move on.<br />
<blockquote><span style="font-family: 'Courier New', Courier, monospace;">run "./build.ksh -target clean"</span><br />
</blockquote><br />
Just to make sure everything is clean. Not a problem, no issues here. Next!<br />
<blockquote><span style="font-family: 'Courier New', Courier, monospace;">run "./build.ksh -target all"</span><br />
</blockquote><br />
This is where the "fun" began. It simply failed with some generic failure message:<br />
<blockquote><span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">[Begin Makefile generation phase]</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">[Creating symbolic link: /Users/ammendonca/Desktop/seagull/bin]</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">[Making directory: /Users/ammendonca/Desktop/seagull/work-1.8.1]</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">[Making directory: /Users/ammendonca/Desktop/seagull/build-1.8.1]</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">make: *** [/Users/ammendonca/Desktop/seagull/work-1.8.1/project.mk] Error 1</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">[Begin compilation phase]</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">make: *** No rule to make target `all'. Stop.</span></span><br />
</blockquote><div><br />
Nice, isn't it? Not much clues of what and where it is failing. After running some pieces of the make script by itself, I got to <span style="text-decoration: underline;">./work-1.8.1/</span><span style="text-decoration: underline;">compiler.mk</span> file where it said <b>"Compiler variable for OS DARWIN not defined"</b>.<br />
</div><div><br />
</div><div>For adding this information, it was needed to edit the <span style="text-decoration: underline;">./</span><span style="text-decoration: underline;">build.conf</span> afterall :-). So I just copied all the (...)_LINUX entries and renamed them to _DARWIN, et voilá. It worked.<br />
</div><div><br />
</div><div>Next ran, next failure:<br />
</div><blockquote><span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">[Compiling protocol-external/C_ProtocolExternal.cpp]</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">[Compiling protocol-text/C_MessageText.cpp]</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">cc1plus: warnings being treated as errors</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">protocol-text/C_MessageText.cpp: In member function 'C_ProtocolFrame::_msg_error_code C_MessageText::EncodeWithContentLength(int)':</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">protocol-text/C_MessageText.cpp:62: warning: format '%d' expects type 'int', but argument 4 has type 'size_t'</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">make[1]: *** [/Users/ammendonca/Desktop/seagull/work-1.8.1/C_MessageText.o] Error 1</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">make: *** [all_seagull] Error 2</span></span><br />
</blockquote><div><br />
This was a pretty simple and obvious one. Just learned how size_t should be printed, it's with %Zd instead of the %d that is present. Made that change at line 62 of <span style="text-decoration: underline;">./</span><span style="text-decoration: underline;">protocol-text/C_MessageText.cpp</span> and that's it!<br />
</div><div><br />
</div><div>One step closer... but not there yet:<br />
</div><div><blockquote><span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">[Compiling /Users/ammendonca/Desktop/seagull/work-1.8.1/y.tab.c]</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">y.tab.c: In function 'int yyparse()':</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">y.tab.c:1349: error: 'yylex' was not declared in this scope</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">y.tab.c:1587: error: 'yyerror' was not declared in this scope</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">y.tab.c:1733: error: 'yyerror' was not declared in this scope</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">make[1]: *** [/Users/ammendonca/Desktop/seagull/work-1.8.1/y.tab.o] Error 1</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">make: *** [all_seagull] Error 2</span></span><br />
</blockquote><div><br />
Checking the referred y.tab.c I've checked it declared those methods only if some vars (__linux__ OR __CYGWIN__) were declared. This should be some compiler info as my friend grep didn't found any reference on the seagull sources. Googled a little bit and just <a href="http://lists.debian.org/debian-devel/2001/01/msg00979.html">found what it was</a> and so I checked it should be __APPLE__ for my system.<br />
</div><div><br />
</div><div>A previous message showed that this y.tab.c file was being generated and, so, with the help of grep I managed to find out that it came from <span style="text-decoration: underline;">./xml-parser/xml_definition.y</span>, at line 38. Changed<br />
</div><blockquote><span style="font-family: 'Courier New', Courier, monospace;">#if defined(__linux__) || defined(__CYGWIN__)</span><br />
</blockquote>to<br />
<blockquote><span style="font-family: 'Courier New', Courier, monospace;">#if defined(__linux__) || defined(__CYGWIN__)</span><b><span style="font-family: 'Courier New', Courier, monospace;"> || defined(__APPLE__)</span></b><br />
</blockquote><br />
It was almost there... got the binary seagull already linked in the ./bin folder! Good news, but still some required lib is failing to link:<br />
<blockquote><span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">[Linking /Users/ammendonca/Desktop/seagull/build-1.8.1/libtrans_ip.so]</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">Undefined symbols:</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;"> "_main", referenced from:</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;"> start in crt1.10.5.o</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">ld: symbol(s) not found</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">collect2: ld returned 1 exit status</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">make[1]: *** [/Users/ammendonca/Desktop/seagull/build-1.8.1/libtrans_ip.so] Error 1</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ea9999;">make: *** [all_libtrans_ip.so] Error 2</span></span><br />
</blockquote><br />
Boooring! Thought this could be it... so much work and now some weird linkage error was going to throw it all away. Well.. can't give up, tried some own ideas... then went googling, nothing much useful, every linkage error seems to have this same output.<br />
<br />
Since it referred main, started looking for it.. no sign of it in the files being linked. Hmm.. that makes sense, it's a library, why would it need to have a main anyway? After checking the flags being used for compilation, just found out this one for compiling a library was not present: <b>-dynamiclib</b><br />
<br />
So I added it to <b>BUILD_LIB_LD_FLAGS_DARWIN</b> in <span style="text-decoration: underline;">./build.conf</span> which now looked like this:<br />
<blockquote><span style="font-family: 'Courier New', Courier, monospace;">BUILD_LIB_LD_FLAGS_DARWIN="-shared -fPIC -dynamiclib"</span><br />
</blockquote><div><br />
Yeah! Everything worked just fine! The install was completed successfully and all the binaries were in the bin folder. Hurray!<br />
</div><div><br />
</div><div>This was a lengthy journey but in the end it was fruitful.. as always, when it works ;-) Seagull v1.8.1 running on Mac OS X 10.5.6 (Leopard)!<br />
</div><div><br />
</div><div>Notes:<br />
</div><div><ol><li>Apple Dev Tools are required to be installed prior to any of this being made. They can be found in the Install DVD;</li>
<li>I had to run the commands with "sudo" as it required permissions for some operations;</li>
<li>Optionally you can run "./install.ksh" to copy Seagull binaries and config files as suggested in INSTALL.TXT and perform the remaining actions, if needed.</li>
</ol><br />
Please let me know if this has been useful for you and/or if something is inaccurate. This has been tested against Seagull 1.7.0 and 1.8.1 on Mac OS X 10.5.6 (Leopard).<br />
</div><br />
</div>Alexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com10tag:blogger.com,1999:blog-4670964355147826480.post-85006291453701462362009-10-18T01:25:00.002+01:002009-10-18T01:28:56.298+01:00Mobicents Diameter v1.1.0.GA Released!It was on Friday, 16th October 2009 that a shiny new release of Mobicents Diameter happened.<br />
<br />
It's v1.1.0.GA and along with the usual <a href="http://code.google.com/p/mobicents/issues/list?can=7&q=Diameter+version%3D1.1.00">enhancements and bug fixes</a>, the main new features are:<br />
<ul><li>JBoss AS 5 support</li>
<li>Stack configuration at runtime, via JMX</li>
<li>Educative Example for Cx/Dx application</li>
<li>Preview of the Mobicents Diameter User Guide</li>
</ul><div>It can be downloaded from here: <a href="https://sourceforge.net/projects/mobicents/files/Mobicents%20Diameter/mobicents-diameter-1.1.0.GA/">Mobicents Diameter v1.1.0.GA Downloads</a><br />
</div><div><br />
</div><div><i><span style="font-size: small;">Please note that the JBoss 5 version zip contains only the Stack and the Multiplexer, no JAIN SLEE Resource Adaptors or Examples are included. If you want to try the new Mobicents JAIN SLEE 2.x version (which runs on JBoss 5) and it's Diameter Resource Adaptors and Examples, you'll need to build them from source, which can be found in the </span></i><a href="http://mobicents.googlecode.com/svn/trunk/servers/jain-slee/"><i><span style="font-size: small;">SVN trunk</span></i></a><i><span style="font-size: small;">.</span></i><br />
</div><div><br />
</div><div>Summing it up, you now get a more stable Diameter in 2 flavors (JBoss 4 & JBoss 5), the ability to configure the stack in realtime (add/remove realms, add/remove peers, manage timeouts, etc...), a new example of how to play with Cx/Dx (which will be the basis for the HSS prototype) plus the user guide to help you play with all of it!<br />
</div><div><br />
</div><div>A special thanks to Jared Morgan and Tom Wells for the extra effort on the documentation!<br />
</div>Alexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com0tag:blogger.com,1999:blog-4670964355147826480.post-41733108079509648312009-09-07T02:23:00.002+01:002009-09-07T02:33:34.103+01:00Mobicents Meeting 2009 @ BrnoIt was that time of the year again when the Mobicents Team meets face-2-face to discuss the achievements made through the current year, plan the roadmaps for the upcoming year and last but not the least, party a lot!<br />
<br />
This time it happened in Brno, the second largest city in Czech Republic, but at least for this week it was the funniest! Only possible thanks to Pavel, who led us through Brno! Thank You!<br />
<br />
It had a quite troubled start, with the Portuguese members (me included) ending up by missing the plane due to issues with the airlines company (which suspended their operations since Sept. 1st). We made it anyway, missing the first day.<br />
<br />
Regarding Mobicents, the 2009 achievements were quite amazing:<br />
<br />
<ul><li>Mobicents SIP Servlets, Mobicents Diameter and Mobicents Media Server became GA.</li>
<li>Mobicents JAIN SLEE 2.x had it's first version, BETA1, which was certified for JAIN SLEE 1.1 (JSR 240), being the first besides the specs leader, and still the only open source.</li>
</ul><br />
Although all this being accomplished, there's still much more to work on, and a lot of new projects to stabilize. One of the hottest topics was the High-Availability across all these servers, which as you can understand is not a trivial subject and had a quite intense discussion.<br />
<br />
On my side, I made a presentation regarding Diameter (available <a href="http://mobicents.googlecode.com/files/diameter-brno-2009.pdf">here</a>), the main project where I'm involved. For the achievements of 2009, we have highlighted the following:<br />
<ul><li>Integration with Mobicents SIP Servlets;</li>
<li>Sh-Client/Server Application support (3GPP TS 29.328 & TS 29.329);</li>
<li>Credit Control Application support (RFC 4006);</li>
<li>Ro/Rf Application support (3GPP TS 32.225 & TS 32.299);</li>
<li>Cx/Dx Application support (3GPP TS 29.228 & TS 29.229)</li>
</ul><div>This was a great improvement for an year! But we won't stop and will evolve it even further, with the following features being the most important ones:</div><div><ul><li>High-Availability;</li>
<li>Management Console (cross-server);</li>
<li>NAT (STUN/TURN/ICE) support;</li>
<li>WebServices support;</li>
<li>IMS Applications prototypes (HSS/x-CSCF)</li>
</ul><div>So it's still a long road ahead of us, and now it's when the fun begins! And we are counting on the Mobicents Community for helping us out improving!</div><div></div><div>Here's a picture taken at the end of my presentation:</div><div></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbWKn59OixDrzsCXSlYwpFfPsX8E8ICZyBGCKf1-OFrhsVnK7iWkhIYxfWunZF6obdljUi48HZADkeQXi0ruPh4SpBKYZV8C070gz451a5hMxSxr3bLCejM94RUVh7DhWTzcbSw1OYIx4/s1600-h/mobicents-brno-2009-presentation.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbWKn59OixDrzsCXSlYwpFfPsX8E8ICZyBGCKf1-OFrhsVnK7iWkhIYxfWunZF6obdljUi48HZADkeQXi0ruPh4SpBKYZV8C070gz451a5hMxSxr3bLCejM94RUVh7DhWTzcbSw1OYIx4/s400/mobicents-brno-2009-presentation.JPG" /></a></div></div></div><div style="text-align: center;">Left to right: Pavel, Bartosz, Amit, Jean, Vladimir, me, Ivelin, Luis and Eduardo.</div><br />
And the team warming up for dinner (Pavel is missing and I'm taking the picture):<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNPyWfc5Oz2kjNy3DFwwCthsgtWP3ndCOPDtWdHbYR4rN4UyM8DC1BKyw29fUJsVH4fh9zqpF4z-Ancj4enL-UW8RM2QNhvWhQtNrPW2qtPwNq_0j-mzMf025tXUCM6zfGEfeCUrcIR1c/s1600-h/mobicents-brno-2009-cheers.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNPyWfc5Oz2kjNy3DFwwCthsgtWP3ndCOPDtWdHbYR4rN4UyM8DC1BKyw29fUJsVH4fh9zqpF4z-Ancj4enL-UW8RM2QNhvWhQtNrPW2qtPwNq_0j-mzMf025tXUCM6zfGEfeCUrcIR1c/s400/mobicents-brno-2009-cheers.JPG" /></a></div><div style="text-align: center;">Left to right: Luis, Amit, Eduardo, Bartosz, Vladimir, Ivelin and Jean.</div><br />
Cheers for Mobicents team and hope for another successful year!Alexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com0tag:blogger.com,1999:blog-4670964355147826480.post-59797354030727631812009-09-05T03:32:00.000+01:002009-09-05T03:39:38.593+01:00Welcome to a new era!That's right! It's a complete new world for me now that I've started my own blog.<br />
<br />
First of all, let me introduce myself and the role of this blog:<br />
<br />
I'm a Software Engineer working for JBoss R&D on the open source telco framework <a href="http://www.mobicents.org/">Mobicents</a>. I've been using and developing services for it for almost 4 years, namely in JAIN SLEE server, and roughly 2 years ago I started to work on the core team, developing JAIN SLEE core and started from scratch along with <a href="http://baranowb.blogspot.com/">Bartosz Baranowski</a> the Diameter component for the project.<br />
<br />
It's been a wonderful experience so far, I've learned a lot from all the team members, all JBoss community and from work itself!<br />
<br />
Regarding the blog, it's been a project that I've always been delaying but I think the time has come and I hope I can keep it up! I expect to write on a regular basis, mainly with new announcements, some hints regarding my work... and whatever comes to my mind! :)<br />
<br />
See you soon!Alexandre Mendonçahttp://www.blogger.com/profile/09409638475629377312noreply@blogger.com0