如何从 Debian 命令行发送短信?

如何从 Debian 命令行发送短信?

我在 Debian PC 上安装了 4G wwan 调制解调器 (Fibocom L850GL),并配有有效的 SIM 卡。modem-manager-gui我可以用它发送短信。

调制解调器管理器 GUI 帮助使用 GUI 从 Linux 发送短信

我如何从命令行执行相同操作?

我已经尝试过 mmcli v1.10.0,但是

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'

我刚才按照mmcli -G DEBUG说明做了mmcli 文档,这是日志:


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

它说:该命令是message-store-status,我怎样才能看到该mmcli命令?

相关问题:

答案1

1. 最简单的方法是从 CLI 邮件应用程序向收件人电话提供商的 SMS 网关发送不超过 160 个字符的纯文本电子邮件。对于美国运营商,您需要将您的十位数手机号码放在:

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)    [email protected]
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列出了其他国家的航空公司。

如果找不到收件人提供商的网关地址,您可以查找https://freecarrierlookup.com

如果您没有基于文本的电子邮件应用程序(例如晚餐杂种狗不多高山, 或者空气动力学研究所),请参阅本文了解如何使用卷曲

2.TextMagic API还可以从命令行访问 SMS。

3. 其他方法请见此处

4.您可以使用 AT 命令发送以下消息本文档中的规范

相关内容