Jernas Solutions

Download Report

Transcript Jernas Solutions

Jernas Solutions
Ozeki NG SMS Gateway: Development
Overview
Presented by: Milen Nikolov
Manager, Products & Services
A subsidiary of International Development Company [IDC] http://www.idcuae.com
The Big Picture
OzekiNG SMS Gateway
Queue
Service Provider/SMSC
API
Adaptors
Encapsulator
SMTP/POP3
HTTP
methods
Applications
C++,C#,ASP,PHP,
AJAX, …
SQL queries
E-mail
Servers
Databases
Sendmail,
Qmail, MS
Exchange, etc
TEXT Files
Oracle, MSSQL,
Sybase, Postgre,
MySQL, etc
Users and Applications
User Type
Description
Standard user
User account for accessing the OzekiNG management interface
or for sending/receiving SMS messages using the built-in web
interface
E-mail user
Automated user, implementing two-way SMS/E-mail gateway
service using POP3 and SMTP
Autoreply user
A user for automatic reply and message routing based on sender
address or message content
SMPP user
This user account enables other devices to connect to the
OzekiNG, turning the software into a SMSC
Database user
A user account that periodically polls a database for
incoming/outgoing messages
File user
A user account that processes text files as means for sending
and receiving messages
HTTP Client user
A translator, converting mobile communication into HTTP GET
and HTTP POST methods.
OzekiNG and Databases
• Send and receive messages using SQL queries
– Supports a variety of databases
• MS SQL, Sybase, Oracle [ADO/OLEDB]; MySQL, Postgre [ODBC]
• And almost anything that does ADO and ODBC
OzekiNG + Databases Quickstart
• Requirements
– Two database tables: ozekimessageout and
ozekimessagein
– A database user account and a connector [ODBC or ADO]
Create the
database tables
and a user account
for accessing them
[SQL Server]
Install and
configure the
database user
account [OzekiNG]
Setup logging and
configure log
behavior
Incoming Messages: Table Fields
Field
Description
Example
id
This distinguishes incoming messages from each
other. Every id has to be different.
This is the phone number of the sender of the
message.
1, 2, 3, ...
sender
receiver
This is the phone number of the recipient of the
message.
msg
This is the text of the message.
+36441234567,
06459876543
+36441234567,
06459876543
This is a message text.
senttime
This is the time of sending the message.
2007-04-23 10:02:13
receivedtime
This is the time of receiving the message.
2007-04-23 10:02:13
operator
This denotes which service provider connection was
used to receive the message.
This denotes the type of the message.
Vodafone1
msgtype
SMS:TEXT,
SMS:WAPPUSH, ...
Outgoing Messages: Table Fields
Column name
Description
Example
id
This distinguishes outgoing messages from each other.
Every id has to be different
1, 2, 3, ...
sender
This is the phone number of the sender of the message
+36441234567, 06459876543
receiver
This is the phone number of the recipient of the message
+36441234567, 06459876543
msg
This is the text of the message
This is a message text.
senttime
This is the time of sending the message
2007-04-23 10:02:13
receivedtime
This is the time of receiving the message
2007-04-23 10:02:13
operator
This denotes which service provider connection is to be
used to send out the message. The default is ANY
ANY; Vodafone1
msgtype
This denotes the type of the message, default SMS:TEXT
SMS:TEXT, SMS:WAPPUSH, …
status
This denotes the status of the message.
send, sending, sent, notsent,
delivered, undelivered
Message Status Field
Status
Description
send
The message has been inserted into the database table
(ozekimessageout), but not yet processed by Ozeki NG. This is the status
to be specified when inserting a new message.
sending
The message has been processed by Ozeki NG, and inserted into the
Database user's Outbox folder, where it is waiting to be sent out.
sent
The message has been sent out to the SMS Center of a specified service
provider, which has accepted the message for delivery.
notsent
The message has not been sent out to the SMS Center of a specified
service provider. Some error has caused the sending to fail.
delivered
The specified service provider has reported that the message has been
delivered to the recipient.
undelivered
The specified service provider has reported that the delivery of the
message to the recipient has failed.
Status Update Process Flow
Creating OzekiNG Tables
• CREATE TABLE
ozekimessagein (
id int IDENTITY (1,1),
sender varchar(30),
receiver varchar(30),
msg varchar(160),
senttime varchar(100),
receivedtime varchar(100),
operator varchar(30),
msgtype varchar(30),
reference varchar(30),
);
• CREATE TABLE
ozekimessageout (
id int IDENTITY (1,1),
sender varchar(30),
receiver varchar(30),
msg varchar(160),
senttime varchar(100),
receivedtime varchar(100),
operator varchar(100),
msgtype varchar(30),
reference varchar(30),
status varchar(30),
errormsg varchar(250)
);
You can optionally create an index in the database for the 'id' field of the outgoing
SMS table to support SQL updates.
Creating a Database User
Creating a Database User
Configuring the Connector
Configure Logging
Monitoring Events
Sending a Message
• insert into ozekimessageout (receiver,msg,status)
values ("+97150XXXXXXX","Hello world","Send");
SMS Scheduled Sending
Add a field to the database
• alter table ozekimessageout add column scheduledtime
Configure the database user to poll the field
• Open "SQL for Sending" tab of the SQL user configuration form
and changing the "Polling" query to add “and
scheduledtime>now()”
USING THE HTTP API
How to send SMS messages using ASP,ASP .NET, C# and other languages
HTTP API: The Idea
OzekiNG SMS Gateway
Service Provider/SMSC
Queue
Encapsulator
WWW
Server
Application
HTTP POST
C++,C#,ASP,PHP,
AJAX, …
http://127.0.0.1:9501/ozeki?action=SendMessage&username=user&password=pass&
recipient=050XXXXXXX&messageData=hello
HTTP Fields
Parameter
Description
Values
Example
action
Mandatory field, specifying
the API command
sendMessage
action=sendMessage
originator
Optional field. Specifies the
sender identity/number,
URL encoded
An alphanumeric sender
address, or telephone
number. Encoded in UTF8
originator=%2B362011122
22
recipient
Mandatory field, specifying
the recipient phone
number. Must be URL
encoded
Comma separated
telephone numbers in local
or international number
format
recipient=%2B3620123456
7
messageType
Optional field, defining the
type of SMS message
There are more than 20
possible message types
messageType=SMS:TEXT
messageData
Specifies the text or the
data of the SMS message.
Mandatory
The value must be encoded
in UTF8 and must be URL
encoded
messageData=Hello+World
_charset_
Specifies the charset of the
encoded data (if not
specified UTF-8 will be
assumed). Optional.
utf-8
windows-1250
iso-8859-1
iso-8859-2
_charset_=iso-8859-2
serviceProvider
The name of the service
provider connection to use
Must match the string
from the configuration
serviceProvider=Etisalat
Using HTTP Forms to Send SMS
<form action="http://127.0.0.1:9501/ozeki" method="GET">
<input type="hidden" name="_charset_">
<input type="hidden" name="action" value='sendMessage'>
<input type="hidden" name="username" value=“yourusername">
<input type="hidden" name="password" value=“yourpassword">
<input type="hidden" name="messageType" value='SMS:TEXT'>
<table> <tr><td>Recipient</td>
<td><input type="text" name="recepient"></td></tr>
<tr><td>Message</td>
<td><textarea name="messageData" rows=5 cols=40></textarea></td></tr>
<tr><td> </td>
<td><input type="submit" value=" OK "></td></tr> </table>
</form>
ASP? “S” is for “Simplicity”
<%
Dim strMsg
Dim strReceiver
Dim strUrl
' Retrieve the posted items from the HTTP-SMS GW
strUrl = http://localhost:9501/ozeki?
strRequest = "username=youruser";
strRequest = strRequest+"&password=p4$$wd";
strRequest = strRequest+"&action=sendMessage";
strRequest =
strRequest+"&messageType=SMS:TEXT";
strRequest =
strRequest+"&recipient="+Server.URLEncode("+971
50XXXXXXX");
strRequest =
strRequest+"&messageData="+Server.URLEncode("
Hello World");
strUrl = strUrl+strRequest;
'Create InternetExplorer
Dim WebBrowser: Set WebBrowser =
CreateObject("InternetExplorer.Application")
WebBrowser.Navigate strUrl
Do While WebBrowser.busy
Loop
WebBrowser.Quit
'Display message info to the user
Response.Write("The message has been
sent . " + chr(13))
%>
Q&A
• Can we send the same message to multiple phone
numbers?
– Comma separated list of the phone numbers to be used, i.e.
string smsRecipients = HttpUtility.UrlEncode (“+971050XXXX,+97150YYYY");
• Is it possible to run the code on a different server?
– Certainly, simply set the correct URL and port number of
the OzekiNG server in your application.
– WARNING! Security measures have to be in place – ACL,
firewalling, strong passwords, VPN.
• Can we change sender identity?
– Required: IP SMS connectivity, service provider-set Sender
ID
– Use the “originator” field in the API, i.e. string smsOriginator =
HttpUtility.UrlEncode(“Dental Clinic");
Other Languages and Methods
• Developers’ Guide at
http://www.ozekisms.com
– ASP.NET, C#, PHP, AJAX, SQL
– Examples and source code
– Sending and receiving SMS
– Different types of messages
– Application ports for J2ME
developers
THANK YOU
For more information:
Milen Nikolov, [email protected]
+971 50 6823400 or +971 2 6418533