我在Ubuntu Server 14.04.3 LTS中配置了Kannel。我现在能够推送消息,但我还没弄清楚如何实现交付报告。为此,我使用了以下kannel配置,其中我已经为mysql定义了存储类型和mysql连接组以及连接属性。
include = "/etc/kannel/modems.conf"
group = core
admin-port = 13000
smsbox-port = 13001
admin-password = 12345
admin-deny-ip = “*.*.*.*”
admin-allow-ip = “127.0.0.1″
box-deny-ip = “*.*.*.*”
box-allow-ip = “127.0.0.1″
log-file = /var/log/kannel/bearerbox.log
log-level = 0
dlr-storage = mysql
group = smsc
smsc = at
smsc-id = GSM
my-number = xxxxxxxxxxxx
modemtype = auto
device = /dev/ttyUSB0
group = smsbox
bearerbox-host = 127.0.0.1
sendsms-port = 13013
global-sender =13013
log-file = /var/log/kannel/smsbox.log
log-level = 0
group = smsbox-route
smsbox-id = smsbox
smsc-id = GSM
group = sendsms-user
username = user
password = user
concatenation= true
max-messages = 10
user-deny-ip = “*.*.*.*”
user-allow-ip = “127.0.0.1;”
dlr-url = "http://127.0.0.1/dlr.php"
group = sms-service
keyword = default
catch-all = yes
accepted-smsc = usb1-modem
max-messages = 0
get-url = http://localhost/sms?phone=%p&text=%a
group = mysql-connection
id = mydlr
host = localhost
port = 3306
username = root
password = 00000
database = dlr
max-connections = 1
group = dlr-db
id = mydlr
table = dlr
field-smsc = smsc
field-timestamp = ts
field-destination = destination
field-source = source
field-service = service
field-url = url
field-mask = mask
field-status = status
field-boxc-id = boxc
现在我的问题是:
我尝试在sendms网址中传递dlr-mask和dlr-url,但没有任何反应。
http://127.0.0.1:13013/cgi-bin/sendsms?username=user&password=user&to=xxxxxxxx&text=hello&dlr-mask=31&dlr-url=http%3A%2F%2F127.0.0.1%2Fdlr.php%3FmyId%3D123456%26type%3D%25d
最重要的是,我不明白" id "消息的处理。根据我的理解,我觉得kannel应该将每个发送信息插入数据库,然后根据数据库中的id返回消息的状态。但是在表格中没有 id 这样的字段。
由于用户指南没有详尽的指示,而且kannel论坛对此有任何好的线索,因此我遇到了这个问题。请告诉我详细的程序来实施交付报告。
答案 0 :(得分:0)
您必须编写自己的脚本(dlr.php)来处理DLR答案并保存状态,关于您可以使用时间戳或自动增量生成它的ID。 最后你的发送短信请求看起来应该是这样的
$dlrURL="http://www.xxxxx.com:/dlr.php?dlr=%d&answer=%A&to=%p&ts=%T&smsID=$yourOwnID";
/* Build Kannel Request */
$request = "http://localhost:13013/cgi-bin/sendsms?";
$request .= "smsc=" ."smppgw1";
$request .= "&username=" ."someuser";
$request .= "&password=" ."somepass";
$request .= "&from=" .$fromNumber;
$request .= "&to=" .trim($somenumber);
$request .= "&text=" .urlencode($in_msg);
$request .= "&dlr-mask=31&dlr-url=" .urlencode($dlrURL);
此致 高尔基
答案 1 :(得分:0)
获取DLR reort和MO,MT报告到数据库的最稳定方法是使用一个名为SQLBOX的附加插件框,也可以通过将其插入SQLBOX表来发送SMS。您可以找到源代码在kannel主项目下的addon目录中