我正在尝试通过 Kannel 的 dlr 功能将 Kannel 配置为移动状态检查器(打开或关闭)。
我正在使用 MySql 作为数据库。
问题是,我不知道为什么,但它没有保存状态。
我正在存储我不感兴趣的信息。
这是我的数据库:
这是我的频道配置:
group = core
admin-port = 13000
smsbox-port = 13001
admin-password = bar
#status-password = foo
#admin-deny-ip = ""
#admin-allow-ip = ""
log-file = "/var/log/kannel/gateway/kannel.log"
log-level = 0
#box-deny-ip = "*.*.*.*"
box-allow-ip = "*.*.*.*"
dlr-storage = mysql
#sms-service = mysql
#unified-prefix = "+358,00358,0;+,00"
#access-log = "/tmp/access.log"
#store-file = "kannel.store"
#ssl-server-cert-file = "cert.pem"
#ssl-server-key-file = "key.pem"
#ssl-certkey-file = "mycertandprivkeyfile.pem"
#---------------------------------------------
# SMSC CONNECTIONS
#
# SMSC connections are created in bearerbox and they handle SMSC specific
# protocol and message relying. You need these to actually receive and send
# messages to handset, but can use GSM modems as virtual SMSCs
# This is a fake smsc connection, _only_ used to test the system and services.
# It really cannot relay messages to actual handsets!
group = smsc
smsc = at
modemtype = auto
device = /dev/ttyUSB1
log-file = "/var/log/kannel/smsc/smsc.log"
smsc-id = KANNEL
#port = 20000
#connect-allow-ip = 127.0.0.1
log-level = 0
group = modems
id = generic
name = ZTE
#---------------------------------------------
# SMSBOX SETUP
#
# Smsbox(es) do higher-level SMS handling after they have been received from
# SMS centers by bearerbox, or before they are given to bearerbox for delivery
group = smsbox
bearerbox-host = 127.0.0.1
bearerbox-port = 13001
sendsms-port = 13013
global-sender = 13013
#sendsms-chars = "0123456789 +-"
log-file = "/var/log/kannel/smsbox/smsbox.log"
log-level = 0
#sendsms-port-ssl = true
#access-log = "/tmp/access.log"
#---------------------------------------------
# SEND-SMS USERS
#
# These users are used when Kannel smsbox sendsms interface is used to
# send PUSH sms messages, i.e. calling URL like
# http://kannel.machine:13013/cgi-bin/sendsms?username=tester&password=foobar...
group = sendsms-user
username = tester
password = foobar
#user-deny-ip = ""
#user-allow-ip = ""
#---------------------------------------------
# SERVICES
#
# These are 'responses' to sms PULL messages, i.e. messages arriving from
# handsets. The response is based on message content. Only one sms-service is
# applied, using the first one to match.
#group = sms-service
#keyword = nop
#text = "You asked nothing and I did it!"
# There should be always a 'default' service. This service is used when no
# other 'sms-service' is applied.
#group = sms-service
#keyword = default
#text = "No service specified"
group = mysql-connection
id = mydlr
host = localhost
username = kannel
password = kannel
database = kannel
# max count of connections that will be opened for dbpool
# default is 1
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
这是我的sqlbox配置:
group = sqlbox
id = sqlbox-db
smsbox-id = sqlbox
#global-sender = ""
bearerbox-host = localhost
bearerbox-port = 13001
#smsbox-port = 13013
#smsbox-port-ssl = false
sql-log-table = sent_sms
sql-insert-table = send_sms
log-file = "/var/log/kannel/sqlbox/sqlbox.log"
log-level = 0
如您所见,我一直在使用 dlr-url 进行测试,因为我认为可能存在错误。
我的 .php 文件如下:
<?php
// Database configuration
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "kannel";
// Database connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Verification of the connection
if ($conn->connect_error) {
die("Database connection has failed: " . $conn->connect_error);
}
// Obtaining DLR data
$id = $_GET['id'];
$destination = $_GET['destination'];
$status = $_GET['status'];
$smsc = $_GET['smsc'];
$time = $_GET['time'];
// Checking the cell phone status
if ($status == "DELIVRD") {
$mobile_status = "ON";
} else {
$mobile_status = "OFF";
}
// Insertion of data in the "dlr" table
$sql = "INSERT INTO dlr (id, destination, status, smsc, ts) VALUES ('$id', '$destination', '$status', '$smsc', '$time')";
if ($conn->query($sql) === FALSE) {
echo "Error inserting data into dlr table: " . $conn->error;
}
// Insertion of data in the table "sent_sms".
$sql = "INSERT INTO sent_sms (momt, sender, receiver, time, smsc_id, service, account, id, sms_type, mclass, mwi, coding, compress, validity, deferred, dlr_mask, dlr_url, pid, alt_dcs, rpi, charset, boxc_id, binfo, meta_data, priority$
if ($conn->query($sql) === FALSE) {
echo "Error inserting data in the table sent_sms: " . $conn->error;
}
// Insertion of data in the table "send_sms".
$sql = "INSERT INTO send_sms (momt, sender, receiver, udhdata, msgdata, time, smsc_id, service, account, id, sms_type, mclass, mwi, coding, compress, validity, deferred, dlr_mask, dlr_url, pid, alt_dcs, rpi, charset, boxc_id, binfo, m$
if ($conn->query($sql) === FALSE) {
echo "Error inserting data in the table sent_sms: " . $conn->error;
}
提前谢谢你。