Content.asmx WebService




The formal description of the service referred to in this document is located here: http://smsc.sendega.com/Content.asmx?WSDL
All functions are called: http://smsc.sendega.com/Content.asmx/<Function name>?<Parameters>, or prefferably implemented as SOAP WebService

Table of contents
Send For sending misc. content (sms text, sms binary, mms...)
Parameters
Response
Error codes
RequestNumberEnquiry For requesting a number enquiry for a given msisdn (Only Norwegian numbers)
Parameters
Response
Error codes
SetOperator Sets operator for an msisdn manually
Parameters
Response
Error codes
 
Code examples
Send sms Examples to how to implement the Send function, and parse the response
.net Examples in both C# and VB
php Shows different methods, for different php versions
Ruby on Rails
 
Appendices
Misc. params Misc. params defined in GSM service
TON Type of Number
NPI Number Plan Indicator
Example messages / Message handling Misc. «special case» messages
VCARD Contact card, can be stored directly in phone list by recipient
VCALENDAR Calendar event, can be stored directly in calendar by recipient
Example DCS Some example of how to use DCS
Text encoding Some words about encoding, and a couple of character encoding lists
Basic GSM7 table
Extended GSM7 table
Dictionary
References
Document history

Send


This function in the WebService are used to send different kind of content, like sms text, sms binary and mms. To see how to implement an WebService to your system, see the Code examples chapter.

To see how to make a request to the Send function, see this link

Parameters

Parameter Description Parameter type Comment
username Chosen username for API access string
password Your password at Sendega string
sender Numeric or alphanumeric message sender string Numeric sender cannot be longer than 16 numbers and Alphanumeric sender cannot be longer than 11 characters.

TON and NPI is set automaticly by Sendega gateway. Contact Sendega if you need to override these parameters.
destination Destination msisdn string Multiple recipients can be separated with comma, but you will not receive any delivery report for sms to multiple recipients
pricegroup Pricegroup for current sms/mms. integer Set to 0 for bulk content or zero rated premium
contentTypeID 0 - Wap bookmark
1 - Sms Bulk
2 - Sms Premium / CPA
3 - MMS Bulk
4 - MMS Premium / CPA
integer Note: Type 2 premium sms with pricegroup 0 have a higher rate than Type 1 bulk, but may be delivered faster
contentHeader contentTypeID 0 - Url
contentTypeID 1/2 - Binary message header
contentTypeID 3/4 - Base64 encoded MMS data
string Mandatory for contentTypeID 0, 3 and 4
(and 1 when sending binary message)
content contentTypeID 0 - Bookmark text
contentTypeID 1/2 - Message text / Binary Message Body
contentTypeID 3/4 - Subject field
string See parameter: contentTypeID
dlrUrl Url to script at your side, that handles delivery reports. string If not applied, no dlr will be sent.
Ignored when sending to multiple recipients
ageLimit Used to indicate end-user age limit for premium services. integer If no ageLimit applies, or bulk sms; set to 0
extID Transparent ID, sent back when delivering dlr, if any dlr address is submitted string Ignored when sending to multiple recipients
sendDate Delivery time if message is not to be sent immediatly.
Format: yyyy-mm-ddTHH:mi:ss - or any valid sql timestamp
string Messages sent instantly should set this empty
refID Used for premium content to some countries. string See appendix
priority -1 - Low priority
 0 - Normal priority
 1 - High priority
integer Note: High priority messages have a higher rate
Messages to multiple recipients will always be set to priority -1.
Please use priority -1 for large bulks of commercial messages
gwID Specifies use of a specific gateway. integer Set to 0 for default gateway for MCC/MNC
pid Protocol ID of the message integer Set this to 0 if you're unsure of the use. Max value 255, min value 0
dcs Data Coding Scheme integer Set this to 0 if you're unsure of this parameter. E.g. set to 16 for flash sms in GSM7 alphabet. Max value 255, min value 0


IMPORTANT: Use of parameters pid/dcs at other values than 0 may affect the price of the sms, as this require that the sms is sent through an advanced gateway. These paramters can cause sms to not be delivered, or to be handled in unexptected ways by the mobile handset.

To read more about the dcs-parameter, please consult 3GPP TS 23.038 (Technical Specification Group Core Network and Terminals; Alphabets and language-specific Information)

For testing of MMS, this Base64 encoded string can be used: (Base 64 encoded string must be url encoded)
UEsDBBQAAAAAACto4TqxTLUe2xIAANsSAAAJAAAAaW1hZ2UuanBn/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAASUkqAAgAAAAEABoBBQABAAAAPgAAABsBBQABAAAARgAAACgBAwABAAAAAgAAADEBAgAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABAAAAUGFpbnQuTkVUIHYzLjM2AP/bAEMAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/bAEMBAQEBA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eIYCqyB8/fnwfPyL+x7/3H3z8e7xblOllXjdFtfzso93xzkdpvpxWs2J58dlH6/Z8++Cj3+PoN04eN4uipJ9p+nieZzP+jX4vs+tq3epf9HedXxCctJh99tHZIrvIP0rbavXZRwR0nhcX8/azj+7v/O4fpVfFrJ1Tbzv447ygj+fFbJYvP0rvRmG9yd+1Corff09gj+96eD6+awfweFLNrk2bVVa7vlvqMG3q6Wcf4bdxi+4FH4OMh2ixuJC2BYY8/unVhWusVHCYmG4e39XOH99l0v4/UEsBAhQAFAAAAAAAK2jhOrFMtR7bEgAA2xIAAAkAAAAAAAAAAQAgALaBAAAAAGltYWdlLmpwZ1BLAQIUABQAAAAAANlVkDtpyX43EAAAABAAAAAIAAAAAAAAAAEAIAC2gQITAAB0ZXh0LnR4dFBLAQIUABQAAAAIANlVkDskaYnILQEAAIwBAAAIAAAAAAAAAAEAIAC2gTgTAABtbXMuc21pbFBLBQYAAAAAAwADAKMAAACLFAAAAAA=

Response

Message id is a Guid - a hexadecimal number, e.g: 7fa588e7-6e24-4b32-931e-01136ed02f8a
<?xml version="1.0" encoding="iso-8859-1"?>
<SendResult xmlns="http://services.sendega.com/Content">
  <MessageID>guid</MessageID>
  <ErrorMessage>string</ErrorMessage>
  <ErrorNumber>int</ErrorNumber>
  <Success>boolean</Success>
</SendResult>

Error codes

Errorcode ErrorMessage Comment
1001 Not validated Username or password erroneous, or wrong IP if IP-lock is enabled
1003 Wrong format: WhenToSend Parameter WhenToSend was in an erroneous format
1004 Erroneous typeID typeID was not correct
1020 fromAlpha too long Max length for alphanumeric sender is 11 characters
1021 fromNumber too long Max length for numeric sender is 16 numbers
1022 Erroneous recipient, integer overflow Recipient is erroneous. Use type 'bigint' instead of 'int' in your mySql database
1023 No message content submitted messageText was empty for an content type that requires messageText parameter
1050 Message not delivered Error message is sent by delivery report if dlrUrl is set
1099 Internal error An internal error has occured. Error is logged. Contact Sendega if this error re-appears

Code examples - Send sms

.net

Add the Content service by following these steps:
  • Right-click at your project (not your solution) in server explorer
  • Choose "Add web reference..."
  • In the field "url" type http://smsc.sendega.com/Content.asmx?wsdl, and then press "go"
  • When service is found, enter into "Web reference name": "com.sendega.smsc"
  • Press "add reference"
You are now ready to use the web service from your code as following in C#:
string username = "myUsername";
string password = "myPassword";
string sender = "Sendega";
string destination = "4790222333";
int pricegroup = 0;
int contentTypeID = 1;
string contentHeader = "";
string content = "Hello world!";
string dlrUrl = "http://myserver.example/mydlrUrl.aspx";
int ageLImit = 0;
string extID = "";
string sendDate = "";
string refID = "";
int priority = 0;
int gwID = 0;
int pid = 0;
int dcs = 0;

com.Sendega.Content.SendResult serverResult;

com.sendega.Content content = new com.sendega.Content();
serverResult = content.Send(username, password, sender, destination, pricegroup, contentTypeID, contentHeader,
                       content, dlrUrl, ageLimit, extID, sendDate, refID, priority, gwID, pid, dcs);
Or in VB:
Dim username As String = "myUsername"
Dim password As String = "myPassword"
Dim sender As String = "Sendega"
Dim destination As String = "4790222333"
Dim pricegroup As Integer = 0
Dim contentTypeID As Integer = 1
Dim contentHeader As String = ""
Dim content As String = "Hello World!"
Dim dlrUrl As String = "http://myserver.example/myDlrUrl.aspx"
Dim ageLimit As Integer = 0
Dim extID As String = ""
Dim sendDate As String = ""
Dim refID As String = ""
Dim priority As Integer = 0
Dim gwID As Integer = 0
Dim pid As Integer = 0
Dim dcs As Integer = 0
Dim serverResult As com.Sendega.Content.SendResult

Dim content As New com.sendega.Content
serverResult = content.Send(username, password, sender, destination, pricegroup, contentTypeID, contentHeader,_
                       content, dlrUrl, ageLimit, extID, sendDate, refID, priority, gwID, pid, dcs)
For parsing of the response:
In C#:
if( serverResult.Success )
    Response.Write(string.Format("Message was sent. Id: {0}", serverResult.MessageID));
else
    Response.Write(string.Format("Message was not sent. Errornumber: {0}, Errormessage: {1}",
                                serverResult.ErrorNumber,
                                serverResult.ErrorMessage));
And in VB:
If serverResult.Success Then
    Response.Write(string.Format("Message was sent. Id: {0}", serverResult.MessageID))
Else
    Response Write("Message was not sent. Errornumber: {0}, Errormessage: {1}", _
                    serverResult.ErrorNumber, _
                    serverResult.ErrorMessage)
End If

php

Using SoapClient to send Content:
$params["username"]         = "myUsername";
$params["password"]         = "myPass";
$params["sender"]           = "Sendega";
$params["destination"]      = 4790222333;
$params["pricegroup"]       = 0;
$params["contentTypeID"]    = 1;
$params["contentHeader"]    = "";
$params["content"]          = urlencode("HelloWorld");
$params["dlrUrl"]           = urlencode("http://myserver.example/mydlrscript.php");
$params["ageLimit"]         = 0;
$params["extID"]            = "";
$params["sendDate"]         = "";
$params["refID"]            = "";
$params["priority"]         = 0;
$params["gwID"]             = 0;
$params["pid"]              = 0;
$params["dcs"]              = 0;


$content = new SoapClient(
                "http://smsc.sendega.com/Content.asmx?wsdl",
                array( 'trace'      => true,
                       'exceptions' => true,
                     )
                );
                
$response = $content->Send($params);
$serverResult = $response->SendResult;
Or by using http post/get by file_get_contents() (php 4.3.0 or newer):
$serverResult = @file_get_contents("http://services.sendega.com/Content.asmx/Send".
                                    "?username=myUsername".
                                    "&password=myPassword".
                                    "&sender=Sendega".
                                    "&destination=4790222333".
                                    "&priceGroup=0".
                                    "&contentTypeID=1".
                                    "&contentHeader=".
                                    "&content=".urlencode("Hello World!").
                                    "&dlrUrl=".urlencode("http://myserver.example/dlrurl.php").
                                    "&ageLimit=0".
                                    "&extID=".
                                    "&sendDate=".
                                    "&refID=".
                                    "&priority=0".
                                    "&gateway=0".
                                    "&pid=0".
                                    "&dcs=0");
For older versions of php, use fopen():
$url = "http://services.sendega.com/sendSMS.asmx/Send".
        "?username=myUsername".
        "&password=myPassword".
        "&sender=Sendega".
        "&destination=4790222333".
        "&priceGroup=0".
        "&contentTypeID=1".
        "&contentHeader=".
        "&content=".urlencode("Hello World!").
        "&dlrUrl=".urlencode("http://myserver.example/dlrurl.php").
        "&ageLimit=0".
        "&extID=".
        "&sendDate=".
        "&refID=".
        "&priority=0".
        "&gateway=0".
        "&pid=0".
        "&dcs=0";

$handle = fopen($url, "r");
$serverResult = '';

while (!feof($handle)) {
  $serverResult .= fread($handle, 8192);
}

fclose($handle);
For parsing of the response:
When using SOAP client:
if( $serverResult->Success )
    echo "Message was sent. Id: ".$serverResult->MessageID;
else
    echo "Message was not sent. Errornumber: ".$serverResult->ErrorNumber.", Errormessage: ".$serverResult->ErrorMessage;
Use simple_xml to parse response (php5 or newer):
$xmlDocument = simplexml_load_string($serverResult);

if( $xmlDocument->SendResult->Success == 'True' )
    echo "Message was sent. Message id: ".$xmlDocument->SendResult->MessageID;
else
    echo "Message was not sent. Errorcode: ".$xmlDocument->SendResult->ErrorNumber.", ErrorMessage: ".$xmlDocument->SendResult->ErrorMessage;
For older versions, use RegExp to parse response (Untested code):
preg_match('/\<Success\>(.+)\<\/Success\>/i', $serverResult, $success);
preg_match('/\<MessageID\>(.+)\<\/MessageID\>/i', $serverResult, $messageID);
preg_match('/\<ErrorNumber\>(.+)\<\/ErrorNumber\>/i', $serverResult, $errorNumber);
preg_match('/\<ErrorMessage\>(.+)\<\/ErrorMessage\>/i', $serverResult, $errorMessage);

if( $success == 'True' )
    echo "Message was sent, ID: ".$messageID;
else
    echo "Message eas not sent. Errorcode: ".$errorNumber.", Errormessage: ".$errorMessage;

Ruby on Rails

All examples of Ruby on Rails code are untested
require 'soap/wsdlDriver'
require 'uri'

wsdl_url = "http://smsc.sendega.com/Content.asmx?WSDL"
content = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver

result = content.Send(
  :username => 'myUsername',
  :password => 'myPassword',
  :sender => 'Sendega',
  :destination => '4790222333',
  :pricegroup => 0,
  :contentTypeID => 1,
  :contentHeader => '',
  :content => URI.escape('Hello world!'),
  :dlrUrl => URI.escape('http://myservicer.com/myDlrScript.ror'),
  :ageLimit => 0,
  :extID => '',
  :sendDate => '',
  :refID => '',
  :priority => 0,
  :gwID => 0,
  :pid => 0,
  :dcs => 0)
To parse result string
if result.Success == true
    print "Message was sent. ID: " + result.MessageID
else
    print "Message was not sent. Errorcode: " + result.ErrorNumber + ", Errormessage: " + result.ErrorMessage
end

Misc. parameters

In these chapter, some misc. parameters used by the GSM standard will be discussed.

TON (Type of Number)

TON is used, together with NPI to deifine the number type of a OA/DA. It's a numeric field with the following values:
TON Description
0 Unknown - The network has to figure out the format
1 International - International msisdn with leading country code
2 National - Msisdn without leading country code
3 Network specific - Not widely used
4 Subscriber number - Not used, and usually ignored
5 Alphanumeric
6 Abbreviated number
7 Reserved

NPI (Number Plan Indicator)

NPI is used, together with TON to define type of OA/DA.
NPI Description
0 Unknowsn - determined by operator - Most often this is used as default
1 ISDN (E.163/E.164) - telephone number - Some operators require this instead of 0
2 Reserved
3 Data (X.121)
4 Telex (F.69)
5 Reserved
6 Land mobile (E.212)
7 Reserved
8 National
9 Private
10 ERMES
11 Reserved
12 Reserved
13 Reserved
14 Internet (IP)
15 Reserved
16 Reserved
17 Reserved
18 WAP Client ID (not yet defined)

Example messages / message handling


In this chapter we will discuss some «special case» messages, and the use of e.g. DCS to format sent messages.

VCARD

The VCARD message is a standard format used by email clients, to send contact information, containing phone number, email address etc. The format for sending these messages to mobile phones is the same. At Sendega you can use refID 'vcard' (without apostrophe) to ensure these messages are sent correctly.

To send a vcard to a cell phone use the following format of the sms message text/content (sent as contentTypeID 1 or 2):
BEGIN:VCARD
VERSION:2.1
N:Smith;John
ORG:Sendega AS
TITLE:CEO
TEL;CELL;VOICE:4790222333
TEL;WORK;VOICE:4722685000
ADR;WORK;PREF:;;Karoline Kristiansens vei 2;Oslo;;0661;Norway
EMAIL;PREF;INTERNET:support@sendega.com
END:VCARD

VCALENDAR

The VCALENDAR is a standard format used by email and calendar clients, to send calendar events, containing description, start time, end time, etc. The format for sending these messages to mobile phones is the same. At Sendega you can use refID 'vcal' (without apostrophe) to ensure these messages are sent correctly.

To send a vcalendar event to a cell phone, use the following format of the sms message text/content (sent as contentTypeID 1 or 2):
BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
DESCRIPTION:Planning meeting
DTSTART:20091231T120000
DTEND:20091231T140000
END:VEVENT
BEGIN:VALARM
TRIGGER:-PT30M
REPEAT:2
DURATION:PT15M
ACTION:DISPLAY
DESCRIPTION:Remember planning meeting at 12pm!
END:VALARM
END:VCALENDAR

Example DCS

Note: If you want to use the advanced features of DCS you need to consult Sendega, when not every gateway supports advanced features.

The DCS parameter is a complex field, defined by a 35 pages document, the 3GPP TS 23.038 (Technical Specification Group Core Network and Terminals; Alphabets and language-specific Information). We'll here try to break it down a bit, and give a couple of examples of how to use this parameter. This will require a basic understanding of binary numbers.

The length of this parameter is 1 byte, that is 1 octet or 8 bits. Each od the bit (value 0 or 1) in this byte has its own meaning, and also defines how the rest of the bytes should be read. We number these bits from 0 to 7, starting from the right. The DCS parameter is devided into coding groups. e.g. when bit 7 and 6 is set to zero (00xxxxxx) the DCS coding group is called «General data coding indication», and this is the most used group, and this is used by default.

The special case of this group is when bit 7..0 is set to zero (0000 0000). This indicates a standard sms, handled normally, encoded in GSM7 standard alphabet. Another «commonly used» type of this class is when bit 4 is set to 1, indicating that bit 0..1 has a class meaning, and bit 0..1 both set to 0 (class 0) is commonly mentioned as a "flash message", which immideatly shows in the mobile phone's display when received. This feature is supported by most of the gateways. To send a message with class 0, encoded in GSM7, the dcs parameter should be set to 16 (bit 4 value 1).

A more «fun» group to look at is group «Message Marked for Automatic Deletion Group», which has bit 7..6 set to 01, and 5..0 follows the same pattern as «General Data Coding Indication». This means that message with DCS set to 64 is a message marked for deletion after read, encoded in GSM7 and sent as a «standard text message». This is an advanced feature, not supported by all gateways.

To mention one last group, we can take the group «Message Waiting Indication Group: Discard Message». These messages should be received by the ME (Mobile Equipment), a delivery status should be acked to the operator, but the ME should discard the content and not show this to the end user. This is mentioned as «silent sms» or «sms ping». This group is defined by bit 7..4 set to 1100, bits 3..0 is discarded. This means that the DCS parameter should be set to 192.

To read more about the DCS parameter, consult the documentation mentioned in the first paragraph. You can also contact Sendega if you have questions about this parameter. You should then ask for the author of this chapter, ref. Document history.

Text encoding


GSM7 is the 7 bit alphabet used by default in GSM sms messages. An sms message is 140 bytes long, and in order to send longer messages than 140 characters, there has been developed a 7 bit encoding set - called GSM7. This allows 160 characters to be sent, using only 140 bytes. But this alphabet is considerably reduced, and not all characters are supported. Some characters will also count as 2 bytes (See extended table).

When using our HTTP API, use the "ISO-8859-1 Latin1 Hexadecimal" values to encode your request (with leading %). E.g.: "support@sendega.com" should be encoded: "support%40sendega.com". Characters with green background in the list does not have to be encoded. Characters in red are not possible to send using HTTP API.

One sms is 160 characters (consider characters in extended table as two), for sms with length more than 160 characters each part of the concatinated sms message is 153 characters. This gives:

Number of sms Maximum number of characters
GSM7 Unicode
1 160 70
2 306 134
3 459 201

We advice against sending sms messages with a length of more than 459 characters, when this might not be supported by destination operator or mobile handset.

Binary encoded messages

Messages can be sent binary encoded, and in this way you can be sure that the encoding is received correct to the mobile handset, and no loss of information in the connection to our SMSC. The message then have to be submitted with separately defined user data header (UDH). The UDH is typically 6 octets long, and the content of the octets will be:

Octet # Description Example value
1 Length of UDH 05
2 Information Element Identifier 00
3 Length of the header, excluding the first two fields 03
4 Reference number, used to identify that the parts of the concatinated message belongs together CC
5 Total number of parts 02
6 This part's number 01

The header in this example (The header for the first of two concatinated messages) will be:
05 00 03 CC 02 01
For a message consisting of only one sms, you will not have to declare a UDH, but due to limitations in the Sendega SOAP/HTTP API you will not be able to submit binary messages without an UDH.

The text "Hello world!" would be encoded as following (according to GSM7 encoding table below):
48 65 6C 6C 6F 20 77 6F 72 6C 64 21
UDH is submitted in the field "ContentHeader", and message part is submitted as "Content" in Sendega SOAP API (Without space padding).

Unicode encoded messages

In order du send Unicode encoded sms messages the request has to be binary encoded before submitted to Sendega, and submitted to the SendUnicode Webservice method. Notice that one character in Unicode is 2 bytes, which means two hexadecimal values per character. A header consists of 12 semi-octets, which gives 6 octets, or 3 unicode characters.

The Unicode character set contains 65 536 different characters, and should be enough for everybody, compared to GSM7 which contains 128, and ISO-8859-1 which contains 256 characters. Please use the GSM7 alphabet when submitting to Send and SimpleSend webservice methods, when we cannot guarantee that messages with characters outside of the GSM7 alphabet is delivered correctly to the mobile handset, even if the character is contained in ISO-8859-1 or some of its extended tables. When sending messages contaning characters not in the GSM7 encoding table, please use SendUnicode function with binary encoded unicode character set.

The complete Unicode character list is to be found here (Copyright © 1991-2009 Unicode Inc.).

Basic GSM7 table

All characters in basic table is counted as one character

Character GSM 7-bit default alphabet
(Decimal)
GSM 7-bit default alphabet
(Hexadecimal)
ISO-8859-1 - Latin1
(Decimal)
ISO-8859-1 - Latin1
(Hexadecimal)
@ At sign 0 00 64 40
£ Pound sign 1 01 163 A3
$ Dollar sign 2 02 36 24
¥ Yuan/Yen sign 3 03 165 A5
è Small letter e with grave accent 4 04 232 E8
é Small letter e with acute accent 5 05 233 E9
ù Small letter u with grave accent 6 06 129 F9
ì Small letter i with grave accent 7 07 236 EC
ò Small letter o with grave accent 8 08 242 F2
Ç Capital letter C with cedilla 9 09 199 C7
<LF> Line feed 10 0A 10 0A
Ø Capital letter O with stroke 11 0B 216 D8
ø Small letter o with stroke 12 0C 248 F8
<CR> Carriage return 13 0D 13 0D
Å Capital letter A with ring 14 0E 197 C5
å Small letter a with ring 15 0F 229 E5
Δ Capital letter Greek delta 16 10
_ Underscore 17 11 95 5F
Φ Capital letter Greek phi 18 12
Γ Capital letter Greek gamma 19 13
Λ Capital letter Greek lambda 20 14
Ω Capital letter Greek omega 21 15
Π Capital letter Greek pi 22 16
Ψ Capital letter Greek psi 23 17
Σ Capital letter Greek sigma 24 18
Θ Capital letter Greek theta 25 19
Ξ Capital letter Greek xi 26 1A
<ESC> Escape 27 1B 27 1B
Æ Capital letter 28 1C 198 C6
æ Small letter 29 1D 230 E6
ß Small letter German eszett 30 1E 223 DF
É Capital letter E with acute accent 31 1F 201 C9
<SPACE> Space 32 20 32 20
! Exclamation mark 33 21 33 21
" Quotation mark 34 22 34 22
# Number sign 35 23 35 23
¤ Currency sign 36 24 164 A4
% Percent sign 37 25 37 25
& Ampersand 38 26 38 26
' Apostrophe 39 27 39 27
( Left paranthesis 40 28 40 28
) Right paranthesis 41 29 41 29
* Asterisk 42 2A 42 2A
+ Plus sign 43 2B 43 2B
, Comma 44 2C 44 2C
- Minus sign / hyphen 45 2D 45 2D
. Full stop / period 46 2E 46 2E
/ Slash 47 2F 47 2F
0 Digit zero 48 30 48 30
1 Digit one 49 31 49 31
2 Digit two 50 32 50 32
3 Digit three 51 33 51 33
4 Digit four 52 34 52 34
5 Digit five 53 35 53 35
6 Digit six 54 36 54 36
7 Digit seven 55 37 55 37
8 Digit eight 56 38 56 38
9 Digit nine 57 39 57 39
: Colon 58 3A 58 3A
; Semicolon 59 3B 59 3B
< Less-than sign 60 3C 60 3C
= Equals sign 61 3D 61 3D
> Greater-than sign 62 3E 62 3E
? Question mark 63 3F 63 3F
¡ Inverted exclamation mark 64 40 161 A1
A Capital letter A 65 41 65 41
B Capital letter B 66 42 66 42
C Capital letter C 67 43 67 43
D Capital letter D 68 44 68 44
E Capital letter E 69 45 69 45
F Capital letter F 70 46 70 46
G Capital letter G 71 47 71 47
H Capital letter H 72 48 72 48
I Capital letter I 73 49 73 49
J Capital letter J 74 4A 74 4A
K Capital letter K 75 4B 75 4B
L Capital letter L 76 4C 76 4C
M Capital letter M 77 4D 77 4D
N Capital letter N 78 4E 78 4E
O Capital letter O 79 4F 79 4F
P Capital letter P 80 50 80 50
Q Capital letter Q 81 51 81 51
R Capital letter R 82 52 82 52
S Capital letter S 83 53 83 53
T Capital letter T 84 54 84 54
U Capital letter U 85 55 85 55
V Capital letter V 86 56 86 56
W Capital letter W 87 57 87 57
X Capital letter X 88 58 88 58
Y Capital letter Y 89 59 89 59
Z Capital letter Z 90 5A 90 5A
Ä Capital letter A with diaeresis 91 5B 196 C4
Ö Capital letter O with diaeresis 92 5C 214 D6
Ñ Capital letter N with tilde 93 5D 209 D1
Ü Capital letter U with diaeresis 94 5E 220 DC
§ Section sign 95 5F 167 A7
¿ Inverted question mark 96 60 191 BF
a Small letter a 97 61 97 61
b Small letter b 98 62 98 62
c Small letter c 99 63 99 63
d Small letter d 100 64 100 64
e Small letter e 101 65 101 65
f Small letter f 102 66 102 66
g Small letter g 103 67 103 67
h Small letter h 104 68 104 68
i Small letter i 105 69 105 69
j Small letter j 106 6A 106 6A
k Small letter k 107 6B 107 6B
l Small letter l 108 6C 108 6C
m Small letter m 109 6D 109 6D
n Small letter n 110 6E 110 6E
o Small letter o 111 6F 111 6F
p Small letter p 112 70 112 70
q Small letter q 113 71 113 71
r Small letter r 114 72 114 72
s Small letter s 115 73 115 73
t Small letter t 116 74 116 74
u Small letter u 117 75 117 75
v Small letter v 118 76 118 76
w Small letter w 119 77 119 77
x Small letter x 120 78 120 78
y Small letter y 121 79 121 79
z Small letter z 122 7A 122 7A
ä Small letter a with diaeresis 123 7B 228 E4
ö Small letter o with diaeresis 124 7C 246 F6
ñ Small letter n with tilde 125 7D 241 F1
ü Small letter u with diaeresis 126 7E 252 FC
à Small letter a with grave accent 127 7F 224 E0

Extended GSM7 table

All characters in extended table is counted as two characters

Character GSM 7-bit default alphabet
(Decimal)
GSM 7-bit default alphabet
(Hexadecimal)
ISO-8859-1 - Latin1
(Decimal)
ISO-8859-1 - Latin1
(Hexadecimal)
<FF> Form feed 27 10 1B 0A 12 0C
^ Caret / circumflex 27 20 1B 14 94 5E
{ Left curly bracket 27 40 1B 28 123 7B
} Right curly bracket 27 47 1B 29 125 7D
\ Backslash 27 47 1B 2F 92 5C
[ Left square bracket 27 60 1B 3C 91 5B
~ Tilde 27 61 1B 3D 126 7E
] Right square bracket 27 62 1B 3E 93 5D
| Vertical bar / pipeline 27 64 1B 40 124 7C
Euro sign 27 101 1B 65 128 80

Dictionary

DA Destination Address Recipient number of sms. At Sendega parameter is called "destination"
DLR / DR Delivery Report A report from the mobile operator indicating the delivery status of an sms/mms message
Doublet 16 bits Also called plate, playte, chomp, chawmp (on a 32-bit machine). Describes the collection of 16 bits
GPRS General Packet Radio Service GPRS is defined by 3GPP (Third Generation Partnership Project) and is employed to connect mobile cellular users to PDN (Public Data Network). Within the GSM network it shares the network databases and radio access network and employs functions known as the PCU (Packet Control Unit), SGSN (Serving GPRS Support Node) and GGSN (Gateway GPRS Support Node) to provide packet switching data services across the fixed and radio network.

GPRS offers packet data bearers within 3G networks. The functions of the SGSN and GGSN are the same as those in the GSM network. The difference is the capability of the radio access network. The RNC (Radio Network Controller) supports RAB (Radio Access Bearer) that can support real time bearer services in the region of 100Kbps to 300Kbps. Furthermore, with the introduction of HSPA, this figure can approach 3Mbps.
GSM Global System for Mobile communications The most popular standard for mobile phones in the world. Its promoter, the GSM Association, estimates that 80% of the global mobile market uses the standard
HLR Home Location Register The Home Location Register is a database within the HPLMN - Containing information about every msisdn's home network (MCC/MNC). This is distributed to the relevant VLR or SGSN through the attach process and mobility management procedures such as Location Area and Routing Area updates.
HPLMN Home Public Land Mobile Network The Home Public Land Mobile Network identifies the PLMN in which the subscriber's profile is held
MCC Mobile Country Code A number uniquely identifying a country - used by sms services for routing purposes
MNC Mobile Network Code A number uniquely identifying a network within a country. The combination MCC/MNC uniquely identifies a network worldwide
MNO Mobile Network Operator A number uniquely identifying a mobile operator
MO Mobile Originated Content sent from a mobile handset. See SMS-MO
msisdn Mobile Subscriber Integrated Services Digital Network Number A number uniquely identifying a subscription in a GSM or UMTS/CDMA mobile network
MT Mobile Terminated Content sent to a mobile handset. See SMS-MT
MVNO Mobile Virtual Network Operator A number uniquely identifying a virtual mobile operator
NPI Number Plan Indicator Is used, together with TON, to define OA/DA type. See table
Nybble / Nibble 4 bits See Semi-octet
NRDB Nasjonal Referanse Database The Norwegian HPLMN and database for land line numbers. http://www.nrdb.no (Norwegian only)
OA Originating address The sender of the sms. In Sendega gateway parameter is called "sender"
Octet 8 bits Used to describe the collection of 8 bits
UDH User data header Header of binary encoded text messages
Sectet 7 bits Used to describe the collection of 7 bits - Used in the GSM7 alphabet, hex values from 00 to 7F
Semi-octet 4 bits Used to describe the collection of 4 bits (an half octet)
SGSN Serving GPRS Support Node The Serving GPRS Support Node keeps track of the location of an individual MS (Mobile Station) and performs security functions and access control. The SGSN also exists in a UMTS network, where it connects to the RNC (Radio Network Controller) over the Iu-PS interface.
SMPP Short Message Peer-to-Peer A standarized protocol for transmitting sms messages
SMS Short Message Service A standarized short message protocol for GSM / CDMA mobile networks
SMSC Short Message Service Center A network element in the mobile telephone network which handles SMS messages both SMS-MO and SMS-MT
SMS-MO Short Message Service - Mobile Originated An sms message sent from a mobile handset, to a SMSC
SMS-MT Short Message Service - Mobile Terminated An sms message sent to a mobile handset, from a SMSC
SMS Streaming Short Message Service Streaming message An sms message from a mobile handset to another mobile handset. Also used as a description of SMS-MT with a msisdn as message sender
SR Status Report See DLR/DR
TON Type of Number Is used, together with NPI, to define OA/DA type. See table
VLR Visitor Location Register The Visitor Location Register contains all subscriber data required for call handling and mobility management for mobile subscribers currently located in the area controlled by the VLR.
References
Document history
Date Change Author
2009-10-08 Document created Manfred Bjørlin
2009-10-13 Added chapter «Misc. parameters» - NPI and TON Manfred Bjørlin
2009-10-14 Added chapter «Example messages / message handling» - VCARD, VCALENDAR and DCS Manfred Bjørlin