|
1) How to send SMS using Aspicore SMS gateway? SQL examples.
To test sending SMS messages with SQL you can try AdeptSQL software (a free
30-day evaluation version is available via Internet) or using MSDE's own
osql-program.
You can find a more detailed document of using AdeptSQL from here in DOC format or
from here in PDF format,
if you decide to use that.
Some hints of using osql-program here
1. Open command prompt.
2. Type 'osql -E -e' and press enter
(parameters indicate that Windows Integrated security is
used to connect to database). If osql does not work in
the root directory, go to e.g. C:\MSSQL7\Binn\
directory first.
3. Type 'use GSMSGW' and press enter.
4. Type 'go' and press enter (go-command executes
previously given sql-clause).
5. Type "INSERT INTO SEND_QUEUE (TO_PHONE, MESSAGE) VALUES
('+358407335153', 'Test sending SMS')" and press enter.
6. Type 'go' and press enter. If SMS Gateway is running an
SMS message should be sent to given phone. Phone numbers
have to be in international format.
7. You can exit osql by typing 'exit'.
There is a PDF manual included in the evaluation version download. In the manual
you can see examples how to access the database from e.g. a Visual Basic program
or VB Script ASP pages by using ADO.
2) How to send SMS from a Visual Basic program?
Aspicore SMS Gateway uses a logical database called GSMSGW within MSSQL service.
You need to insert your text messages into the SEND_QUEUE table in the database GSMSGW.
You can do this from your application by executing an SQL "INSERT" statement as you execute any other MSSQL statements or queries.
Example (if you have an active connection to the database GSMSGW):
INSERT INTO SEND_QUEUE (USER_ID, TO_PHONE, MESSAGE) VALUES ('Demo App', '+358401234567', 'Sample Message')
Source code of a small VB 6 sample application is here.
Aspicore SMS Gateway takes care of sending the inserted message to the recipient
via the connected GSM phone. No connection to a SMSC is required.
You only need a compatible GSM phone, a data cable and a SIM card to the phone.
The SIM card must have the SMS service activated,
in some cases you need to make one voice call with a new SIM card before the SMS service gets activated.
3) How do I install SMS Gateway to use an existing SQL Server 7 database (or MSDE) that is located in another computer?
3.1) Choose custom setup intead of typical setup in the installation program. Uncheck MSDE component. Otherwise install normally.
3.2) When the setup program has finished, do not start Aspicore SMS Gateway yet. Go to folder C:\Program Files\Aspicore SMSGW\DB_Scripts\ (or the corresponding folder in your machine according to your setup). You should have a SQL script file named GSMSGW.sql in that folder. Run the script in the SQL server computer with osql.exe or with the Query Analyzer of the MS SQL Server.
3.3) Adjust the ConnectString in C:\Program Files\Aspicore SMSGW\Bin\GSMSGW.ini (or in the corresponding folder in your machine according to your setup). You should change the word "(local)" in the SERVER=(local) setting with the network name of the computer where your SQL database is running. E.g. SERVER=COMPANY_SERVER.
3.4) Now you can launch Aspicore SMS Gateway Interactive to finalize your configuration settings as described in the user's manual.
4) One of the following messages appears in the operating system's event log:
4.1) "Error: ProcessSendQueue: Problem polling database"
Action: Check that your SQL engine is running. (The service MSSQLServer status is "Started".)
Check ConnectString in C:\Program Files\Aspicore SMSGW\Bin\GSMSGW.ini. Run the database creation script GSMSGW.sql again, if necessary. (It deletes all old data from the database GSMSGW.)
4.2) "Error: PollSIM: Problem with phone SIM card polling"
or
"Error: Framing Error"
The phone cable has probably been disconnected.
Action: Check that the phone is powered up and the cable is connected.
If the Aspicore SMS Gateway is running as a service: Stop the SMSGW service and start it again e.g. with the SMS Service Manager.
If you are using Aspicore SMS Gateway Interactive: Exit the application and start it again. Ensure that the GSM Device connection has been activated.
5) Error message dialog box "Problem polling database. Check your database
connection and make sure that the SMSQLServer service is running." when
selecting "File...Connect GSM Device"
Possible cause: The standard Aspicore GSMSGW.ini
file assumes that your security settings in Microsoft SQL Server are as follows:
Authentication: "SQL Server and Windows"
If you are using the MSDE that was included in our package, there
should not be a problem. However, if you are using an existing Microsoft
SQL Server, you should check your security settings. Right click your SQL
server in the Enterprise Manager tree view. Choose Properties. Choose tab
"Security".
Action: If your setting is "Windows only", you need to
modify the ConnectString in GSMSGW.ini as follows:
BEFORE CHANGES:
ConnectString=DRIVER=SQL
Server; UID=SMS_GW; PWD=SMS_GW; DATABASE=GSMSGW;
APP=Global SMS Gateway; SERVER=(local)
AFTER CHANGES:
ConnectString=DRIVER=SQL
Server; UID=Administrator; Trusted_Connection=Yes; DATABASE=GSMSGW;
APP=Global SMS Gateway; SERVER=(local)
Change the word Administrator above to the
Windows user name, which you used for Windows login.
Or simpy delete the UID and PWD fields from the ConnectString
as follows:
ConnectString=DRIVER=SQL Server; DATABASE=GSMSGW;
APP=Global SMS Gateway; SERVER=(local)
6) "+CMS ERROR:28" or similar when trying to send SMS messages:
Action: Check your SMS Service Center number in the Aspicore SMS Gateway configuration.
7) Cannot receive SMS messages.
Action: Send one message first with the SIM card you are using for receiving. Sending one message may be necessary to activate the SMS service on your SIM card.
8) My evaluation software sends empty SMS messages.
Earlier evaluation versions used to add advertisement text starting with *Aspicore to every sent message.
Some GSM operators treat messages starting with an asterisk (*) in a special way,
which may cause the receiver to get an empty message.
Action: Download newer evaluation version.
Version 1.2.27 (28.3.2002) does not any more add an asterisk (*) to the beginning of the sent messages.
9) Cannot use infrared interface to connect the phone with Aspicore SMS Gateway.
For serious use we recommend a GSM phone with serial cable or a GSM modem with serial cable.
However, you can evaluate Aspicore SMS Gateway with a GSM phone, which only has an infrared interface.
To do this, you need drivers, which make your PC's infrared port to be seen as a virtual COM port.
This is a bit tricky in Windows 2000.
There are non-Microsoft Windows 2000 IrCOMM drivers around, which cause our
software to hang.
If your infrared port is not yet mapped as a virtual COM port, we recommend IrCOMM2k
from from Jan Kiszka for Windows 2000 and Windows XP. Alternative try: Microsoft Knowledge Base
Q252795.
10) Cannot connect to Nokia 5110 or Nokia 6110.
Have you got Nokia Data Suite 3.0 installed?
Make sure that you are using the correct COM port number in SMS Gateway
Settings. You can check, which is the correct COM port number as follows:
Open the Windows Control Panel. Double-click the System applet. Activate the
Hardware tab. Press the Device Manager button. Open the Modems node in the tree view.
Double-click Nokia GSM Data 3.0. Activate the Modem tab. Now you see the
COM port number, which Nokia Data Suite 3.0 is using for its virtual COM
port. E.g. "Port: COM3". You must use the same COM port number in
Aspicore SMS Gateway settings. You must not use directly the physical
COM port.
Make also sure, that neither the Hyperterminal nor any of the Nokia Data Suite 3.0 programs are
running, when you are using the Aspicore SMS Gateway.
11) Database polling stops with Nokia Data Suite.
Normally there is a blinking message "Database: Polling" in the status panel of SMS Gateway Interactive.
In the version 1.2.29 this message stops blinking in certain cases with Nokia phones and says instead: "Database: Not polling".
At the same time, a new message appears in the application event log. The end of the event message says:
"OnComm: GSM device was unplugged or power was switched off. Please check your GSM device."
This issue concerns you, if your version of AspicoreSMSGW.exe is 1.2.0.29 and you are using a Nokia phone or
especially Nokia Data Suite. The cause of the error is, that version 1.2.29 monitors the COM port handshake signals
trying to detect low battery or cable disconnection/reconnection situations. Especially Nokia Data Suite seems to generate
short peaks to the DSR handshake signal level causing SMS Gateway to stop database polling.
Action: Download newer evaluation version.
Version 1.2.30 (14.5.2002) does not halt database polling based on the handshake signal levels.
12) Example of using database triggers.
Here is an example of using triggers in SQL. This example simply sends an
autoreply message to the same GSM number from which it received an SMS containing the keyword 'TEST' in the beginning of the
message.
Aspicore SMS Gateway stores the incoming message first
to RECEIVE_QUEUE and then it copies the same information to
the RECEIVE_HISTORY table. The trigger should be created to
the RECEIVE_HISTORY table instead of RECEIVE_QUEUE, because otherwise the
trigger will interfere the copying process done by Aspicore SMS
Gateway.
Here is the script:
USE GSMSGW
GO
CREATE TRIGGER [TEST_TRIGGER] ON [RECEIVE_HISTORY]
FOR INSERT AS
IF EXISTS
(SELECT * FROM INSERTED
WHERE MESSAGE LIKE 'TEST%')
BEGIN
INSERT INTO SEND_QUEUE (USER_ID, TO_PHONE, MESSAGE)
SELECT
'AutoReply', INSERTED.FROM_PHONE,
'Thank you for using Aspicore SMS
Gateway.' FROM INSERTED
END
GO
Save this to a file and run it from command prompt with osql-program:
osql -E -e -i C:\temp\CreateTestTrigger.sql
The example is rather simple, but you'll get the idea of using triggers.
You can easily add e.g. some SELECT-clauses instead of the automated
autoreply 'Thank you for...'-message to fetch some data from other database
table and then send this data back with sms (you just have to make sure
that SMS_GW database user has all the necessary permissions to access these tables).
WARNING: If an error occurs in your trigger code, the database engine does automatically a rollback
for the whole enclosing transaction. This means, that the INSERT INTO RECEIVE_HISTORY statement,
which Aspicore SMS Gateway internally tries to execute, will be cancelled. Keep you trigger routine as simple and fail-safe as possible! A failure in the trigger code can affect
the normal operation of Aspicore SMS Gateway.
13) Error at the command line "AT+CMGF=1".
Symptoms:
When you press the "Test" button on the "GSM Settings" page, the modem replies with an error
to the command "AT+CMGF=1".
Cause:
The SMS Gateway uses "Text Mode" message format when it communicates with
the GSM modem.
You must use a GSM phone or modem supporting "Text mode" (According to the GSM
standard 07.05) to be able to successfully execute the "AT+CMGF=1" command.
Some GSM phones support only "PDU mode".
You can list the modes your phone supports by giving the command
"AT+CMGF=?" e.g. with HyperTerminal or with SMS Gateway menu option
File / Diagnostics.
The GSM modem replies with a list of supported modes.
The value 0 represents PDU mode and the value 1 text mode.
The list must contain the value 1, if the phone is going to be used with Aspicore SMS Gateway.
14) Aspicore SMS Gateway version history
You can find Aspicore SMS Gateway version history from here.
15) Aspicore SMS Gateway sends the same message over and over again
This is a known problem in version 1.2.33 and earlier, when something causes a primary key violation in the SEND_HISTORY table.
Symptoms:
Aspicore SMS Gateway isn't deleting the messages in the SEND_QUEUE table, and as a result,
it sends the same message over and over again until someone manually
deletes the message from the database.
Cause:
If there for some reason already exists a duplicate record with the same
ID in the SEND_HISTORY table, then the procedure within the gateway, which tries to delete
the already sent message from the SEND_QUEUE, might fail. (The procedure first tries to add the record into SEND_HISTORY and then delete it from
SEND_QUEUE.)
Solution:
Delete all the records from the SEND_HISTORY table.
16) Using Nokia 9210 Communicator
You must activate the Fax modem application behind the Extras button of Nokia
9210, before you can use the Communicator with Aspicore SMS Gateway.
We have used 9210 with the following settings in the 9210 Fax modem application:
Connection type: Cable 19200
Status: Active
Note, that status must be ACTIVE! (In the Fax modem main view, press
ACTIVATE button.) (There is an inactivity timeout of 20 minutes in the Nokia
9210 Fax modem activation.)
(Further settings in our Nokia Fax modem application:
8 data bits,
Operating system: Windows 2000 > No
Note, that we have Windows 2000
setting as NO in our Nokia 9210, although in fact our PC is running Windows
2000.)
17) Beware of the Slammer Worm
Aspicore SMS Gateway installs MSDE 1.0 into your computer by default.
This database engine is vulnerable to the very aggressively spreading W32.Slammer virus,
if you have a direct connection to the Internet and do not apply protective measures.
The Slammer virus does not destroy your data, but it blocks your network
with a denial of service attack and starts immediately spreading itself
to the neighboring unprotected systems. Luckily the virus can be removed
relatively easily.
To protect your system against worm attacks, it is highly recommended to use a firewall between your SMS Gateway computer and the Internet.
To isolate Slammer attacks, you should block incoming and outgoing UDP port 1434 packets at your firewall.
It is also recommended to install the security patch for Microsoft SQL Server 7.0 as instructed in
Microsoft Security Bulletin MS02-061. This patch makes the system
immune to the Slammer worm.
How to know, if a MSSQL system has been patched against the Slammer virus?
You can resolve, whether your system is up to date by executing the following
SQL statement:
SELECT @@VERSION
You can execute this e.g. either with the MS SQL Server Query
Analyzer or with the osql.exe utility. The latter is included with MSDE
1.0.
The MSSQL7 engine, which has been fixed with MS02-061 responds with version number 7.00.1077.
On the other hand, the SQL Server 2000 with SP3 (including Slammer protection) responds with version number 8.00.760.
More information about Slammer worm can be found at
PSS Security Response Team Alert - New Worm: W32.Slammer
You do not need to worry about Slammer even without any extra measures, if
- you are constantly disconnected from the Internet or if
- you are connected to a LAN,
which is properly protected by a firewall.
18) SMS Gateway stops receiving SMS messages.
Symptoms:
-
When started, SMS Gateway stores received SMS messages into the RECEIVE_QUEUE
table, as it should.
After the program has been running for some time, receiving stops working while sending
out messages still work.
You can resume the receiving function by giving command
"File"/"Disconnect GSM Device", turning the power off from your GSM device
and back on again and then giving command "File"/"Connect GSM Device"
- Occassionally SMS Gateway inserts AT commands into sent messages
Cause:
An SMS message has been received at the same time as another SMS message
was being sent. This occassionally caused lost messages or corrupted sent messages
with the default settings of version 1.2.33
and earlier.
If the value of the New Message Indication paramater <mode> in the GSM Settings tab
of the Settings window is 1, then the GSM device rejects received message, if it
is received exactly the same time while another message is being sent by the SMS Gateway.
Afterwards, the operator's SMSC starts buffering the subsequent received messages
and does not send them to your GSM device until you make
the "Disconnect" and "Connect" maneuver described above.
SMS Gateway version 1.2.33 and earlier had a bug, which in some rare cases caused
corruption of the message being sent, if another message was
received almost the same time.
Action:
Set the value of 2 to the New Message Indication paramater <mode> in the GSM Settings tab
of the Settings window. (You can also change this value by editing the file
GSMSGW.ini with a text editor like Notepad. Edit the row "Mode=1" to be "Mode=2".)
Check that your GSM device accepts the new value by observing the
Receive History window during the "Connect GSM Device" function.
The GSM device should answer OK to the
AT+CNMI command
Make note of your SMS Gateway registration info from the register menu.
Uninstall your current version.
Download version 1.2.44 or above from Aspicore web
site.
Install the new version and enter the same registration data as in the previous version.
19) Allowed COM port range.
If you cannot see your USB cellular modem COM port in the Aspicore SMS
Gateway communications settings drop-down list box,
check the COM port number from Windows Device Manager / Modems node,
double-click your cellular modem name, activate the Modem tab. If the
COM port number is greater than 16, try uninstalling your cellular modem driver
and reinstalling the driver so that the COM port number becomes between COM 1 and COM 16.
Only COM port numbers between 1 and 16 are supported by Aspicore SMS Gateway.
|