短信猫+kannel调试一例

时间:2023-11-23 21:19:56

同事做一短信网关平台,采用kannel软件。

安装正常,配置文件如下:

# Vodafone 3G card
group = core
admin-port = 13000
admin-password = test
status-password = test
smsbox-port = 13001

group = smsbox
bearerbox-host = 127.0.0.1
sendsms-port = 13013

group = sendsms-user
username = tester
password = foobar

group = smsc
smsc = at
smsc-id = VODAFONE1
modemtype = auto
device = /dev/ttyUSB0

group = modems
id = vodafone
name = VodaFone3G
detect-string = "SIEMENS"
speed = 9600

启动bearerbox时,在phase 2阶段报错:General error. 之前有一个AT+CNMI=1,2,X,X,0

用终端软件连接串口后,通过at+cmdf=?进行查询,发现最后一个参数必须是1

于是,修改配置文件,增加一行初始化命令

# config file

......

group = modems
id = vodafone
name = VodaFone3G
detect-string = "SIEMENS"
init-string ="AT+CNMI=1,2,0,1,1"
speed = 9600

再次启动bearerbox /etc/kannel.conf, 结果启动成功,问题解决。

附:kannel常用操作

========================

启动方法:
bearerbox /etc/kannel.conf
smsbox /etc/kannel.conf

发送一条短信:现在可以用浏览器发送短信了,把下面的 “手机号码” 改成要发送的手机号码。
http://127.0.0.1:13013/cgi-bin/sendsms?username=tester&password=foobar&text=hello, world.&to=手机号码&from=test

终端AT命令手工发送方式(完整AT命令可百度):

发送SMS,可按文本方式
AT+CMGF=1
OK
AT+CMGS=13501154105
> AAA<^Z>
+CMGS: 204
OK