Kannel - Getting shortcode from POST_URL - sms

currently we uses Kannel to connect to SMSC and receive any incoming SMS.
The setup successfully direct the message to our CGI Perl script. However, the destination address (in this case it's the shortcode) is empty. We have several shortcode configured at the SMSC therefore we need to be able to know the message is sent via which shortcode.
The current configuration is as follow:
group = sms-service
keyword =default
accept-x-kannel-headers=true
post-url= "http://127.0.0.1:8990/cgi-bin/test_shortcode.cgi?MSISDN=%p&MSG=%a&SC=%P"
max-messages =1
catch-all=yes
concatenation = 1
omit-empty = true
send-sender=true
The param SC receive empty string.
A check in the SMSC log files and the shortcode is actually found as the destination_addr:
2016-04-20 14:48:56 [20307] [6] DEBUG: dest_addr_ton: 0 = 0x00000000
2016-04-20 14:48:56 [20307] [6] DEBUG: dest_addr_npi: 1 = 0x00000001
2016-04-20 14:48:56 [20307] [6] DEBUG: destination_addr: "27626"
Any idea on why this is happening and how can we get the shortcode as the param?
Thank you

Found the issue after checking the Kannel source. Turns out Kannel will read a sequence of configuration for sending out SMS, and these setting will replace the destination number when MO is coming in. The settings i found are:
my-number
global-sender
faked-sender
Each level of setting will override the previous one, i.e. if all 3 are set, faked-sender will be in effect. By commenting off the above 3, we are able to get the correct shortcode value from the parameter %P in the post-url request.
Just posting this in case it will help somebody.

Related

Unable to receive URC for an incoming SMS from a modem

I have an issue in being unable to recive the URC message from the modem whenever it receives an SMS.
I know that it receives them since i can find and read them if I use AT+CMGL but, i don't receive any notification when the modem gets them. I played around with the URC related commands but I've been unable to get it to work (other URCs work fine).
The modem is a BG600L M3 from Quectel and following is the sequence of commands i'm sending ("AT" is always omitted and the first command is literally "AT\r", basically an empty one).
//general config
AT\r
CFUN=1,0
E1
+QCFG=\"urc/ri/other\",\"pulse\",8,1
H0
&F
V1
+CMEE=1
&D0
E1
+CREG=2
+CGREG=2
+CEREG=2
//sms config
+CPMS=\"ME\",\"ME\",\"ME\"
+QINDCFG=\"smsincoming\",1
+CMGF=1
+CSDH=0
+CSCS=\"GSM\"
+CNMI=2,2,0,2,0
//doing some deleting and reading
+CMGD=1,3
+CPMS?
//getting the gps fix
+QGPS=1
+QGPSCFG=\"gnssconfig\",3
+QGPSLOC=1
+QGPSEND
//resetting the gms connection
+CFUN=0
+CFUN=1,0
//setting up the gsm connection
+QICFG=\"dataformat\",0,0
+QICFG=\"viewmode\",0
+QICFG=\"recvind\",1
+QICFG=\"tcp/retranscfg\",3,600
+QISDE=0
+QCFG=\"band\",0xf,0x80085,0x80085,1
+QCFG=\"nwscanmode\",1,1
+QCFG=\"nwscanseq\",010101,1
+QCFG=\"iotopmode\",2,1
// checking if it's connected
+CREG?
+QNWINFO
+COPS?
//Getting the time
+CTZU=3
+CTZR=0
+QLTS
+CCLK?
You can set AT+CNMI=2,1,2,0,0 , that should do the trick.
According to specification ETSI TS 127 005 V11.0.0 (2012-10)
+CNMI: <mode>,<mt>,<bm>,<ds>,<bfr>
by keeping <mt> value to 1 we should get indication when message is stored in ME/TA
<mt>: integer type (the rules for storing received SMs depend on its
data coding scheme
0 No SMS-DELIVER indications are routed to the TE.
1 If SMS-DELIVER is stored into ME/TA, indication of the memory location is routed to the TE using unsolicited result code:
+CMTI: <mem>,<index>

Concatinating Long SMS using kannel

Kannel 1.4.4
I need to receive "long" sms (length > 160 ) by Kannel. If sms length less than 160 - all is ok. But if it is long sms kannel splits sms to 2 or more sms and not send sms. I get this error from smsc log
SMSC returned error code 0x000000ff (Unknown Error) in response to submit_sm PDU
What can cause this error ?
Use concatenation option for resolving this issue
max-messages = 3
concatenation = true

Error: Invalid number format while sending SMS with SIM800L

I'm using a SIM800L GSM module connected over USB-Serial to my computer.
When I try to send a SMS I got an error:
AT+CMGS="+4915xxxxxxxxx"
> Test (Ctrl+Z)
+CMS ERROR: Invalid number format (incomplete number)
I’m obviously connected to the network because pin is entered +CREG an +COPS seems good.
AT+CPIN?
+CPIN: READY
OK
AT+CREG?
+CREG: 0,1
OK
AT+COPS?
+COPS: 0,0,"O2 (Germany)"
OK
As well I can receive SMS and see incoming calls.
I set the module in sms text mode and use the coding GSM
AT+CMGF?
+CMGF: 1
OK
AT+CSCS?
+CSCS: "GSM"
OK
I try different number formats like "015xxxxxxxxx" or "004915xxxxxxxxx". Also I try different values for the optional parameter from +CMGS
Could anybody advise me what to do?
To send SMS it was necessary for me to change the SMSC adress with the command AT+CSCA.
AT+CSCA="+491760000443",145
The SMSC you can found at your mobile operator. In my case Netzclub at O2 Germany.

Set up multiple accounts for one connection in Kannel

I am stuck with a problem with Kannel. I have one SMSC (with one IP and port) but I have 2 user accounts for it. The problem is that I can't set up both user accounts for one SMSC in Kannel (only one connection.) Currently I'm setting each user account in a separate connection (2 connections.) I want to run both accounts on one smsc group in case one of them dies. How can I use two accounts with one connection?
You can do it by creating two smsc groups with the same smsc-id but with different smsc-admin-id, e.g.:
group = "smsc"
smsc-id = "my-smsc"
smsc-admin-id = "my-smsc-1"
smsc-username = "login-1"
smsc-password = "pass-1"
... other params...
group = "smsc"
smsc-id = "my-smsc"
smsc-admin-id = "my-smsc-2"
smsc-username = "login-2"
smsc-password = "pass-2"
... other params...
When sending to smsbox use the my-smsc as SMSC ID. However, if you want to do something like stop-smsc, start-smsc, etc. from the web interface, you have to use the my-smsc-1 or my-smsc-2.
Kannel will treat both connections as the same and will automatically load balance your messages over both connections. If one of them will die, Kannel will automatically move all traffic to the live connection.

DisMan Monitoring - traps not being generated

In order to set up a self-monitoring of a linux OS (CentOS) in order to send traps if a condition occurs i have configured the lines
com2sec notConfigUser default Public0
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
view systemview included .1
access notConfigGroup "" any noauth exact systemview systemview none
for disk query
disk / 100000000
trap2sink 10.10.64.132
authorization for self monitoring
rouser admin
iquerySecName admin
define message to send OID to monitor threshold values
monitor -r 10 DiskAlmostFull dskPercent < 90
monitor -r 10 machineTooBusy hrProcessorLoad < 90
But the traps are generated only when i restart the snmpd deamon.
I have tried to troubleshoot this issue without success.
Any held will be helpful.
Thanks in advance
Having had the same problem, I discovered the following explanation in "man snmpd.conf".
Section "monitor [OPTIONS] NAME EXPRESSION" states:
"Note that the event will only be triggered once, when the expression first matches. This monitor entry will not fire again until the monitored condition first becomes false, and then matches again."
You may not like the answer, but the monitor command behaves as advertised.

Resources