Net::SIGTRAN::M3UA

Have released a draft beta version of SCTP Perl Module that is published in CPAN.

Net::SIGTRAN::M3UA – An implementation to create M3UA protol stack to provide SIGTRAN stack implementation in perl. Before installing Net::SIGTRAN::M3UA, make sure that the following package:

$ rpm -qa|grep sctp
lksctp-tools-1.0.6-3.el5
lksctp-tools-devel-1.0.6-3.el5

Alternatively you can download and compile the source from http://lksctp.sourceforge.net.

The following is example source code to get started.

SCTP Server Example

use Net::SIGTRAN::M3UA;
use threads;

my $server=new Net::SIGTRAN::M3UA(
PORT=>12346 ); my $ssock=$server->bind(); if ($ssock) {
my $csock;
while($csock = $server->accept($ssock)) {
print "New Client Connection\n";
my $thr=threads->create(\&processRequest,$server,$csock);
$thr->detach();
}
}

sub processRequest {
my $server=shift;
my $ssock=shift;
my $connSock = $server->accept($ssock);
cmp_ok($connSock,'>',0,'Unable to accept Client Connection');
print "Sending to $connSock\n";
$server->ASPUP($connSock);
$server->ASPUP_ACK($connSock);
$server->ASPAC($connSock,2,0);
$server->ASPAC_ACK($connSock,2,0);
$server->NTFY($connSock,1,2);
$server->DAUD($connSock,12,0,1142);
$server->DAVA($connSock,12,0,1142);
$server->DUNA($connSock,12,0,1142);
my $heartbeat='0005000101ffd8398047021227041120';
$server->BEAT($connSock,$heartbeat);
$server->BEAT_ACK($connSock,$heartbeat);
$server->close($connSock);
}

SCTP Server Example

use Net::SIGTRAN::M3UA;

my $client=new Net::SIGTRAN::M3UA(
HOST=>'127.0.0.1',
PORT=>12346 );

my $csock=$client->connect();
#Read ASPUP
&clientread('ASPUP',$client,$csock);
#Read ASPUP_ACK
&clientread('ASPUP_ACK',$client,$csock);
#Read ASPAC
&clientread('ASPAC',$client,$csock);
#Read ASPAC_ACK
&clientread('ASPAC_ACK', $client,$csock);
#Read NTFY
&clientread('NTFY', $client,$csock);
#Read DAUD
&clientread('DAUD', $client,$csock);
#Read DAVA
&clientread('DAVA', $client,$csock);
#Read DUNA
&clientread('DUNA', $client,$csock);
#Read BEAT
&clientread('BEAT', $client,$csock);
#Read BEAT_ACK
&clientread('BEAT_ACK', $client,$csock);

$client->close($csock);

sub clientread {
my $title=shift;
my $client=shift;
my $csock=shift;
my ($buffer)=$client->readpdu($csock);
if ($buffer) {
if ($buffer->{'M3UA'} =~/Invalid|Unknown/) {
print("Reading $title test");
} else {
print("reading $title test");
print STDERR Dumper($buffer);
}
} else {
print("Reading $title test, Client Socket does not recieve any packet");
}
}

INSTALLATION

To install the module, perform the usual perl module installation procedures. The following is the steps:


perl Makefile.PL
make
make install

Net::SIGTRAN::SCTP

Have released a draft beta version of SCTP Perl Module that is published in CPAN.

This SCTP module is created to access lksctp to provide SCTP implementation. Before installing Net::SIGTRAN::SCTP, make sure that the following package:

$ rpm -qa|grep sctp
lksctp-tools-1.0.6-3.el5
lksctp-tools-devel-1.0.6-3.el5

Alternatively you can download and compile the source from http://lksctp.sourceforge.net.

The following is example source code to get started.

SCTP Server Example

use Net::SIGTRAN::SCTP;
use threads;

my $server=new Net::SIGTRAN::SCTP( PORT=>12345 );
my $ssock=$server->bind();
if ($ssock) {
my $csock;
while($csock = $server->accept($ssock)) {
print "New Client Connection\n";
my $thr=threads->create(\&processRequest,$server,$csock);
$thr->detach();
}
}

sub processRequest {
my $connection=shift;
my $socket=shift;
my ($readlen,$buffer)= $connection->recieve($socket,1000);
print "Recieved ($readlen,$buffer)\n";
}

SCTP Server Example

use Net::SIGTRAN::SCTP;

my $textstring='Hello World';
my $client=new Net::SIGTRAN::SCTP( HOST=>'127.0.0.1', PORT=>12345 );

my $csock=$client->connect();

$client->send($csock,0,length($textstring),$textstring);
$client->close($csock);

INSTALLATION

To install the module, perform the usual perl module installation procedures. The following is the steps:


perl Makefile.PL
make
make install

EMI UCP protocol

External Machine Interface (EMI), an extension to Universal Computer Protocol (UCP) is a SMSC VAS protocol created by CMG. As one of the major SMSC vendor, EMI and SMPP are two of the widely used SMSC VAS protocol. Even after the merger of Logica and CMG, both protocols are still widely used.

One of the free library that I’ve using is from Marco Romano. It is a Perl library which can be used to generate EMI/UCP message easily. Please take a look at:

http://search.cpan.org/~nemux/Net-UCP-0.29/

Transcoding Engine

Nowadays, anyone that working in the telco space, esp. those who work in the ip mobile space, has to come in touch with transcoding one way or another. Today, topic is about transcoding and how to find information for each transcoding engine that are free and widely available.

Image Transcoding

The best and free engine that I’ve come across is ImageMagick. You can take a look at www.imagemagick.org. To convert from one format to another is as simple as:

convert rose.jpg rose.png

Audio Transcoding

Searching for free audio transcoding is not as simple as I thought initially until I found this web site at
http://xa.bi/mms/. It describes the difference audio transcoding engine and how they work together to convert different format of audio to/from one another.

Video Transcoding

FFMpeg is always the choice when I ask someone for a free source to transcode video file.

Check out these web site, it should give you a starting point of where to look out for free library and third party software to do transcoding.

Perl Module to check OMA DRA support for a mobile device

Last Month in one of articles, I covered a topic on how to get the screen size of a mobile device, someone is wondering about how to check the Open Mobile Alliance (OMA) Digital Rights Management (DRM) support.

To check Forward-Lock, you need to ensure that the following content-type is accepted by the device:

  • application/vnd.oma.drm.message

To check Combined Delivery, you need to ensure that the following content-type is accepted by the device:

  • application/vnd.oma.drm.message
  • application/vnd.oma.drm.rights+xml

To check Separate Delivery, you need to ensure that the following content-type is accepted by the device:

  • application/vnd.oma.drm.rights+xml
  • application/vnd.oma.drm.rights+wbxml
  • application/vnd.oma.drm.content

One more thing is that the device may support (for example) Combined Delivery DRM, but you may not be able to use that in MMS. Thus, further check on “MmsCcppAccept” tag of the User Agent Profile (UAProf) to ensure that it is supported.

Some may wonder why I don’t just check the “DrmClass” tag instead. Well, you can, however, during my investigation, I found out that some mobile phone manufacturers do not include this in the UAProf. Thus, it is much safer to check the DRM’s content-types instead.

I have further modified the previous Mobile::UserAgentProfile library and include this checking into that. I have also make changes to the method calling so that I can hold the profile in memory rather than load the profile from file every time I need to check on the UAProf.

INSTALL

To install, do the following:

perl Makefile.PL
make
make install

Continue reading

Perl Module to get the Screen Size of a mobile device

As mobile devices are created differently, there are a lot of different Screen size available in the market. Due to the small screen size, mobile application developers had always find it hard to optimize the WAP portal for different devices. Keeping a record of the screen size is also difficult as there isn’t a standard way for mobile devices manufacturers to communicate to the mobile application developers.

User Agent Profile (UAProf) specification is the answer to this problem. It is used to capture capability and preference information for mobile devices. This information can be used by content providers to produce content in an appropriate format for the specific device.

In this article, we will discuss the Perl module which use UAProf to get the screen size of the mobile devices. For further information, you can download a copy of UAProf’s specification at:

Specification of UAProf

INSTALL

To install, do the following:

perl Makefile.PL
make
make install

Continue reading

Perl Module to encapsulate OMA DRM format for a media type

Open Mobile Alliance (OMA) is a standards body founded by telecommunication companies which develops open standards for the mobile phone industry. In order to ensure interoperability across all implementations for Digital Rights Management (DRM), the OMA provides DRM specifications so that content providers, operators and mobile phone manufacturers can easily integrate the DRM solution as smoothly as possible.

I have created Net::OmaDrm Perl module so that content providers can format the content-type quickly.

This module support the OMA DRM version 1.0 method of sending content to the handset. A device will declare the support for OMA-DRM by including one of the method which is provided by this module:

  • Forward-lock
  • Content-Type
  • application/vnd.oma.drm.message
  • Combined delivery
    • Content-Type
    • application/vnd.oma.drm.message
    • application/vnd.oma.drm.rights+xml
  • o-ex:permission
    • o-dd:display
    • o-dd:play
  • o-ex:constraint
    • o-dd:count
    • o-dd:interval

    A detailed document of OMA-DRM can be found at:
    http://www.openmobilealliance.org/release_program/drm_v1_0.html

    I have tested this module on perl v5.8.5.

    INSTALL
    To install, do the following:

    perl Makefile.PL
    make
    make install
    

    Continue reading

    Perl Module to access Clickatell HTTP API

    I’ve written a perl module to access to Clickatell HTTP API. This module supports the API from Clickatell’s HTTP API Specification v.2.2.7.

    The following are all the available APIs and whether they are supported or not:

    Basic Commands

    • http://api.clickatell.com/http/auth
    • Yes (But session Not support)
  • http://api.clickatell.com/http/ping
    • Yes (But session Not support)
  • http://api.clickatell.com/http/querymsg
    • Yes
  • http://api.clickatell.com/http/sendmsg
    • Yes

    Additional Commands

    • http://api.clickatell.com/http/delmsg
    • No
  • http://api.clickatell.com/http/getbalance
    • Yes
  • http://api.clickatell.com/http/routeCoverage.php
    • Yes
  • http://api.clickatell.com/mms/ind_push.php
    • Yes
  • http://api.clickatell.com/mms/si_push.php
    • Yes
  • http://api.clickatell.com/http/getmsgcharge
    • Yes
  • http://api.clickatell.com/http/token_pay
    • No

    Batch Messaging

    • http://api.clickatell.com/http_batch/startbatch
    • No
  • http://api.clickatell.com/http_batch/senditem
    • No
  • http://api.clickatell.com/http_batch/quicksend
    • No
  • http://api.clickatell.com/http_batch/endbatch
    • No

    I tested this module on perl v5.8.5.

    INSTALL

    To install the module, perform the usual perl module installation procedures. The following is the steps:

            perl Makefile.PL
            make
            make install
    

    Continue reading