Mbuni MMSBOX – Mms VAS Gateway

18 Feb

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.

Released version can be found in

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 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
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-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
Content-Disposition: form-data; name="fx"
Content-Disposition: form-data; name="text[]"; filename="This_is.txt"
Content-Type: text/plain; charset=utf-8
This is 4 test
Content-Disposition: form-data; name="skip"

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";


Posted by on February 18, 2010 in mmsc


Tags: , , , , , ,

7 responses to “Mbuni MMSBOX – Mms VAS Gateway

  1. hamza

    September 21, 2010 at 10:13 am

    Hi, your tutorial is very useful. However I am stuck in decoding received MMS. Can I see the code of file test-mbuni.php? It would be very helpful. Thanks!

  2. thilani

    September 21, 2010 at 11:46 am

    Thanks for the comment
    I have added sample php script in the blog. It will save mms content as separate file(s).
    according to the script, files are saved in /var/www/html/.If files are not saving just check directory permissions etc.

  3. hamza

    September 21, 2010 at 12:21 pm

    The script is working perfectly, giving image and text. However, I need to pass the information of originating MSISDN and target short-code ID to the script as well. Need your help on that.

  4. thilani

    September 21, 2010 at 1:04 pm

    Google on, how to extract http headers in php.

  5. Alex

    December 14, 2010 at 7:34 am

    Greatest thanks!!!
    to: hamza possible $_SERVER can help

  6. thilani

    December 14, 2010 at 8:50 am

    You are welcome 🙂

  7. Santosh

    July 31, 2013 at 8:01 pm

    Hi Thilani,

    I am newbie to mbuni.
    Need ur help.
    I have followed ur post & done exact setup on my virtual machine at my home.
    But dont know how to test it.
    Please guide.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: