Multimedia Messaging Service
****************************

Copyright (C) 2010-2011  Intel Corporation. All rights reserved.
Updated 2021 by: Mohammad Sadiq, kent, kop316, 
                 fuzzy7k, craftyguy, anteater
Parts adapted from: https://source.puri.sm/Librem5/purple-mm-sms
                    Copyright (C) 2018 Purism SPC
                    
About
===========================
mmsd is a lower level daemon that transmits and recieves MMSes. It works with
both the ofono stack and the Modem Manager stack.

Please note that mmsd alone will not get MMS working! It is designed to work 
with a higher level chat application to facilitate fetching and 
sending MMS. It interfaces with other applications via the dbus.

A note about this repository
===========================
This repository is a fork of 
https://git.kernel.org/pub/scm/network/ofono/mmsd.git

and includes updates found here:
https://git.sr.ht/~anteater/mmsd

Commit f4b8b32477a411180be1823fdc460b4f7e1e3c9c from the master branch 
is synced with the latest updates from upstream.

This fork includes a plugin to support Modem Manager in addition to ofono, 
patches to improve the core of mmsd, and packaging for Debian. This author 
has only tested this fork with Modem Manager, and primarily maintains 
the Modem Manager plugin. However, the ofono plugin should work as 
expected, and the author is happy to work with others to keep the 
ofono plugin maintained and/or improve the ofono plugin.

Based on a conversation held in Nov/Dec 2019 in the ofono IRC, upstream 
mmsd has effectively not been maintained for around 8 years. This author has 
attempted to contact the ofono maintainers both through the ofono mailing 
list and the ofono IRC to upstream changes found here, but did not get a 
response. This author is happy to work with the ofono maintainers to upstream 
the changes found in this repository, should they so desire.

Modem Manager specific notes
===========================
Upon start up, mmsd looks for and tracks the state of the modem
that has Modem Messaging (i.e. SMS) capabilities. Since mmsd is a lower 
level program, mmsd assumes that other parts of the OS stack manage mobile 
connectivity. 

Please note that due to limitations of Modem Manager, mmsd does not support
having multiple APNs at the same time (for carriers that seperate MMS APN 
from Mobile Data APNs).
    
Please read "Configuring the Modem Manager Plugin" for configuration.

Compiling mmsd
============================
In order to compile proxy daemon you need following software packages:
	- GCC compiler
	- D-Bus library
	- GLib library
	- Modem Manager Library

Installing mmsd
============================

To configure run:
    ./bootstrap-configure --prefix=/usr/

Configure automatically searches for all required components and packages.

To compile, run:
    make
	
And to Install:
    make install

mmsd will be installed in /${prefix}/libexec (if you are following this guide,
it is /usr/libexec )

To uninstall, simply remove the "mmsd" binary from /${prefix}/libexec or run:
    sudo make uninstall

Note that you must manually configure your favorite service manager to run 
the daemon, as this installer does not configure it to autorun.

Testing out mmsd
===========================
To configure, run:
    ./bootstrap-configure --enable-debug --enable-maintainer-mode

Make it:
    make 

Run daemon in foreground with debugging:
    ./src/mmsd -n -d 'src/*'

General Configuration
===========================
On first run, mmsd will write a settings file at
"$HOME/.mms/$PLUGIN/mms"

IMPORTANT NOTE: If you change settings in this file, mmsd MUST BE RESTARTED 
                for the changes to take effect!

This settings file use sane defaults, but you can change them:

UseDeliveryReports
        Whether you want delivery reports for MMSes you send

TotalMaxAttachmentSize
        The maximum size all of your attachments can be before mmsd rejects it.
        NOTE: This value is carrier specific! Changing this value to a higher
              number may cause your carrier to silently reject MMSes you send.
              CHANGE AT YOUR OWN RISK!

Configuring the Modem Manager Plugin
===========================
On first run, mmsd will write a settings file at
"$HOME/.mms/modemmanager/ModemManagerSettings"

IMPORTANT NOTE: If you change any settings through the file,
                mmsd MUST BE RESTARTED for the changes to take effect! 
                
                You can change CarrierMMSC, CarrierMMSProxy, or MMS_APN via 
                dbus and they will take effect right away, but any
	            messages sent to the mmsd queue need to be processed 
	            again. The easiest way to do this is to reset mmsd.
	            But it can be done with the dbus proxy call ProcessMessageQueue().

This settings file needs to be changed before mmsd will connect! The settings
are as follows:

CarrierMMSC
        Get this from your carrier.
	        
        Carrier MMSC Format: "http://mms.example.com"
        
CarrierMMSProxy 
        Get this from your carrier.
     	        
        MMS Proxy Format: "proxy.example.com:80" or "NULL"
            Both the proxy address AND port are required, or else mmsd will not work!
            The proxy is "proxy.example.com" 
            The proxy port is "80"
            If you do NOT have a proxy, set this to "NULL"
            
MMS_APN
        Note that at this point, this plugin can only support one bearer at 
        a time (this works fine for carriers with a combined Internet/MMS APN
        but will not function with carriers that have two APNS seperating 
        the two)
        
        MMS APN Format: "apn.example.com"

AutoProcessOnConnection
        Tell mmsd to automatically send and recieve messages when the modem
        is connected. This will also allow mmsd to auto send/recieve if the
        modem is disconnected and reconnects, suspends and unsuspends, etc.
        
        AutoProcessOnConnection Options: "true" or "false"

AutoProcessSMSWAP
        Tell mmsd to automatically check and process SMS WAPs. This can be
        useful if you do not have a chat application that manages MMS or if
        a higher level chat application does not process SMS WAPs to send to
        mmsd.
        
        AutoProcessSMSWAP Options: "true" or "false"
        
        
An example of what you are looking for is here:
https://www.t-mobile.com/support/devices/not-sold-by-t-mobile/byod-t-mobile-data-and-apn-settings

From this:

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


