Quantcast
Channel: Syed Jahanzaib – Personal Blog to Share Knowledge !
Viewing all articles
Browse latest Browse all 408

Kannel SMS gateway with multiple smsc/modems & CMS Err 330

$
0
0

kannellogo

 

Following are reference guide on how you can run Kannel with multiple modems / smsc.
For basic / initial level of KANNEL configuration, please refer to the internet or my previous post at …

https://aacable.wordpress.com/2012/11/26/howto-configure-your-local-http-gateway-using-kannel-on-ubuntu/


Scenario:

Kannel is working as an SMS gateway to send/receive SMS. There is one Serial Modem connected with it using ttyS0 port. Another USB GSM Modem have been added recently which is installed as ttyUSB2.

Now we want to send SMS some specific announcement base messages via Modem#1 and some complaint system messages via Modem#2.


Hardware Used:

OS = Ubuntu 12.4 / Server Edition / x86 [Its support may end in 2017]

SMS Gateway App = Kannel 1.4.3

Modems:

1# Teltonika Modem Model = ModemCOM-G10 [Reliable & solid in performance, serial modems are good and easily configurable]
http://www.teltonika.lt/product/modemcom-g10/

modemcom-g10

 

2# TP-Link MA260 USB GSM Modem [Problematic, avoid using such cheap brands like tplink/dlink etc]
http://www.tp-link.com/en/products/details/cat-5090_MA260.html

 

ma260-01


KANNEL.CONF  Sample


# KANNEL config sample for multiple modem / SMSC
# Syed Jahanzaib

# MODEM 1 / Teltonika Brand / Type : Serial
group = smsc
smsc = at
smsc-id = zaibgsmid1
modemtype = teltonika
device = /dev/ttyS0
transceiver-mode = true
speed = 115200
# MODEM 2 / TP-LINK MA260 Brand / Type : USB
group = smsc
smsc = at
smsc-id = zaibgsmid2
modemtype = teltonika
device = /dev/ttyUSB2
transceiver-mode = true
speed = 115200
# for other models/modems adjust the INIT strings accordingly
group = modems
id = teltonika
name = "Teltonika E12"
detect-string = "Undefined"
enable-mms = true
#init-string = "AT+CNMI=2,2,0,1,1"
init-string = "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0;+CNMI=1,3,2,2,1;+CMEE=1;+CPMS="SM","SM","SM";+CMGF=0"
speed = 115200
message-storage = "SM"

Make sure to restart the Kannel service and watch the bearerbox.log available at /var/log/kannel for any errors.


Howto send SMS via specific SMSC / MODEM

Now to send SMS using HTTP API method , via modem # 1 or 2, we will use its smsc ID as shown in example below … focus on smsc= part

MODEM#1

http://KANNEL-IP:13013/cgi-bin/sendsms?smsc=zaibgsmid1&username=KANNELID&password=KANNEL-PASSWORD&to=MOBILENO&text=TEST+MSG+FROM+MODEM+1

MODEM#2

http://KANNEL-IP:13013/cgi-bin/sendsms?smsc=zaibgsmid2&username=KANNELID&password=KANNEL-PASSWORD&to=MOBILENO&text=TEST+MSG+FROM+MODEM+2

 


CMS ERROR 330

I was getting cms error 330 in bearerbox.log when sending SMS with specific model of TP-LINK MA260 ,
As shown below …

cms-error

2016-12-01 08:24:05 [13727] [6] DEBUG: AT2[zaibgsmid1]: <– +CMS ERROR: 330
2016-12-01 08:24:05 [13727] [6] ERROR: AT2[zaibgsmid1]: CMS ERROR: +CMS ERROR: 330
2016-12-01 08:24:05 [13727] [6] ERROR: AT2[zaibgsmid1]: CMS ERROR: SMSC address unknown (330)

With some troubleshooting using minicom, I found out that the message center service number was not set, Strange, it should get the value auto (which is normal with other modems) , any way I sort this issue as following

(For ZONG SIM)

AT+CSCA=”+923040000011″

# now Query CSCA number

AT+CSCA?

and you should get the center number fine.

Now send sms using minicom AT commands

# Sets text mode
AT+CMGF=1  
# Now input the msg we want to send to recipient
AT+CMGS=”03333021909″
# Press Enter, and type your desired msg
TEST MSG FROM ZAIB
# Press CTRL+Z and it will send the SMS to the specified number

Some other useful minicom / AT commands with minicom

# To configure Modem ports/etc
minicom -s

General Check
AT

Getting IMEI
AT+CGSN
AT+CIMI

Getting Signal quality and battery charge status
AT+CSQ
AT+CBC

Model Inquiry
AT+CGMI

MINICOM USSD
T+CUSD=1,”your_service_code”,15

so for your case

AT+CUSD=1,”*555*87*1234#
and don’t forget the 15 at the end , this question helped me to solve the problem.


Regard’s
Syed Jahanzaib


Filed under: Linux Related

Viewing all articles
Browse latest Browse all 408

Trending Articles