Tuesday, November 16, 2010

Troubleshooting smslib-based applications (DHIS Mobile, SCDRT, InventMobi, StocksTracker)

While I’ve been troubleshooting SMS Applications (based on smslib, Gnokii, Kannel) for over 3 yrs, it is excruciatingly painful to tell people the basics of the troubleshooting again and again. There have been numerous small docs, readme files, emails that have repeated the same things again and again. To people who have gone through with the implementation and fixed problems, I’ve repeatedly requested to document these at some place (…infact as part of their job profiles), but none have sadly been able to produce anything useful. So, here is an attempt to make the troubleshooting process a little more easier for someone who is stuck. There is always websearch that will finally give you the answer to the troubleshooting process, but this is just a reminder to myself where to look at.

    0.) Archive the logs and send it... as basic as it sounds, ALWAYS look at the log file
  1. Check the application/library version – report this as part of any question you are asking
  2. Check the Native Library version and the Java Library version. These should ideally match or should have the same type. i.e if you are using RXTXComm (this is bundled with dhis-web-mobile module), then you should have rxtxSerial.so (Linux) or rxtxSerial.dll (Windows). If using the older version, check the comm.jar and the required dlls is at the right location.
  3. Check the compatibility of the modem (Kannel) and (smslib). If not listed, check if it supports common standard AT command and may just work
  4. If you are using SMSLib for Java on Linux with the RxTx, you can have a no response exception or gnu.io.NoSuchPortException, as if no modem is actually connected to your computer – create a simlink to the dev/ttyS20 and also do start your application (for DHIS this is catalina.sh) with the –Dsmslib.serial.polling parameter as given in this bug filing.
  5. Check if you have the correct port number in the configuration. For Windows, look at the device manager and the modem. Put the COM10 as the port (COM is needed for DHIS, while not for SMSListener), while for Linux add the /dev/tty<whatever> (/dev/ttyUSB0). For linux, try running the “wvdialconf /etc/wvdial.conf” (without quotes) or scanModem script. This will give the modem port
  6. Check the SIM memory location and add it to the configuration file. This is complex, but a Google search on your modem should help. If you don’t find anything obvious leaving it blank should likely work for your modem
  7. If you repeatedly see Framing Errors, it is primarily because the baud-rate mismatch between what you have set and what your modem supports. Running wvdialconf as earlier may give you good indication of what baud-rates are supported and best for your modem. If its windows, then setting to 56000 should be safe enough.
  8. Some modems supports a specialized AT command set. These are init commands and activation AT commands. You should change the manufacturer and model string. If you know the manufacturer, then it is always good to put the exact manufacturer name in that string.


Marissa Fernandes said...

Hi!I have been struggling with SMSLib for over 2 months now and have checked everything on the list you have mentioned above. I also tried using 2 modems and nothing seems to get the "no response from device" away. I am working on Windows with a SIM900A modem. Please help me out!

Saptarshi Purkayastha said...

Can you send me a link to your project?? Are you trying to run the standard examples?

Marissa Fernandes said...

I am trying to send an SMS. Instead of Javax Comm, Im using RxTx, coz i read somewhere that it could be useful. I have tried to use both the SIM900 GSM modem and my Samsung Galaxy S2. For both, I always get the same error saying no response from device.

Saptarshi Purkayastha said...

Please do a DEBUG logging - http://smslib.org/doc/smslib/troubleshooting/#EnableDisable_debug_logging

and share the log through a pastebin.com , then I'd be able to help. Seems like a simple configuration issue that rxtx libraries may not be placed in the correct location

Marissa Fernandes said...

I finally found out the problem: the device was faulty. I had to replace it with another SIM900, shelled out some cash but its all working now! Although I keep getting the error: "org.smslib.GatewayException: GSM Network Registration denied!" once a while.... I have tried changing sim cards but it hasnt helped

Pamod said...


I'm facing a similar issue as you have mentioned under #4.
I'm trying to connect kannel sms gateway running on usb modem to DHIS2.
How do I enable Dsmslib.serial.polling on DHIS2?