duangou1953 2016-02-24 13:37
浏览 87

获取送货报告:Kannel:SMPP

I am new to kannel configuration.I follow user guide 1.5.

I want to use opensmppbox as a gateway for my customers, in a way that they connect via SMPP protocol.

But I want to use http as an smsc (customers's smppclient ---> opensmppbox --->sqlbox--->smsbox---> kannel---> smsc=http---> operator HTTP-gateway)

I have few questions about opensmppbox configuration

1) How can I get delivery report from operator HTTP-gateway and send a delivery report back to customers's smppclient? 2) Why sms detail is not getting inserted into send_sms table? 3) Why delivery reports are not getting inserted into dlr table? 4) Why I cannot see any event on sqlbox and smsbox? 5) dlr-url is not getting called in spite of mentioning the same

my configurations are as below:

    ========================================
    ==> smskannel.conf
    ========================================
#
# THIS IS A SAMPLE CONFIGURATION FOR SMS KANNEL
#
# This basic version is used for system testing. It expects 'fakesmsc' to
# send messages which are replied with simple fixed text message.
# It is run like this:
#
#  1% gw/bearerbox gw/smskannel.conf
#  2% gw/smsbox gw/smskannel.conf
#  3% test/fakesmsc -i 0.1 -m 100 "123 345 text nop"
#
# ..all 3 commands in separate shells (or screen sessions)
# Note that you can run them in different machines but have to
# add certain command line argument and configuration variables then
#
#
# For any modifications to this file, see Kannel User Guide 
# If that does not help, see Kannel web page (http://www.kannel.org) and
# various online help and mailing list archives
#
# Notes on those who base their configuration on this:
#  1) check security issues! (allowed IPs, passwords and ports)
#  2) groups cannot have empty rows inside them!
#  3) read the user guide
#
# Kalle Marjola for Kannel project 2001, 2004

#---------------------------------------------
# CORE
#
# There is only one core group and it sets all basic settings
# of the bearerbox (and system). You should take extra notes on
# configuration variables like 'store-file' (or 'store-dir'),                                                                                                                                    
# 'admin-allow-ip' and 'access.log'                                                                                                                                                              


group = core                                                                                                                                                                                     
dlr-storage=mysql                                                                                                                                                                               
admin-port = 13000                                                                                                                                                                               
smsbox-port = 13001
admin-password = bar
#status-password = foo
#admin-deny-ip = ""
#admin-allow-ip = ""
log-file = "/var/log//kannel/kannel.log"
#log-level = 0
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"
#unified-prefix = "+358,00358,0;+,00"
access-log = "/var/log/kannel/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 = http
smsc-id = http
system-type = generic
port = 13015
connect-allow-ip = "*.*.*.*"
#dlr-mask=3
#dlr-url="http://192.168.1.132/dlr.php?report=%d"
#dlr-url=urlencode(http://192.168.1.132/dlr.php?report=%d)
send-url = "http://192.168.1.111/btisms/V1/smppsms?username=cust2&sms_type=SMPP&from=%P&message=%I-%t&recipient=%p&type=%d&dlr-mask=3&dlr-url=urlencode(http://192.168.1.132/dlr.php?report=%d)"
status-success-regex = "success"
status-permfail-regex = "failure"
status-tempfail-regex = "retry later"
generic-foreign-id-regex = "<id>(.+)</id>"
generic-param-from = "senderID"
generic-param-to = "to"
generic-param-text = "text"
generic-param-dlr-mask = "DLRStatus"
generic-param-dlr-mid = "msgID"
generic-param-dlr-url = "DLRUrl"
generic-param-flash = "flash"
generic-param-mclass = "mclass"
generic-param-mwi = "mwi"
generic-param-coding = "coding"
generic-param-validity = "validity"
generic-param-deferred = "deferred"
generic-param-foreign-id = "foreignID"
generic-message-sent = "Message sent with ID: %I"
generic-status-sent = 200
generic-status-error = 404
connect-allow-ip = 127.0.0.1

#---------------------------------------------
# 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
smsbox-id = mysmsbox
bearerbox-host = 127.0.0.1
#bearerbox-port = 13003
sendsms-port = 13013
#global-sender = 13013
access-log = "/var/log/kannel/smsbox-access.log"
log-file = "/var/log/kannel/smsbox.log"
log-level = 0

group = smsbox-route
smsbox-id = mysmsbox
smsc-id = http

group = mysql-connection
id = mydlr
host = localhost
username = root
password = XXXXXX
database = dlr
# you can increase this upon a higher load
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.conf
========================================

group = sqlbox
id = sqlbox-db
smsbox-id = mysmsbox
bearerbox-host = 127.0.0.1
bearerbox-port = 13001
smsbox-port = 13005
smsbox-port-ssl = false
sql-log-table = sent_sms
sql-insert-table = send_sms
log-file = "/var/log/kannel/kannel-sqlbox.log"
log-level = 0

group = mysql-connection
id = sqlbox-db
host = localhost
username = root
password = ecosmob
database = dlr
max-connections = 1



========================================
==> opensmppbox.conf
========================================

group = core
dlr-storage = mysql

group = opensmppbox
opensmppbox-id = OPENSMPP
opensmppbox-port = 2775
bearerbox-host = 127.0.0.1
bearerbox-port = 13001
#our-system-id = VFSSMPP1
our-system-id = mysmsbox
smpp-logins = /usr/local/kannel/smpplogins.txt
use-systemid-as-smsboxid = true
#route-to-smsc = smsc
log-file = /usr/local/kannel/smppbox.log

group = mysql-connection
id = mydlr
host = localhost
username = root
password = XXXXX
database = dlr
# you can increase this upon a higher load
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 = boxcid


The steps that I follow to send sms are as below:
1. start the bearbox
2. start the smsbox
3. start the sqlbox
4. start the smppbox

5. sent a message from smpp client(192.168.1.132) php script, which is as below:

#!/usr/bin/php
<?php
require_once 'smppclient.class.php';
require_once 'gsmencoder.class.php';
require_once 'sockettransport.class.php';

// Construct transport and client
$transport = new SocketTransport(array('192.168.1.81'),2775);
$transport->setRecvTimeout(10000);
$smpp = new SmppClient($transport);

// Activate binary hex-output of server interaction
$smpp->debug = true;
$transport->debug = true;

// Open the connection
$transport->open();
$smpp->bindTransmitter("cust2","cust@123");

// Optional connection specific overrides
//SmppClient::$sms_null_terminate_octetstrings = false;
//SmppClient::$csms_method = SmppClient::CSMS_PAYLOAD;
//SmppClient::$sms_registered_delivery_flag = SMPP::REG_DELIVERY_SMSC_BOTH;

// Prepare message
$message = 'Hello world';
$encodedMessage = GsmEncoder::utf8_to_gsm0338($message);
$from = new SmppAddress('98248222',SMPP::TON_ALPHANUMERIC);
$to = new SmppAddress('972526228604',SMPP::TON_INTERNATIONAL,SMPP::NPI_E164);

// Send
$smpp->sendSMS($from,$to,$encodedMessage,$tags);




$smpp->bindReceiver("cust2","cust@123");

// Read SMS and output
$sms = $smpp->readSMS();
echo "


SMS:

";
var_dump($sms);


// Close connection
$smpp->close();
?>




Any help is really appreciable

Please let me know if there's any information needed from my side
  • 写回答

1条回答 默认 最新

  • dongqian5384 2016-08-30 17:11
    关注

    Change the dlr-mask to 19

    send-url = "http://192.168.1.111/btisms/V1/smppsms?username=cust2&sms_type=SMPP&from=%P&message=%I-%t&recipient=%p&type=%d&dlr-mask=19&dlr-url=urlencode(http://192.168.1.132/dlr.php?report=%d)"
    

    From the Kannel User Guide: "dlr-mask: Optional. Request for delivery reports with the state of the sent message. The value is a bit mask composed of:

    1: Delivered to phone, 
    2: Non-Delivered to Phone, 
    4: Queued on SMSC, 
    8: Delivered to SMSC, 
    16: Non-Delivered to SMSC.
    
    评论

报告相同问题?

悬赏问题

  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像