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

Database Contents | SearchLeast Cost Routing

Home > Product Manual > Examples and Solutions > SMS Order System > ASP Script

SMS Gateway SMS Gateway Home

  Product Manual
  Introduction
  SMS technology
  Installation Guide
  User Guide
  Developers Guide
  Examples and Solutions
  Telephone networks
  SMS Pin game
  E-mail to SMS alert
  2 way SMS to Email gateway
  SMS Order System
  Database
  ASP Script
  Least Cost Routing
  SMS Load Balancing
  Asterisk PBX SMS
  SQL SMS Gateway
  SMS Service Provider
  Service Provider
  SMS PIN code query
  SMS Counter game
  SMS newsgroup
  Distributed SMS
  SMS Menu
  Google maps
  Forwarding
  Birthday greeting - SQL Express
  Birthday greeting - MySQL
  Birthday greeting - Oracle
  Instant brochure - MMS autoreply
  Alphabet letter game
  SMS sport betting service
  E-mail about outgoing SMS messages
  SMS Information Menu
  Email to SMS feature
  Reminder example
  Bulk SMS Client
  Bulk SMS to a given phone number range
  Filtering phone numbers
  Ozeki Phone Sytem PBX SMS
  Autoreply voucher example
  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.

Sample ASP script for SMS Order System

The following script is called by Ozeki NG when a new SMS message arrives. The script processes the text of the incoming SMS messages and creates an SQL INSERT statement that is used to place a record into the orders database table. This script is an attachment of the ASP SMS Order System case study.

Download: asp_sms_example_order_system.zip

The script should be saved into the following director:

C:\Program Files\Ozeki\OzekiNG - SMS Gateway\config\ordersystem\sample.aspx

<%@ Page Language="C#"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<%
//************************************************************
//Copy the properties of the incoming SMS into local variables
//************************************************************

string sender = Request.QueryString["sender"];
string receiver = Request.QueryString["receiver"];
string messagedata = Request.QueryString["messagedata"];
string messageid = Request.QueryString["messageid"];
string messagetype = Request.QueryString["messagetype"];
string senttime = Request.QueryString["senttime"];
string receivedtime = Request.QueryString["receivedtime"];
string serviceprovider = Request.QueryString["operatornames"];

//************************************************************
//Process incoming message
//example: "Order: Lipton 1 box, Nescafe 2 box, Sugar 10 kg";
//************************************************************
bool messageFormatOk = true;


string columnames = "";
string values = "";
string sql = "";
//messagedata = "Order: Lipton 1 box, Nescafe 2 box, Sugar 10 kg";

messagedata = messagedata.ToLower();
if (messagedata.StartsWith("order:")) messagedata = messagedata.Substring(6);
try
{
        string[] items = messagedata.Trim().Split(new char[] { ',', ';' });
        for (int x = 0; x < items.Length; x++)
        {
                string[] itementry = items[x].Trim().Split(new char[] { ' ' }, 2);
                string itemname = itementry[0];
                string itemquantity = itementry[1];

                if ((itemname == "lipton") || (itemname == "nescafe") || (itemname == "sugar"))
                {
                        if (columnames.Length > 0) columnames += ",";
                        columnames += itemname;
                        if (values.Length > 0) values += ",";
                        values += "'" + itemquantity + "'";
                }
                else
                {
                        //invalid item name
                        messageFormatOk = false;
                }
        }

        if ((columnames.Length > 0) && (messageFormatOk)) {
                sql = "INSERT INTO orders (shop,orderdate," + columnames + ") " +
                          "VALUES ('"+sender+"',getdate()," + values + ")";
        }
}
catch
{
        messageFormatOk = false;
}

//************************************************************
//Connect to the database and insert the record
//************************************************************
if (messageFormatOk)
{
        string sServer = ".\\SQLEXPRESS";
        string sUser="ozekiuser";
        string sPwd="ozekipass";
        string sDB="ozeki";
        string sConStr = "Server="+sServer+";User ID=" + sUser + ";"+
        "password=" + sPwd + ";Database=" + sDB        +";Persist Security Info=True";

        SqlConnection conn = new SqlConnection();
        conn.ConnectionString = sConStr;
        conn.Open();
        SqlCommand cmd = conn.CreateCommand();
        cmd.CommandText = sql;
        cmd.ExecuteNonQuery();
        conn.Close();
}

//************************************************************
//create the response message(s) in the following format:
//http://www.ozekisms.com/index.php?owpn=355
//************************************************************
string respmsg = "";
if (messageFormatOk) {
    respmsg = "Your order has been accepted at " + receivedtime;
} else {
    respmsg = "Invalid format. Please send you order again. Correct "+
    "format example: Lipton 1 box, Nescafe 2 box, Sugar 10 kg";
}

string destnum = sender;
string resptype = "SMS:TEXT";
string resp = "{"+resptype+"}{}{}{"+destnum+"}{"+respmsg+"}";

Response.Write(resp);

%>


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





Next page: Least Cost Routing
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