RSS

Category Archives: technology

Mbuni MMSBOX – Mms VAS Gateway

I tried to install cvs version of Mbuni which can be downloaded from Sourceforge.

As I found the mbuni project can be downloaded from the following link. http://sourceforge.net/projects/mbuni/

Released version can be found in  http://www.mbuni.org/downloads/1.4.0/mbuni-1.4.0.tar.gz

I used the source code compilation method.

First I needed to install several dependencies of Mbuni

Installed Kannel patched version found in mbuni site.

Installed AMR Encoder Decoder and given patch

Above steps are mandatory, otherwise there ll be compilation errors in mbuni.

For  basic installation I followed following steps

Inside mbuni source folder

chmod +x  configure

./configure --with-kannel-dir=DIR

DIR is where my kannel  installation is. I installed Kannel in /usr/local/kannel.

So DIR = /usr/local/kannel

Compile mbuni source


make
make install

by default  `make install’ will install all the files in

/usr/local/bin and /usr/local/lib.

For alter the default installation directory try

./configure ––help

Try out the options available

For  configure the mbuni vas gateway I used the  sample configuration file provided with mbuni.

Configuration files can be found in  doc/examples folder.

I used mmsbox.conf file for configuring the vas gateway.

I copied the mmsbox.conf file into  /etc/

cp mmsbox.conf /etc

Im mmsbox need to add following configurations

  1. Communicate with operator mmsc(s)
  2. Communicate with VAS application.

Communicate with operator mmsc.
Modify the group mmsc

group = mmsc
id = local
mmsc-url = http://mbuni:test@localhost:1982/soap
incoming-username = user
incoming-password = pass
incoming-port = 12345
type = soap

id – is a mandatory field
mmsc-url – url address of the mmsc.
Normally mmsc needs to configure vas application with short code,vas_usrename ,vas_password,vasp-url ..etc
So VAS application can send messages to mmsc using
http://vas_username:vas_password@mmsc_host:mm7_port
Here I have used Mbuni mmsc as my mmsc. I configured VASP account in mmsc.conf.

group = mms-vasp
vasp-id = newscorp
type = soap
short-codes = 111,1234
vasp-username = mbuni
vasp-password = test
vasp-url = http://user:pass@localhost:12345/

Here vasp-url is the url of vas gw
Any incoming message to shortcode 111 or 1234 will post to vasp-url
user:pass is the incoming-username and incoming-password of vas gw.
localhost – Vas gw host
12345 is the port which vas gw listens for messages from mmsc

In mmsc-url
mbuni:test is vasp-username and vasp-password
localhost – mmsc host
1982 –mmsc mm7 listen port
When a VAS application sends a message to VAS GW ,VAS GW will post messages to mmsc- url .

Communicate with VAS application

Group mms-service can be used to send message to VAS application

group = mms-service
name = me
post-url = http://localhost/test-mbuni.php
catch-all = false
http-post-parameters = fx=true&images[]=%i&text[]=%t&skip=1
accept-x-mbuni-headers = true
pass-thro-headers = X-NOKIA-MMSC-Charging,X-NOKIA-MMSC-Charged-Party
keyword = test
omit-empty = no
suppress-reply = true
service-code = regular

According to my mms-service configuration
messages which has the word test will post to http://localhost/test-mbuni.php
Vas gw only passes images and text content to service.

Catch message sent to post-url

I have configured a vasp account in my mbuni mmsc.which has the shortcode of
111,1234. So when I send a mms to shortcode 111 or 1234,mmsc should send the message to VAS GW and
VAS GW should route to the message into correct mms-service (mm7 application).
According to my mms-service configuration,incoming message which has text ‘test’ will route to test-mbuni.php

test-mbuni.php will get a message which has following format.(multipart/form-data)


POST /test-mbuni.php HTTP/1.1
Host: localhost
Connection: keep-alive
User-Agent: Mbuni/cvs-20091014
X-Mbuni-Message-ID: qf1032.5.x293.98
X-Mbuni-MMSC-ID: newscorp
X-Mbuni-LinkedID: o-8n-qf1029.5.x876.70@mmsc
X-Mbuni-From: 172.16.11.18@unknown
X-Mbuni-TransactionID: Mbuni-qf1032.5.x293.98
X-Mbuni-To: 111
X-Mbuni-Message-Date: Wed, 17 Feb 2010 10:03:49 GMT
X-Mbuni-Received-Date: Wed, 17 Feb 2010 10:03:52 GMT
Content-Type: multipart/form-data; boundary=_boundary_800406929_1266401032_C_s_bd914252053
MIME-Version: 1.0
Content-Length: 435
--_boundary_800406929_1266401032_C_s_bd914252053
Content-Disposition: form-data; name="fx"
true
--_boundary_800406929_1266401032_C_s_bd914252053
Content-Disposition: form-data; name="text[]"; filename="This_is.txt"
Content-Type: text/plain; charset=utf-8
This is 4 test
--_boundary_800406929_1266401032_C_s_bd914252053
Content-Disposition: form-data; name="skip"
1
--_boundary_800406929_1266401032_C_s_bd914252053--

Capture mms content

This is a sample php script which extracts mms content and save them as separate files.


$uploaddir = '/var/www/html/';
foreach ($_FILES as $i => $file) {
$part = $_FILES[$i];
$uploadfile = $uploaddir . basename $part['name'][0]);
if(move_uploaded_file($part['tmp_name'][0],$part['name'][0])) {
echo "File is valid, and was successfully uploaded.\n";
}
else {
echo "File upload error!\n";
}
}

Advertisements
 
7 Comments

Posted by on February 18, 2010 in mmsc

 

Tags: , , , , , ,

Mms Vas Gateway

According to my interpretation VAS gateway operates between MMSC(s) and VAS Application(s).
It switches messages between mmsc and vas application

mmsc and vas gateway

Protocol between MMSC and MMS VAS GW is MM7.

 
Leave a comment

Posted by on February 17, 2010 in mmsc

 

Tags: , ,

MMS TO EMAIL & EMAIL TO MMS

After installed mbuni mmsc,now I can send mms mobile to mobile. This is using MM1 interface.There are
sevral MM interfaces available in Mbuni.
It supports essential MM interfaces.MM1,MM3,MM4 and MM7.

MM1 – Interface between mobile and the mmsc
MM3 -Interface between MMSC and external servers
MM4 -Interface for foriegn MMSCs
MM7 -Interface between VASP s (Value added service providers)
This post is about how to configure mbuni mmsc for sending mms as an email and vise versa.

Mbuni communicates with SMTP/Mail interface for delivering mms as an email or email as a MMS.

MMS2EMAIL
First take a look how to deliver mms to email account

For that purpose we need to install MTA(Mail transfer agent)like postfix,or we can use default sendmail also.

Install and configure postfix (sendmail) for sending mails.

Then set the following parameter in mbuni mmsc.conf file

send-mail-prog = /usr/sbin/sendmail -f '%f' '%t'

we can set these parameters also
mms-notify-text = "You have received a multimedia message from %S, go to XXX to view it"
mms-notify-unprovisioned-text = "This is a test"
mms-to-email-txt = "This is a multimedia message (HTML suppressed)"
mms-to-email-html = "This is a multimedia message powered by Mbuni"
mms-to-email-default-subject = "This is a multimedia message"

restart mbuni .Lets use mmssend utility to check mms2email functionality.

mmssend -f [from no] -t [valid email] -m sample.mms -b /etc/mmsc.conf

After that check logs

EMAIL2MMS

For this configuration we need mail transfer agent (postfix) .We need to tell postfix how to route emails to mbuni.
I used the method stated in this link
Other than that I needed to give access rights to postfix to access mbuin log files (access log ,mmsc.log)
set permisson of Mbuni log file folder
chmod 644 logfolder/*

In mbuni configuration I need to set the
email2mms-relay-hosts
This is to specify which domain that mbuni gets email messages.Mbuni only accepts messages from that domains.Here I needed to add mbuni’s own domain name also as a relay host.If mbuni mmsc connected with other operator mmscs
need to add that host names also.And there after need to configure group “foreign mms gateways configuration MM4”

 
2 Comments

Posted by on November 29, 2009 in mmsc

 

Tags: , , ,

Webcam not working with skype

I was using Skype in my Fedora 9 (kernel release -2.6.25-14.fc9.i686)machine and tried to use the ETEL E-10 phone as a web cam .
When I tried to test my video device in Skype screen remained as a black ,
and got following errors

Skype V4L2: Could not find a suitable capture format
Skype V4L2: Could not find a suitable capture format
Starting the process…
Skype Xv: Xv ports available: 33
Skype XShm: XShm support enabled
Skype Xv: Using Xv port 57
Skype Xv: No suitable overlay format found

For solving the issue I had to install libv4l libraries
Libraries for fc9 can be found here
Or simply install with yum install libv4l

Then I started skype giving following command line arguments
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype
more detail explanation found in this article

 
Leave a comment

Posted by on November 29, 2009 in technology, Uncategorized

 

Tags: ,

Running Mbuni as a MMSC

Mbuni is an open source mms gateway.You can download Mbuni source code from Mbuni site.
Try to compile source and install.Go through mbuni documentation for installation instructions.
It is a must to install all the dependencies stated in documentation page.

mbuni installation will install several components.

mmsrelay

mmsproxy

mmsbox

mmsfromemail

mmssend

we can run Mbuni as MMSC or as VAS gateway.

Lets see how
mbuni configured as a MMSC.

First we need to meet these requirements

Mbuni installation machine
1)should be globally accessible.So we need to assign a global ip and open a port.

2)It should be able to access internet

3)Running web server (optional)

4)SMPP connection or a GSM modem with SIM.

Mbuni source comes with .conf files.you have to manually configure them.
Copy .conf files (you might find them in mbuni-1.4.0\mbuni-1.4.0\doc\examples) in to folder.

Ex /etc/mmsc.conf,/etc/mmsbox.conf

Lets take a look few important configuration parameters.
refer  mmsc .conf file using vi editor

vi /etc/mmsc.conf
hostname=mmsc.mytest.lk ip or hostname configured in hosts file
host-alias = This is used to shorten the message retrieval url
lets put some thing like
mmsc
This should be configured in hosts file.located at /etc/hosts
In /etc/hosts configuration there should be a configuration like
x.x.x.x mmsc.mytest.lk mmsc

x.x.x.x is (global) ip of your machine
when mbuni send out notification, in mbuni logs we can see that it is sending this url
LOG :::Preparing to notify client to fetch message at URL: http://mmsc/4-qf3440.1.x96.38@2/wx63
local-prefixes =according to mbuni documentation ,number prefixes that should be considered local.

Normally mobile number consists of  country code ,operator code ,followed by identification number.

Ex : +94 77 XXXXXXX

+94 = country code

77 = operator code

Send a mms to this number you need to put +9477 as local prefix.

storage-directory =This is where mbuni creates message queue.

since retrieval url is something like http://x.x.x.x/mms/mm1.we need to create a directory called ‘mms’inside a web server root directory
Ex :/usr/local/apache/htdocs/mms

sendsms-url = According to documentation
URL of the service through which SMS can be sent to a mobile subscriber .
This is some what similar to Kannel send-sms-url

Ex 1)http://x.x.x.x:port/cgi-bin/sendsms
2)http://x.x.x.x:port/cgi-bin/sendsms?&smsc=TEST&

x.x.x.x = Ip of kannel installed machine
port= sendsms-port in Kannel configuration
/cgi-bin/sendsms = sendsms-url in Kannel configuration

If using GSM modem with SIM,it should be configured in kannel configuration file under group smsc

smskannel.conf
-------------
group =smsc
smsc = TEST
modemtype =
device = /dev/ttyS0
speed = 9600
allowed-smsc-id=TEST

# SMSBOX SETUP

group = smsbox
bearerbox-host = localhost
sendsms-port = 12345
sendsms-url = /cgi-bin/sendsms
global-sender = 900

# SEND-SMS USERS

group = sendsms-user
username = foor
password = bar
....

Then mbuni sendsms-url must be like in example 2.Where we have to provide extra parameter smsc=TEST
TEST is the allowed-smsc-id .
If Kannel binds to an smpp account then the sendsms-url must be like in example 1.
sendsms-username ,sendsms-password
This is for authentication of sendsms url.
Insert same username ,pasword pair in Kannel ,”smskannel.conf “group = sendsms-user
sendsms-global-sender This maps with the kannel global-sender
Mms port
mms-port = 1981
This is the port mbuni listens for sending/receiving mms

Allow_ip
List of IP addresses of hosts allowed to use/access the MM1Port

optimize-notification-size set true

go to mms/ folder. set read write file permission
chmod – R 777 mm1
Set read wite file permission of mms/mm1 directory,sub directories owns to daemon

Once set these parameters.Save the. conf file and exit from vi editor (press <Esc>:wq).

Now we have to start mmsproxy and mmsrelay components.

Try these commands

mmsproxy /etc/mmsc.conf  &

mmsrelay /etc/mmsc.conf  &

See logs and check for errors.

We can use sendmms component to test whether mms is delivered to mobile
Try this command

mmssend -f XXXX -t YYYY -m sample.mms -b /etc/mmsc.conf

-f = From number
-t = To number
-m = give binary mms file name with path
-b = configuration file name
After executing the command check mbuni logs.
make sure your SIM is activated for sending and receiving MMS.
You should get a notification mms. If you have correctly configured mbuni with Kannel & GSM Modem
When you received the notification sms try to download the MMS .For this we should connect to Mbuni installation machine via GPRS .If you are unable to download the message this is because mobile doesn’t know how to grab the message from
mbuni.So we need to modify MMS settings in our mobile

Here is sample MMS profile configuration for Samsung SGH-J200 model
Go to
Messages ->Message Settings->Multimedia Message->Multimedia Message Profile
Option ->new
Change these parameters
Set Name = mbuni (as you wish )
Access name = put your operator APN name here
Home url =http://x.x.x.x:mms_port/mms
According to above configurations x.x.x.x is the global ip of mbuni installed machine,
“mms_port” is mms port we configured in mmsc.conf
“mms” is the storage directory inside web server root directory

proxy address =If you connect to mbuni machine via proxy put that ip here.Otherwise mbuni machine ip
Port = proxy port if any otherwise mms_port

Try to download the mms now.This should download the mms into your mobile.
Check for mbuni logs.It will show any attempt that is made by the phone to fetch the message.
Ex

2009-07-17 08:30:32 [23422] [2] DEBUG: HTTP: Creating HTTPClient for `202.129.234.232'.
2009-07-17 08:30:32 [23422] [2] DEBUG: HTTP: Created HTTPClient area 0xa00e328.
2009-07-17 08:30:33 [23422] [0] DEBUG: Request, ip=202.129.234.232, base_client_addr=2001514, client_addr=2001514/TYPE=PLMN, url=http://mmsc/4-qf3440.1.x96.38@2/wx63
2009-07-17 08:30:33 [23422] [0] DEBUG: Started thread 5 (mmsproxy.c:(gwthread_func_t *)fetchmms_proxy)
2009-07-17 08:30:33 [23422] [5] DEBUG: Thread 5 (mmsproxy.c:(gwthread_func_t *)fetchmms_proxy) maps to pid 23422.
2009-07-17 08:30:33 [23422] [5] DEBUG: ---> Entered fetch interface: url=http://mmsc/4-qf3440.1.x96.38@2/wx63<---

In logs if you can’t see any attempt made by phone to download the message,Check for these
1:Make sure machine has a global ip and the mms port is not blocked.
2: Make sure the GPRS APN configured in your mms profile permits HTTP requests to other addresses
These are few reasons that I have come across where above configuration is not working .If still its not working update me:).

 
54 Comments

Posted by on July 15, 2009 in mmsc

 

Tags: , , , , , ,

Workers and supervisors

Herd of workers and supervisors :).In real world workers are doing the actual work and supervisors are monitoring the behaviour of workers

Well ,here it is about Erlang supervisors.In Erlang Workers are processes which perform the actual work whereas supervisors are processes which monitor the behaviour of workers.At the same time supervisor can restart the worker if something goes wrong.

Graphical representation of supervisor and worker.

Rectangular shape -supervisor
eclipse /circular shape -worker.
This is called supervision tree.
According to this supervision tree, there is one supervisor and under that supervisor there is one worker.
In Erlang there are different types of supervisors are defined according to their behavior.

They are

one_for_one

one_for_all

simple_one_for_one.

 
Leave a comment

Posted by on May 9, 2009 in technology

 

Tags: , , ,

Erlang

Bulk loading data into Mnesia

Mnesia is a DBMS which comes with the erlang distribution.Which is appropriate for
telecommunication applications which are realtime and continues
Mnesia provides read,write operations which can be used to load and search data.

Here the problem is bulk loading of data into mnesia table
say 1 million records.[records which has about 12 attributes]
tables which are disc_copies and disc_only_copies

create tables,both disc_copies and disc_only_copies
In disc_copies table kept in RAM as well as on disc.Where as in disc_only_copies table kept on disc_only

mnesia_create_tables(NodeList) ->
case mnesia:start() of
ok ->
error_logger:error_report([“Mnesia start ok”]),

mnesia:create_table(person,
[{disc_only_copies, NodeList},{type, set},
{attributes, record_info(fields, person)}]),

mnesia:create_table(subscriber,
[{disc_copies, NodeList},{type, set},
{attributes, record_info(fields, subscriber)}]);

{error, Reason} ->
error_logger:error_report([“Mnesia start error: “, Reason]),
{error, Reason}
end.

For bulk writing we can use two functions. one is mnesia:dirty_write and other one is
mnesia transaction mechanism.
Dirty operations are performance wise better than transaction mechanism.Its because dirty operations are bypassing much of processing
In transaction mechanism action is either performed or aborted.

Use dirty method for loading data.

dirty_populate_disc_copy(Rec) ->
dirty_populate_disc_copy(Rec,5).

dirty_populate_disc_copy(N,NumProc) ->
From =N,
To= N-trunc(N/5),
dirty_populate_disc_copy(N,NumProc,From,To).

dirty_populate_disc_copy(N,NumProc,From,To)->
if
NumProc > 0 ->
io:format(“From=~w To=~w Pocess=~w~n”,[From,To,NumProc]),
spawn(bench_db,populate_subscriber,[From,To,dirty]),
dirty_populate_disc_copy(N,NumProc-1,To,To-trunc(N/5));
NumProc ==0 ->
no_spawn
end,
ok.

Used 5 spawns to load data into mnesia tables.
specify integer value for Rec .It will load that number of records into mnesia table.
%% ——————————————————————-
%% Populate the subscriber table :disc_copies
%% ——————————————————————-

populate_subscriber(From,To,Option) ->
random:seed(),
Stime =erlang:localtime(),
statistics(runtime),
statistics(wall_clock),
do_populate_subscriber(From, To,Option),
{_, RT} = statistics(runtime),
{_, WC} = statistics(wall_clock),
Etime=erlang:localtime(),
io:format(“Start=~p End=~p~n~n”, [Stime, Etime]),
io:format(“Run Time=~p Wall Clock Time=(~p) milliseconds~n”, [RT, WC]).

do_populate_subscriber(FId,TId,Option) when FId > TId ->
Name = “abcddddd”,
GroupId = random:uniform(100) – 1,
Subscr = #subscriber{subscriber_number = FId,
subscriber_name = Name,
group_id = GroupId,
variable_id = GroupId,
variable_name = “sports”,
marketing_value = “12.4454555”,
length_variable = false,
location = 9064949,
active_sessions = 450000,
changed_by = <>,
changed_time = <>,
suffix = “222222”
},
if
Option == dirty ->
save_record_dirty(subscriber,Subscr);
Option == trans ->
save_record_trans(subscriber,Subscr)
end,
do_populate_subscriber(FId-1,TId,Option);

do_populate_subscriber(_,_,_) ->
io:format(” totally ~p bytes~n”,
[mnesia:table_info(subscriber, memory) * 4]),
ok.

save_record_dirty(DB,Record) ->
mnesia:dirty_write(DB,Record).

Find the complete module here


 
Leave a comment

Posted by on January 15, 2009 in technology

 

Tags: , , , , ,