TR: Need help with kannel HTTP SMSC with openssmppbox, sqlbox, custom web App for billing and delivery report management

abel adegnon <[email protected]> Sat, 26 Mar 2016 07:26:12 +0000
Newsgroups gmane.comp.mobile.kannel.user,gmane.comp.mobile.kannel.devel
Message-ID <DB3PR01MB07558B3CD6231A8D5DA2E2EA5840@DB3PR01MB075.eurprd01.prod.exchangelabs.com>


________________________________
De : abel adegnon <[email protected]>
Envoyé : samedi 26 mars 2016 07:14
À : [email protected]; [email protected]; [email protected]
Cc : [email protected]
Objet : Need help with kannel HTTP SMSC with openssmppbox, sqlbox, custom web App for billing and delivery report management


Hello Guys !
I needs to bill my clients and I have configure bearebox,opensmppbox smsbox, sqlbox to achieved my goal.
I have configure two instance of kannel :
* first instance :
./bearerbox -v 1 /usr/local/gateway/clients/kannel.conf
 ./smsbox -v 1 /usr/local/gateway/clients/kannel.conf
 ./opensmppbox -v 1 /usr/local/gateway/clients/opensmppbox.conf

 * seconde instance of kannel :
 ./bearerbox -v 1 /usr/local/gateway/server/kannel.conf
 ./smsbox -v 1 /usr/local/gateway/server/kannel.conf
 ./sqlbox -v 1 /usr/local/gateway/server/sqlbox.conf

First of all I have configure and http smsc in bearerbox of the first instance and I use route-to-smsc of opensmppbox to route all incoming SMS from client by SMPP connection to the HTTP SMSC in bearerbox of the first instance.
The HTTP SMSC with generic type, thus send the message variable to web App which deduict the credit , do some stuff and record the message into sqlbox database.

Therefore the second instance of kannel send normaly the message as there are new entry in the send_sms table of sqlbox.

All thing are worked fine but I have some problem and need also some explanation to understand more how kannel exactly operate.

My operator have gave me two http API accounts to connect to him, so the two http APi account server also as HTTP SMSC in the second instance to deliver the final message to the final client handset.

Now my questions are :
1- How to get the operator messageId in Kannel ?

2- When I inserting the message in sqlbox send_sms table kannel give internal message ID to the message and I can retrieve the DLR in a DLR table with same messageID with status 0 but when the second instance make the execution and move the data to sent_sms table I can see another DLR in the dlr table with another messageId with status 0.
So It is very difficult for me to manage the DLR and send also the result back to my customer because my customer have the first messageId gave by the kannel when the message was pass throught the 1st HTTP SMSC.
Can you show me the right way to make the sytem ?

3- How to get the delivery report from operator ?
2 - How the send back delivery report back to my customer connect through opensmppbox?
3 - Can anybody explain me clearly the role of the generic param, by example generic-param-to of http SMSC?

Here are my configuration files :
 * first instance configuration file :
 *****************1 instance kannel.conf***********************
 # Default kannel configuration file
group = core
admin-port = 13000
admin-password = gateway2016
status-password = gateway2016
admin-allow-ip = "*.*.*.*"
smsbox-port = 13012
box-allow-ip = 127.0.0.1
log-file = "/var/log/kannel/bearerbox.log"
log-level = 3
dlr-storage = internal
#ssl-client-certkey-file = /usr/local/gateway/certificats/public/sever.key
ssl-server-cert-file = /usr/local/gateway/certificats/public/sever.crt
ssl-server-key-file =  /usr/local/gateway/certificats/public/sever.key
ssl-trusted-ca-file = /usr/local/gateway/certificats/private/sms.csr

include ="/usr/local/gateway/sbin/smsbox.conf"

group = smsc
smsc = http
system-type = generic
smsc-id = http-billing
port = 13015
send-url="http://IP_of_remote_site/gateway/?r=sendSms/send&momt=%&sender=%P&receiver=%p&udhdata=%u&msgdata=%a&time=%t&service=%n&account=%n&id=%F&sms_type=%&mclass=%m&mwi=%M&coding=%c&compress=%&validity=%&deferred=%&dlr_mask=%d&dlr_url=%R&pid=%&alt_dcs=%O&rpi=%&charset=%C&boxc_id=%&binfo=%B&meta_data=%D&messageId=%I"
status-success-regex = "ok"
status-permfail-regex = "failure"
status-tempfail-regex = "retry later"
reroute-dlr = true
transceiver-mode = true
generic-param-from = "from"
generic-param-to = "to"
generic-param-text = "text"
generic-param-udh = "udh"
generic-param-service ="service"
generic-param-account ="account"
generic-param-binfo = "binfo"
generic-param-dlr-mask ="dlr_mak"
generic-param-dlr-url ="dlr_url"
generic-param-dlr-mid = "dlr_mid"
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 ="messageId"
generic-message-sent ="%I"
generic-status-sent = 200
generic-status-error = 404

# SEND­SMS USERS
group = sendsms-user
default-sender=MysendeId
username = username
password = gate8976353
max-messages = 6
concatenation = true

# SERVICES
group = sms-service
keyword = nop
text = "You asked nothing and I did it!"
# there should be default always

group = sms-service
keyword = default
text = "No service specified"

#SMS SERVICE
group = sms-service
keyword=
name = default-service
accept-x-kannel-headers = true
max-messages = 6
assume-plain-text = true
#catch-all = true
get-url = "http://IP_of_remote_site/folder/?r=site/dlr&from=%p&to=%P&text=%a&token=%o&time=%t&smsc=%i&messageId=%F&meta=%D&messageCoding=%c&messageClass=%m&billing=%B&originatingSmsc=%f"

*************************1st instance smsbox.conf file**********************************
# SMS box
group = smsbox
smsbox-id=http-billing-smsbox
bearerbox-host = IP
log-file = "/var/log/kannel/smsbox.log"
sendsms-url="/cgi-bin/sendsms"
sendsms-chars = "0123456789 "
sendsms-port=13013
log-level=1
global-sender=MysenderId
mo-recode = true

# SEND­SMS USERS
group = sendsms-user
default-sender=MysenderId
username = #username#
password = gateway2016%
max-messages = 6
concatenation = true
#name = default-service

***************************1st instance opensmppbox.conf file******************************
group = core
dlr-storage = mysql


group=opensmppbox
opensmppbox-id = SMPP
opensmppbox-port = 2775
bearerbox-host = localhost
bearerbox-port = 13012
timeout= 120
log-level = 5
log-file = /var/log/kannel/clients/opensmppbox.log
our-system-id = vma
use-systemid-as-smsboxid = true
route-to-smsc = http-billing
# see sample smpplogins.txt
smpp-logins =/usr/local/gateway/clients/smpplogins.txt


group = mysql-connection
id = mydlr
host = localhost
username = root
password = #password#
database = smpp
# you can increase this upon a higher load
max-connections = 10

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
 ************************smpplogins file ********************************************
 system-id-01 password-01 system-type-01 127.0.0.1
client-02 password-02 locahost 127.0.0.1
abolo kAjdh20 vma *.*.*.*
afi 20jdh16 vma *.*.*.*


**************************************************************************************
Seconde instance configuration files

**************************************************************************************

 ************************2nd instance kannel.conf ************************************
 # Default kannel configuration file
group = core
admin-port = 14000
admin-password = admin pass
status-password = status pass
admin-allow-ip = "*.*.*.*"
smsbox-port = 14012
box-allow-ip = 127.0.0.1
log-file = "/var/log/kannel/server/bearerbox.log"
log-level = 5
dlr-storage = mysql

# SMS box
group = smsbox
smsbox-id= "server-smsbox"
bearerbox-host = My IP
log-file = "/var/log/kannel/server/smsbox.log"
sendsms-url="/cgi-bin/sendsms"
sendsms-port=14013
mo-recode = true
log-level=5
global-sender=senderId

#include = "/usr/local/gateway/server/smsbox.conf"

# Route sms pour les SMS entrants
#group = smsbox-route
#smsbox-id = server-smsbox
#smsc-id = http-billing


# SEND­SMS USERS
group = sendsms-user
default-sender=senderId
username = username
password = password
max-messages = 6
concatenation = true
#name = default-service

group = smsc
smsc = http
system-type = generic
smsc-id = http-operator-1
port = 13015
send-url="http://first_IP_of_operator_site/gateway/?r=sendSms/send&sender=%P&receiver=%p&text=%u&user=myUsername&pass=MyPass"
status-success-regex = "ok"
status-permfail-regex = "failure"
status-tempfail-regex = "retry later"
reroute-dlr = true
transceiver-mode = true


group = smsc
smsc = http
system-type = generic
smsc-id = http-operator-2
port = 13016
send-url="http://first_IP_of_operator_site/gateway/?r=sendSms/send&sender=%P&receiver=%p&text=%u&user=myUsername&pass=MyPass"
status-success-regex = "ok"
status-permfail-regex = "failure"
status-tempfail-regex = "retry later"
reroute-dlr = true
transceiver-mode = true

# SERVICES
group = sms-service
keyword = nop
text = "You asked nothing and I did it!"
# there should be default always

group = sms-service
keyword = default
text = "No service specified"

group = mysql-connection
id = mydlr
host = My IP
username = root
password = My DB password
database = smpp
max-connections = 5

group = dlr-db
id = mydlr
table = dlr
field-smsc = smsc
field-timestamp = ts
field-source = source
field-destination = destination
field-service = service
field-url = url
field-mask = mask
field-status = status
field-boxc-id = boxc





**************************************2nd instance smsbox **********************************************
group = sqlbox
id = "sqlbox-db"
smsbox-id = "server-smsbox"
global-sender= "senderId"
bearerbox-host = My IP
bearerbox-port = 14012
smsbox-port = 13005
smsbox-port-ssl = false
sql-log-table = sent_sms
sql-insert-table = send_sms
log-file = "/var/log/kannel/server/sqlbox.log"
log-level = 5
#ssl-client-certkey-file = ""
#ssl-server-cert-file = ""
#ssl-server-key-file = ""
#ssl-trusted-ca-file = ""


# Database connection examples. Please uncomment as needed
# Example MYSQL Connection
group = mysql-connection
id = "sqlbox-db"
host = My IP
username = root
password = My DB password
database = smpp

********************************* 2nd instance sqlbox file **********************************************

group = sqlbox
id = "sqlbox-db"
smsbox-id = "server-smsbox"
global-sender= "senderId"
bearerbox-host = My IP
bearerbox-port = 14012
smsbox-port = 13005
smsbox-port-ssl = false
sql-log-table = sent_sms
sql-insert-table = send_sms
log-file = "/var/log/kannel/server/sqlbox.log"
log-level = 5
#ssl-client-certkey-file = ""
#ssl-server-cert-file = ""
#ssl-server-key-file = ""
#ssl-trusted-ca-file = ""

# Database connection examples. Please uncomment as needed
# Example MYSQL Connection
group = mysql-connection
id = "sqlbox-db"
host = localhost
username = root
password = My DB password
database = smpp