使用 gnokii 发送短信

来自 Alpine Linux


此材料建议删除...

gnokii 不再在软件仓库中 (讨论)
在删除之前,请确保没有其他页面链接到这里并检查页面的历史记录

在本教程中,我们使用 gnokii 发送短信

前提条件

本文档基于 Alpine Linux 2.7 编写和测试,但也可能适用于更早的版本。
你还需要某种可以发送短信的调制解调器(例如,带有 SIM 卡的 USB 加密狗)。

安装

  • 安装所需的软件包

apk add gnokii

  • 创建缺失的文件夹

mkdir -p /root/.cache/gnokii/

  • 将支持短信的调制解调器物理连接到主机

配置

  • 将以下内容添加到 '/etc/gnokiirc'
[global]
port = /dev/ttyUSB0
model = AT
connection = serial
use_locking = yes
serial_baudrate = 115200
smsc_timeout = 30

[gnokiid]
binddir = /usr/bin/

[logging]
debug = off
rlpdebug = off
xdebug = off
注意: 你很可能需要更改上面的配置以适应你的设备和设置。
  • 验证配置是否按预期工作

gnokii --identify

注意: 你应该收到类似如下的输出:
GNOKII Version 0.6.31 Cannot open logfile /root/.cache/gnokii/gnokii-errors WARNING: cannot open logfile, logs will be directed to stderr IMEI  : 123456789012345 Manufacturer : Undefined No flags section in the config file. Model  : Teltonika TM1 Product name : Teltonika TM1 Revision  : VilniusSMD 05.94.01 

发送短信

  • 现在发送短信

echo "Test sms" | gnokii --sendsms 123456

注意: 你需要将 123456 替换为你想要发送测试短信的电话号码