Testing playSMS with Kannel

This article is about how to use Kannel for testing playSMS. Assumed you have a box of VPS, a droplet, a physical server, or a VM running and playSMS is installed and work properly. Follow manuals here to add Kannel to the playSMS server box, configure both playSMS and Kannel to make them work together.

Once you get a working playSMS connected to a well configured Kannel for testing, you can then send bulk SMS (fake non-delivered to the real cellphone of course) and see the performace of both software handling thousands of SMS.

Let\’s start the manual.

1. Install

How to install Kannel for playSMS in Ubuntu:

sudo apt install kannel kannel-extras
sudo mkdir -p /var/log/kannel /var/run/kannel /var/spool/kannel/store
sudo chown -R kannel /var/log/kannel /var/run/kannel /var/spool/kannel/store
sudo usermod -a -G dialout kannel

Edit /etc/default/kannel to activate smsbox, smsbox is part of Kannel, the daemon that handles SMS in Kannel:

sudo sed -i \'s/#START_SMSBOX/START_SMSBOX/\' /etc/default/kannel

I don\’t need wapbox so I disable it:

sudo sed -i \'s/START_WAPBOX/#START_WAPBOX/\' /etc/default/kannel

Backup original kannel.conf:

sudo cp /etc/kannel/kannel.conf /etc/kannel/kannel.conf.dist

Download example kannel.conf for testing purposes (for this article):

wget -c https://raw.githubusercontent.com/playsms/playsms/master/contrib/kannel/kannel.conf
sudo cp kannel.conf /etc/kannel/
ls -l /etc/kannel/

Edit new /etc/kannel/kannel.conf and change passwords, parts with CHANGE_THIS on the line.

Restart Kannel:

/etc/init.d/kannel stop
/etc/init.d/kannel start

Note, I\’ll wait about 2-3 seconds after stop before start, and I don\’t use restart.

New example kannel.conf for testing purposes pushed in github, here:

  • https://raw.githubusercontent.com/playsms/playsms/master/contrib/kannel/kannel.conf

You can download and use it as your base and then modify it.

Using example kannel.conf above as-is for your Kannel will provide 2 SMSC, smpp1 and smpp2. Both test SMSC are using fake SMSC. For this to work you need another tools from Kannel, included in kannel-extras package (you already install this with apt above).

2. Connection Configuration

Next, configure Kannel gateway plugin in playSMS.

Go to Settings -> Manage gateway and SMSC and click Manage (the folder icon) on Gateway Kannel. Fill in with data form kannel.conf:


See above on Bearerbox hostname or IP, its an IP public, not or localhost, this is because my playSMS is using HTTPS and a domain name, and its not accessible through http://localhost. Therefore I need to fill server\’s IP address instead, where requests from Kannel to playSMS logged as access from outside/Internet.

If you can access playSMS with http://localhost then Bearerbox hostname or IP should be or localhost.

On Operational tab, fill in the correct admin password or status password, sets in kannel.conf:


You should see SMSC smpp1 and smpp2 are both online.


  • Above screenshot shown LOOPBACK type SMSC, this is because the screenshot was taken during my tests using Kannel SMSC type loopback. The latest test configuration here is using Kannel SMSC type fake.
  • Both are fake SMSC types, you can use either for tests, the different is the loopback type will return received SMS as incoming SMS immediately to playSMS. I prefer to use fake as it seems more real.

3. Test Configuration

To route SMS to Kannel and those SMSC\’s above you will need to add SMSC to playSMS, click the plus sign in Gateway Kannel in Settings -> Manage gateway and SMSC.

Add 2 SMSC to playSMS, first give name smpp1 and then the second give it name smpp2, example here:


Now we can route SMS for testing, go to Settings -> Route outgoing SMS:


Last, activate fake SMSC by running 2 fakesmsc instances from console. You will need to install screen before starting fakesmsc:

apt install screen

Let\’s run the first fake SMSC application is receiving on port 10001 (as configured on kannel.conf):

screen -dmS smpp1 /usr/lib/kannel/test/fakesmsc -r 10001

Second fake SMSC application is receiving on port 10002:

screen -dmS smpp2 /usr/lib/kannel/test/fakesmsc -r 10002

4. Send & Receive

Send SMS and Delivery Reports

By now you should be able to access playSMS and send some SMS. You can try sending to more destination by using Send from file feature, or add a group and send to the group.

Use this file to import dummy contacts to playSMS\’s phonebook. Create phonebook group with group code TESTGROUP and then import this phonebook CSV file. You can then compose message to the group #TESTGROUP.

Use this file to send SMS using Send from file menu. Download this CSV file and upload it in Send from file menu.

Receive SMS

Run another instance of fakesmsc in this format:

/usr/lib/kannel/test/fakesmsc -r <port> -i <interval> -m <number_of_sms> \"<from> <to> <message>\"

Example of sending to Kannel from smpp1, that is the fakesmsc running on port 10001 according to kannel.conf configuration:

/usr/lib/kannel/test/fakesmsc -r 10001 -i 0.01 -m 10 \"0100001 1234 This is test message\"


  • Above example command will get fakesmsc to push 10 SMS to Kannel at the interval of 0.01s
  • Those SMS will be recognized by Kannel as coming from SMSC smpp1 and from 0100001 with destination number 1234
  • Kannel will get them and deliver them to playSMS, playSMS will read and parse, and process them according to playSMS configuration

5. References

See this article to give you understanding on how playSMS handles gateway and SMSC:

Original article, more kannel.conf examples, ask questions, visit:

Leave a Reply

Your email address will not be published. Required fields are marked *