Difference between revisions of "PinePhone MMS with Matrix"

From PINE64
Jump to navigation Jump to search
Line 187: Line 187:
matrix-synapse 1.29.0-1, fractal 4.4.0-2, kop316 mmsd v0.3 -- Works, but images don't go through.
matrix-synapse 1.29.0-1, fractal 4.4.0-2, kop316 mmsd v0.3 -- Works, but images don't go through.


On mobian I'm using matrix-synapse-py3 1.30.0+bionic1, fractal 4.4.0-2 (and saving the login actually works), kop316 mmsd 0.1-2.2, and images DO go through.  
On mobian I'm using matrix-synapse-py3 1.30.0+bionic1 (on a remote VPS server), fractal 4.4.0-2 (and saving the login actually works), kop316 mmsd 0.1-2.2, and images DO go through.  


Going to try to downgrade mmsd and see if that helps...
Going to try to downgrade mmsd and see if that helps... It does not. Might be worth trying a newer synapse on arch through pip. Maybe some support libs are missing? I'm working on redoing all of this for mobian.

Revision as of 23:53, 25 April 2021

This is a possible way to get mms fully working by running a localhost matrix server, a bridge between mmsd and matrix, and the fractal matrix client to interact with them. Most of this should be cut and pastable.

Install packages

start with a nice and up to date danctnix arch arm pinephone install, mine is from April 20 2021. Ssh into the pinephone and then run this to install all the needed packages

sudo pacman -Sy matrix-synapse fractal python-matrix_client python-gobject git meson ninja base-devel python-matrix-nio python-dbus

Set up Matrix Synapse

Make a new config with the server name set to local host.

cd /etc/synapse/
sudo python -m synapse.app.homeserver --server-name localhost --config-path homeserver.yaml --generate-config --report-stats=no

Start the service and add a new user.

cd /etc/synapse/
sudo systemctl enable synapse
sudo systemctl start synapse
register_new_matrix_user -c homeserver.yaml http://localhost:8008 # New user name and pw will both be pinephone
register_new_matrix_user -c homeserver.yaml http://localhost:8008 # New user name and pw will both be mmsbridge

Open fractal and log into the homeserver at http://localhost:8008 with username pinephone and password pinephone

Install MMSD

Grab the git repo and install it

cd ~
git clone https://source.puri.sm/kop316/mmsd.git
cd mmsd
meson _build
meson compile -C _build
meson test -C _build
sudo meson install -C _build

Settings for tmobile

This config works for me

mkdir -p ~/.mms/modemmanager/
vi ~/.mms/modemmanager/ModemManagerSettings

[Modem Manager]
CarrierMMSC=http://mms.msg.eng.t-mobile.com/mms/wapenc
MMS_APN=fast.t-mobile.com
CarrierMMSProxy=NULL
AutoProcessOnConnection=true

Start MMSD ModemManager service

sudo vi /usr/lib/systemd/user/mmsd-mm.service

[Unit]
Description=Multimedia Messaging Service Daemon
After=ModemManager.service

[Service]
ExecStart=/usr/local/bin/mmsd -n -d

Restart=on-failure
RestartSec=10s

[Install]
WantedBy=default.target
sudo chmod 644 /usr/lib/systemd/user/mmsd-mm.service
systemctl enable mmsd-mm.service --user
systemctl start mmsd-mm --user

Install mms bridge

Grab it from git and put things in places

cd ~
git clone https://gitlab.com/untidylamp/mmmpuppet.git
cd mmmpuppet
chmod +x mmmpuppet.py
sudo cp mmm*.py /usr/local/bin/
mkdir -p $HOME/.config/mmm/
cp conf.json.sample $HOME/.config/mmm/conf.json

Configure mms bridge

This will mostly take care of editing the config for you

sed -i 's^"https://matrix-client.matrix.org"^"http://localhost:8008"^' $HOME/.config/mmm/conf.json
sed -i 's^"@bot_account:matrix.org"^"@mmsbridge:localhost"^' $HOME/.config/mmm/conf.json
sed -i 's^"Change_me"^"mmsbridge"^' $HOME/.config/mmm/conf.json
sed -i 's^"@your_accounts:matrix.org"^"@pinephone:localhost"^' $HOME/.config/mmm/conf.json

You actually have to fill these two out yourself. I put "US" and my +1 and rest of 10 digit number.

vi  $HOME/.config/mmm/conf.json

"cell_number":      "+15554441234",
"cell_country":     "CA",


Now we need to run it once to process the config file and remove secrets

/usr/local/bin/mmmpuppet.py

check it out now

cat $HOME/.config/mmm/conf.json

If it doesn't change the file to remove all the linebreaks then it didn't like it. Figure out why by looking at the log file.

cat ~/.config/mmm/mmmpuppet.log

Go fix whatever went wrong. Which should be nothing. You should have seen a message like this as output before it returns you to a prompt:

Login successful. Config updated with token. Run again to start bridge.

Set up mms bridge service

Make systemd unit

sudo vi /usr/lib/systemd/user/mmmpuppet.service

[Unit]
Description=Starts mmmpuppet interface
After=mmsd-mm.service

[Service]
ExecStart=/usr/bin/python3 /usr/local/bin/mmmpuppet.py
Restart=on-failure
RestartSec=10s

[Install]
WantedBy=default.target

and start it

sudo chmod 644 /usr/lib/systemd/user/mmmpuppet.service
systemctl enable mmmpuppet.service --user
systemctl start mmmpuppet.service --user

done? see if services are running:

ps aux | grep mm

should show something like this even after reboot

alarm       6374  0.0  0.3 235364  7752 ?        Ssl  22:44   0:00 /usr/local/bin/mmsd -n -d
alarm       6825  9.8  2.7 224976 54188 ?        Ssl  22:52   0:05 /usr/bin/python3 /usr/local/bin/mmmpuppet.py

Done

At this point if you get a message a new room should be created by the bridge bot which you will be invited to. Needs more testing to find problems. Outgoing works for replies but I can't seem to find the 'set topic' button so new rooms can't be created that the mms bridge can use. The ones the bridge creates work fine though.

I have gotten a test sms through this so far, and a test mms has not arrived yet.

Incoming and outgoing images did work with matrix on a namecheap vps with fractal on mobian so I think it can be made to work here.

matrix-synapse 1.29.0-1, fractal 4.4.0-2, kop316 mmsd v0.3 -- Works, but images don't go through.

On mobian I'm using matrix-synapse-py3 1.30.0+bionic1 (on a remote VPS server), fractal 4.4.0-2 (and saving the login actually works), kop316 mmsd 0.1-2.2, and images DO go through.

Going to try to downgrade mmsd and see if that helps... It does not. Might be worth trying a newer synapse on arch through pip. Maybe some support libs are missing? I'm working on redoing all of this for mobian.