7ba3 SMS Gateway - AutoreplyDatabase user, Script file structure

                

Search the manual:

Overview Quick start Download Manual How to buy FAQ Contact Us
OZEKI NG SMS Gateway - Product Guide

Sample script file Contents | SearchAutoreply user

Home > Product Manual > Installation Guide > Users and applications > AutoreplyDatabase user > 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
  Database user
  AutoreplyDatabase user
  Installation guide
  Create database layout
  Sample script file
  Script file structure
  Autoreply user
  AutoReplyEasy user
  File user
  E-mail user
  HTTP Client user
  Colour SMS user
  Appstarter user
  SMS Voting
  Outlook Mobile Service
  FTP user
  PDF user
  WCF Client User
  Forwarder user
  Linux
  User Guide
  Developers Guide
  Examples and Solutions
  Appendix
  FAQ
  Feature list
  Commercial Information
  Search
 



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.


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

Webphone solutions:
- Adobe Flash video phone
- Silverlight video phone
- Web to web calls
- Web to VoIP calls

Custom SIP clients:
- Silverlight SIP VoIP client
- Flash SIP VoIP client
- C# .net SIP VoIP client
- ASP .net SIP VoIP client
- Web based SIP VoIP client

Custom VoIP solutions:
- VoIP SIP softphones
- VoIP call center clients
- VoIP IVR systems
- VoIP predictive dialer systems
- VoIP auto dialer systems
- VoIP call assistant
- VoIP call recording systems
- VoIP intercom solutions

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 user
Copyright © 2000 - 2013 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


0