meta data for this page

MMS support

A community member, kop316, has made great progress on MMS support. Until the various PRs get merged, here are some instructions to help get MMS working. You can download mmsd-tng from Mobian Unstable

When you first run mmsd-tng, it autopopulates a settings file at $HOME/.mms/modemmanager/mms, but you can edit it yourself. Make sure mmsd-tng is turned off before editing the file (systemctl --user stop mmsd-tng), or changes will be overwritten:

[Modem Manager]
CarrierMMSC=http://mmsc.invalid
MMS_APN=apn.invalid
CarrierMMSProxy=NULL
AutoProcessOnConnection=true
AutoProcessSMSWAP=false

As a note, if you want to try using mmsd-tng without Chatty/Purple-mm-sms, you need to set “AutoProcessSMSWAP” to “true”. This allows mmsd-tng to automatically download and process MMS by itself.

We will need to edit the file $HOME/.mms/modemmanager/mms. If you look up the APN settings for your carrier (in GNOME Settings, for example) you should be able to fill out the fields (last of the three is optional). Here is my example for Verizon USA:

CarrierMMSC=http://mms.vtext.com/servlets/mms
MMS_APN=vzwinternet

Another example for T-Mobile USA:

CarrierMMSC=http://mms.msg.eng.t-mobile.com/mms/wapenc
MMS_APN=fast.t-mobile.com

T-Mobile may alternatively use the mobilenet APN.

Here is one for telus

CarrierMMSC=http://aliasredirect.net/proxy/mmsc
MMS_APN=sp.telus.com
CarrierMMSProxy=74.49.0.18:80 

Note that you need the IP address/domain name AND the port for the MMS Proxy!

We need to now restart mmsd-tng since we changed the file:

systemctl --user restart mmsd-tng

Uou can also check the status of mmsd-tng with:

systemctl --user status mmsd-tng

If you want to try sending an MMS manually, You can use the python script at: https://source.puri.sm/kop316/mmsd/-/blob/master/test/send-message

python test/send-message --help

Shows you how to format the message. An example to send a group MMS:

python test/send-message "+10123456789,+12223334444" "" "cid-1,text/plain,/home/mobian/text.txt"

“cid-1” is the filename that the file is, “” is where you would put SMIL, “text/plain” is the MIMEtype of the object, and “/home/mobian/text.txt” is the absolute path of the file.

an example to send a picture:

python test/send-message "+10123456789" "" "cid-1,image/jpeg,/home/mobian/img.jpg"

Note that you can mix and match.

Here is also sample code to send an MMS from python:

#!/usr/bin/python

import pydbus
import gi.repository 
from pydbus import SessionBus
from gi.repository import GLib
bus = SessionBus()
TestServer = bus.get("org.ofono.mms", "/org/ofono/mms/modemmanager")

options = GLib.Variant('a{sv}', {
    'DeliveryReport': GLib.Variant('b', False),
    'Subject': GLib.Variant('s', "Test Subject!!")
})

TestServer.SendMessage(["+1XXXXXXXXXX"], options, [("cid-1", "text/plain", "/home/mobian/Test-MMS/text.txt")])

In this one, you man manually override the request for a Delivery report, and you can add a Subject to the MMS.

Clients

chatty

git clone https://source.puri.sm/kop316/chatty/-/tree/wip/sadiq/mm-account
cd chatty
sudo apt-get -y build-dep .
meson build
ninja -C build

DIY python

An example of extracting the MMS file (example picture) follow the instructions below:

Clone the repository python-messaging:

> git clone https://www.github.com/davegermiquet/python-messaging.git
> cd python-messaging
> python setup.py install

create a python script that is like the following called extractmms.py

import sys
from messaging.mms.message import MMSMessage
path = sys.argv[1]
mms = MMSMessage.from_file(path)

print(mms.headers['From'])            
for data_part in mms.data_parts:
    datacontent=data_part.headers['Content-Type']
    if datacontent is not None:
        if 'Name' in datacontent[1]:
            print(datacontent[1])
            filename = datacontent[1]['Name']
            file_to_save = open(data_part.headers['Content-Type'][1]['Name'],'wb')
            file_to_save.write(data_part.data)
            file_to_save.close()

Look in the /home/mobian/.mms/modemmanager

You'll see files similar to this:

-rw-r--r-- 1 mobian mobian     35 Apr 25 15:04 EAF3794E6976ED658AE16353C998AC927FFE7778.status
-rw------- 1 mobian mobian  99943 Apr 25 15:04 EAF3794E6976ED658AE16353C998AC927FFE7778

Run the script above like this:

> python3 ./extractmms.py EAF3e794E6976ED658AE16353C998AC927FFE7778 

{'Name': '2c58dc7a3.png'}

> the picture is saved in the current folder named with the output from the script above

mms2mail

this tool act as a gateway between mms and. It convert received mms in mail stored in a mbox (unix standard mails storage). And accept mail through smtp which are converted to mms and sent by mmsd.

git clone https://gitea.geodock.egeo.net.eu.org/Public/mms2mail.git
cd mms2mail
make deb-deps install

In order to activate the daemon :

make configure start

Mbox path, mail metadata and listening port can be customized with the configuration file mms2mail.ini (~/.mms/modemmanager/mms2mail.ini). Default value are used if not specified :

[mail]
mailbox = /var/mail/$USER  ; the mailbox where mms are appended
user = $USER               ; the user account specified as recipient
domain = $HOSTNAME         ; the domain part appended to phone number and user
attach_mms = false         ; whether to attach the full mms binary file
delete_from_mmsd = false   ; delete mms from mmsd storage upon successful conversion

[smtp]
hostname = localhost
port = 2525

To configure your mail client you need to specify the following smtp server : localhost:2525 without authentication and without TLS As geary does not support local mbox file, you will need a local imap server (dovecot work well and is packaged in debian)

If you like Mutt put this line in your : ~/.muttrc

set smtp_url = "smtp://localhost:2525"
set ssl_starttls = no
set ssl_force_tls = no

More info

Please refer to these upstream links for any comments, hopefully they will get merged and this section can be removed soon.

https://gitlab.com/kop316/mmsd

https://gitea.geodock.egeo.net.eu.org/Public/mms2mail

You can also see progress on MMS here: https://forum.pine64.org/showthread.php?tid=12491

You can optionally try and test out the full reference of MMS here:

https://source.puri.sm/kop316/chatty/-/tree/wip/sadiq/mm-account