How to Send and Read SMS By Using Command Line


REVISION HISTORY

EDITION ISSUED DATE REMARK
7th 5th of September,2016 Version 6 released
6th 21th of January, 2016 “HOW TO USE” and “LONG MESSAGE ON CLISMS VERSION 5.4.2” added by Iqa
5th 4th of August, 2014 “HOW TO TRIGGER SMS ALERT WHEN SERVER IS REBOOTED” added by Faez
4th 15th of September, 2010 Version 5.2 released; New section added – “CONFIGURING UPSMAN”
3rd 23rd of September, 2009 Updated the section “CONFIGURING PRTG Traffic Grapher TO CALL CLISMS.EXE” with new version of PRTG
2nd 28th of November, 2008 Added new section “SMS ALERT WHEN UPS RUNNING ON BATTERY
1st 13th of August, 2007 Initial release

 

COPYRIGHT

Copyright © 2007 – 2016 MOBITEK System Sdn. Bhd. All rights reserved.

No part of this document may be reproduced, distributed, stored in a retrieval system or translated into any language, in any form or by any means, electronic, mechanical, magnetic, optical, photocopying, manual or otherwise, without the prior written permission of MOBITEK System Sdn. Bhd.

 

TRADEMARKS

MOBITEKTM is a trademark that belongs to MOBITEK System Sdn. Bhd.

 

DISCLAIMER

MOBITEK makes no representations or warranties with respect to the contents hereof and specifically disclaims any implied warranties of merchantability or fitness for any particular purpose. Further, MOBITEK reserves the right to revise this publication and to make changes from time to time in the contents hereof without obligation to notify any person of such revision or changes. Trademarks and Registered Trademarks Products and product names mentioned in this document may be trademarks or registered trademarks of their respective owners.

 

ACKNOWLEDGEMENT

We like to extend our appreciation to the following person for their contribution in revising this manual:-

 

  1.  Mr. Muhamad Faezudin bin Hairuddin, UNIVERSITY SAINS MALAYSIA

  2.  Ms. Nur Shafiqah binti Muhamad Baharum, UNIVERSITI PERTAHANAN NASIONAL MALAYSIA

 

INTRODUCTION

Programme: Command Line Interface SMS (“CLISMS”)

API TYPE: COMMAND LINE INTERFACE (“CLI”) for Windows only

File Name: CLISMS.exe

Version: 6.0

Requirements:

  1. System integrator, and software developer (“SI/SD”) must posses knowledge in using command line interface, or shell command in Windows command prompt environment.

  2. Any software applications that can call external programme, or shell out to CLISMS.exe such as:

    2.1 Network monitoring programme – OpManager, IPServerCheck, PRTG, etc.
    2.2 Anti-virus programme
    2.3 Firewall programme
    2.4 Windows Services

  3. The operating system must be Windows OS (XP and above)

Command Line Interface SMS (“CLISMS”) is part of the SMS Gateway Development Kit (“SMS GDK”). System integrator, and software developer can choose any development kit in the SMS GDK to build their own SMS Gateway.

 

RELEASE NOTES

VERSION RELEASE DATE NOTE
6.0 2016-09-05 ported from VB6 to VB .Net
5.4 2016-01-12 add support for concatenate SMS (long SMS)
5.2 2010-09-15 allow to send 1 message to a maximum of 3 mobile numbers
5.1 will re-initialize modem if it fails to do so
5.0 supports USSD where SI/SD can check credit balance, and reload credit

 

INSTALLATION

  1. Run the “setup.exe”.

  2. By default, the “CLISMS.exe” will be installed in “C:\” or to the designated path as specified in the installation process.

  3. On 64 bit case, the CLISMS.exe will be installed in C:\Program Files (x86)\MOBITEK\CLISMS.
    CLISMS-01

  4. If necessary (e.g. in Windows Vista and above), configure “CLISMS.exe” to run in administrator mode.
    CLISMS-37

 

HOW TO USE CLISMS

  1. Open the Device Manager and look into the Ports. Then you will find your modem is connected in which port on “Prolific USB-to-Serial Comm Port”.
    CLISMS-02
  2. Open Right click on sms.bat. Then choose Edit
    CLISMS-03
  3. Then the notepad will display like this. Change the port, phone number and message with necessary. Save it.
    CLISMS-04
  4. Go back to your path file C:\Program Files (x86)\MOBITEK\CLISMS. Double click at sms.bat
    CLISMS-05
  5. Then it will apear on command line form. This will automatically closed once the transaction of sending SMS is done.
    CLISMS-06
  6. You can see the log file is generated on your path C:\Program Files (x86)\MOBITEK\CLISMS
    CLISMS-07
  7. You may click on the log to see the transaction.
  8. Now you can see the record is there.
    CLISMS-08
  9. The sending of SMS using the CLISMS is done.

 

LONG MESSAGE ON CLISMS VERSION 5.4.2

Long message text is supported on CLISMS version 5.4.2 which is can send more than 160 characters

  1. Right click on the sms.bat. The notepad will appear like this.
    CLISMS-09
  2. Change the port number, phone number and message. This message I used for 165 character to be send out as LMS. Save it and close.
    CLISMS-10

      1. If you send out the SMS/LMS to 1 number, the command should be like this:
        clisms /port=3 /to=01127171635 /msg=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA165 echo “sent”

      2. If you send out the SMS/LMS to 3 numbers, the command should be like this:
        clisms /port=3 /to=01127171635,0176096718,0125605167 /msg=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA165 echo “sent”

  3. Double click at sms.bat
    CLISMS-11

  4. It appear as a command line. It will automatically closed once it is done.
    CLISMS-12

  5. You can see the record generated on Log file
    CLISMS-13

 

COMMANDS

Commands can be executed through:

  • Windows command prompt

  • a software application that allows you to call CLISMS.EXE, and passing the parameters.

  • Java programme

    1. To send out SMS

     clisms.exe /port=2 /to=0162211600 /msg=Alert

  • port” is the COM port where the GSM modem is connected

  • to” is the mobile number of the recipient (one number only)

  • msg” is the SMS to be sent out (160 character limit, and in text format only)
    CLISMS-14

 

       2. To send 1 SMS to 3 numbers (maximum)

    clisms.exe /port=2 /to=0162211600,0128877111,0197878101 /msg=Alert

  • port” is the COM port where the GSM modem is connected

  • to” is the mobile number of the recipient, maximum 3 numbers only, number is separated by comma

  • msg” is the SMS to be sent out (160 character limit, and in text format only)

     

    3. To check credit balance of HOTLINK

     clisms.exe /port=2 /ussd=*122#

          4. To check credit balance of DIGI

     clisms.exe /port=2 /ussd=*126#

          5. To check credit balance of XPAX

     clisms.exe /port=2 /ussd=*124#

           6. To top-up credit of HOTLINK

     clisms.exe /port=2 /ussd=*111*14 digit PIN code#

           7. To top-up credit of DIGI

     clisms.exe /port=2 /ussd=*123*reload coupon serial number#

            8. To top-up credit of XPAX

     clisms.exe /port=2 /ussd=*122*16 digit reload code#

Responses for all the above commands will be logged in a text file called “Log.txt”. It is located at the same directory of “CLISMS.exe”.

 

SUITABLE SITUATIONS

CLISMS is suitable for use in the following situations:-

  1. when SI/SD wants to quickly enable their own software applications, or system to send out SMS alerts;

  2. to send SMS alert to administrator when server is down, virus is detected, or network intrusion (the network monitoring programme detects the server is down, and call CLISMS.exe);

  3. to send SMS alert when Windows service fails to run;

  4. to send SMS alert when UPS is running on battery, that is no power supply.

 

BENEFITS

The benefits to system integrator, and software developer in using CLISMS are:

  1. rapid development of a SMS Alert programme;

  2. can decide who should receive outgoing message, when to send, what to send;

  3. integrate SMS Alert function with existing software applications that support calling external programme;

  4. open source (VB6), SI/SD can modified CLISMS to incorporate business rules, and process flow.

 

CONFIGURING NETWORK MONITORING TOOL

This section will explain how to use CLISMS with a network monitoring tool such as PRTG Traffic Grapher (https://www.paessler.com/prtg). When PRTG detects an event, it will send out SMS via CLISMS.

  • Click on the Notifications.
    CLISMS-15
  • Click on the Mail to admin.
    CLISMS-16
  • Check the “Execute Program”. (DO NOT select the Send SMS/Pager Message check box)
  • In “Program file:”, enter “CLISMS”, or the location of the CLISMS.exe
  • In “Parameters:”, enter “/port=3 /to=0162211600 /msg=Alert”

Result: After configuration is done, when the sensor is triggered, a notification will be sent through SMS.

 

CONFIGURING WINDOWS SERVICE

CLISMS-17

At “First failure:”, select “Run a Program”.
At “Program:”, enter “C:\CLISMS.exe”
At “Command line parameters”, enter
“/port=1 /to=0122883030 /msg=Alert”

When MySQL service fails, a SMS alert will be send out to 0122883030 with message “Alert”.

 

 CONFIGURING UPS MONITORING TOOL

This section will guide you how to configure the UPS to send SMS alert when there is no power supply and UPS is running on battery.

Each UPS manufacturer provides their own UPS software. In this example, the UPS manufacturer is Power Kinetics , and the UPS model is BlackoutBusterTX (https://www.powerkinetics.com.my/blackoutseries.htm), refer to illustration 1.

The UPS software is “Powersoft TX version 1.12”, refer to illustration 2. The UPS software can be downloaded from http://jst.cc/download.html

The end result is like this – when there is no power supply, the UPS will run on battery and will shut down the PC in 5 minutes time. Then 4 minutes before shutting down PC, UPS will call CLISMS to send SMS alert to the hand phone number 0163311600 with message “UPS running on battery”.

CLISMS-20
Illustration 2: BlackoutBuster TX          Illustration 3: Powersoft TX version 1.12

 

First, configure Powersoft TX to shut down PC when running on battery:-
1. To configure Powersoft TX with CLISMS, click on “Settings > Configuration”.

2. At “Battery Low Shutdown”, select “Shutdown in (s)”, enter “180”. This means when there is no power and UPS running on battery until low lever battery, the UPS will shut down the PC in 3 minutes.

3. At “Battery Shutdown”, check “Enable System Shutdown”, and enter “5”. This means 5 minutes before battery runs dry, UPS will shut down the PC.

4. Click “OK” to save setting.

 

Next, configure the Powersoft TX to call CLISMS:-

1. Then click on “Tools > Special”.

2. Check “Enable Job #1”, enter “4”, then at “Path” select the file “sms.bat”.

3. Use text editor (notepad), copy the following and save as “sms.bat”:-

clisms /port=2 /to=0163311600 /msg=UPS running on battery!

echo “sent”

4. Click “OK” button to save setting.

The end result is like this: when there is no power supply, the UPS will run on battery and will shut down the PC in 5 minutes time. Then 4 minutes before shutting down PC, UPS will call CLISMS to send SMS alert to the hand phone number 0163311600 with message “UPS running on battery”.

llustration 5: Calling sms.bat

 

CONFIGURING UPSMAN

UPSMAN is a software written by GENEREX (www.generex.de). UPSMAN is a UPS management software. UPSMAN communicates with Unterinteruptible Power Supplies (UPS) and other devices via serial, USB or network interfaces in order to receive status information and measurement data.

Here is an illustration of configuring CLISMS with UPSMAN

Illustration 6: Click on “Advance User” then “Events” tab

CLISMS-26

Illustration 8: Click on “Insert”

CLISMS-25

Illustration 9: Double click on “Powerfail”

CLISMS-27

Illustration 10: Select “Execute Program”

CLISMS-28

Illustration 11: Click on “File”

CLISMS-29

Illustration 12: Select file “SMS.bat”

CLISMS-30

Illustration 13: “sms.bat” contains command and parameter for CLISMS.exe

CLISMS-31

Illustration 14: Click “OK”

CLISMS-32

Illustration 15: When there is the power failure, sms.bat will be executed, and SMS will be send out

 

CLISMS-38

sms.bat contains:-

clisms /port=2 /to=0162211600 /msg=Alert! Power failure!

echo “sent”

 

HOW TO TRIGGER SMS ALERT WHEN SERVER IS REBOOTED

SMS Alert can be triggered after the server is booted with the help of script. Script contain a list of instruction for a computer. By taking advantages of this we create a script which will send SMS to designed number. This Script contain a command on sending specific message to receiver via CLISMS application and it is set to run right after the server is successfully booted.

Instruction:-

1. Install “CLISMS.exe” located inside SMS Gateway Development Kit CD, manual for installing can be read inside the CD

2. Create a new notepad files copy and paste these code inside the notepad.

CLISMS-33

 

clisms.exe /port=1 /to=0123456789 /msg=server is booted.

echo “send”

* rename port number to the port number used by the GSM Modem

* rename the number to your own number

3. Save it inside the same folder of CLISMS ( default is C:\Program Files\MOBITEK\CLISMS )

CLISMS-34

*make sure the file name has “.bat” at the end ( exp: “SMS_Alert.bat” )

* make sure the file is save as type “All Files”

* Leave the encoding to ANSI

4. Copy the files and paste it as shortcut to startup folder.

* Window XP: “C:\Documents and Settings\%username%\Start Menu\Programs\Startup”

CLISMS-35

CLISMS-36

 

5. You’re done! Now every times the computer booted it will run the SMSAlert.bat which will send SMS Alert to your number.

 

TERMS AND CONDITIONS

  1. CLISMS must be used together with MOBITEK SMS Modem.

  2. MOBITEK System Sdn. Bhd. shall not be held liable for any loss or damaged as a result of using CLI SMS.

 

TERMS AND CONDITIONS OF SOURCE CODE

  1. You are allowed to use, modify, distribute, this VB.net code for free.

  2. This source code is provided on “as-is” basis. No warranty nor support is provided on the use of the code.

  3. BY USING THIS CODE, YOU ASSUME ALL THE RISK AND RESPONSIBILITY

  4. MOBITEK System Sdn. Bhd. EXPRESSLY DISCLAIMS ANY WARRANTIES

  5. MOBITEK System Sdn. Bhd. SHALL NOT BE LIABLE TO YOU OR ANYONE ELSE FOR ANY LOSS OR DAMAGES WHATSOEVER