#! /usr/bin/perl
# 
# $Id$
# Contact page Perl template.
# Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; exactly version 2 of June 1991 is required
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


package Contact;
require 5.6.0;	# at least 'use warnings;' but we need some 5.6.0+ modules anyway
use vars qw($VERSION $CVS_ID);
$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
$CVS_ID=q$Id$;
use strict;
use warnings;

BEGIN{ open F,"Makefile"; our $top_dir=pop @{[split /\s/,(grep /^top_srcdir/,<F>)[0]]}; eval "use lib '$top_dir'"; close F; }
use My::Web;
require CGI;
Wrequire 'My::Project';


my $W=My::Web->init(
		"__PACKAGE__"=>__PACKAGE__,
		"title"=>"MMS Center Debugging",
		);
My::Web->heading();


sub project ($)
{
my($name)=@_;

	my %name_item=( My::Project->one_item_list_read($name) );
	return a_href "/project/$name/",$name_item{"name"}.': '.$name_item{"summary"};
};


print <<"HERE";
<h1>MMS Center Debugging</h1>

<p>Here you can find description of very simple but technically interesting hack.
You can provide your own MMS Center (MMS=Multimedia Messaging Service) in GSM
network instead of the operator's one.</p>

<p>There is only a limitation of a bearer data service - MMS is usually run
over GPRS (General Packet Radio Service) channels while you cannot behave as
GPRS callee in GSM network. Fortunately MMS can be run also over CSD (Circuit
Switched Data - up to 14400bps) or HSCSD (High Speed CSD - up to 57600bps)
services. GPRS is usually known as always-online while CSD/HSCSD you must dial
some destination number. GPRS vs. CSD have usually also different GSM operator
tariffication but it should not matter much for the short data messages.</p>

<p>I did not provite a completely mine MMS center. I was involved in pilot MMS
Center project where some compatibility issues of MMS message format between
MMS phone and MMS center had to be solved. As I did not have technical access
to the MMS center itself I setup two mobile phones
(@{[ a_href 'http://www.nokia.com/','Nokia' ]} @{[ a_href 'http://www.communicator.org/','Communicator' ]}s)
to setup sniffing tunnel. One of the phones were setup in answer mode to
simulate the MMS center while the other one called to the real official (and
buggy) MMS center accessible as regular service provided by the GSM operator.</p>

@{[ centerimg 'gate','MMS Sniffing Diagram' ]}
@{[ vskip "2ex" ]}
@{[ centerimg 'triple.jpeg','MMS Sniffing Mobiles Setup' ]}

<dl>
	<dt>Answer side <i>pppd(8)</i> command</dt>
	<dd><pre>
pppd /dev/ttyS5 19200 modem lock crtscts connect "chat -vf /etc/ppp/answer-T68i.chat" @{[ "\\" ]}
		noauth debug nodefaultroute 192.168.192.67:192.168.192.68 default-asyncmap
	</pre></dd>
	<dt>Answer side <i>/etc/ppp/answer-T68i.chat</i> file</dt>
	<dd><pre>
TIMEOUT 3 "" "ATZ" "OK-ATZ-OK" "" ABORT "BUSY" ABORT "NO CARRIER"
ABORT "NO DIAL TONE" ABORT "ERROR" ABORT "VOICE" REPORT CONNECT ""
ATL2 OK-ATL2-OK
AT+CBST=7,0,1;+DS=3,0,1300,32;+CR=1;+DR=1 OK
""
TIMEOUT 300
@{[ 'RING \d\d\d\d\d\dATA' ]}
CONNECT "" ^M ""
	</pre></dd>

	<dt>Dial side <i>pppd(8)</i> command</dt>
	<dd><pre>
pppd /dev/ttyS4 19200 modem lock nocrtscts xonxoff connect "chat -vf /etc/ppp/mmsgate.chat" @{[ "\\" ]}
		noauth debug nodefaultroute
	</pre></dd>
	<dt>Answer side <i>/etc/ppp/mmsgate.chat</i> file</dt>
	<dd><pre>
TIMEOUT 3 "" "ATZ" "OK-ATZ-OK" "" ABORT "BUSY" ABORT "NO CARRIER"
ABORT "NO DIAL TONE" ABORT "ERROR" ABORT "VOICE" REPORT CONNECT ""
#AT+CBST=7,0,1;+DS=3,0,1300,32;+CR=1;+DR=1 OK
ATD+420602900666
TIMEOUT 90 CONNECT "" ^M ""
	</pre></dd>
</dl>

<p>Some decoded data illustration</p>
<pre>
MMS Message Encapsulation
	Message-Type: m-retrieve-conf (0x84)
	Transaction-ID: PVve-6DaCUEAAC5qAAAAAQAAAEoAAAAA
	MMS-Version: 1.0
	Date: Aug 15, 2002 19:25:20.000000000
	From: +4206CENSORED/TYPE=PLMN
	Subject: testidD
	To: +4206CENSORED/TYPE=PLMN
	Message-Class: Informational (0x82)
	Delivery-Report: No (0x81)
	Content Type: application/vnd.wap.multipart.related (0x33)
		Type: application/smil
		Start: AAAA
	Multipart body
		Part: 1
			Content Type: application/smil
				Charset: us-ascii (0x0003)
			Headers
				Content-Location: AAAA
			Data in this part
		Part: 2
			Content Type: image/gif (0x1d)
			Headers
				Content-Location: postcard.gif
			Data in this part
</pre>

<p>@{[ a_href 'http://www.sonyericsson.com/T68i/','Sony Ericsson T68i' ]}
MMS definition file URL decoded out of the data stream above:
@{[ a_href 'http://wap.sonyericssonmobile.com/UAprof/T68R201.xml' ]}</p>


<h2>Completed Subtasks</h2>
<ul>
	<li style="font-size: larger;">@{[ project 'etherealmmse' ]}</li>
	<li style="font-size: larger;">@{[ project 'etherealwsp' ]}</li>
</ul>













HERE


My::Web->footer();
