+ All Categories
Home > Documents > ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe...

® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe...

Date post: 16-Dec-2015
Category:
Upload: abner-mosley
View: 217 times
Download: 0 times
Share this document with a friend
Popular Tags:
16
® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas [email protected]
Transcript
Page 1: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

®

IBM Software Group

© 2005 IBM Corporation

Using JScript to Send a SMS with ITM v6By Philippe Thomas

[email protected]

Page 2: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

IBM Software Group | Tivoli software

2

Purpose

The purpose of this document is to describe how to send SMS when a situation fires in ITM 6 or OMEGAMON

This solution is based on :

Reflex Situation Action to generate a command

This command is a Jscript to send a SMS to someone

A local mobile phone or a GSM Modem (for example TC35 Siemens and SIM card) to send SMS

This solution gives you a complete operational example.

Page 3: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

IBM Software Group | Tivoli software

3

Hardware Architecture

Local GSM Phoneor SMS Modem

COM Port Communication

wire or Bluetooth …

Remote GSM Phone

SMS Provider

Page 4: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

IBM Software Group | Tivoli software

4

Hardware details

We recommend to use a specific SMS modem, SMS terminal or GSM telephone with a wired connection to the HUB TEMS system.

If you choose a GSM mobile phone : be sure that it includes a modem and supports Hayes AT commands for sending SMS.

For Siemens Cellular Engine TC35 Terminal, see : http://www.usbdeveloper.com/GSMModule/USBDeveloper.GSMmodule.html#GSM_MODULE_SPECIFICATIONS

The HUB TEMS system must have a serial COM port : This could be a physical serial port : RS232C wire

or a virtual COM port : in that case, the connection could be wireless, USB or Infrared …depending of the way to connect to the SMS modem.

Whatever modem you choose, you will need to have a SIM card and a provider.

Page 5: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

IBM Software Group | Tivoli software

5

Architecture flow

COM6

TEMS Server

Situation Reflex Action

Command Line

cscript sms.js /p:6 /t:069999999 /m:”My First Message”

AT+CMGS="0660994822"

OK

My First MESSAGE

+CMGS: 25

OK

Provider

Page 6: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

IBM Software Group | Tivoli software

6

What’s in the software package ?

The package is composed of :

SMS.JS : this is a JScript that sends a SMS to a mobile phone by using a local GSM modem or a local mobile phone.

This presentation.

You’ll need to download and install :

Visual Basic Express 2005 : We need to install Visual Basic to get the DLL to support the Serial Com Ports.

Page 7: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

IBM Software Group | Tivoli software

7

Installation stepsCheck prerequisites :

• Windows 2000 SP4 or XP SP1 or Windows 2003 server SP1

• a GSM modem or a local mobile phone (with an internal modem) using a serial port (RS232C) or emulating a serial port (Bluetooth,USB …)

• a SIM card and a provider

• Supporting SMS Hayes AT commands

Steps

1. Unzip the files into the TEMS directory (like c:\IBM\ITM\cms ) on the TEMS platform

2. Download and Install Visual Basic Express 2005 on the TEMS platform

3. Connect a local modem and get a serial com port number COMx

Page 8: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

IBM Software Group | Tivoli software

8

Installing Visual Basic 2005 Express Edition

Visual Basic 2005 Express Edition is a free solution that brings some DLLs to support Com Port.

To download :

http://msdn.microsoft.com/vstudio/express/vb/

During the installation, you don’t need to install any database but you’ll install the Microsoft .NET Framework version 2.

Page 9: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

IBM Software Group | Tivoli software

9

Obtaining a COM port number

If you have connected your modem thru a real COM port, you should easily know what is the COM port (it should normally be COM1 or COM2).

If you have used a USB wire, you should have installed some additional drivers and you should have been asked for a COM port.

For Infrared or Bluetooth, you should have installed some additional drivers and you should have been asked for a COM port.

In all cases, at this step, you must have a COM port number before to continue …

Page 10: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

IBM Software Group | Tivoli software

10

Using SMS.JS

To use a JScript program like a Windows command, you must use a command processor like CSCRIPT so that your program will be interpreted by the Jscript processor or VB.

The format is : cscript sms.js /p:port /t:phone /m:”message”

Where :– port is the number of your com port

– phone is the remote mobile telephone number you want to call

– message is the test you want to send

Example :

cscript sms.js /p:1 /t:0660994822 /m:“My First Message“

If you don’t want the version logo of cscript, just add //Nologo

Page 11: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

IBM Software Group | Tivoli software

11

Check that SMS.JS is working

Open a DOS windows and type the following command :

C:\IBM\ITM\cms> cscript sms.js /p:1 /t:0660994822 /m:“My First Message“

You should receive this :Microsoft (R) Windows Script Host Version 5.6Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.1/3/2007 21:53:17:484 --------------------------------------------------------------------- sms.js1/3/2007 21:53:17:484 Program - sms.js - 12/12/2006 - version 1.01/3/2007 21:53:17:500 Parameters - Port=1 Telephone=0660994822 Message=My First Message1/3/2007 21:53:18:31 Comm Port started on COM11/3/2007 21:53:20:62 --->ATE1/3/2007 21:53:20:78 OK1/3/2007 21:53:24:93 --->AT+CMEE=21/3/2007 21:53:24:109 OK1/3/2007 21:53:28:125 --->AT+CMGF=11/3/2007 21:53:28:125 OK1/3/2007 21:53:35:203 --->AT+CMGS="0660994822"1/3/2007 21:53:35:203 >1/3/2007 21:53:40:234 --->My First Message→1/3/2007 21:53:40:250 +CMGS: 181/3/2007 21:53:40:265 OK1/3/2007 21:53:40:328 Comm Port Closed1/3/2007 21:53:40:328 Exit 0

You should have received a SMS on your remote mobile phone

Page 12: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

IBM Software Group | Tivoli software

12

ATE : sets the echo to ON (ie you can then see the response from the modem. Expected answer is OK.

AT+CMEE=2 : sets the verbose option for all SMS commands for the modem. Expected answer is OK.

AT+CMGF=1 : activates the text mode (there is also the PDU mode – but not used in our case). Expected answer is OK.

AT+CMGS=telephonenumber : this is the first part of the command. It must end with the return key (crlf). It indicates the mobile remote telephone number. The expected answer is > that indicates you can enter your message text.

>This is my message text ctrz : this is the message text followed by the Control-Z key. The expected answer is OK.

Some modems are normally de facto in the echo mode (ATE) and verbose state (AT+CMEE=2). So, using these commands are not necessary (then you can avoid the time spent for these commands by deleting the corresponding paragraphs).

Notes about Hayes SMS commands

Page 13: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

IBM Software Group | Tivoli software

13

Troubleshooting Hayes SMS commands

If you want to troubleshoot communication problem between the SMS.JS and the COM port and the modem, we suggest to start the HyperTerminal and type the previous Hayes command in the terminal.

Use HyperTerminal which comes with Windows (Start->Accessories->Communications->HyperTerminal).  Connect directly to the COM port which you have connected to the GSM modem.

Select the baud rate to be 9600 bps (actually, the module will accept all the baud rate setting, any selection will work).  The other parameters are : Data Bits (8), Parity (None), Stop bits (1), Flow Control (None).

It could necessary to reboot the modem or phone before configuring.

Page 14: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

IBM Software Group | Tivoli software

14

Reading received SMS in the Modem

The user that received the SMS can reply and send back a SMS to acknowledge the alert.

To do so, SMS.JS includes a feature that can read messages in the local modem.

To activate this feature, you must edit the SMS.JS using notepad.

Then, at the beginning of the program, there is line saying :

WAIT=0

Modify to :

WAIT=60

If you specify 60, SMS.JS will wait 60 seconds and it will read the received SMS in the modem indicating that the alert is acknowledged.

Page 15: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

IBM Software Group | Tivoli software

15

Logging Hayes Commands

Automatic Logging is active.

A file called SMS.log is located in the same directory as SMS.JS

Page 16: ® IBM Software Group © 2005 IBM Corporation Using JScript to Send a SMS with ITM v6 By Philippe Thomas thomas1@fr.ibm.com.

IBM Software Group | Tivoli software

16

Define a situation with a take action

In the TEP or OMEGAMON Console, defined a new situation

Use low thresholds to check the success of the SMS

In the Take Action, use the following parameters

cscript sms.js /p:port /t:phone /m:”message”

You can follow the execution of the SMS.JS in the SMS.log If nothing happens in the SMS.log, this is because SMS.JS is not

located in the right directory (i.e. the CMS directory). Or the CMS directory is not C:\IBM\ITM\cms phonenumber should be one string representing the remote

phone number (i.e. 0660994822 or +33660994822)


Recommended