How to send an SMS from Debian command line?

4

I have a 4G wwan modem (Fibocom L850GL) with a valid SIM card on a Debian PC. I have modem-manager-gui and I can send SMS with it.

modem manager gui help send SMS from linux with a GUI

How can I do the same from the command line?

I have tried with mmcli v1.10.0 but I have

dka@dka:[~]: mmcli -m 0 --messaging-create-sms="text='Hello world',number='+33692822789'"
Successfully created new SMS: /org/freedesktop/ModemManager1/SMS/0
dka@dka:[~]: mmcli -s 0 --send -v
[28 Nov 2019, 03:46:12] [Debug] Assuming '0' is the SMS index
[28 Nov 2019, 03:46:12] [Debug] ModemManager process found at ':1.8'
[28 Nov 2019, 03:46:12] [Debug] Sms found at '/org/freedesktop/ModemManager1/SMS/0'

error: couldn't send the SMS: 'GDBus.Error:org.freedesktop.libmbim.Error.Status.Failure: Couldn't send SMS part: Failure'

I just did with mmcli -G DEBUG as stated in mmcli documentation, this is the log:


Dec  1 16:33:19 dka ModemManager[843]: [/dev/cdc-wdm0] Received message...#012>>>>>> RAW:#012>>>>>>   length = 52#012>>>>>>   data   = 07:00:00:80:34:00:00:00:00:00:00:00:01:00:00:00:00:00:00:00:53:3F:BE:EB:14:FE:44:67:9F:90:33:A2:23:E5:6C:3F:05:00:00:00:08:00:00:00:02:00:00:00:01:00:00:00
Dec  1 16:33:19 dka ModemManager[843]: [/dev/cdc-wdm0] Received message (translated)...#012>>>>>> Header:#012>>>>>>   length      = 52#012>>>>>>   type        = indicate-status (0x80000007)#012>>>>>>   transaction = 0#012>>>>>> Fragment header:#012>>>>>>   total   = 1#012>>>>>>   current = 0#012>>>>>> Contents:#012>>>>>>   service = 'sms' (533fbeeb-14fe-4467-9f90-33a223e56c3f)#012>>>>>>   cid     = 'message-store-status' (0x00000005)#012>>>>>> Fields:#012>>>>>>   Flag = 'new-message'#012>>>>>>   MessageIndex = '1'
Dec  1 16:33:19 dka ModemManager[843]: <debug> Received notification (service 'sms', command 'message-store-status')
Dec  1 16:33:19 dka ModemManager[843]: <debug> Received SMS store status update: 'new-message'
Dec  1 16:33:19 dka ModemManager[843]: <debug> Reading new SMS at index '1'
Dec  1 16:33:19 dka ModemManager[843]: [/dev/cdc-wdm0] Sent message...#012<<<<<< RAW:#012<<<<<<   length = 60#012<<<<<<   data   = 03:00:00:00:3C:00:00:00:32:00:00:00:01:00:00:00:00:00:00:00:53:3F:BE:EB:14:FE:44:67:9F:90:33:A2:23:E5:6C:3F:02:00:00:00:00:00:00:00:0C:00:00:00:00:00:00:00:01:00:00:00:01:00:00:00
Dec  1 16:33:19 dka ModemManager[843]: [/dev/cdc-wdm0] Sent message (translated)...#012<<<<<< Header:#012<<<<<<   length      = 60#012<<<<<<   type        = command (0x00000003)#012<<<<<<   transaction = 50#012<<<<<< Fragment header:#012<<<<<<   total   = 1#012<<<<<<   current = 0#012<<<<<< Contents:#012<<<<<<   service = 'sms' (533fbeeb-14fe-4467-9f90-33a223e56c3f)#012<<<<<<   cid     = 'read' (0x00000002)#012<<<<<<   type    = 'query' (0x00000000)#012<<<<<< Fields:#012<<<<<<   Format = 'pdu'#012<<<<<<   Flag = 'index'#012<<<<<<   MessageIndex = '1'
Dec  1 16:33:19 dka ModemManager[843]: [/dev/cdc-wdm0] Received message...#012>>>>>> RAW:#012>>>>>>   length = 112#012>>>>>>   data   = 03:00:00:80:70:00:00:00:32:00:00:00:01:00:00:00:00:00:00:00:53:3F:BE:EB:14:FE:44:67:9F:90:33:A2:23:E5:6C:3F:02:00:00:00:00:00:00:00:40:00:00:00:00:00:00:00:01:00:00:00:10:00:00:00:30:00:00:00:01:00:00:00:00:00:00:00:10:00:00:00:20:00:00:00:07:91:33:96:05:00:56:F4:20:0B:91:33:96:85:62:87:F9:00:00:91:21:10:61:33:81:40:05:F4:F2:9C:2E:03
Dec  1 16:33:19 dka ModemManager[843]: [/dev/cdc-wdm0] Received message (translated)...#012>>>>>> Header:#012>>>>>>   length      = 112#012>>>>>>   type        = command-done (0x80000003)#012>>>>>>   transaction = 50#012>>>>>> Fragment header:#012>>>>>>   total   = 1#012>>>>>>   current = 0#012>>>>>> Contents:#012>>>>>>   status error = 'None' (0x00000000)#012>>>>>>   service      = 'sms' (533fbeeb-14fe-4467-9f90-33a223e56c3f)#012>>>>>>   cid          = 'read' (0x00000002)#012>>>>>> Fields:#012>>>>>>   Format = '0'#012>>>>>>   MessagesCount = '1'#012>>>>>>   PduMessages = '{#012>>>>>>     [0] = {#012>>>>>>           MessageIndex = '1'#012>>>>>>           MessageStatus = '0'#012>>>>>>           PduData = '07:91:33:96:05:00:56:f4:20:0b:91:33:96:85:62:87:f9:00:00:91:21:10:61:33:81:40:05:f4:f2:9c:2e:03'#012>>>>>>     },#012>>>>>>   }'#012>>>>>>   CdmaMessages = 
Dec  1 16:33:19 dka ModemManager[843]: <debug> Parsing PDU (1)...
Dec  1 16:33:19 dka ModemManager[843]: <debug>   SMSC address parsed: '+3369500****'
Dec  1 16:33:19 dka ModemManager[843]: <debug>   Deliver type PDU detected
Dec  1 16:33:19 dka ModemManager[843]: <debug>   Number parsed: '+336********'
Dec  1 16:33:19 dka ModemManager[843]: <debug>   PID: 0
Dec  1 16:33:19 dka ModemManager[843]: <debug>   user data encoding is GSM7
Dec  1 16:33:19 dka ModemManager[843]: <debug>   user data length: 5 elements
Dec  1 16:33:19 dka ModemManager[843]: <debug>   user data length: 5 bytes
Dec  1 16:33:19 dka ModemManager[843]: <debug> Decoding SMS text with '5' elements
Dec  1 16:33:19 dka ModemManager[843]: <debug> Converting SMS part text from GSM-7 to UTF-8...
Dec  1 16:33:19 dka ModemManager[843]: <debug>    Got UTF-8 text: 'test2'
Dec  1 16:33:19 dka ModemManager[843]: <debug> Correctly parsed PDU (1)
Dec  1 16:33:19 dka ModemManager[843]: <debug> SMS part at 'mt/1' is from a singlepart SMS
Dec  1 16:33:19 dka ModemManager[843]: <debug> Added received SMS at '/org/freedesktop/ModemManager1/SMS/3'



Dec  1 16:33:20 dka ModemManager[843]: <debug> (ttyACM2): <-- '<CR><LF><CR><LF>$GPGGA,153320.000,,,,,0,0,,,M,,M,,*4E<CR><LF>$GNGGA,153320.000,,,,,0,0,,,M,,M,,*50<CR><LF>$GPGSA,A,1,,,,,,,,,,,,,,,*1E<CR><LF>$GNGSA,A,1,,,,,,,,,,,,,,,,1*1D<CR><LF>$GPGSV,1,1,01,15,,,30,1*62<CR><LF>$GPRMC,153320.000,V,,,,,,,011219,,,N,V*3B<CR><LF>$GNRMC,153320.000,V,,,,,,,011219,,,N,V*25<CR><LF>$GPVTG,,T,,M,,N,,K,N*2C<CR><LF>$GNVTG,,T,,M,,N,,K,N*32<CR><LF><CR><LF><CR><LF>OK<CR><LF>'
Dec  1 16:33:20 dka ModemManager[843]: [/dev/cdc-wdm0] Sent message...#012<<<<<< RAW:#012<<<<<<   length = 56#012<<<<<<   data   = 03:00:00:00:38:00:00:00:33:00:00:00:01:00:00:00:00:00:00:00:53:3F:BE:EB:14:FE:44:67:9F:90:33:A2:23:E5:6C:3F:04:00:00:00:01:00:00:00:08:00:00:00:01:00:00:00:01:00:00:00
Dec  1 16:33:20 dka ModemManager[843]: [/dev/cdc-wdm0] Sent message (translated)...#012<<<<<< Header:#012<<<<<<   length      = 56#012<<<<<<   type        = command (0x00000003)#012<<<<<<   transaction = 51#012<<<<<< Fragment header:#012<<<<<<   total   = 1#012<<<<<<   current = 0#012<<<<<< Contents:#012<<<<<<   service = 'sms' (533fbeeb-14fe-4467-9f90-33a223e56c3f)#012<<<<<<   cid     = 'delete' (0x00000004)#012<<<<<<   type    = 'set' (0x00000001)#012<<<<<< Fields:#012<<<<<<   Flag = 'index'#012<<<<<<   MessageIndex = '1'
Dec  1 16:33:20 dka ModemManager[843]: [/dev/cdc-wdm0] Received message...#012>>>>>> RAW:#012>>>>>>   length = 48#012>>>>>>   data   = 03:00:00:80:30:00:00:00:33:00:00:00:01:00:00:00:00:00:00:00:53:3F:BE:EB:14:FE:44:67:9F:90:33:A2:23:E5:6C:3F:04:00:00:00:00:00:00:00:00:00:00:00
Dec  1 16:33:20 dka ModemManager[843]: [/dev/cdc-wdm0] Received message (translated)...#012>>>>>> Header:#012>>>>>>   length      = 48#012>>>>>>   type        = command-done (0x80000003)#012>>>>>>   transaction = 51#012>>>>>> Fragment header:#012>>>>>>   total   = 1#012>>>>>>   current = 0#012>>>>>> Contents:#012>>>>>>   status error = 'None' (0x00000000)#012>>>>>>   service      = 'sms' (533fbeeb-14fe-4467-9f90-33a223e56c3f)#012>>>>>>   cid          = 'delete' (0x00000004)
Dec  1 16:33:20 dka ModemManager[843]: <debug> Deleted SMS at '/org/freedesktop/ModemManager1/SMS/3'
Dec  1 16:33:21 dka ModemManager[843]: <debug> (ttyACM2): <-- '<CR><LF><CR><LF>$GPGGA,153321.000,,,,,0,0,,,M,,M,,*4F<CR><LF>$GNGGA,153321.000,,,,,0,0,,,M,,M,,*51<CR><LF>$GPGSA,A,1,,,,,,,,,,,,,,,*1E<CR><LF>$GNGSA,A,1,,,,,,,,,,,,,,,,1*1D<CR><LF>$GPGSV,1,1,01,15,,,30,1*62<CR><LF>$GPRMC,153321.000,V,,,,,,,011219,,,N,V*3A<CR><LF>$GNRMC,153321.000,V,,,,,,,011219,,,N,V*24<CR><LF>$GPVTG,,T,,M,,N,,K,N*2C<CR><LF>$GNVTG,,T,,M,,N,,K,N*32<CR><LF><CR><LF><CR><LF>OK<CR><LF>'
Dec  1 16:33:22 dka ModemManager[843]: <debug> (ttyACM2): <-- '<CR><LF><CR><LF>$GPGGA,153322.000,,,,,0,0,,,M,,M,,*4C<CR><LF>$GNGGA,153322.000,,,,,0,0,,,M,,M,,*52<CR><LF>$GPGSA,A,1,,,,,,,,,,,,,,,*1E<CR><LF>$GNGSA,A,1,,,,,,,,,,,,,,,,1*1D<CR><LF>$GPGSV,1,1,01,15,,,31,1*63<CR><LF>$GPRMC,153322.000,V,,,,,,,011219,,,N,V*39<CR><LF>$GNRMC,153322.000,V,,,,,,,011219,,,N,V*27<CR><LF>$GPVTG,,T,,M,,N,,K,N*2C<CR><LF>$GNVTG,,T,,M,,N,,K,N*32<CR><LF><CR><LF><CR><LF>OK<CR><LF>'
Dec  1 16:33:23 dka ModemManager[843]: <debug> (ttyACM2): <-- '<CR><LF><CR><LF>$GPGGA,15332

It says : that the command is message-store-status, how can I see the mmcli command?

Related issue:

networking
debian
modem
wwan
asked on Super User Nov 25, 2019 by Dimitri Kopriwa • edited Dec 1, 2019 by Dimitri Kopriwa

1 Answer

0

1. The simplest way is to send a plaintext email of no more than 160 characters from a CLI mail app to the SMS gateway for the addressee's phone provider. For the US carriers, you put your ten digit mobile number in front of:

Aio Wireless            @mms.aiowireless.net
AirFire Mobile          @sms.airfiremobile.com
Alaska Communications   @msg.acsalaska.com
Alltel (Allied Wirels)  @mms.alltelwireless.com
Ameritech               @paging.acswireless.com
Assurance Wireless      @vmobl.com
AT&T Enterprise Paging  @page.att.net
AT&T Mobility           @mms.att.net
BellSouth               @bellsouth.cl
Bluegrass Cellular      @mms.myblueworks.com
Bluesky Comm (Samoa)    @psms.bluesky.as
Boost mobile            @myboostmobile.com
C Spire Wireless        @cspire1.com
CellCom                 @cellcom.quiktxt.com
Cellular South          @csouth1.com
Centennial Wireless     @cwemail.com
Chariton Valley Wirels  @sms.cvalley.net
Chat Mobility           @mail.msgsender.com
Cincinnati Bell         @mms.gocbw.com
Cleartalk               @sms.cleartalk.us
Cricket                 @mms.mycricket.com
DTC                     @sms.advantagecell.net
Edge Wireless           @sms.edgewireless.com
Element Mobile          @SMS.elementmobile.net
General Comms., Inc.    @mobile.gci.net
Golden State Cellular   @gscsms.com
Greatcall               @vtxt.com
Hawaiian Telcom         @hawaii.sprintpcs.com
I-wireless(Sprint PCS)  @iwirelesshometext.com
I-wireless(T-Mobile)    .iws@iwspcs.net
Kajeet                  @mobile.kajeet.net
LongLines               @text.longlines.com
MetroPCS                @mymetropcs.com
Nextech                 @sms.ntwls.net
Page Plus (Verizon)     @vzwpix.com
Pioneer Cellular        @zsend.com
Pocket Wireless         @sms.pocket.com
Qwest Wireless          @qwestmp.com
Red Pocket Mobile       @vtext.com
Rogers Wireless         @mms.rogers.com
Simple Mobile           @smtext.com
South Central Comms     @rinasms.com
Southernlinc            @page.southernlinc.com
Sprint                  @pm.sprint.com
Straight Talk ATT:      @mms.att.net
Straight Talk Other:    @mmst5.tracfone.com
Straight Talk Sprint:   @tracfone.plspictures.com
Straight Talk T-Mobile: @tmomail.net
Straight Talk Verizon:  @vzwpix.com
Syringa Wireless        @rinasms.com
Teleflip                @teleflip.com
Telus Mobility          @mms.telusmobility.com
Ting                    @message.ting.com
T-Mobile                @tmomail.net
TracFone (prepaid)      @mmst5.tracfone.com
Unicel                  @utext.com
Union Wireless          @union-tel.com
US Cellular             @mms.uscc.net
USA Mobility            @usamobility.net
Verizon Wireless        @vzwpix.com
Viaero                  @mmsviaero.com
Virgin Mobile           @vmpix.com
Voyager Mobile          @text.voyagermobile.com
West Central Wirels     @sms.wcc.net
XIT Communications      @sms.xit.net

https://kb.sandisk.com/app/answers/detail/a_id/17056/~/list-of-mobile-carrier-gateway-addresses lists other nations' carriers.

If you can't find the gateway address for the addressee's provider, you can do a lookup at https://freecarrierlookup.com .

If you do not have a text based email app (such as sup, mutt, notmuch, alpine, or aerc), see this article on how to send with curl.

2. The TextMagic API also provides access to SMS from your commend line.

3. Other methods are described here.

4. You can use AT commands to send a message following the specifications in this document.

answered on Super User Nov 25, 2019 by K7AAY • edited Nov 27, 2019 by K7AAY

User contributions licensed under CC BY-SA 3.0