# CONFIGURATION FOR USING SMS KANNEL WITH RAPIDSMS
#
# 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
include = "/etc/kannel/modems.conf"
#---------------------------------------------
# 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
admin-port = 13000
smsbox-port = 13001
admin-password = TestPassword!@#$%
status-password = TestPassword!@#$%
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
#---------------------------------------------
# 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
# Here is a sample SMSC for use with the /usr/lib/kannel/test/fakesmsc command
group = smsc
smsc = fake
smsc-id = FAKE
port = 10000
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
bearerbox-host = 127.0.0.1
sendsms-port = 13013
sendsms-chars = "0123456789 +-"
log-file = "/var/log/kannel/smsbox.log"
log-level = 0
access-log = "/var/log/kannel/smsbox-access.log"
reply-couldnotfetch = "Your message could not be processed at this time. Please try again later. (err=couldnotfetch)"
reply-requestfailed = "Your message could not be processed at this time. Please try again later. (err=requestfailed)"
reply-couldnotrepresent = "Your message could not be processed at this time. Please try again later. (err=couldnotrepresent)"
http-request-retry = 3
http-queue-delay = 10
# 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...
# This is the username and password that RapidSMS uses to deliver SMSes to
# Kannel. It must also set the 'smsc' variable in the query string, so that
# Kannel knows which SMSC to use to route the message.
group = sendsms-user
username = rapidsms
password = TestPassword!@#$%
user-deny-ip = "*.*.*.*"
user-allow-ip = "127.0.0.1;"
#---------------------------------------------
# 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.
# The 'ping-kannel' service let's you check to see if Kannel is running,
# even if RapidSMS is offline for some reason.
group = sms-service
keyword = ping-kannel
text = "Kannel is online and responding to messages."
# There should be always a 'default' service. This service is used when no
# other 'sms-service' is applied. These relay incoming messages from any
# configured SMSCs to the appropriate HTTP backend URLs in RapidSMS.
# By setting 'accepted-smsc', we are assured that messages are routed to
# the appropriate backend in RapidSMS.
group = sms-service
keyword = default
catch-all = yes
accepted-smsc = FAKE
# don't send a reply here (it'll come through sendsms):
max-messages = 0
get-url = http://127.0.0.1:8000/backend/kannel-fake-smsc/?id=%p&text=%a&charset=%C&coding=%c
and my index.php is like this :
<?php
require_once 'smppclient.class.php';
require_once 'gsmencoder.class.php';
require_once 'sockettransport.class.php';
// Construct transport and client
$transport = new SocketTransport(array('127.0.0.1'),10000);
$transport->setRecvTimeout(30000);
$transport->setSendTimeout(30000);
$smpp = new SmppClient($transport);
// Activate binary hex-output of server interaction
$smpp->debug = true;
$transport->debug = true;
// Open the connection
$transport->open();
$smpp->bindTransmitter("rapidsms","TestPassword!@#$%");
// 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 = 'H€llo world';
$encodedMessage = GsmEncoder::utf8_to_gsm0338($message);
$from = new SmppAddress('SMPP Test',SMPP::TON_ALPHANUMERIC);
$to = new SmppAddress(4512345678,SMPP::TON_INTERNATIONAL,SMPP::NPI_E164);
// Send
$smpp->sendSMS($from,$to,$encodedMessage,$tags);
// Close connection
$smpp->close();
but this produces the following error
**Fatal error: Uncaught SmppException: Failed to read reply to command: 0x2 in /var/www/html/smspro/smppclient.class.php:651 Stack trace: #0 /var/www/html/smspro/smppclient.class.php(507): SmppClient->sendCommand(2, 'rapidsms\x00TestPa...') #1 /var/www/html/smspro/smppclient.class.php(140): SmppClient->_bind('rapidsms', 'TestPassword!@#...', 2) #2 /var/www/html/smspro/smspro.php(18): SmppClient->bindTransmitter('rapidsms', 'TestPassword!@#...') #3 {main} thrown in /var/www/html/smspro/smppclient.class.php on line 651**
when I run kannel fake message through terminal like this : $ /usr/lib/kannel/test/fakesmsc -m 1 "123 789 text ping-kannel"
it gives me this output on terminal :
2018-04-03 22:29:38 [15284] [0] INFO: Debug_lvl = -1, log_file = , log_lvl = 0
2018-04-03 22:29:38 [15284] [0] INFO: Host localhost Port 10000 interval 1.000 max-messages 1
2018-04-03 22:29:38 [15284] [0] INFO: fakesmsc starting
2018-04-03 22:29:38 [15284] [0] DEBUG: Connecting to <127.0.0.1>
2018-04-03 22:29:38 [15284] [0] INFO: fakesmsc: sent message 1
2018-04-03 22:29:38 [15284] [0] INFO: Got message 1: <789 123 text Kannel is online and responding to messages.>
How can I solve this issue. Please help me solve this. Thank you.
I installed and started Kannel as described in this doc http://rapidsms.readthedocs.io/en/v0.21.1/topics/backends/kannel.html
And currently my kannel.conf is like this :
and my index.php is like this :
but this produces the following error
when I run kannel fake message through terminal like this : $ /usr/lib/kannel/test/fakesmsc -m 1 "123 789 text ping-kannel" it gives me this output on terminal :
2018-04-03 22:29:38 [15284] [0] INFO: Debug_lvl = -1, log_file =, log_lvl = 0
2018-04-03 22:29:38 [15284] [0] INFO: Host localhost Port 10000 interval 1.000 max-messages 1
2018-04-03 22:29:38 [15284] [0] INFO: fakesmsc starting
2018-04-03 22:29:38 [15284] [0] DEBUG: Connecting to <127.0.0.1>
2018-04-03 22:29:38 [15284] [0] INFO: fakesmsc: sent message 1
2018-04-03 22:29:38 [15284] [0] INFO: Got message 1: <789 123 text Kannel is online and responding to messages.>
How can I solve this issue. Please help me solve this. Thank you.