Syed Jahanzaib Personal Blog to Share Knowledge !

November 26, 2012

Howto configure your Local SMS HTTP Gateway using KANNEL on Ubuntu

Filed under: Linux Related — Tags: , , , , , , , — Syed Jahanzaib / Pinochio~:) @ 12:01 PM

 

1

As per web defines: Kannel (http://www.kannel.org/) is one of the most popular open source WAP/SMS Gateway, because its very good performance to handle a huge SMS. Kannel supports many modem’s brand even generic modem, also support multi modems (modem bank).

x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x

After some testing, I have found Kannel one of the best , fastest SMS and WAP gateway among other open source sms gateways , capable of handling several hundreds of requests per second.

Following is a guide on how you can configure your own Local SMS HTTP gateway using KANNEL 

(The aim of configuring kannel on my Ubuntu box was that I required it to send sms via DMASOFTLAB RADIUS MANAGER which uses API to send sms via clickatell HTTP gateway for New Account / Expiry Warning / Password recovery via sms , verification code and many other cool functions. It comes with the clickatell HTTP gateway API which off course require you to buy sms bundle package and do require handsome amount of $$ if you have a huge number of users, Therefore to save $$ money , I  created my own gateway)

O/S = Ubuntu 10.4
Hardware = Teltonika ModemUSB/E12 UM1400 / and Dlink dwm-156 , dlink is a problematic modem

 


 Detecting MODEM

First thing you have to do is to search for working modem port , various methods are used, try to Use WVDIALCONF command to detect modem and see at which port its working (or not detected)

As showed below …

root@radius:/temp# wvdialconf

Editing `/etc/wvdial.conf'.

Scanning your serial ports for a modem.

ttyS0<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyS0<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud
ttyS0<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
Modem Port Scan<*1>: S1   S2   S3   S4   S5   S6   S7   S8
Modem Port Scan<*1>: S9   S10  S11  S12  S13  S14  S15  S16
Modem Port Scan<*1>: S17  S18  S19  S20  S21  S22  S23  S24
Modem Port Scan<*1>: S25  S26  S27  S28  S29  S30  S31
ttyUSB0<Info>: Device or resource busy
Modem Port Scan<*1>: USB0
ttyUSB1<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyUSB1<*1>: ATQ0 V1 E1 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 Z -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB1<*1>: Modem Identifier: ATI -- MTK2
ttyUSB1<*1>: Max speed is 9600; that should be safe.
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB2<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyUSB2<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 9600 baud
ttyUSB2<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
ttyUSB3<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyUSB3<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 9600 baud
ttyUSB3<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.

Found a modem on /dev/ttyUSB1.
Modem configuration written to /etc/wvdial.conf.
ttyUSB1<Info>: Speed 9600; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

As you can see the modem is detected on ttyUSB1 port.


 

INSTALL KANNEL in ubuntu

First install KANNEL using apt-get (configuring it on ubuntu is the easiest task ! that’s why i love ubuntu ,not all but in most cases 😉 )


apt-get install libxml2

apt-get install kannel

 


EDIT KANNEL CONFIGURATION FILE

Now open the kannel config file by

nano /etc/kannel/kannel.conf

Remove all the lines and paste the following config

!     MAKE     SURE     YOU     CHANGE     THE     USB     PORT      IN    THE  DEVICE     SECTION     ! Also pay attention to speed as some modems like serial may work on 115200 speed , zaib

# Syed Jahanzaib
# https://aacable.wordpress.com
# aacable [at] hotmail.com

group = core
admin-port = 13000
smsbox-port = 13001
admin-password = zaibadmin
status-password = zaibstatus
log-file = "/var/log/kannel/bearerbox.log"
log-level = 0
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"
#Send sms only once. No retry
sms-resend-retry = 1

group = smsc
smsc = at
smsc-id = zaibgsmid
modemtype = teltonika
device = /dev/ttyACM0
# Change above port to match your port, it could ACM1 or USB0, if you dont set it correctly,  it will not work and you will get error in logs that unable to connect to device)
# Or use serial-by-id like
# device = /dev/serial/by-id/usb-D-Link_Inc_D-Link_DWM-156-if03-port0
speed = 19200
my-number = 0333302100000 # (put your sim number, not necessary)
# Following SMSC number is for zong
# sms-center = 00923040000011
sim-buffering = true
log-level = 0

# for teltonkia only, if you are using other brand you may need to get there INIT stribgs
# But what I have seen that this string worked for dlink and huawei modem as well.
group = modems
id = teltonika
name = "Teltonika E12"
detect-string = "Undefined"
enable-mms = true
init-string = "AT+CNMI=2,2,0,1,1"
# or i used this for dlink as well.
#init-string = "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
speed = 115200
message-storage = "SM"

# for Huawei USB/GSM modem e155 i guess, remove hashes from below lines if u r using this model.
#group = modems
#id = huawei
#name = "Huawei"
#detect-string = "huawei"
#enable-mms = true
#init-string = "ATZ"
#init-string = "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

group = smsbox
bearerbox-host = localhost
sendsms-port = 13013
global-sender = 13013
sendsms-chars = "0123456789 +-"
log-file = "/var/log/kannel/smsbox.log"
log-level = 0
access-log = "/var/log/kannel/access.log"

group = sendsms-user
# MAKE VERY SURE that you change the PASSWORD for security reasons
username = kannel
password = kannel
concatenation = true
max-messages = 1000

group = sms-service
keyword = default
get-url = "http://localhost/kannel/receivesms.php?sender=%p&text=%b"
# If you have playSMS installed to receive sms use below line instead
#get-url = "http://localhost/playsms/index.php?app=call&cat=gateway&plugin=kannel&access=geturl&t=%t&q=%q&a=%a&Q=%Q"
accept-x-kannel-headers = true
max-messages = 99
concatenation = true
catch-all = true
text = "Galaxy ROBOT by Zaib"
omit-empty = true

 


 START KANNEL CONSOLE   

Now start kannel (for test start with two terminals, one bearerbox and smsbox)

[ BEARER & SMSBOX ]

Open two terminal windows and issue below commands in each terminal box in the following order.

1. Start the Bearer Box

and leave it running as it will show you the debug logs)

bearerbox -v 0 /etc/kannel/kannel.conf

You may see the following screenshot if your config is ok

Now leave it running.

 

2. Start the SMSBOX in separate terminal

(in second terminal window and leave it running as it will show you the debug logs)


smsbox -v 0 /etc/kannel/kannel.conf

 

You may see the following screenshot if your config is OK

[If you receive error that the address is already in use, first issue the command service kannel stop]

 


 

CHECK KANNEL CONFIGURATION STATUS VIA CLI and WEB

First check kannel service status with

ps aux |grep kannel

and you should see something like this


root@radius:/temp# ps aux |grep kannel
kannel   15448  0.0  0.0   2252   308 ?        Ss   12:05   0:00 /usr/sbin/run_kannel_box --pidfile /var/run/kannel/kannel_bearerbox.pid --no-extra-args /usr/sbin/bearerbox -v 4 -- /etc/kannel/kannel.conf
kannel   15450  1.5  0.1  94936  7780 ?        Sl   12:05   0:10 /usr/sbin/bearerbox -v 4 -- /etc/kannel/kannel.conf
kannel   15465  0.0  0.0   2252   368 ?        Ss   12:05   0:00 /usr/sbin/run_kannel_box --pidfile /var/run/kannel/kannel_wapbox.pid --no-extra-args /usr/sbin/wapbox -v 4 -- /etc/kannel/kannel.conf
kannel   15468  0.0  0.0   2252   312 ?        Ss   12:05   0:00 /usr/sbin/run_kannel_box --pidfile /var/run/kannel/kannel_smsbox.pid --no-extra-args /usr/sbin/smsbox -v 4 -- /etc/kannel/kannel.conf
kannel   15470  0.0  0.0  71192  2544 ?        Sl   12:05   0:00 /usr/sbin/smsbox -v 4 -- /etc/kannel/kannel.conf
root     23357  0.0  0.0   4388   820 pts/0    S+   12:16   0:00 grep --color=auto kannel

CHECK via WEB

Now From your browse, type the following to make sure kannel is working fine 🙂

http://101.11.11.250:13000/status?password=zaibstatus

[change the ip and password to match your config]

and you may see the following screen , if your config is ok

 


 

How to Send SMS via HTTP command

Open your browser and paste the following command.

http://101.11.11.250:13013/cgi-bin/sendsms?username=kannel&password=kannel&to=03333021909&text=ZAIB+KANNEL+WORK

 

NOTE: Change the IP / ID + Password = and number to match your local configuration.

 

The result would be similar to the following . . .

 

and you shoudl receive sms on your cell as following …

kannel_works

 

 


Some Tips and reference.


Howto send SMS via GAMMU CLI

gammu sendsms TEXT 03333021909 -text "Test Msg from GAMMU  .."

Howto send USSD CODES via GAMMU CLI

For balance check (below example is for zong balacne check)

gammu --getussd *222# 


Howto send sms via CLI
using KANNEL

curl "http://localhost:13013/cgi-bin/sendsms?username=kannel&password=KANNELPASS&to=03333021909&text=Welcome+Jahanzaib+Test+Message"

Sending mesage with new line using %0A code using KANNEL

curl "http://localhost:13013/cgi-bin/sendsms?username=kannel&password=KANNELPASS&to=03333021909&text=Welcome+Jahanzaib+Test+Message%0ANew+line"

Howto send sms using FILE via CLI using KANNEL

curl "http://127.0.0.1:13013/cgi-bin/sendsms?username=kannel&password=kannelpassword&to=03333333333" -G --data-urlencode text@/temp/message.txt

Howto send sms using any output  via CLI using KANNEL

ls -l | curl "http://127.0.0.1:13013/cgi-bin/sendsms?username=kannel&password=kannelpassword&to=03333333333" -G --data-urlencode text@-

 

SEND SMS FROM MIKROTIK USING KANNEL AS GW


/tool fetch url="http://KANNEL_GW_IP:13013/cgi-bin/sendsms\?username=kannel&password=KANNELPASSWORD&to=03333021909&text=ALERT:+INTERNET+Link+DOWN+at+$date+$time+[YOURCOMPANY+Pvt+Ltd]"

 


 

Howto make KANNEL start on reboot 

edit following file

/etc/default/kannel

and make sure it looks like following

START_WAPBOX=1
START_SMSBOX=1

If you receive some permission error in logs like below image

ttyacm

then follow this guide

https://aacable.wordpress.com/2014/11/21/kannel-auto-startup-problem-with-system-error-13-permission-denied/

 


 

 

 

Regard’s
Syed Jahanzaib

Advertisements

50 Comments »

  1. brilliant. have been wanting to do this myself but didnt know how!

    Like

    Comment by nyasha — November 26, 2012 @ 1:14 PM

  2. I’m not sure if I’m doing someting wrong but the sent sms dust get’s queued. If I sent a sms through gammu, it works fine – so my modem is working!

    Here is my logs.

    smsbox.log

    2012-12-27 12:31:04 [1371] [0] DEBUG: Kannel smsbox version 1.4.3 starting
    2012-12-27 12:31:04 [1371] [0] DEBUG: dumping group (sendsms-user):
    2012-12-27 12:31:04 [1371] [0] DEBUG: =
    2012-12-27 12:31:04 [1371] [0] DEBUG: =
    2012-12-27 12:31:04 [1371] [0] DEBUG: =
    2012-12-27 12:31:04 [1371] [0] DEBUG: =
    2012-12-27 12:31:04 [1371] [0] DEBUG: =
    2012-12-27 12:31:04 [1371] [0] DEBUG: Started thread 4 (gw/smsbox.c:obey_request_thread)
    2012-12-27 12:31:04 [1371] [4] DEBUG: Thread 4 (gw/smsbox.c:obey_request_thread) maps to pid 1371.
    2012-12-27 12:31:04 [1371] [0] DEBUG: Started thread 5 (gw/smsbox.c:url_result_thread)
    2012-12-27 12:31:04 [1371] [5] DEBUG: Thread 5 (gw/smsbox.c:url_result_thread) maps to pid 1371.
    2012-12-27 12:31:04 [1371] [0] DEBUG: Started thread 6 (gw/smsbox.c:http_queue_thread)
    2012-12-27 12:31:04 [1371] [6] DEBUG: Thread 6 (gw/smsbox.c:http_queue_thread) maps to pid 1371.
    2012-12-27 12:31:04 [1371] [0] INFO: Connected to bearerbox at localhost port 13001.
    2012-12-27 12:31:04 [1371] [0] DEBUG: Started thread 7 (gw/heartbeat.c:heartbeat_thread)
    2012-12-27 12:31:04 [1371] [7] DEBUG: Thread 7 (gw/heartbeat.c:heartbeat_thread) maps to pid 1371.
    2012-12-27 12:31:13 [1371] [2] DEBUG: HTTP: Creating HTTPClient for `192.168.111.253′.
    2012-12-27 12:31:13 [1371] [2] DEBUG: HTTP: Created HTTPClient area 0x8b03a00.
    2012-12-27 12:31:13 [1371] [3] INFO: smsbox: Got HTTP request from
    2012-12-27 12:31:13 [1371] [3] INFO: sendsms used by
    2012-12-27 12:31:13 [1371] [3] INFO: sendsms sender: (192.168.111.253) to: msg:
    2012-12-27 12:31:13 [1371] [3] DEBUG: Stored UUID 09c19c5f-7f31-4905-a296-fff39a6ecc2d
    2012-12-27 12:31:13 [1371] [3] DEBUG: message length 16, sending 1 messages
    2012-12-27 12:31:13 [1371] [3] DEBUG: Status: 202 Answer:
    2012-12-27 12:31:13 [1371] [3] DEBUG: Delayed reply – wait for bearerbox
    2012-12-27 12:31:13 [1371] [0] DEBUG: Got ACK (3) of 09c19c5f-7f31-4905-a296-fff39a6ecc2d
    2012-12-27 12:31:13 [1371] [0] DEBUG: HTTP: Resetting HTTPClient for `192.168.111.253′.
    2012-12-27 12:32:13 [1371] [1] DEBUG: Timeout for fd:24 appeares.
    2012-12-27 12:32:13 [1371] [1] DEBUG: HTTP: Destroying HTTPClient area 0x8b03a00.
    2012-12-27 12:32:13 [1371] [1] DEBUG: HTTP: Destroying HTTPClient for `192.168.111.253′.

    Status Page:

    Kannel bearerbox version `1.4.3′. Build `Apr 6 2010 13:16:08′, compiler `4.4.3′. System Linux, release 2.6.32-38-generic-pae, version #83-Ubuntu SMP Wed Jan 4 12:11:13 UTC 2012, machine i686. Hostname ubuntu.hartjies.co.za, IP 192.168.111.5. Libxml version 2.7.6. Using OpenSSL 0.9.8k 25 Mar 2009. Compiled with MySQL 5.1.41, using MySQL 5.1.66. Using native malloc.

    Status: running, uptime 0d 0h 39m 55s

    WDP: received 0 (0 queued), sent 0 (0 queued)

    SMS: received 0 (0 queued), sent 0 (1 queued), store size -1

    SMS: inbound (0.00,0.00,0.00) msg/sec, outbound (0.00,0.00,0.00) msg/sec

    DLR: 0 queued, using internal storage

    Box connections:
    smsbox:(none), IP 127.0.0.1 (0 queued), (on-line 0d 0h 4m 22s)

    SMSC connections:
    unknown AT2[/dev/ttyUSB1] (connecting, rcvd 0, sent 0, failed 0, queued 0 msgs)

    Status: running, uptime 0d 0h 39m 55s

    WDP: received 0 (0 queued), sent 0 (0 queued)

    SMS: received 0 (0 queued), sent 0 (1 queued), store size -1

    SMS: inbound (0.00,0.00,0.00) msg/sec, outbound (0.00,0.00,0.00) msg/sec

    DLR: 0 queued, using internal storage

    Box connections:
    smsbox:(none), IP 127.0.0.1 (0 queued), (on-line 0d 0h 4m 22s)

    SMSC connections:
    unknown AT2[/dev/ttyUSB1] (connecting, rcvd 0, sent 0, failed 0, queued 0 msgs)

    SMS Page:

    3: Queued for later delivery

    Any Advice?

    Like

    Comment by A.J. Hart — December 27, 2012 @ 3:41 PM

  3. I Think I found the cause – I have changed the init-string = “AT+CNMI=2,2,0,1,1” to “AT+CNMI=2,1,0,0,0”.

    2012-12-27 15:03:11 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: device opened
    2012-12-27 15:03:11 [2677] [0] INFO: Kannel bearerbox II version 1.4.3 starting
    2012-12-27 15:03:11 [2677] [6] INFO: AT2[/dev/ttyUSB1]: Logging in
    2012-12-27 15:03:11 [2677] [0] INFO: MAIN: Start-up done, entering mainloop
    2012-12-27 15:03:11 [2677] [0] DEBUG: AT2[/dev/ttyUSB1]: start called
    2012-12-27 15:03:11 [2677] [7] DEBUG: Thread 7 (gw/bb_smscconn.c:sms_router) maps to pid 2677.
    2012-12-27 15:03:11 [2677] [6] INFO: AT2[/dev/ttyUSB1]: init device
    2012-12-27 15:03:11 [2677] [6] INFO: AT2[/dev/ttyUSB1]: speed set to 19200
    2012-12-27 15:03:11 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: –> ATZ^M
    2012-12-27 15:03:11 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: AT^M
    2012-12-27 15:03:11 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: <– AT
    2012-12-27 15:03:11 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: AT&F^M
    2012-12-27 15:03:11 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: <– AT&F
    2012-12-27 15:03:11 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: ATE0^M
    2012-12-27 15:03:11 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: <– ATE0
    2012-12-27 15:03:11 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: AT+IFC=2,2^M
    2012-12-27 15:03:12 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: AT+CPIN?^M
    2012-12-27 15:03:12 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: <– +CPIN: READY
    2012-12-27 15:03:12 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: AT+CMGF=0^M
    2012-12-27 15:03:12 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: AT+CSMS=?^M
    2012-12-27 15:03:12 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: <– +CSMS: (0-1)
    2012-12-27 15:03:12 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: AT+CNMI=2,1,0,0,0^M
    2012-12-27 15:03:12 [2677] [6] DEBUG: AT2[/dev/ttyUSB1]: <– OK
    2012-12-27 15:03:12 [2677] [6] INFO: AT2[/dev/ttyUSB1]: AT SMSC successfully opened.

    Like

    Comment by A.J. Hart — December 27, 2012 @ 6:06 PM

  4. how can I use USSD with kannel

    Like

    Comment by bilal waheed — September 21, 2013 @ 2:30 PM

  5. I used same configuration as described by syed jahazaib and its working absolutely fine for me.

    Like

    Comment by bilal waheed — September 21, 2013 @ 2:33 PM

  6. I just need one more that how to configure it, so I can send USSD command through it.

    Like

    Comment by bilal waheed — September 21, 2013 @ 2:35 PM

  7. Dear Zaib
    how can I run kannel on boot
    when i restart the system I must run the command ( bearerbox -v 0 /etc/kannel/kannel.conf ) and ( smsbox -v 0 /etc/kannel/kannel.conf ) please help me

    Like

    Comment by Haroon Rashidi — June 19, 2014 @ 7:55 PM

  8. Hi All,
    Please Help me out …below is my error after configuring the kannel sms

    2014-07-07 15:39:22 [12897] [6] DEBUG: AT2[SMSC1]: TP-Validity-Period: 24.0 hours
    2014-07-07 15:39:22 [12897] [6] DEBUG: AT2[SMSC1]: –> AT+CMGS=18^M
    2014-07-07 15:39:22 [12897] [6] DEBUG: AT2[SMSC1]: <– AT+CMGS=18
    2014-07-07 15:39:22 [12897] [6] DEBUG: AT2[SMSC1]:
    2014-07-07 15:39:22 [12897] [6] DEBUG: AT2[SMSC1]: send command status: 1
    2014-07-07 15:39:22 [12897] [6] DEBUG: AT2[SMSC1]: –> 0011000A8199006262660000A7054167D04904
    2014-07-07 15:39:22 [12897] [6] DEBUG: AT2[SMSC1]: –> ^Z
    2014-07-07 15:39:22 [12897] [6] DEBUG: AT2[SMSC1]: 0011000A8199006262660000A7054167D04904
    2014-07-07 15:39:22 [12897] [6] DEBUG: AT2[SMSC1]: maybe Sim storage is full? I’ll have a look at it. (500)
    2014-07-07 15:39:22 [12897] [6] DEBUG: AT2[SMSC1]: send command status: 1
    2014-07-07 15:39:22 [12897] [7] DEBUG: sms_router: handling message (0x7fd294000c20 vs 0x7fd294000c20)
    2014-07-07 15:39:22 [12897] [7] DEBUG: re-queing SMS not-yet-to-be resent
    2014-07-07 15:39:22 [12897] [7] DEBUG: sms_router: handling message (0x7fd294000c20 vs 0x7fd294000c20)
    2014-07-07 15:39:22 [12897] [7] DEBUG: re-queing SMS not-yet-to-be resent
    2014-07-07 15:39:22 [12897] [7] DEBUG: sms_router: time to sleep 30.00 secs.
    2014-07-07 15:39:52 [12897] [7] DEBUG: sms_router: gwlist_len = 1
    2014-07-07 15:39:52 [12897] [7] DEBUG: sms_router: handling message (0x7fd294000c20 vs 0x7fd294000c20)
    2014-07-07 15:39:52 [12897] [7] DEBUG: re-queing SMS not-yet-to-be resent
    2014-07-07 15:39:52 [12897] [7] DEBUG: sms_router: handling message (0x7fd294000c20 vs 0x7fd294000c20)
    2014-07-07 15:39:52 [12897] [7] DEBUG: re-queing SMS not-yet-to-be resent
    2014-07-07 15:39:52 [12897] [7] DEBUG: sms_router: time to sleep 30.00 secs.

    Like

    Comment by anand — July 7, 2014 @ 3:11 PM

  9. thanks Allah save U
    I searched very in google but i doesn’t find how fix this issue thank u

    Like

    Comment by haroonnimroozy — December 13, 2014 @ 11:07 PM

  10. how to setup huawei e 1550 usb adapter

    Like

    Comment by spi plus — January 10, 2015 @ 5:37 PM

    • i found
      Bus 001 Device 002: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem

      Like

      Comment by spi plus — January 10, 2015 @ 5:50 PM

      • and i have problem
        2015-01-11 20:08:26 [32368] [0] INFO: Added logfile `/var/log/kannel/bearerbox.log’ with level `0′.
        2015-01-11 20:08:26 [32368] [0] INFO: HTTP: Opening server at port 13000.
        2015-01-11 20:08:26 [32368] [0] ERROR: bind failed
        2015-01-11 20:08:26 [32368] [0] ERROR: System error 98: Address already in use
        2015-01-11 20:08:26 [32368] [0] DEBUG: Started thread 1 (gw/bb_http.c:httpadmin run)
        2015-01-11 20:08:26 [32368] [1] DEBUG: Thread 1 (gw/bb_http.c:httpadmin_run) maps to pid 32368.
        2015-01-11 20:08:26 [32368] [1] DEBUG: HTTP: No clients with requests, quitting.
        2015-01-11 20:08:26 [32368] [0] DEBUG: starting smsbox connection module
        2015-01-11 20:08:26 [32368] [0] INFO: BOXC: ‘smsbox-max-pending’ not set, usingdefault (100).
        2015-01-11 20:08:26 [32368] [1] DEBUG: Thread 1 (gw/bb_http.c:httpadmin_run) terminates.
        2015-01-11 20:08:26 [32368] [0] DEBUG: Started thread 2 (gw/bb_boxc.c:sms_to_sms boxes)
        2015-01-11 20:08:26 [32368] [2] DEBUG: Thread 2 (gw/bb_boxc.c:sms_to_smsboxes) maps to pid 32368.
        2015-01-11 20:08:26 [32368] [0] DEBUG: Started thread 3 (gw/bb_boxc.c:smsboxc_ru n)
        2015-01-11 20:08:26 [32368] [3] DEBUG: Thread 3 (gw/bb_boxc.c:smsboxc_run) maps to pid 32368.
        2015-01-11 20:08:26 [32368] [3] ERROR: bind failed
        2015-01-11 20:08:26 [32368] [3] ERROR: System error 98: Address already in use
        2015-01-11 20:08:26 [32368] [0] INFO: Set SMS resend frequency to 60 seconds.
        2015-01-11 20:08:26 [32368] [3] PANIC: Could not open smsbox port 13001
        2015-01-11 20:08:26 [32368] [0] INFO: SMS resend retry set to unlimited.
        2015-01-11 20:08:26 [32368] [0] DEBUG: smsbox MO concatenated message handling enabled
        2015-01-11 20:08:26 [32368] [3] PANIC: bearerbox(gw_panic+0xcd) [0x80ce67d]
        2015-01-11 20:08:26 [32368] [3] PANIC: bearerbox() [0x8057fb8]
        2015-01-11 20:08:26 [32368] [3] PANIC: bearerbox() [0x80c585e]
        2015-01-11 20:08:26 [32368] [3] PANIC: /lib/libpthread.so.0() [0x548b39]
        2015-01-11 20:08:26 [32368] [3] PANIC: /lib/libc.so.6(clone+0x5e) [0x48bd6e]
        2015-01-11 20:08:26 [32368] [0] INFO: DLR rerouting for smsc id disabled.

        Like

        Comment by spi plus — January 12, 2015 @ 12:10 AM

  11. Assalam O Alaikum Jahanzeb Bhai,

    It is an excellent article. Jazal Allah. I would really appreciate if you can guide us on how to start the kannel and sqlbox on ubuntu 14.04 reboot.

    Thanks a lot

    Like

    Comment by Attaullah — February 10, 2015 @ 1:44 PM

  12. hi sir,
    i am using radius manager in centos7 x64
    so can you please update this with Howto configure your Local SMS HTTP Gateway using KANNEL on centos7

    Like

    Comment by naveen chittimotu — April 22, 2015 @ 11:00 PM

  13. you can install on the same server as the radius manager ?

    Like

    Comment by serena — May 3, 2015 @ 4:02 PM

  14. prejudice I have performed all the installation , I am trying to configure a Samsung modem as SMS , but I can not ask you help plea

    Like

    Comment by serena — May 17, 2015 @ 10:56 PM

  15. error groups does not contain variable ‘group’

    Like

    Comment by serena — May 17, 2015 @ 10:58 PM

  16. 2015-05-17 19:57:20 [1773] [0] INFO: Debug_lvl = 0, log_file = , log_lvl = 0
    2015-05-17 19:57:20 [1773] [0] ERROR: Group does not contain variable ‘group’.
    2015-05-17 19:57:20 [1773] [0] ERROR: Error found on line 17 of file `/etc/kannel/kannel.conf’.
    2015-05-17 19:57:20 [1773] [0] PANIC: Couldn’t read configuration from `/etc/kannel/kannel.conf’.
    2015-05-17 19:57:20 [1773] [0] PANIC: bearerbox(gw_panic+0xcd) [0x80d21ed]
    2015-05-17 19:57:20 [1773] [0] PANIC: bearerbox(main+0xdc8) [0x8055a58]
    2015-05-17 19:57:20 [1773] [0] PANIC: /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0x50dbd6]
    2015-05-17 19:57:20 [1773] [0] PANIC: bearerbox() [0x8053f51]

    Like

    Comment by serena — May 17, 2015 @ 10:58 PM

  17. hello

    i am trying to install kannel on my raspberry pi 2. But i am getting this error.Do you have any idea to fix this error.

    2015-12-22 13:22:43 [3099] [6] DEBUG: AT2[/dev/ttyUSB0]: –> ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0^M
    2015-12-22 13:22:43 [3099] [6] DEBUG: AT2[/dev/ttyUSB0]: <– OK
    2015-12-22 13:22:43 [3099] [6] INFO: AT2[/dev/ttyUSB0]: AT SMSC successfully opened.
    2015-12-22 13:23:05 [3099] [5] INFO: Client connected from
    2015-12-22 13:23:05 [3099] [5] DEBUG: Started thread 8 (gw/bb_boxc.c:function)
    2015-12-22 13:23:05 [3099] [8] DEBUG: Thread 8 (gw/bb_boxc.c:function) maps to pid 3099.
    2015-12-22 13:23:05 [3099] [8] DEBUG: Started thread 9 (gw/bb_boxc.c:boxc_sender)
    2015-12-22 13:23:05 [3099] [9] DEBUG: Thread 9 (gw/bb_boxc.c:boxc_sender) maps to pid 3099.
    2015-12-22 13:23:08 [3099] [8] DEBUG: boxc_receiver: sms received
    2015-12-22 13:23:08 [3099] [8] DEBUG: send_msg: sending msg to box:
    2015-12-22 13:23:09 [3099] [6] DEBUG: AT2[/dev/ttyUSB0]: TP-Validity-Period: 24. 0 hours
    2015-12-22 13:23:09 [3099] [6] DEBUG: AT2[/dev/ttyUSB0]: –> AT+CMGS=28^M
    2015-12-22 13:23:09 [3099] [6] DEBUG: AT2[/dev/ttyUSB0]: <– AT+CMGS=28
    2015-12-22 13:23:09 [3099] [6] DEBUG: AT2[/dev/ttyUSB0]:
    2015-12-22 13:23:09 [3099] [6] DEBUG: AT2[/dev/ttyUSB0]: send command status: 1
    2015-12-22 13:23:09 [3099] [6] DEBUG: AT2[/dev/ttyUSB0]: –> 0011000B91131677007 0F10000A710DA6052085A069DCE2213747D4A97
    2015-12-22 13:23:09 [3099] [6] DEBUG: AT2[/dev/ttyUSB0]: –> ^Z
    2015-12-22 13:23:09 [3099] [6] DEBUG: AT2[/dev/ttyUSB0]: 0011000B911316770 070F10000A710DA6052085A069DCE2213747D4A97
    2015-12-22 13:23:30 [3099] [6] DEBUG: AT2[/dev/ttyUSB0]: send command status: -1
    2015-12-22 13:23:30 [3099] [7] DEBUG: sms_router: handling message (0x71701078 vs 0x71701078)
    2015-12-22 13:23:30 [3099] [7] DEBUG: re-queing SMS not-yet-to-be resent
    2015-12-22 13:23:30 [3099] [7] DEBUG: sms_router: handling message (0x71701078 vs 0x71701078)
    2015-12-22 13:23:30 [3099] [7] DEBUG: re-queing SMS not-yet-to-be resent
    2015-12-22 13:23:30 [3099] [7] DEBUG: sms_router: time to sleep 30.00 secs.
    2015-12-22 13:23:30 [3099] [7] DEBUG: sms_router: gwlist_len = 1
    2015-12-22 13:23:30 [3099] [7] DEBUG: sms_router: handling message (0x71701078 vs 0x71701078)
    2015-12-22 13:23:30 [3099] [7] DEBUG: re-queing SMS not-yet-to-be resent
    2015-12-22 13:23:30 [3099] [7] DEBUG: sms_router: handling message (0x71701078 vs 0x71701078)
    2015-12-22 13:23:30 [3099] [7] DEBUG: re-queing SMS not-yet-to-be resent
    2015-12-22 13:23:30 [3099] [7] DEBUG: sms_router: time to sleep 30.00 secs.
    2015-12-22 13:23:39 [3099] [6] DEBUG: AT2[/dev/ttyUSB0]: maybe Sim storage is full? I’ll have a look at it. (500)

    regards.

    Ahmet

    Like

    Comment by Race Monstah — December 22, 2015 @ 6:30 PM

  18. very good, thank you

    Like

    Comment by Good — March 23, 2016 @ 5:14 PM

  19. Thank you so much for this, Please what is the function of the Teltonika Modem.

    Like

    Comment by Patrick Chi — May 10, 2016 @ 2:53 PM

  20. Great share

    2016-05-29 17:46:23 [13760] [4] DEBUG: AT2[zaibgsmid]: don’t worry, just memory fragmentation. (321)
    2016-05-29 17:46:23 [13760] [4] DEBUG: AT2[zaibgsmid]: failed to get message 30.

    Please i keep getting this error an i dnt knw i to go abt it, any help caos am new to linux

    Thank you

    Like

    Comment by Richmond — May 29, 2016 @ 10:48 PM

  21. Great share

    2016-05-29 17:55:03 [13760] [4] DEBUG: AT2[zaibgsmid]: don’t worry, just memory fragmentation. (321)
    2016-05-29 17:55:03 [13760] [4] DEBUG: AT2[zaibgsmid]: failed to get message 30.

    Please i keep getting this error an i dnt knw i to go abt it, any help caos am new to linux

    Thank you

    Like

    Comment by Richmond — May 29, 2016 @ 10:56 PM

  22. Thank you sir for the share, please i have been able to complete the configuration but i get thi error when trying to send Send SMS via HTTP command

    Queued for later delivery

    Please can anybody help me out?

    thank you.

    Like

    Comment by Richmond — May 30, 2016 @ 10:09 PM

  23. Syed, Thanks alot, please is there any other alternative to using the USB internet modem

    Like

    Comment by Spec — July 16, 2016 @ 1:41 AM

  24. my problem is i am configure two sms gateway smpp connect ok but when send me sms only send one side, can you please help me how to connect two sms gateway, bearbox conncet at a time . DLR: 0 queued, using internal storage

    No boxes connected

    SMSC connections:
    SMPP SMPP:10.243.166.22:5000/5000:dfn1:VMA (re-connecting, rcvd 0, sent 0, failed 0, queued 0 msgs)
    SMPP SMPP:172.16.249.43:6014/6015:dfnwap: (re-connecting, rcvd 0, sent 0, failed 0, queued 0 msgs)

    Like

    Comment by Rashed Khan — August 24, 2016 @ 10:22 PM

  25. Great post!!! I wish to use playsms with one modem(dongle) per user,(modem1=user1; modem2=user2…) Its possible with kannel in playsms? I use gammu but I dont know how make this. :/ Thanks! (sorry my poor english)

    Like

    Comment by Dalton Aranha — September 9, 2016 @ 7:42 PM

    • unfortunately I have not worked with 2 modems with single kannel/playsms box.
      Post your query at playSMS forum, surely you may receive good reply on it.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — September 18, 2016 @ 4:03 PM

  26. hi sir i send the sms from playsms from kannel but can’t received plz update me what can i do

    Like

    Comment by Sheheryar — December 4, 2016 @ 5:36 AM

  27. […] Kannel/playsms for receiving SMS and execute the script which will in return sends response by email (or sms) [ I have covered kannel and playSMS in my previous guides at my blog] […]

    Like

    Pingback by Acquiring Cisco Switch Customized Report via Sms/Email | Syed Jahanzaib Personal Blog to Share Knowledge ! — January 28, 2017 @ 10:02 AM

  28. How to configure Local SMS HTTP Gateway using KANNEL on CENTOS 6.9?

    Like

    Comment by husham dogar — April 28, 2017 @ 11:24 AM

  29. when i run “sqlbox -v 0 /etc/kannel/kannel.conf” i receive the below panic message.
    i have been searching on google for several days but couldn’t find any solution.

    2017-05-25 10:58:53 [5405] [0] INFO: Debug_lvl = 0, log_file = , log_lvl = 0
    2017-05-25 10:58:53 [5405] [0] DEBUG: Kannel sqlbox version `1.4.4′.
    Build `Apr 5 2016 13:32:05′, compiler `5.3.1 20160330′.
    System Linux, release 4.4.0-77-generic, version #98-Ubuntu SMP Wed Apr 26 08:34:02 UTC 2017, machine x86_64.
    Hostname awais-HP-EliteBook-8470p, IP 127.0.1.1.
    Libxml version 2.9.3.
    Using OpenSSL 1.0.2g 1 Mar 2016.
    Compiled with MySQL 5.7.11, using MySQL 5.7.18.
    Compiled with PostgreSQL 9.5.2.
    Using SQLite 3.11.0.
    Using hiredis API 0.13.3
    Using native malloc.

    2017-05-25 10:58:53 [5405] [0] PANIC: Trying to fetch variable `bearerbox-port’ in non-existing group
    2017-05-25 10:58:53 [5405] [0] PANIC: sqlbox(gw_backtrace+0xce) [0x42d07e]
    2017-05-25 10:58:53 [5405] [0] PANIC: sqlbox(gw_panic+0x16f) [0x42d1ff]
    2017-05-25 10:58:53 [5405] [0] PANIC: sqlbox(cfg_get_real+0xe8) [0x422448]
    2017-05-25 10:58:53 [5405] [0] PANIC: sqlbox(cfg_get_integer+0x24) [0x4226c4]
    2017-05-25 10:58:53 [5405] [0] PANIC: sqlbox(main+0x172) [0x40c0a2]
    2017-05-25 10:58:53 [5405] [0] PANIC: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7fb365771830]
    2017-05-25 10:58:53 [5405] [0] PANIC: sqlbox(_start+0x29) [0x40c4d9]

    here is my sql.conf file

    group = sqlbox
    id = sqlbox-db
    smsbox-id = sqlbox-db-1
    global-sender = “0302381***” # change this to SIM number
    bearerbox-host = localhost
    bearerbox-port = 13001
    smsbox-port = 13005
    smsbox-port-ssl = false
    sql-log-table = sent_sms
    sql-insert-table = send_sms
    log-level = 0
    log-file = “/var/log/kannel/kannel-sqlbox.log”

    group = mysql-connection
    id = sqlbox-db
    host = localhost
    username = root
    password = 1***
    port = 3306
    database = kannel_db
    #max-connection = 1

    and here is my kannel.conf

    group = core
    admin-port = 13000
    smsbox-port = 13001
    #bearerbox-port = 13002
    admin-password = kanneladmin
    status-password = kannelstatus
    log-file = “/var/log/kannel/bearerbox.log”
    log-level = 0
    box-deny-ip = “*.*.*.*”
    box-allow-ip = “127.0.0.1”
    #Send sms only once. No retry
    sms-resend-retry = 1
    dlr-storage = mysql
    #storage-type = file
    #store-location = /var/log/kannel/kannel-store.file
    #access-log = /var/log/kannel/bearerbox.access

    #include = “/etc/kannel/sqlbox.conf”

    group = smsc
    smsc = at
    smsc-id = gsmid
    modemtype = huawei
    device = /dev/ttyUSB0
    speed = 9600
    my-number = 030238**** # (put your sim number, not necessary)
    #sms-center = 0092300000042 # (put your sim message center number)
    sim-buffering = true
    log-level = 0

    group = modems
    id = huawei
    name = huawei
    detect-string = “huawei”
    #enable-mms = true
    init-string = “AT+CNMI=2,2,0,1,1”
    init-string = “ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0”
    speed = 9600
    message-start = 0
    message-storage = “MT”

    group = smsbox
    smsbox-id = smsbox
    bearerbox-host = localhost
    sendsms-port = 13013
    global-sender = 13013
    #bearerbox-port = 13002
    sendsms-chars = “0123456789 +-”
    log-file = “/var/log/kannel/smsbox.log”
    log-level = 0
    access-log = “/var/log/kannel/access.log”

    group = sendsms-user
    # MAKE VERY SURE that you change the PASSWORD for security reasons
    username = kannel
    password = kannel
    default-smsc = SMSC-ID
    concatenation = true
    max-messages = 1000

    group = sms-service
    keyword = default
    get-url = “http://localhost/kannel/receivesms.php?sender=%p&text=%b”
    # If you have playSMS installed to receive sms use below line instead
    #get-url = “http://localhost/playsms/index.php?app=call&cat=gateway&plugin=kannel&access=geturl&t=%t&q=%q&a=%a&Q=%Q”
    accept-x-kannel-headers = true
    #max-messages = 99
    concatenation = true
    catch-all = true
    #text = “Kannel SMS Robot”
    omit-empty = true

    ################# MYSQL CONFIGURATION #############
    # SQL BOX CONFIG
    # Database connection examples. Please uncomment as needed
    # Example MYSQL Connection

    group = mysql-connection
    id = sqlbox-db
    host = localhost
    port = 3306
    username = root
    password = 123***
    database = kannel_db

    # DLR SETUP
    #mysql connection
    group = mysql-connection
    id = mydlr
    host = localhost
    username = root
    password = 123
    database = kannel_db

    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

    Like

    Comment by Awais — May 25, 2017 @ 11:05 AM


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: