Table of contents

Introduction

The software ModemManager handles modems on Linux operating systems. It has the mmcli command line utility included which exposes its functionality.

It is possible to use mmcli to setup mobile internet connections, make phone calls and send SMS.

This article summarizes some basic mmcli commands. It was written to further debug the issue described in this postmarketOS issue.

Get modem summary

With this command a summary about the modem is printed. It assumes just one connected modem (-m any) which should be given on nearly all devices:

mmcli -m any

Unlock a SIM card

To actually do something with the modem it might be necessary to unlock the inserted SIM card:

# this command needs appropriate polkit authentication or root permissions
mmcli -i "/org/freedesktop/ModemManager1/SIM/0" --pin "1234"

Use the SIM path listed in the summary (see section above).

Enable modem

In addition to unlocking the SIM card it is required to enable the modem:

# this command needs appropriate polkit authentication or root permissions
mmcli -m any -e

List calls

This command lists active, ringing, terminated and other calls:

mmcli -m any --voice-list-calls

The idea is that calls are tracked with the identifiers printed by this command which allows to send additional commands like accept or hangup.

Accept a call

An incoming call can be accepted like this:

# this command needs appropriate polkit authentication or root permissions
mmcli -m any -o "/org/freedesktop/ModemManager1/Call/0" --accept

Hangup a call

Any active call can be hung up like this:

# this command needs appropriate polkit authentication or root permissions
mmcli -m any -o "/org/freedesktop/ModemManager1/Call/0" --hangup

Create a call

To create a call one can use the following command. Take care to select the right phone number format. Given is an example phone number with German international prefix +49.

mmcli -m any --voice-create-call "number=+49123456789"

This command just registeres a new call. To actually start it one has to get its identifier with listing all calls and then start it like this:

# this command needs appropriate polkit authentication or root permissions
mmcli -m any -o "/org/freedesktop/ModemManager1/Call/4" --start

It can be hung up like incoming calls.

Further documentation

Running mmcli --help and the there listed help commands provide a summary of all the functionality ModemManager provides. This article is just a brief subset of it.

The SXMO modem scripts from the SXMO project helped me a lot to write this summary aswell as the Chromium mmcli help page.

Of course the ModemManager homepage is the most official entry point to search for further documentation.