我已经在Ubuntu服务器14.04.3lts中配置了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

现在我的问题是:
如何写入数据库表dlr?是坎内尔做的还是我们必须通过剧本来完成?
我试着在sendsms url中传递dlr掩码和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论坛也没有任何关于这个问题的好线索。请告知我详细的交货报告执行程序。

最佳答案

您必须编写自己的脚本(dlr.php)来处理dlr应答并保存状态,关于可以使用timestamp或autoincrement生成的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);

当做
高尔基

10-08 08:36