Ozeki NG SMS Gateway logo OZEKI NG SMS Gateway
"The World's most reliable SMS gateway software!"
info@ozekisms.com
Tel.: +36 1 371 0150
SMS Gateway to send SMS via GSM modem or IP SMS connection Overview SMS Gateway to send SMS via GSM modem or IP SMS connection SMS Gateway to send SMS via GSM modem or IP SMS connection Quick start SMS Gateway to send SMS via GSM modem or IP SMS connection SMS Gateway to send SMS via GSM modem or IP SMS connection Download SMS Gateway to send SMS via GSM modem or IP SMS connection SMS Gateway to send SMS via GSM modem or IP SMS connection Manual SMS Gateway to send SMS via GSM modem or IP SMS connection SMS Gateway to send SMS via GSM modem or IP SMS connection How to buy SMS Gateway to send SMS via GSM modem or IP SMS connection SMS Gateway to send SMS via GSM modem or IP SMS connection FAQ SMS Gateway to send SMS via GSM modem or IP SMS connection SMS Gateway to send SMS via GSM modem or IP SMS connection Contact Us SMS Gateway to send SMS via GSM modem or IP SMS connection
OZEKI NG SMS Gateway - Product Guide

Sample script file Contents | SearchAutoreply SMS using a script

Home > Product Manual > Installation Guide > Users and applications > Autoreply SMS from database > Script file structure

SMS Gateway SMS Gateway Home

  Product Manual
  Introduction
  SMS technology
  Installation Guide
  Prerequisites
  Download Information
  Installation Steps
  Service Provider Connections
  Users and applications
  Standard user
  SMPP user
  SMS from/to database
  Autoreply SMS from database
  Installation guide
  Create database layout
  Sample script file
  Script file structure
  Autoreply SMS using a script
  Simple autoreply SMS
  SMS from/to file
  SMS through E-mail
  SMS via HTTP Request
  SMS via colour protocol
  Application starter SMS
  SMS Voting
  SMS from MS Outlook
  SMS from/to FTP server
  PDF Request in SMS
  SMS to WCF service
  SMS Forwarder
  RSS to SMS
  Linux
  User Guide
  Developers Guide
  Examples and Solutions
  Appendix
  FAQ
  Feature list
  Commercial Information
  Search
  Cookie policy
 


Automated phone calls?
Ozeki Phone System XE VoIP PBX software is an advanced PBX built for automated voice calls and 2 way SMS messaging. It has outstanding APIs for software developers. It can be used for:

Phone calls from SQL
Phone calls from HTTP
Voice and SMS applications

Callcenter developers
If you are working on telephone solutions, please check out the Ozeki VoIP SIP SDK.
It can be used to create VoIP client and server software.

Contact Us!
If you wish to get further information, do not hesitate to contact us!

E-mail: info@ozekisms.com

If you have a technical question, please submit a support request on-line.

File structure for controlling SQL information query from database

This document explain the file structure of the script file that is used to control which SQL query is executed when an incoming SMS message arrives to the system.

Introduction

The script file contains sections. Sections are separated by an empty line. There is now limit for the number of sections. When the script is consulted sections are read sequentially. The first section that matches an incoming SMS is used to create the response SMS message.

A section contains a condition and a set of SQL commands called action (Figure 1). The condition is the first line in the section. Any number of SQL commands can follow this line. If the condition matches all the SQL commands following the condition will be executed until an empty line is found. The SQL commands can return one or more response messages.


Figure 1 - Sections in the script file


Condition

The condition is a single line statement. It has two parts the match target selector, and the match pattern (Figure 2). The match selector is a single letter, that determines which part of the incoming SMS message is checked with the matching pattern.



Figure 2 - Information query condition


The match selector letter can be one of the following:

k - keyword //The first word of the SMS message
converted to uppercase
n - sender telephone number
m - the message text

The match pattern is a standard regular expression. Regular expressions are explain in the Regular expressions tutorial.

Some examples:

.* - matches any letter
^abc.* - matches a text starting with abc
.*abc.* - matches a text that contains abc


Action

If the condition matches the incoming SMS message, the SQL commands in the section will be executed. You can use one ore more SQL SELECT statements to query the information for the response messages and you can use SQL INSERT, SQL UPDATE or any other SQL statement to modify the database. Before the SQL commands are executed on the database, the following words are replaced in them:

$originator - is replaced to the sender telephone number of the messages
$recipient - is replaced to the telephone number that received the
message
$messagedata - is replaced to the message text
$keyword - is replaced to the keyword in the message
$senttime - is replaced to the timestamp, that represents when the
message was sent
$receivedtime - is replaced to the timestamp, that represents when the
message was received
$messagetype - is replaced to the message type (in most cases this will
be SMS:TEXT)
$id - is replaced to the unique string identifier of the message
$operator - is replaced to the name of the service provider connection
that received the message


The SQL statements will be executed in the order they follow each other. Every SQL statement must be written on a single line.

(Hint: In most cases you will only use one SQL SELECT to get the content for the response SMS message.)

Response

When SELECT SQL statements are executed, they can return one or more response messages. A response message is a row in the result set of the SQL select. A row in the result set should contain the following columns:

recipient - The 1st column in the result set (Mandatory)
messageData - The 2nd column in the result set (Mandatory)
messageType - The 3rd column in the result set (Optional)
sender - The 4th column in the result set (Optional)
operatorNames - The 5th column in the result set (Optional)


The SMS gateway will process the returned results and will send them as SMS messages.

Example

The following is an example script that matches two keywords: RED and BLUE and handles unmatched incoming messages with a default response.

C:\Program Files\Ozeki\OzekiNG - SMS Gateway\config\TestApp\sqlscript.txt
k^RED
INSERT INTO  log (sender,message) VALUES ('$sender','$messagedata');
SELECT '$sender',msg FROM autoreplymessage WHERE keyword='red'

k^BLUE
SELECT '$sender',msg FROM autoreplymessage WHERE keyword='blue'

k.*
SELECT '$sender',msg FROM autoreplymessage WHERE keyword='default'

Dig deeper!
People who read this also read...





Next page: Autoreply SMS using a script
Copyright © 2000 - 2017 Ozeki Informatics Ltd.
All rights reserved

Software PBX for Windows | VoIP SDK   |   Legal information   |   Privacy policy   |   Terms of use
Please, address your inquiries to info@ozekisms.com