Snippet 6: Sending Long Unicode SMS using ASP Specify the long unicode SMS message type by setting the SMSType property to longunicode.. routo.SetType"RingTone"; routo.SetModel"nokia";
Trang 1The information contained in this document is proprietary
and copyright and for the sole purpose of informing
customers about the above service The service is owned
by Routo Telecommunications Ltd, 2nd Floor, Kingsgate House,
115 High Holborn, London, WC1V 6JJ, United Kingdom.
HTTP SMS GATEWAY
User guide
Trang 2Preface:
Please register for SMS or MMS account for testing our messaging services and integration to our SMS, MMS APIs The following features and services are available:
• Straightforward, SMS API and MMS API integration:
• Free sample code on how to send and receive SMS
• Free sample code on how to send MMS
• Status and the real time delivery reports of the messages you have sent
• Free Support, manned and around the clock 24/7 to answer any questions
• Minimal SMS and MMS development time
• Deploy with confidence; we have over ten years of experience in Mobile Messaging Integration
Trang 3Table of contents:
1 CHANGE HISTORY 6
2 INTRODUCTION 7
3 EXAMPLE OF SENDING MESSAGES USING ASP 8
3.1 Example of Sending SMS basics using ASP 8
3.2 Sending SMS using form POST method ASP 9
3.3 Sending Long SMS using ASP 9
3.4 Sending Unicode SMS using ASP 10
3.5 Sending Long Unicode SMS using ASP 11
3.6 Sending operator logo using ASP 12
3.7 Sending ring tone using ASP 13
3.8 Sending WAP bookmark using ASP 13
4 EXAMPLE OF SENDING MESSAGES ASP.NET AND C# CLASS 14
4.1 Sending SMS basics using ASP.NET and C# class 14
4.2 Sending an SMS using a form on an aspx page 15
4.3 Sending Long SMS using form on aspx page 16
4.4 Sending Unicode SMS using C# 18
4.5 Sending a Long Unicode SMS using C# 19
4.6 Sending operator logo using C# 19
4.7 Sending ring tones using C# 20
4.8 Sending vCard using C# 20
4.9 Sending vCalendar using C# 21
4.10 Sending WAP bookmark using C# 22
5 EXAMPLE OF SENDING MESSAGES USING PERL 23
5.1 Sending SMS basics using Perl 23
5.2 Sending Long SMS using Perl 24
5.3 Sending Unicode SMS using Perl 24
5.4 Sending Long Unicode SMS using Perl 25
5.5 Sending operator logo using Perl 25
5.6 Sending ring tone using Perl 26
5.7 Sending vCard using Perl 26
5.8 Sending vCalendar using Perl 27
5.9 Sending messages (full example) using Perl 27
5.10 Sending WAP bookmark using Perl 30
6 EXAMPLE OF SENDING MESSAGES USING PHP 31
6.1 Sending SMS basics using PHP 31
6.2 Sending SMS using form POST method PHP 32
6.3 Sending Long SMS using form POST method PHP 33
6.4 Sending Unicode SMS using PHP 34
6.5 Sending Long Unicode SMS using PHP 34
6.6 Sending operator logo using PHP 35
6.7 Sending ring tones using PHP 36
6.8 Sending vCard using PHP 37
6.9 Sending vCalendar using PHP 37
6.10 Sending WAP bookmark using PHP 38
7 EXAMPLE OF SENDING SMS USING JAVA 39
7.1 Sending SMS basics using Java and jsp page 39
7.2 Sending SMS using form POST method 40
7.3 Sending Long SMS using form POST method 41
7.4 Sending Unicode SMS using Java class 42
7.5 Sending Long Unicode SMS using Java class 42
7.6 Sending operator logo using Java class 43
7.7 Sending ring tones using Java class 44
7.8 Sending vCard using Java 45
7.9 Sending vCalendar using Java 45
Trang 47.10 Sending WAP bookmark using Java 46
8 EXAMPLE OF SENDING MESSAGES VIA VB.NET CLASS 47
8.1 Sending SMS basics using VB.NET class 47
8.2 Sending an SMS using a Windows Form 47
8.3 Sending a Long Unicode SMS using VB.NET 48
8.4 Sending operator logo using VB.NET 48
8.5 Sending ring tones using VB.NET 49
8.6 Sending vCard using VB.NET 49
8.7 Sending vCalendar using VB.NET 50
8.8 Sending Wap Bookmark using VB.NET 50
9 ROUTOTELECOM ACTIVEX CONTROLS IN MS.NET PRODUCTS 51
10 APPENDIX A: SMS PARAMETER DESCRIPTION 53
11 APPENDIX B: REPLIES FROM OUR SMS GATEWAY 54
12 APPENDIX C: SMS HANDSET DELIVERY REPORTS 55
13 APPENDIX D: UNICODE SMS AND INTERNATIONAL CHARACTERS 57
14 APPENDIX E: SMS BINARY MESSAGES 58
List of code snippets: Snippet 1: Example of Sending SMS basics using ASP 8
Snippet 2: Index.html 9
Snippet 3: sendsms.asp 9
Snippet 4: Sending Long SMS using ASP 10
Snippet 5: Sending Unicode SMS using ASP 10
Snippet 6: Sending Long Unicode SMS using ASP 11
Snippet 7: Sending operator logo using ASP 12
Snippet 8: Sending ring tone using ASP 13
Snippet 9: Sending WAP bookmark using ASP 13
Snippet 10: Sending SMS basics using ASP.NET and C# class 14
Snippet 11: index.aspx 15
Snippet 12: Example of the code which is sent 15
Snippet 13: sendsms.aspx 16
Snippet 14: sendsms.aspx.cs 16
Snippet 15: index.aspx 17
Snippet 16: Example of the executed code 17
Snippet 17: the aspx file 17
Snippet 18: sendsms.aspx.cs file 17
Snippet 19: sendsms.aspx.cs 18
Snippet 20: sendsms.aspx.cs 19
Snippet 21: Operator logo C# Example 20
Snippet 22: C# example for the ring tone 20
Snippet 23: C# vCard example 21
Snippet 24: C# vCalendar example 21
Snippet 25: C# WAP bookmark example 22
Snippet 26: Sending SMS basics using Perl 23
Snippet 27: Sending Long SMS using Perl 24
Snippet 28: Sending Unicode SMS using Perl 24
Snippet 29: Sending Long Unicode SMS using Perl 25
Snippet 30: Sending operator logo using Perl 26
Snippet 31: Sending ring tone using Perl 26
Snippet 32: Sending vCard using Perl 26
Snippet 33: Sending vCalendar using Perl 27
Snippet 34: sms.html 28
Snippet 35: testSMS.cgi 29
Snippet 36: Sending WAP bookmark using Perl 30
Snippet 37: Sending SMS basics using PHP 31
Snippet 38: index.html 32
Snippet 39: sendsms.php 33
Snippet 40: index.html 33
Trang 5Snippet 41: sendsms.php 33
Snippet 42: sendsms.php 34
Snippet 43: Sending SMS basics using Java and jsp page 39
Snippet 44: Index html file 40
Snippet 45: sendsms.jsp 41
Snippet 46: index.html 41
Snippet 47: sendsms.jsp 41
Snippet 48: Sending Unicode SMS using Java class 42
Snippet 49: Sending Long Unicode SMS using Java class 43
Snippet 50: Sending operator logo using Java class 44
Snippet 51: Sending ring tones using Java class 44
Snippet 52: Sending vCard using Java 45
Snippet 53: Sending vCalendar using Java 46
Snippet 54: WAP boomark Java example 46
Snippet 55: Sending SMS basics using VB.NET class 47
Snippet 56: Form1.vb 48
Snippet 57: VB.NET SMS 48
Snippet 58: VB.NET Long Unicode 48
Snippet 59: VB.NET Operator logo 49
Snippet 60: VB.NET Ring Tones 49
Snippet 61: VB.NET vCards 49
Snippet 62: VB.NET vCalendar 50
Snippet 63: VB.NET Wap Bookmark 50
Snippet 64: A simple example of sending the plain text sms by using the DLL 52
Snippet 65: Appendix D: Unicode SMS and international characters 57
Snippet 66: Encoded 58
Snippet 67: URL encoded 58
List of tables: Table 1: Change history 6
Table 2: RoutoMessaging SMS methods 14
Table 3: RoutoMessaging SMS methods 32
Table 4: Parameters description 51
Table 5: Appendix A: SMS parameter description 53
Table 6: Replies from RoutoMessaging SMS gateway 54
Table 7: Supported statuses 56
Trang 61 Change History
Date Changes Section
Table 1: Change history
Trang 7For more details or examples not included in this user guide please contact us through email at
support@routotelecom.com or live chat available at www.routomessaging.com
RoutoMessaging provides the following two servers for sending messages through HTTP protocol:
• an SMS account with RoutoMessaging
• available messaging credit on the SMS account with RoutoMessaging
Note: The servers are not limited to any platforms/languages In this document we have provided
typical examples for connecting to our SMS gateway and sending text messages using ASP, PHP, Perl and JAVA scripting languages in order to get you started
Trang 83 Example of Sending messages using ASP
This section provides an explanation on how to send ASP programmed RoutoTelecom.Sender
server object which is available for download as RoutoTelecom DLL source or RoutoTelecom DLL
at: https://www.routomessaging.com/cust/
Since this is a server component, the customers will only be able to send SMS messages using
ASP with RoutoTelecom.Sender server object registered on their servers
3.1 Example of Sending SMS basics using ASP
The following snippet demonstrates sending SMS basics using ASP
Snippet 1: Example of Sending SMS basics using ASP
The SMS object is created in the first line of the code
set Sms = Server.CreateObject("RoutoTelecom.Sender")
All other required properties are set in the subsequent lines of this example allowing the message
to be sent
Further available information:
Parameters description is explained in section 9 (Appendix A)
The SMS replies which the customer can receive from our SMS gateway are specified in
section 11 (Appendix B)
Detailed explanation of the delivery reports can be found in section 12 (Appendix C)
Trang 93.2 Sending SMS using form POST method ASP
This section will demonstrate sending an SMS message by using an HTML form You need to
create two files
The first file is index.html which implements the HTML form the users will use to input the phone
number and message
The second file is the sendsms.asp script which sends your SMS using the RoutoMessaging
component
<html>
<body>
<form action='sendsms.asp' method='post'>
Number: <input type='text' name='number'><br>
Message: <input type='text' name='message'><br>
<input type='submit' value='Send SMS'>
3.3 Sending Long SMS using ASP
The following snippet demonstrates sending of Long SMS by using ASP
Trang 10SmsResult = Sms.Send
Response.Write SmsResult
set Sms = Nothing
%
Snippet 4: Sending Long SMS using ASP
Specify long SMS message by setting the SMSType property to LongSMS The length of the
single SMS message is 160 characters A long SMS message is considered to be message longer
than 160 characters
In case of a long SMS message, our system will automatically divide it into several single
messages The divided messages then will be sent and delivered to the recipient’s phone as a
single SMS
3.4 Sending Unicode SMS using ASP
The following snippet demonstrates sending Unicode SMS by using ASP
Snippet 5: Sending Unicode SMS using ASP
Specify the unicode SMS message type by setting the SMSType property to unicode In case of
Unicode type, the message will be 70 characters long and 2 bytes will be allocated for each
character
Trang 113.5 Sending Long Unicode SMS using ASP
The following snippet demonstrates sending of the Long Unicode SMS by using ASP
Snippet 6: Sending Long Unicode SMS using ASP
Specify the long unicode SMS message type by setting the SMSType property to longunicode
Long Unicode SMS message is a message consisting of over 70 characters
In case of a long Unicode SMS, one message will be divided into several messages (70 characters
per message) and delivered to the recipient's phone as a single unicode SMS TheLong unicode
SMS message can consist of a maximum of 4 parts/messages
Trang 123.6 Sending operator logo using ASP
The RoutoMessaging SMS service allows you to send operator logos The following are the image
requirements:
dimensions:
o width: 72 pixels
o height: 14 pixels
format: grayscale GIF
Below is the operator logo ASP Example:
Snippet 7: Sending operator logo using ASP
As you may see, the MIME encode is required for the GIF image You can use the
GetFileMIMEEncoded method of the SMS object, or a third party component
The operator code needs to be specified, by using the Operator property In addition, you should
specify SMSType as OperatorLogo
For full list of Operator Codes please contact our support team: live 24/7 on our Web Site or Email
at support@routotelecom.com
Trang 133.7 Sending ring tone using ASP
The RoutoMessaging SMS service allows you to send ring tones in the RTTTL format, which can
be sent to all supported mobile phones Below is the ASP example for the ring tone
Snippet 8: Sending ring tone using ASP
You can specify the manufacturer of the recipient phone by setting the MobileModel property The
SMSType property should be set as RingTone
3.8 Sending WAP bookmark using ASP
To send a WAP bookmark you need to set the message type parameter to bookmark and format
the message as follows:
Trang 144 Example of Sending messages ASP.net and C# class
This section of the document will describe sending SMS by using the ASP.net and C# class
4.1 Sending SMS basics using ASP.NET and C# class
This section will describe sending SMS basics using ASP.NET and C# class Below is the snippet
with a simple ASP.NET example
protected void Page_Load(object sender, EventArgs e)
{
Snippet 10: Sending SMS basics using ASP.NET and C# class
The first step is taking the number and the message from the index.aspx page The second step is
creating routo object from the RoutoSMSTelecom class
After these two initial steps all other required properties should be set allowing the message to be
sent This is done by using the following RoutoMessaging SMS methods:
method Description type
SetNumber(value) number to which the
message will be sent
mandatory
SetOwnNum(value) number that will appear in
message header on the recipient's mobile device
optional
SetMessage(value) message body mandatory
SetType(value) type of message to send
Set to SMS by default
optional
SetOp(value) mobile operator code mandatory for
operator logos only
SetModel(value) used when sending 8-bit
messages to specify the manufacturer of the recipient's phone Set to
nokia by default
optional
Table 2: RoutoMessaging SMS methods
Trang 15Further available information
Parameters description is explained in section 8 (Appendix A)
The SMS replies which the customer can receive from our SMS gateway are specified in
section 11 (Appendix B)
Detailed explanation of the delivery reports can be found in section 12 (Appendix C)
4.2 Sending an SMS using a form on an aspx page
This example will demonstrate how you can send an SMS message which is entered in an HTML
form You will need to create two files
The first one is index.aspx which implements the HTML form for where the users will input the
destination phone number and the message
<%@ Page Language="C#" AutoEventWireup="true"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Routo</title>
<asp:Button ID="Button1" runat="server"
Snippet 12: Example of the code which is sent
The demonstrated code will send the number and the message to sendsms.aspx The second file
is the aspx script which sends your SMS using the RoutoMessaging component
<%@ Page Language="C#" AutoEventWireup="true"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Trang 16<head runat="server">
<title>Routo</title>
</head>
<body>
<form id="form1" runat="server">
<div id="sms" runat="server">
The C# code for this page is in the sendsms.aspx.cs file
public partial class sendsms : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
4.3 Sending Long SMS using form on aspx page
The example in this section will demonstrate how you can send a Long SMS message which is
entered in a HTML form You will need to create two files
The first one is index.aspx which implements the HTML form where the users will input the
destination phone number and message
<%@ Page Language="C#" AutoEventWireup="true"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Routo</title>
Message: <asp:TextBox
ID="txtMessage" runat="server"></asp:TextBox>
<br />
Trang 17<br />
<asp:Button ID="Button1" runat="server"
Snippet 16: Example of the executed code
This code sends the number and the message to the sendsms.aspx The second file is the aspx
script which sends your Long SMS using the RoutoMessaging component
<%@ Page Language="C#" AutoEventWireup="true"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Routo</title>
</head>
<body>
<form id="form1" runat="server">
<div id="sms" runat="server">
</div>
</form>
</body>
</html>
Snippet 17: the aspx file
The C# code for this page is located in the sendsms.aspx.cs file
protected void Page_Load(object sender, EventArgs e)
{
Trang 18Specify the long SMS message by setting the Type property to LongSMS The length of the single
SMS message is 160 characters so any message longer than 160 characters is considered as long
message
In case of a long SMS message, our system will automatically divide the message to several single
messages The divided messages will then be sent to the recipient and delivered as a single SMS
4.4 Sending Unicode SMS using C#
The example below demonstrates how you can send Unicode messages You will need to create
such file which is the class that sends the unicode message using the RoutoMessaging
component
Here we can see the Unicode SMS C# example:
public partial class sendsms : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Specify the Unicode SMS message by setting the Type property to “unicode” The Unicode
message is 70 characters long and 2 bytes are allocated for each character
Trang 194.5 Sending a Long Unicode SMS using C#
This example will demonstrate how you can send the Long Unicode messages You need to create
file like the example presented below
This is the class which sends long unicode message using the RoutoMessaging component
public partial class sendsms : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Specify the Long Unicode SMS message by setting the Type property to longunicode A Long
Unicode SMS message is a message with the length of over 70 characters
In case of a long Unicode type, one SMS message is divided into several messages (70 characters
per message) and delivered to the recipient's phone as a single unicode SMS
Note: the Long unicode SMS message can consist of maximum 4 parts/messages
4.6 Sending operator logo using C#
The RoutoMessaging SMS service allows you to send operator logos The following are the image
requirements:
dimensions:
o width: 72 pixels
o height: 14 pixels
format: grayscale GIF
Below is the operator logo C# Example:
public partial class sendsms : System.Web.UI.Page
Trang 20Snippet 21: Operator logo C# Example
It is required that you specify the operator code for the network, by using SetOp, as well as set the
type to Operator Logo
routo.SetOp("0263");
routo.SetType("OperatorLogo");
4.7 Sending ring tones using C#
The RoutoMessaging SMS service allows you to send ring tones in the RTTTL format which can be
sent to all supported mobile phones Below is the C# example for the ring tone
public partial class sendsms : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Snippet 22: C# example for the ring tone
Specify the make/manufacturer of the target phone by using the SetModel() method In addition,
you need to specify Ring Tone as the message type
routo.SetType("RingTone");
routo.SetModel("nokia");
4.8 Sending vCard using C#
In order to send vCards you need to use the correct SMS type (vCard) and the following message
format:
Below is the C# vCard example:
public partial class sendsms : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Trang 21RoutoSMSTelecom routo = new RoutoSMSTelecom();
routo.SetUser("your_username");
routo.SetNumber("44791212121212");
routo.SetType("vCard");
sms.InnerText = header;
}
}
Snippet 23: C# vCard example
4.9 Sending vCalendar using C#
In order to send a vCalendar you need to use the correct SMS type (vCalendar) and the following
message format:
DESCRIPTION:<description>\r\nDTSTART:<start date>\r\nDTEND:<end date>
The start date and end date have to be in the following format:
Below is the C# vCalendar example
public partial class sendsms : System.Web.UI.Page
Trang 224.10 Sending WAP bookmark using C#
In order to send a WAP bookmark you need to set message type to bookmark and use the
following format for the message:
Below is the C# WAP bookmark example:
public partial class sendsms : System.Web.UI.Page
Trang 235 Example of Sending messages using Perl
This section of the document will describe sending text messages by using the Perl programming
language
5.1 Sending SMS basics using Perl
In order to send an SMS to RoutoMessaging SMS gateway, you will need to make a GET or POST
HTTP request
There are several Perl modules which you can use – examples here will be given with
LWP::UserAgent used LWP::UserAgent which is a part of standard Perl distribution
Below is the the simple Perl example:
Snippet 26: Sending SMS basics using Perl
Further available information:
Parameters description is explained in section 9 (Appendix A)
The SMS replies which the customer can receive from our SMS gateway are specified in
section 11 (Appendix B)
Detailed explanation of the delivery reports can be found in section 12 (Appendix C)
Trang 245.2 Sending Long SMS using Perl
The snippet below demonstrates sending of the long SMS by using Perl
Snippet 27: Sending Long SMS using Perl
Specify the Long SMS message by setting the type property to LongSMS The length of the single
SMS message is 160 characters, so any message longer than 160 characters will be considered a
Long message
In case of a Long SMS message, our system will automatically divide that message to several
single messages The divided messages then will be sent to the recipient and delivered as a single
SMS
5.3 Sending Unicode SMS using Perl
The snippet below demonstrates the method for sending a Unicode SMS by using Perl
Snippet 28: Sending Unicode SMS using Perl
Specify unicode SMS message by setting the type property to unicode In case of Unicode the
message is 70 characters long and 2 bytes are allocated for each character
Trang 255.4 Sending Long Unicode SMS using Perl
The example below demonstrates the method for sending long Unicode messages by using Perl
Snippet 29: Sending Long Unicode SMS using Perl
Specify long unicode SMS message by setting the type property to longunicode A Long Unicode
SMS message is a message with the length of over 70 characters
In case of a long Unicode type, one SMS message is divided into several messages (70 characters
per message) and delivered to the recipient's phone as a single unicode SMS
Note: the Long unicode SMS message can consist of maximum 4 parts/messages
5.5 Sending operator logo using Perl
The RoutoMessaging SMS service allows you to send operator logos The following are the image
requirements:
dimensions:
o width: 72 pixels
o height: 14 pixels
format: grayscale GIF
You need to specify the operator code for the network by using the op parameter as well as the
message type which should be set to OperatorLogo
For full list of Operator Codes please contact our support team: live 24/7 on our Web Site or email
at support@routotelecom.com
Below is the operator logo Perl example:
open(F, "<".$ARGV[0]) or die($!);
Trang 26Snippet 30: Sending operator logo using Perl
5.6 Sending ring tone using Perl
The RoutoMessaging SMS service allows you to send ring tones in the RTTTL format which can be
sent to all supported mobile phones
Specify the make/manufacturer of the target phone by using the model parameter and set the type
parameter to RingTone
Below is the Perl example for the ring tone:
# Ring Tone in RTTTL format
Snippet 31: Sending ring tone using Perl
5.7 Sending vCard using Perl
In order to send a vCard entry, you should to use the corresponding SMS type (vCard) and the
following message format:
Trang 275.8 Sending vCalendar using Perl
In order to send a vCalendar entry, you need to use the corresponding SMS type (vCalendar) and
the following message format:
DESCRIPTION:<description>\nDTSTART:<start date>\nDTEND:<end date>
Start date and end date have to be in this format:
Snippet 33: Sending vCalendar using Perl
5.9 Sending messages (full example) using Perl
The following are the html page and perl script which you can use to send SMS messages,
operator logos or ring tones
Trang 28<h1>Send operator logo</h1>
<form action="/cgi-bin/testSMS.cgi" method="POST"
<h1>Send ring tone</h1>
<form action="/cgi-bin/testSMS.cgi" method="POST">
<input type="hidden" name="type" value="RingTone">
type="text" name="message" size="50"><br/>
<small>Ring Tone in RTTTL format</small>
Trang 29print "Own number you entered is not an number.";
die "Own number you entered is not an number.";