SMS Service XML Interface

Printer Friendly Version

 
  Last Updated: 18/12/2008

Contents


Abbreviations and Terms


 

Element

XML structural construct. An XML element consists of a start tag, an end tag, and the information between the tags, which is often referred to as the contents. Each element has a type, identified by name, sometimes called its “generic identifier” (GI), and may have a set of attribute specifications. Each attribute specification has a name and a value. An instance of an element is declared using <element> tags.

HTML

Hypertext Markup Language

Processing Instruction

Information contained in an XML structure that is intended to be interpreted by a specific application.

XML

Extended Markup Language. A subset of SGML that is optimized for delivery over the Web, XML provides a uniform method for describing and exchanging structured data that is independent of applications or vendors. At the time of this writing, XML 1.0 is a Worldwide Web Consortium Recommendation, which means that it is in the final stage of the approval process.

XML Document

A document object that is well formed, according to the XML recommendation, and that might (or might not) be valid. The XML document has a logical structure (composed of declarations, elements, comments, character references, and processing instructions) and a physical structure (composed of entities, starting with the root, or document entity).

XML Parser

A software module used to read XML documents and provide access to their content and structure. The XML parser generates a hierarchically structured tree, then hands off data to viewers and other applications for processing, and finally returns the results to the browser. A validating XML parser also checks the XML syntax and reports errors.

xxxxxx It is a display wildcard used as placeholder to indicate a required input value, such as user name, password, telephone number, etc, or as a user-specific output value (return value), such as credits balance. When used as input value you should replace it with the proper value.
 

Introduction


The XML interface is designed for supporting non-Windows systems or Web Services on sending SMS Messages. The following features are included:

  • Simple SMS
  • Flashing SMS
  • Blinking SMS
  • Picture SMS
  • WAP Push SMS
  • Multiple SMS (Bulk SMS)
  • Delivery notifications
  • Alphanumeric originator
  • Ringtones
  • VCards
  • Balance check
  • Pre-send Credits Cost Calculation
  • Supported Network Operators

Overview:

  1. Create an XML Document according to the specifications set by this document.
  2. Use XML HTTP POST to transmit this document to our servers (below) synchronously (Various examples of HTTP POST can be found here).
  3. Examine for success or failure by reading the XML Response of our servers.

Servers:

  • https://www.mobilefx.com/web/sms.asp            (Secure ASP Processor)
  • http://sms.mobilefx.com                                         (Primary)
  • http://sms1.mobilefx.com                                       (Backup 1)
  • http://sms2.mobilefx.com                                       (Backup 2)

Secure Servers:

https://www.mobilefx.com/web/sms.asp
https://www.mobilefx.com/web/system/proc_sms.asp

XML Encoding


The XML declaration is a processing instruction (PI) that identifies the document as being XML and sets the encoding of the document. In order be able to send SMS messages with both English ASCII or Unicode characters, all XML documents you create and transmit to our servers must be encoded in UTF8 and begin with the following XML declaration:

<?xml version="1.0" encoding="utf-8"?>

If a request does not contain exactly this declaration, it may be refused.

<?xml version="1.0" encoding="UTF-8" ?>

<!-- 
    mobileFX XML Document for describing various kinds of SMS Messages.
    This XML is just sample for introducing the XML elements involved.
    In real-life, only one Message Kind at a time is valid.
    Depending on the message kind (Text/Picture/Ringtone/etc..)
    several elements are required and others can be omitted.
    Have a look on Message Kinds and MessageDataType topic below for detailed information.
 -->

<REQUEST version='1.0.0' username='xxxxxx' password='xxxxxx' method='send'>
    <MESSAGES>

        <SMS MessageKind='SMS_MESSAGE_KIND' 
             MessageDataType='SMS_MESSAGE_DATA' 
             MessageEffects='SMS_EFFECTS' 
             MessageReplaceIndex='SMS_REPLACE_MESSAGE_INDEX' 
             TrackID='' 
             DeferredDeliveryTime='' 
             LifeTime='0' 
             TimeZone='0' 
             XSer=''
	    Pesonalized='0|1'>

            <URL_BUFFERED><![CDATA[URL_BUFFERED]]></URL_BUFFERED>
            <URL_DELIVERED><![CDATA[URL_DELIVERED]]></URL_DELIVERED>
            <URL_NOT_DELIVERED><![CDATA[URL_NOT_DELIVERED]]></URL_NOT_DELIVERED>

            <ORIGINATOR><![CDATA[Your Name]]></ORIGINATOR>

            <!-- Required for Text SMS Messages -->
            <DATA><![CDATA[Hello World!]]></DATA>

            <!-- Required for Ringtone Messages -->
            <DATA><![CDATA[Hex-Coded Binary Data String]]></DATA>

            <!-- Required for Picture SMS Messages only -->
            <DATA><![CDATA[Hello World!]]></DATA>
            <PIC><![CDATA[Hex-Coded Binary Data String]]></PIC>

            <!-- Required for VCard SMS Messages only -->
            <VNAME><![CDATA[Jack Nickelson]]></VNAME>
            <VNUM><![CDATA[+0441273770932]]></VNUM>

            <!-- Required for WAP Push SMS Messages only -->
            <WAP_CAP><![CDATA[Download this Game!]]></WAP_CAP>
            <WAP_URL><![CDATA[http://wap.mobilefx.com/web/cms.asp?gameid=435465]]></WAP_URL>

            <RECIPIENTS>
                <R number='+xxxxxx'/>
                <R number='+xxxxxx'/>
                ...
                <R number='+xxxxxx'/>
            </RECIPIENTS>

        </SMS>
    </MESSAGES>
</REQUEST>


Single Part and Multi Part Text SMS Messages


(Edited: 03/01/2008)

The Short Message Service - Point to Point (SMS-PP) is defined in GSM recommendation 03.40. GSM 03.41 defines the Short Message Service - Cell Broadcast (SMS-CB) which allows messages (advertising, public information, etc.) to be broadcast to all mobile users in a specified geographical area. Messages are sent to a Short Message Service Centre (SMSC) which provides a store-and-forward mechanism. It attempts to send messages to their recipients. If a recipient is not reachable, the SMSC queues the message for later retry. Some SMSCs also provide a "forward and forget" option where transmission is tried only once. Both Mobile Terminated (MT), for messages sent to a mobile handset, and Mobile Originating (MO), for those that are sent from the mobile handset, operations are supported. Message delivery is best effort, so there are no guarantees that a message will actually be delivered to its recipient and delay or complete loss of a message is not uncommon, particularly when sending between networks. Users may choose to request delivery reports, which can provide positive confirmation that the message has reached the intended recipient.

Transmission of short messages between the SMSC and the handset is done using the Mobile Application Part (MAP) of the SS7 protocol. Messages are sent with the MAP mo- and mt-ForwardSM operations, whose payload length is limited by the constraints of the signaling protocol to precisely 140 octets (140 octets = 140 * 8 bits = 1120 bits). Short messages can be encoded using a variety of alphabets: the default GSM 7-bit alphabet (shown below ETSI GSM Specification 03.41 V7.4.0 (2000-09)), the 8-bit data alphabet, and the 16-bit UTF-16/UCS-2 alphabet. Depending on which alphabet the subscriber has configured in the handset, this leads to the maximum individual Short Message sizes of 160 7-bit characters, 140 8-bit characters, or 70 16-bit characters. Support of the GSM 7-bit alphabet is mandatory for GSM handsets and network elements, but characters in languages such as Arabic, Chinese, Korean, Japanese or Slavic languages (e.g. Russian) must be encoded using the 16-bit UCS-2 character encoding. Routing data and other metadata is additional to the payload size.

Larger content (known as Long SMS, Concatenated SMS, Multipart or Segmented SMS) can be sent using multiple messages, in which case each message will start with a user data header (UDH) containing segmentation information. Since UDH is inside the payload, the number of characters per segment is lower: 153 for 7-bit encoding, 134 for 8-bit encoding and 67 for 16-bit encoding. The receiving handset is then responsible for reassembling the message and presenting it to the user as one long message. While the standard theoretically permits up to 255 segments, 6 to 8 segment messages are the practical maximum, and long messages are often billed as equivalent to multiple SMS messages.

Sending Text Messages using mobileFX SMS Services

  • An SMS can be either Single Part or Multi Part depending on the number of characters it contains and character encoding (GSM 03.38 / Unicode).

  • Single Part SMS can have up to 160 GSM characters or up to 70 Unicode characters.

  • Multipart SMS Messages can have up to 9 parts, each 153 GSM characters long; thus 1377 characters long.

  • Text SMS Messages are automatically converted to GSM-encoded messages (if possible) by replacing Unicode characters with GSM equivalent characters.

  • SMS messages with Greek capital characters are treated as standard GSM encoded messages and can have up to 1377 characters. No support has been added for Greek lower-case characters as several well-known mobile devices can not display them properly or older SMSCs cannot handle them.

The GSM 03.38 Default Character Set
Dec   0 16 32 48 64 80 96 112
  Hex 0 10 20 30 40 50 60 70
0 0 @ Δ SP 0 ΅ P p
1 1 £ _ ! 1 A Q a q
2 2 $ Φ " 2 B R b r
3 3 ¥ Γ # 3 C S c s
4 4 θ Λ ¤ 4 D T d t
5 5 ι Ω % 5 E U e u
6 6 ω Π & 6 F V f v
7 7 μ Ψ ' 7 G W g w
8 8 ς Σ ( 8 H X h x
9 9 Η Θ ) 9 I Y i y
10 A LF Ξ * : J Z j z
11 B Ψ <ESC> + ; K Δ k δ
12 C ψ Ζ , < L Φ l φ
13 D CR ζ - = M Ρ m ρ
14 E Ε . > N ά n ό
15 F ε Ι / ? O § o ΰ

Sending additional characters on GSM phones
You want to send ASCII   Send the following
Character Decimal Hex   Characters Hex Decimal
      <ESC> e 1B 65 27 101
<FF> 10 0C   <ESC> <LF> 1B 0A 27 10
[ 91 5B   <ESC> < 1B 3C 27 60
\ 92 5C   <ESC> / 1B 2F 27 47
] 93 5D   <ESC> > 1B 3E 27 62
^ 94 5E   <ESC> ^ 1B 14 27 20
{ 123 7B   <ESC> ( 1B 28 27 40
| 124 7C   <ESC> @ 1B 40 27 64
} 125 7A   <ESC> ) 1B 29 27 41
~ 126 7E   <ESC> = 1B 3D 27 61

For Picture and WAP Push SMS Messages, display captions may be up to 60 ASCII characters but not all mobile devices can display them.

Character Sets

We support Arabic and other special characters too. You need just to encode a SMS in UCS2/HexEncoded and set the proper XSer value for the character set.

Arabic http://www.unicode.org/charts/PDF/U0600.pdf

Syriac http://www.unicode.org/charts/PDF/U0700.pdf

Thaana http://www.unicode.org/charts/PDF/U0780.pdf

Arabic Presentation Forms-A http://www.unicode.org/charts/PDF/UFB50.pdf

Arabic Presentation Forms-B http://www.unicode.org/charts/PDF/UFE70.pdf

Greek and Coptic http://www.unicode.org/charts/PDF/U0370.pdf

Hebrew http://www.unicode.org/charts/PDF/U0590.pdf

Thai http://www.unicode.org/charts/PDF/U0E00.pdf

Full list for all special characters (Arabic, Greek, Cyrillic, Chinese, Japanese, Thai etc.): http://www.unicode.org/charts

How to get the Parts of a Text Message

Function GetMessageParts(Text)
    Dim a, b
    GetMessageParts = 1
    If Len(Text) <= 160 Then
        GetMessageParts = 1
    Else
        a = CSng(Len(Text)) / 153
        b = Fix(a)
        If a > b Then
            b = b + 1
        End If
        GetMessageParts = b
    End If
End Function

How to check if a String is Unicode

Function IsUnicode(s)
    Dim i, L
    L = Len(s)
    For i = 1 To L
        If AscW(Mid(s, i, 1)) > &HFF Then
            IsUnicode = True
            Exit Function
        End If
    Next
End Function
Converting a Unicode String to Hex-Coded Binary
Function UnicodeToUCS2(s, bTrimForSMS)
    Dim i, L 
    Dim t
    Dim h
    L = Len(s)
    For i = 1 To L
        h = Hex(AscW(Mid(s, i, 1)))
        h = String(4 - Len(h), "0") + h
        t = t + h
    Next
    If bTrimForSMS Then
        'Cut down to 140 bytes, 70 chars
        t = Left(t, 280)
    End If
    UnicodeToUCS2 = t
End Function
Converting an ISO-8859-7 String to GSM 03.38 (Added 03/01/2008)
Function ISO_2_GSM(t)

    Dim s
    s = t + ""
    
    s = Replace(s, Chr(64), Chr(&H0))
    s = Replace(s, Chr(163), Chr(&H1))
    s = Replace(s, Chr(36), Chr(&H2))
    s = Replace(s, Chr(165), Chr(&H3))
    s = Replace(s, Chr(232), Chr(&H4))
    s = Replace(s, Chr(233), Chr(&H5))
    s = Replace(s, Chr(249), Chr(&H6))
    s = Replace(s, Chr(236), Chr(&H7))
    s = Replace(s, Chr(242), Chr(&H8))
    s = Replace(s, Chr(199), Chr(&H9))
    s = Replace(s, Chr(10), Chr(&HA))
    s = Replace(s, Chr(216), Chr(&HB))
    s = Replace(s, Chr(248), Chr(&HC))
    s = Replace(s, Chr(13), Chr(&HD))
    s = Replace(s, Chr(197), Chr(&HE))
    s = Replace(s, Chr(229), Chr(&HF))
    
    s = Replace(s, ChrW(&H394), Chr(&H10))
    s = Replace(s, Chr(95), Chr(&H11))
    s = Replace(s, ChrW(&H3A6), Chr(&H12))
    s = Replace(s, ChrW(&H393), Chr(&H13))
    s = Replace(s, ChrW(&H39B), Chr(&H14))
    s = Replace(s, ChrW(&H3A9), Chr(&H15))
    s = Replace(s, ChrW(&H3A0), Chr(&H16))
    s = Replace(s, ChrW(&H3A8), Chr(&H17))
    s = Replace(s, ChrW(&H3A3), Chr(&H18))
    s = Replace(s, ChrW(&H398), Chr(&H19))
    s = Replace(s, ChrW(&H39E), Chr(&H1A))
    s = Replace(s, ChrW(&H1B), Chr(&H1B))
    
    s = Replace(s, Chr(12), Chr(&H1B) + Chr(&HA))
    s = Replace(s, Chr(94), Chr(&H1B) + Chr(&H14))
    s = Replace(s, Chr(123), Chr(&H1B) + Chr(&H28))
    s = Replace(s, Chr(125), Chr(&H1B) + Chr(&H29))
    s = Replace(s, Chr(92), Chr(&H1B) + Chr(&H2F))
    s = Replace(s, Chr(91), Chr(&H1B) + Chr(&H3C))
    s = Replace(s, Chr(126), Chr(&H1B) + Chr(&H3D))
    s = Replace(s, Chr(93), Chr(&H1B) + Chr(&H3E))
    s = Replace(s, Chr(124), Chr(&H1B) + Chr(&H40))
    
    s = Replace(s, ChrW(&H20AC), Chr(&H1B) + Chr(&H65)) '(ISO-8859-15)
    
    s = Replace(s, Chr(198), Chr(&H1C))
    s = Replace(s, Chr(230), Chr(&H1D))
    s = Replace(s, Chr(223), Chr(&H1E))
    s = Replace(s, Chr(201), Chr(&H1F))
    s = Replace(s, Chr(32), Chr(&H20))
    s = Replace(s, Chr(33), Chr(&H21))
    s = Replace(s, Chr(34), Chr(&H22))
    s = Replace(s, Chr(35), Chr(&H23))
    
    s = Replace(s, ChrW(164), Chr(&H24)) '(ISO-8859-1)
    
    s = Replace(s, Chr(37), Chr(&H25))
    s = Replace(s, Chr(38), Chr(&H26))
    s = Replace(s, Chr(39), Chr(&H27))
    s = Replace(s, Chr(40), Chr(&H28))
    s = Replace(s, Chr(41), Chr(&H29))
    s = Replace(s, Chr(42), Chr(&H2A))
    s = Replace(s, Chr(43), Chr(&H2B))
    s = Replace(s, Chr(44), Chr(&H2C))
    s = Replace(s, Chr(45), Chr(&H2D))
    s = Replace(s, Chr(46), Chr(&H2E))
    s = Replace(s, Chr(47), Chr(&H2F))
    s = Replace(s, Chr(48), Chr(&H30))
    s = Replace(s, Chr(49), Chr(&H31))
    s = Replace(s, Chr(50), Chr(&H32))
    s = Replace(s, Chr(51), Chr(&H33))
    s = Replace(s, Chr(52), Chr(&H34))
    s = Replace(s, Chr(53), Chr(&H35))
    s = Replace(s, Chr(54), Chr(&H36))
    s = Replace(s, Chr(55), Chr(&H37))
    s = Replace(s, Chr(56), Chr(&H38))
    s = Replace(s, Chr(57), Chr(&H39))
    s = Replace(s, Chr(58), Chr(&H3A))
    s = Replace(s, Chr(59), Chr(&H3B))
    s = Replace(s, Chr(60), Chr(&H3C))
    s = Replace(s, Chr(61), Chr(&H3D))
    s = Replace(s, Chr(62), Chr(&H3E))
    s = Replace(s, Chr(63), Chr(&H3F))
    s = Replace(s, Chr(161), Chr(&H40))
    s = Replace(s, Chr(65), Chr(&H41))
    s = Replace(s, Chr(66), Chr(&H42))
    s = Replace(s, Chr(67), Chr(&H43))
    s = Replace(s, Chr(68), Chr(&H44))
    s = Replace(s, Chr(69), Chr(&H45))
    s = Replace(s, Chr(70), Chr(&H46))
    s = Replace(s, Chr(71), Chr(&H47))
    s = Replace(s, Chr(72), Chr(&H48))
    s = Replace(s, Chr(73), Chr(&H49))
    s = Replace(s, Chr(74), Chr(&H4A))
    s = Replace(s, Chr(75), Chr(&H4B))
    s = Replace(s, Chr(76), Chr(&H4C))
    s = Replace(s, Chr(77), Chr(&H4D))
    s = Replace(s, Chr(78), Chr(&H4E))
    s = Replace(s, Chr(79), Chr(&H4F))
    s = Replace(s, Chr(80), Chr(&H50))
    s = Replace(s, Chr(81), Chr(&H51))
    s = Replace(s, Chr(82), Chr(&H52))
    s = Replace(s, Chr(83), Chr(&H53))
    s = Replace(s, Chr(84), Chr(&H54))
    s = Replace(s, Chr(85), Chr(&H55))
    s = Replace(s, Chr(86), Chr(&H56))
    s = Replace(s, Chr(87), Chr(&H57))
    s = Replace(s, Chr(88), Chr(&H58))
    s = Replace(s, Chr(89), Chr(&H59))
    s = Replace(s, Chr(90), Chr(&H5A))
    s = Replace(s, Chr(196), Chr(&H5B))
    s = Replace(s, Chr(214), Chr(&H5C))
    s = Replace(s, Chr(209), Chr(&H5D))
    s = Replace(s, Chr(220), Chr(&H5E))
    s = Replace(s, Chr(167), Chr(&H5F))
    s = Replace(s, Chr(191), Chr(&H60))
    s = Replace(s, Chr(97), Chr(&H61))
    s = Replace(s, Chr(98), Chr(&H62))
    s = Replace(s, Chr(99), Chr(&H63))
    s = Replace(s, Chr(100), Chr(&H64))
    s = Replace(s, Chr(101), Chr(&H65))
    s = Replace(s, Chr(102), Chr(&H66))
    s = Replace(s, Chr(103), Chr(&H67))
    s = Replace(s, Chr(104), Chr(&H68))
    s = Replace(s, Chr(105), Chr(&H69))
    s = Replace(s, Chr(106), Chr(&H6A))
    s = Replace(s, Chr(107), Chr(&H6B))
    s = Replace(s, Chr(108), Chr(&H6C))
    s = Replace(s, Chr(109), Chr(&H6D))
    s = Replace(s, Chr(110), Chr(&H6E))
    s = Replace(s, Chr(111), Chr(&H6F))
    s = Replace(s, Chr(112), Chr(&H70))
    s = Replace(s, Chr(113), Chr(&H71))
    s = Replace(s, Chr(114), Chr(&H72))
    s = Replace(s, Chr(115), Chr(&H73))
    s = Replace(s, Chr(116), Chr(&H74))
    s = Replace(s, Chr(117), Chr(&H75))
    s = Replace(s, Chr(118), Chr(&H76))
    s = Replace(s, Chr(119), Chr(&H77))
    s = Replace(s, Chr(120), Chr(&H78))
    s = Replace(s, Chr(121), Chr(&H79))
    s = Replace(s, Chr(122), Chr(&H7A))
    s = Replace(s, Chr(228), Chr(&H7B))
    s = Replace(s, Chr(246), Chr(&H7C))
    s = Replace(s, Chr(241), Chr(&H7D))
    s = Replace(s, Chr(252), Chr(&H7E))
    s = Replace(s, Chr(224), Chr(&H7F))
    
    ISO_2_GSM = s
    
End Function

Converting a GSM 03.38 String to ISO-8859-7 (Added 03/01/2008)

Function GSM_2_ISO(t)

    Dim s
    s = t + ""
    
    s = Replace(s, Chr(&H0), Chr(64))
    s = Replace(s, Chr(&H1), Chr(163))
    s = Replace(s, Chr(&H2), Chr(36))
    s = Replace(s, Chr(&H3), Chr(165))
    s = Replace(s, Chr(&H4), Chr(232))
    s = Replace(s, Chr(&H5), Chr(233))
    s = Replace(s, Chr(&H6), Chr(249))
    s = Replace(s, Chr(&H7), Chr(236))
    s = Replace(s, Chr(&H8), Chr(242))
    s = Replace(s, Chr(&H9), Chr(199))
    s = Replace(s, Chr(&HA), Chr(10))
    s = Replace(s, Chr(&HB), Chr(216))
    s = Replace(s, Chr(&HC), Chr(248))
    s = Replace(s, Chr(&HD), Chr(13))
    s = Replace(s, Chr(&HE), Chr(197))
    s = Replace(s, Chr(&HF), Chr(229))
    
    s = Replace(s, Chr(&H10), ChrW(&H394))
    s = Replace(s, Chr(&H11), Chr(95))
    s = Replace(s, Chr(&H12), ChrW(&H3A6))
    s = Replace(s, Chr(&H13), ChrW(&H393))
    s = Replace(s, Chr(&H14), ChrW(&H39B))
    s = Replace(s, Chr(&H15), ChrW(&H3A9))
    s = Replace(s, Chr(&H16), ChrW(&H3A0))
    s = Replace(s, Chr(&H17), ChrW(&H3A8))
    s = Replace(s, Chr(&H18), ChrW(&H3A3))
    s = Replace(s, Chr(&H19), ChrW(&H398))
    s = Replace(s, Chr(&H1A), ChrW(&H39E))
    s = Replace(s, Chr(&H1B), ChrW(&H1B))
    
    s = Replace(s, Chr(&H1B) + Chr(&HA), Chr(12))
    s = Replace(s, Chr(&H1B) + Chr(&H14), Chr(94))
    s = Replace(s, Chr(&H1B) + Chr(&H28), Chr(123))
    s = Replace(s, Chr(&H1B) + Chr(&H29), Chr(125))
    s = Replace(s, Chr(&H1B) + Chr(&H2F), Chr(92))
    s = Replace(s, Chr(&H1B) + Chr(&H3C), Chr(91))
    s = Replace(s, Chr(&H1B) + Chr(&H3D), Chr(126))
    s = Replace(s, Chr(&H1B) + Chr(&H3E), Chr(93))
    s = Replace(s, Chr(&H1B) + Chr(&H40), Chr(124))
    
    s = Replace(s, Chr(&H1B) + Chr(&H65), ChrW(&H20AC)) '(ISO-8859-15)
    
    s = Replace(s, Chr(&H1C), Chr(198))
    s = Replace(s, Chr(&H1D), Chr(230))
    s = Replace(s, Chr(&H1E), Chr(223))
    s = Replace(s, Chr(&H1F), Chr(201))
    s = Replace(s, Chr(&H20), Chr(32))
    s = Replace(s, Chr(&H21), Chr(33))
    s = Replace(s, Chr(&H22), Chr(34))
    s = Replace(s, Chr(&H23), Chr(35))
    
    s = Replace(s, Chr(&H24), ChrW(164)) '(ISO-8859-1)
    
    s = Replace(s, Chr(&H25), Chr(37))
    s = Replace(s, Chr(&H26), Chr(38))
    s = Replace(s, Chr(&H27), Chr(39))
    s = Replace(s, Chr(&H28), Chr(40))
    s = Replace(s, Chr(&H29), Chr(41))
    s = Replace(s, Chr(&H2A), Chr(42))
    s = Replace(s, Chr(&H2B), Chr(43))
    s = Replace(s, Chr(&H2C), Chr(44))
    s = Replace(s, Chr(&H2D), Chr(45))
    s = Replace(s, Chr(&H2E), Chr(46))
    s = Replace(s, Chr(&H2F), Chr(47))
    s = Replace(s, Chr(&H30), Chr(48))
    s = Replace(s, Chr(&H31), Chr(49))
    s = Replace(s, Chr(&H32), Chr(50))
    s = Replace(s, Chr(&H33), Chr(51))
    s = Replace(s, Chr(&H34), Chr(52))
    s = Replace(s, Chr(&H35), Chr(53))
    s = Replace(s, Chr(&H36), Chr(54))
    s = Replace(s, Chr(&H37), Chr(55))
    s = Replace(s, Chr(&H38), Chr(56))
    s = Replace(s, Chr(&H39), Chr(57))
    s = Replace(s, Chr(&H3A), Chr(58))
    s = Replace(s, Chr(&H3B), Chr(59))
    s = Replace(s, Chr(&H3C), Chr(60))
    s = Replace(s, Chr(&H3D), Chr(61))
    s = Replace(s, Chr(&H3E), Chr(62))
    s = Replace(s, Chr(&H3F), Chr(63))
    s = Replace(s, Chr(&H40), Chr(161))
    s = Replace(s, Chr(&H41), Chr(65))
    s = Replace(s, Chr(&H42), Chr(66))
    s = Replace(s, Chr(&H43), Chr(67))
    s = Replace(s, Chr(&H44), Chr(68))
    s = Replace(s, Chr(&H45), Chr(69))
    s = Replace(s, Chr(&H46), Chr(70))
    s = Replace(s, Chr(&H47), Chr(71))
    s = Replace(s, Chr(&H48), Chr(72))
    s = Replace(s, Chr(&H49), Chr(73))
    s = Replace(s, Chr(&H4A), Chr(74))
    s = Replace(s, Chr(&H4B), Chr(75))
    s = Replace(s, Chr(&H4C), Chr(76))
    s = Replace(s, Chr(&H4D), Chr(77))
    s = Replace(s, Chr(&H4E), Chr(78))
    s = Replace(s, Chr(&H4F), Chr(79))
    s = Replace(s, Chr(&H50), Chr(80))
    s = Replace(s, Chr(&H51), Chr(81))
    s = Replace(s, Chr(&H52), Chr(82))
    s = Replace(s, Chr(&H53), Chr(83))
    s = Replace(s, Chr(&H54), Chr(84))
    s = Replace(s, Chr(&H55), Chr(85))
    s = Replace(s, Chr(&H56), Chr(86))
    s = Replace(s, Chr(&H57), Chr(87))
    s = Replace(s, Chr(&H58), Chr(88))
    s = Replace(s, Chr(&H59), Chr(89))
    s = Replace(s, Chr(&H5A), Chr(90))
    s = Replace(s, Chr(&H5B), Chr(196))
    s = Replace(s, Chr(&H5C), Chr(214))
    s = Replace(s, Chr(&H5D), Chr(209))
    s = Replace(s, Chr(&H5E), Chr(220))
    s = Replace(s, Chr(&H5F), Chr(167))
    s = Replace(s, Chr(&H60), Chr(191))
    s = Replace(s, Chr(&H61), Chr(97))
    s = Replace(s, Chr(&H62), Chr(98))
    s = Replace(s, Chr(&H63), Chr(99))
    s = Replace(s, Chr(&H64), Chr(100))
    s = Replace(s, Chr(&H65), Chr(101))
    s = Replace(s, Chr(&H66), Chr(102))
    s = Replace(s, Chr(&H67), Chr(103))
    s = Replace(s, Chr(&H68), Chr(104))
    s = Replace(s, Chr(&H69), Chr(105))
    s = Replace(s, Chr(&H6A), Chr(106))
    s = Replace(s, Chr(&H6B), Chr(107))
    s = Replace(s, Chr(&H6C), Chr(108))
    s = Replace(s, Chr(&H6D), Chr(109))
    s = Replace(s, Chr(&H6E), Chr(110))
    s = Replace(s, Chr(&H6F), Chr(111))
    s = Replace(s, Chr(&H70), Chr(112))
    s = Replace(s, Chr(&H71), Chr(113))
    s = Replace(s, Chr(&H72), Chr(114))
    s = Replace(s, Chr(&H73), Chr(115))
    s = Replace(s, Chr(&H74), Chr(116))
    s = Replace(s, Chr(&H75), Chr(117))
    s = Replace(s, Chr(&H76), Chr(118))
    s = Replace(s, Chr(&H77), Chr(119))
    s = Replace(s, Chr(&H78), Chr(120))
    s = Replace(s, Chr(&H79), Chr(121))
    s = Replace(s, Chr(&H7A), Chr(122))
    s = Replace(s, Chr(&H7B), Chr(228))
    s = Replace(s, Chr(&H7C), Chr(246))
    s = Replace(s, Chr(&H7D), Chr(241))
    s = Replace(s, Chr(&H7E), Chr(252))
    s = Replace(s, Chr(&H7F), Chr(224))
    
    GSM_2_ISO = s
    
End Function

XML Elements



Element Attributes Description

REQUEST

(required)

version

Must always be "1.0.0"

username

Your mobileFX username (usually this is your email)

password

Your mobileFX password.

method

method="send"

Informs the server to execute the Bulk Job (send the SMS) and returns your remaining credits and the cost of the job.

HTTP Response: XML

Success <RESPONSE>
    <SEND remaining='xxxxxx' cost='xxxxxx'/>
</RESPONSE>
Failure <ERROR code='Error Number'><![CDATA[Error Description]]></ERROR>
   
method="credits"

Returns your remaining credits.

HTTP Response: XML

Success <RESPONSE>
    <CREDITS remaining='xxxxxx'>
</RESPONSE>
Failure <ERROR code='Error Number'><![CDATA[Error Description]]></ERROR>
   
method="termination" or method="fees"

Returns the Termination Fees for Supported Networks.

HTTP Response: XML

<?xml version="1.0" encoding="ISO-8859-1" ?>
<fees>
    <country name="xxxxxx">
        <network name="xxxxxx" credits="xxxxxx">
            <prefix number="xxxxxx" />
            ...
        </network>
    </country>
</fees>

method="networks" or method="operators"

Returns the supported Network Operators.

HTTP Response: XML

<?xml version="1.0" encoding="ISO-8859-1" ?>
<networks>
    <country name="xxxxxx">
        <network name="xxxxxx" credits="xxxxxx"/>
        ...
    </country>
    ...
</networks>


IMPORTANT: Credits are decimal numbers (eg. 242.75)

MESSAGES

(required)

 

Container element for one or more SMS elements.

SMS

IMPORTANT:
 You may add 1 to 1000 elements.

(required)

 

MessageKind

The Kind of the SMS Message you want to send. This applies to the whole Bulk Job.

   SMS_TextMessage=0
   SMS_PictureMessage=1
   SMS_RingtoneMessage=2
   SMS_VCardMessage=3
   SMS_WapPushMessage=4
   SMS_BinaryMessage=5

 

MessageDataType

The Data Type of the SMS Message you want to send. This applies to the whole Bulk Job.

   SMS_Text=0   
   SMS_Binary=1
   SMS_URL=2

MessageEffects

The Effects for Text SMS Messages (only).  

   SMS_NO_EFFECTS=0   
   SMS_FLASHING=1   
   SMS_BLINKING=2

MessageReplaceIndex

If set to a value ranging from 1 to 7, this allows to overwrite existing messages on a handset with the same ReplaceMessage value.

 

TrackID

A String up to 36 characters with a TrackID that is included in the CallBack Notifications.

DeferredDeliveryTime

If set, specifies when a submitted Message should be sent. The format is "ddmmyyyyhhmmss". If the component is used outside the timezone GMT+1, the property "TimeZone" should also be set.

LifeTime

Lifetime validity of an SMS if it repeatedly fails to be delivered instantly. Lifetime can not be shorter than 3 minutes and can not exceed 1440 minutes (24h - Default). 

TimeZone

Specifies the Timezone where the component is used. It’s only necessary to set this property when the property DeferredDeliveryTime is used and the component is used outside the timezone GMT +1.

XSer

Additional information for binary messages, only used when sending directly to the SMSC gateway.

URL_BUFFERED

CDATA text()

URL that will be contacted when a message is not delivered instantly but it gets buffered. The value of the submitted TrackID will be returned in the URL querystring.

URL_DELIVERED

CDATA text()

URL that will be contacted when a message is delivered. The value of the submitted TrackID will be returned in the URL querystring.

URL_NOT_DELIVERED

CDATA text()

URL that will be contacted when a message fails to be delivered. The value of the submitted TrackID will be returned in the URL querystring.

ORIGINATOR

(required)

CDATA text()

Specifies an alphanumeric or numeric originator. It can be a short text with maximum 11 English characters. Please be aware, that using this feature is delicate. ANY ABUSES OF WILL BE TRACKED AND PROSECUTED.

DATA

CDATA text()

The DATA element is widely used for passing the information that will be included in an SMS message. Please refer to Message Kinds and MessageDataType for more information about packing your information for each message kind (Text Messages, Ringtones, Picture Messages, WAP Push, etc).

VNAME

CDATA text()

Contact Name, required only for VCard Messages.

VNUM

CDATA text()

Contact Telephone Number, required only for VCard Messages.

PIC

CDATA text()

Hex-coded string of Binary Data, required only for Picture Messages.

WAP_CAP

CDATA text()

WAP Push Caption, required only for WAP Push Messages.

WAP_URL

CDATA text()

WAP Push URL, required only for WAP Push Messages.

RECIPIENTS

(required)

 

Container Element of Recipient Elements.

R

IMPORTANT:
 You may add 1 to 1000 elements.

(required)

number

International Mobile Telephone Number of the Recipient.

CDATA text()

For personalized Bulk SMS messages you can include different Text for each Recipient.


IMPORTANT:

The total number of SMS and R (recipient) elements must not exceed 1000

DOM.selectNodes("//SMS").length + DOM.selectNodes("//R").length <= 1000

This means that you can have up to 1000 SMS elements with 1 R element each, 1 SMS element with 1000 R elements in it, or any combination of SMS and R elements that SMS + R <= 1000.

Each Bulk Job can contain SMS elements of the same MessageKind

This means that if you want to send both Text SMS messages and Picture Messages you should create and send two (2) XML Documents.

For Text SMS Messages in a Bulk Job, if one Unicode message is found all messages are treated as Unicode

This is very important!! If for example you send an XML Document with 999 ASCII Text Messages with English Characters and 1 Text Message with Unicode characters, then all 1000 messages will be treated as Unicode and the server will apply the limitation check of 70 Unicode characters per message.

Added on 3/1/2008: Text SMS messages with Greek capital characters are treated as standard GSM-encoded messages and can have up to 1377 characters.


Accounting and Utility XML Functions


Getting Credits Balance XML

<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST version='1.0.0' username='xxxxxx' password='xxxxxx' method='credits'/>

Getting Termination Fees XML

<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST version='1.0.0' username='xxxxxx' password='xxxxxx' method='termination'/>

Getting Supported Networks XML

<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST version='1.0.0' username='xxxxxx' password='xxxxxx' method='networks'/>


Message Kinds and MessageDataType


Each SMS or Bulk SMS message has a MessageKind property that determines what kind of SMS message will be sent to the recipients. MessageDataType property defines the format of the message data or where to retrieve them from.

Text Message XML

<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST version='1.0.0' username='xxxxxx' password='xxxxxx' method='send'>
  <MESSAGES>
    <SMS MessageKind='0' MessageDataType='0' MessageEffects='0' 
         MessageReplaceIndex='0' TrackID='' DeferredDeliveryTime='' 
         LifeTime='0' TimeZone='2' XSer=''>
        <ORIGINATOR><![CDATA[xxxxxx]]></ORIGINATOR>
        <DATA><![CDATA[Hello World!]]></DATA>
        <RECIPIENTS>
            <R number='xxxxxx'/>
        </RECIPIENTS>
    </SMS>
    </MESSAGES>
</REQUEST>

Personalized Bulk SMS Message XML

<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST version='1.0.0' username='xxxxxx' password='xxxxxx' method='send'>
  <MESSAGES>
    <SMS MessageKind='0' MessageDataType='0' MessageEffects='0' 
         MessageReplaceIndex='0' TrackID='' DeferredDeliveryTime='' 
         LifeTime='0' TimeZone='2' XSer='' Personalized='1'>
        <ORIGINATOR><![CDATA[mobileFX]]></ORIGINATOR>
        <DATA><![CDATA[]]></DATA>
        <RECIPIENTS>
            <R number='xxxxxx'><![CDATA[Hello John, Merry XMas!]]></R>
            <R number='xxxxxx'><![CDATA[Hello Marry, Merry XMas!]]></R>
            <R number='xxxxxx'><![CDATA[Γεια σου Κώστα, Ευτυχισμένα Χριστούγεννα!]]></R>
        </RECIPIENTS>
    </SMS>
    </MESSAGES>
</REQUEST>

Picture Message XML

MessageDataType Action
SMS_Binary=1 Insert in the PIC element the binary Hex-Coded bytes of the picture file you want to send.
SMS_URL=2 Insert in the PIC element the URL of the Picture File you want to send.
<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST version='1.0.0' username='xxxxxx' password='xxxxxx' method='send'>
    <MESSAGES>
        <SMS MessageKind="1" MessageDataType="1" MessageEffects="0" 
             MessageReplaceIndex="0" TrackID="" DeferredDeliveryTime="" 
             LifeTime="0" TimeZone="2" XSer="">
            <ORIGINATOR><![CDATA[xxxxxx]]></ORIGINATOR>
            <DATA><![CDATA[This is a Picture message.]]></DATA>
            <PIC><![CDATA[474946383961B000D000F7...D6477F37]]></PIC>
            <RECIPIENTS>;
                <R number="xxxxxxx"/>
            </RECIPIENTS>
        </SMS>
    </MESSAGES>
</REQUEST>
<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST version='1.0.0' username='xxxxxx' password='xxxxxx' method='send'>
    <MESSAGES>
        <SMS MessageKind="1" MessageDataType="2" MessageEffects="0" 
             MessageReplaceIndex="0" TrackID="" DeferredDeliveryTime="" 
             LifeTime="0" TimeZone="2" XSer="">
            <ORIGINATOR><![CDATA[xxxxxx]]></ORIGINATOR>
            <DATA><![CDATA[This is a Picture message.]]></DATA>
            <PIC><![CDATA[http://www.mobilefx.com/web/images/gamers.png]]></PIC>
            <RECIPIENTS>;
                <R number="xxxxxxx"/>
            </RECIPIENTS>
        </SMS>
    </MESSAGES>
</REQUEST>

Ringtone Message XML

MessageDataType Action
SMS_Binary=1 Insert in the DATA element the binary Hex-Coded bytes of the Ringtone file you want to send.
SMS_URL=2 Insert in the DATA element the URL of the Ringtone File you want to send.
<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST version='1.0.0' username='xxxxxx' password='xxxxxx' method='send'>
    <MESSAGES>
        <SMS MessageKind="2" MessageDataType="1" MessageEffects="0" 
             MessageReplaceIndex="0" TrackID="" DeferredDeliveryTime="" 
             LifeTime="0" TimeZone="2" XSer="">
            <ORIGINATOR><![CDATA[xxxxxx]]></ORIGINATOR>
            <DATA><![CDATA[64656174683A643D342C6F3D352C623D3130303A...32E0D0A]]></DATA>
            <RECIPIENTS>
                <R number="xxxxxx"/>
            </RECIPIENTS>;
        </SMS>
    </MESSAGES>
</REQUEST>
<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST version='1.0.0' username='xxxxxx' password='xxxxxx' method='send'>
    <MESSAGES>
        <SMS MessageKind="2" MessageDataType="2" MessageEffects="0" 
             MessageReplaceIndex="0" TrackID="" DeferredDeliveryTime="" 
             LifeTime="0" TimeZone="2" XSer="">
            <ORIGINATOR><![CDATA[xxxxxx]]></ORIGINATOR>
            <DATA><![CDATA[http://www.mobilefx.com/_content/ringtone_file.txt]]></DATA>
            <RECIPIENTS>
                <R number="xxxxxx"/>
            </RECIPIENTS>;
        </SMS>
    </MESSAGES>
</REQUEST>

VCard Message XML

<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST version='1.0.0' username='xxxxxx' password='xxxxxx' method='send'>
    <MESSAGES>
        <SMS MessageKind="3" MessageDataType="0" MessageEffects="0" 
             MessageReplaceIndex="0" TrackID="" DeferredDeliveryTime="" 
             LifeTime="0" TimeZone="2" XSer="">
            <ORIGINATOR><![CDATA[xxxxxx]]></ORIGINATOR>
            <VNAME><![CDATA[Charles]]></VNAME>
            <VNUM><![CDATA[+44127345293]]></VNUM>
            <RECIPIENTS>
                <R number="xxxxxx"/>
            </RECIPIENTS>;
        </SMS>
    </MESSAGES>
</REQUEST>

WAP Push Message XML

<?xml version="1.0" encoding="UTF-8" ?>
&<REQUEST version='1.0.0' username='xxxxxx' password='xxxxxx' method='send'>
    <MESSAGES>
        <SMS MessageKind="4" MessageDataType="0" MessageEffects="0" 
             MessageReplaceIndex="0" TrackID="" DeferredDeliveryTime="" 
             LifeTime="0" TimeZone="2" XSer="">
            <ORIGINATOR><![CDATA[xxxxxx]]></ORIGINATOR>
            <WAP_CAP><![CDATA[Test]]></WAP_CAP>
            <WAP_URL><![CDATA[http://wap.mobilefx.com]]></WAP_URL>
            <RECIPIENTS>
                <R number="xxxxxx"/>
            </RECIPIENTS>
        </SMS>
    </MESSAGES>
</REQUEST>

Notifications and HTTP Callbacks


By setting SMS properties URL_BUFFERED, URL_DELIVERED and URL_NOT_DELIVERED you instruct our server to perform an HTTP Callback to those URLs when the state of your submission changes.

<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST version='1.0.0' username='xxxxxx' password='xxxxxx' method='send'>
  <MESSAGES>
    <SMS MessageKind='0' MessageDataType='0' MessageEffects='0' 
         MessageReplaceIndex='0' TrackID='' DeferredDeliveryTime='' 
         LifeTime='0' TimeZone='2' XSer=''>

        <URL_BUFFERED>
        <![CDATA[http://www.yourhost.com/Buffered.asp?SCTS=<SCTS>&DSCTS=<DSCTS>&RSN=<RSN>&DST=<DST>&TRN=<TRN>]]>
        </URL_BUFFERED>

        <URL_DELIVERED>
        <![CDATA[http://www.yourhost.com/Delivered.asp?SCTS=<SCTS>&DSCTS=<DSCTS>&RSN=<RSN>&DST=<DST>&TRN=<TRN>]]>
        </URL_DELIVERED>

        <URL_NOT_DELIVERED>
        <![CDATA[http://www.yourhost.com/NotDelivered.asp?SCTS=<SCTS>&DSCTS=<DSCTS>&RSN=<RSN>&DST=<DST>&TRN=<TRN>]]>
        </URL_NOT_DELIVERED>

        <ORIGINATOR><![CDATA[xxxxxx]]></ORIGINATOR>
        <DATA><![CDATA[Hello World!]]></DATA>
        <RECIPIENTS>
            <R number='xxxxxx'/>
        </RECIPIENTS>
    </SMS>
    </MESSAGES>
</REQUEST>

The Callback URL Query String provides several fields as described below:

 
URL_BUFFERED http://www.yourhost.com/Buffered.asp?SCTS=<SCTS>&DSCTS=<DSCTS>&RSN=<RSN>&DST=<DST>&TRN=<TRN>
URL_DELIVERED http://www.yourhost.com/Delivered.asp?SCTS=<SCTS>&DSCTS=<DSCTS>&RSN=<RSN>&DST=<DST>&TRN=<TRN>
URL_NOT_DELIVERED http://www.yourhost.com/NotDelivered.asp?SCTS=<SCTS>&DSCTS=<DSCTS>&RSN=<RSN>&DST=<DST>&TRN=<TRN>
 
 
<RCPNT> Recipient, Mobile number
<SCTS> Service center Timestamp, Submission date
<DSCTS> Delivery Service center Timestamp, Notification date
<RSN> Reason code
<DST> Delivery status
<TRN> TrackID
 

The tags within the definition of the URL may be placed on any position but the length of one URL is limited to 200 characters. A URL, which may be called mobileFX, could look like the following:

http:///www.yourhost.com/Buffered.asp?SCTS=25062002120236&DSCTS=25062002120241&RSN=107&DST=1&TRN=00001
Explanation:
Submissiondate: 25.06.2002 12:02:36
Notificationdate: 25.06.2002 12:02:41
Reasoncode: 107 (Absent Subscriber)
Deliverystatus: 1 (Buffered)
TrackID: 00001

Please not that after Delivery status 1 (Buffered) occurs, nearly always the URL is called a second time with Delivery status 0 (Delivered) or Delivery status 2 (Not delivered).

ASP Query String Decode Sample Code

<script language=VBScript runat=server>

Public Sub  HandleCallBack()
    
    On Error Resume Next
   
    Dim RCPNT
    Dim SCTS
    Dim DSCTS
    Dim RSN
    Dim DST
    Dim TRN
        
    RCPNT = Request.QueryString("RCPNT").Item
    SCTS = parseDateTime(Request.QueryString("SCTS").Item)
    DSCTS = parseDateTime(Request.QueryString("DSCTS").Item)
    RSN = Request.QueryString("RSN").Item
    DST = Request.QueryString("DST").Item
    TRN = Request.QueryString("TRN").Item

    ' Your handling code here...
   
End Sub

Private Function parseDateTime(s)
    On Error Resume Next
    Dim yy, mm, dd, H, m, ss
    dd = CInt(Left(s, 2))
    mm = CInt(Mid(s, 3, 2))
    yy = CInt(Mid(s, 5, 4))
    H = CInt(Mid(s, 9, 2))
    m = CInt(Mid(s, 11, 2))
    ss = CInt(Mid(s, 13, 2))
    parseDateTime = DateSerial(yy, mm, dd) + TimeSerial(H, m, ss)
    If Err.Number <> 0 Then
        parseDateTime = Null
    End If
End Function

</script>

Possible values of Deliverystatus


 
-1 Not yet submitted or rejected
0 Delivered
1 Buffered
2 Not Delivered
 

Possible values of Reasoncode


Reasoncodes specify the reason if a message is first being buffered or the delivery of message has definitely failed. They are only relevant if Deliverystatus of a message is 1 (Buffered) or 2 (Not delivered)

 
000 Unknown subscriber
001 Service temporary not available
002 Service temporary not available
003 Service temporary not available
004 Service temporary not available
005 Service temporary not available
006 Service temporary not available
007 Service temporary not available
008 Service temporary not available
009 Illegal error code
010 Network time-out
100 Facility not supported
101 Unknown subscriber
102 Facility not provided
103 Call barred
104 Operation barred
105 SC congestion
106 Facility not supported
107 Absent subscriber
108 Delivery fail
109 SC congestion
110 Protocol error
111 MS not equipped
112 Unknown SC
113 SC congestion
114 Illegal MS
115 MS not a subscriber
116 Error in MS
117 SMS lower layer not provisioned
118 System fail
119 PLMN system failure
120 HLR system failure
121 VLR system failure
122 Previous VLR system failure
123 Controlling MSC system failure
124 VMSC system failure
125 EIR system failure
126 System failure
127 Unexpected data value
200 Error in address service centre
201 Invalid absolute Validity Period
202 Short message exceeds maximum
203 Unable to Unpack GSM message
204 Unable to convert to IA5 ALPHABET
205 Invalid validity period format
206 Invalid destination address
207 Duplicate message submit
208 Invalid message type indicator
 

Most occurring Reasoncodes


In cases of failures, several reasoncodes do occur quite often, others very seldom. The following reasoncodes are most the occurring reasoncodes in our system and therefore listed here.

 
Reasoncode Reason Possible explanation
000 Unknown Subscriber It was tried to send an SMS to a number which is not existing or no longer exists
103 Call Barred It was tried to send an SMS to a number which has been blocked by the provider. This reason code also has already occurred in cases of empty prepaid cards which were not able to receive messages
107 Absent Subscriber It was tried to send an SMS to a mobile phone which is switched off or does not have network coverage
108 (Buffered) Delivery Fail This reason code often occurs when a mobile phone is out of memory. If the recipient deletes one or more SMS, the message probably will be delivered at the end
108 (Not delivered) Delivery Fail External partner has definitely given up to deliver message after a maximum period of 72 hours
110 Protocol Error Mobile phone damaged or not capable to receive message, may occur if a mobile phone has to receive multiple messages at the same time. This reason code already has occurred by using alphanumeric originators and Nokia 91xx mobile phones
111 MS not equipped Mobile phone damaged or not capable to receive message, e.g. if a logo has been sent
118 System fail Indicates serious problems within mobile phone and/or network of the recipient. This reason code already has occurred in combination with not reachable or congested networks and warlike events.
119 PLMN Failure Public Land Mobile Network Failure - Indicates serious problems within network of the recipient
120 HLR system Failure Home Location Register Failure - Indicates serious problems within network of the recipient. This reason code already has occurred by sending messages to networks which are not reachable by mobileFX. Usually after exceeding the validity period, a definite Delivery Fail (Code 108) will be returned.
121 VLR system Failure Visiting Location Register Failure - Indicates problems within the network of the recipient. This reason code has already occurred in combination with roaming problems, e.g. if the recipient was abroad and the foreign network has not negotiated an SMS roaming agreement with his home network.
 
 

Pre-Send Cost Calculation


It is very important to know whether you have enough credits in your account to successfully send your SMS messages. As a general rule, for every SMS message and regardless of its MessageKind, only one (1) credit is charged. However, certain Network Operators apply additional charges, known as Termination Fees.

In order to properly and accurately calculate the cost of your Bulk Job, you must implement the following calculation:

  1. Assume n is the Termination Fee for an SMS message reaching one recipient, multiplied with the actual Message Kind Cost.
  2. SimplePart ASCII Text SMS messages (160 English characters) cost n credits.
  3. SimplePart Unicode Text SMS messages (70 Unicode characters) cost n credit. Unicode messages can only be SinglePart.
  4. Multipart ASCII Text SMS messages can have up to 9 parts. To calculate the cost of the message parts multiply the parts with n.
  5. Apply this calculation accumulative to all recipients for all messages.

Enumerations


SMS_MESSAGE_KIND

   SMS_TextMessage=0
   SMS_PictureMessage=1
   SMS_RingtoneMessage=2
   SMS_VCardMessage=3
   SMS_WapPushMessage=4
   SMS_BinaryMessage=5

SMS_MESSAGE_DATA

   SMS_Text = 0
   SMS_Binary=1
   SMS_URL=2

 SMS_EFFECTS

   SMS_NO_EFFECTS=0   
   SMS_FLASHING=1   
   SMS_BLINKING=2

SMS_REPLACE_MESSAGE_INDEX

   REPLACE_No_Replace = 0
   REPLACE_INDEX_1 = 1
   REPLACE_INDEX_2 = 2
   REPLACE_INDEX_3 = 3
   REPLACE_INDEX_4 = 4
   REPLACE_INDEX_5 = 5
   REPLACE_INDEX_6 = 6
   REPLACE_INDEX_7 = 7


Examples of XML HTTP POST



Visual Basic Sample Code

Function SendSms(XMLDoc As String) As String
    
    Dim h As Object
    Dim x As Object
    Dim r As String
    Dim erNo As Long, erMsg As String
        
    On Error GoTo ErrHnd
    
    Set h = CreateObject("Microsoft.XMLHTTP")
    h.Open "POST", "https://www.mobilefx.com/web/sms.asp", False
    h.Send XMLDoc + ""
    r = h.responseText
    
    SendSms = r
    
    If InStr(r, "<") > 0 Then
        Set x = XML_DOM(r)
        If Not x.documentElement Is Nothing Then
            If x.documentElement.nodeName = "ERROR" Then
                XHTTP = ""
                Err.Raise 1010, , x.documentElement.Text
            End If
        End If
    End If
        
End Function

Private Function XML_DOM(Optional v) As Object
    Dim X As Object
    Set X = CreateObject("Microsoft.XMLDOM")
    X.async = True
    If Not IsEmpty(v) Then
        X.loadXML v
    End If
    Set XML_DOM = X
End Function


VBScript Sample Code (ASP Server)

<script language=VBScript runat=server>

Function SendSms(XMLDoc)    
    Dim h 
    Dim r         
    Set h = Server.CreateObject("Microsoft.XMLHTTP")
    h.Open "POST", "https://www.mobilefx.com/web/sms.asp", False
    h.Send XMLDoc + ""
    r = h.responseText
    SendSms = r
End Function

</script>


HTML Sample Code (VBScript)

<html>
<body>

<textarea id=txt style="width:100%;height:400px">
<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST version='1.0.0' username='xxxxx' password='xxxxx' method='send'>
    <MESSAGES>
        <SMS MessageKind='0' MessageDataType='0' MessageEffects='0' 
             MessageReplaceIndex='0' TrackID='' DeferredDeliveryTime='' 
             LifeTime='0' TimeZone='2' XSer='' Personalized='1'>
            <ORIGINATOR><![CDATA[mobileFX]]></ORIGINATOR>
            <DATA><![CDATA[]]></DATA>
            <RECIPIENTS>
                <R number='xxxxx'><![CDATA[Hello Lina, Merry XMas!]]></R>
                <R number='xxxxx'><![CDATA[Hello Elias, Merry XMas!]]></R>
                <R number='xxxxx'><![CDATA[Γεια σου Κώστα, Ευτυχισμένα Χριστούγεννα!]]></R>
            </RECIPIENTS>
        </SMS>
    </MESSAGES>
</REQUEST>
</textarea>

<button onclick="send()">Send</button>

<script language=vbscript>

sub Send()
    dim x
    set x = createobject("Microsoft.XMLDOM")
    x.async = false
    x.loadxml txt.value 
    if x.xml = "" then
        msgbox x.parseError.reason
    else
        msgbox SendSms(x.xml)
    end if
end sub

Function SendSms(XMLDoc)
    Dim h 
    Dim r 
    Set h = CreateObject("Microsoft.XMLHTTP")
    h.Open "POST", "https://www.mobilefx.com/web/sms.asp", False
    h.Send XMLDoc + ""
    r = h.responseText
    SendSms = r
End Function

</script>
</body>
</html>


PHP Sample Code

(Edited 03/01/2008)

<?php
$xmldocument = ...
$len = strlen($xmldocument);
$fp = fsockopen("www.mobilefx.com", 80, &$errno, &$errdesc );
if ( ! $fp ) die ( "Couldn't connect: $errno   $errdesc\n" );
fputs( $fp, "POST /web/sms.asp HTTP/1.0\r\n"); 
fputs( $fp, "Host: www.mobilefx.com\r\n"); 
fputs( $fp, "Content-Type: text/xml\r\n"); 
fputs( $fp, "Content-Length: $len\r\n\r\n"); 
fputs( $fp, $xmldocument); 
while ( ! feof( $fp ) ) 
$reply[] = fgets( $fp, 1024 ); 
fclose( $fp );
?>

Python Sample Code

#!/usr/bin/python2
print 'Content-Type: text/html'
print # Blank line marking end of HTTP headers

import socket

HOST   = 'www.mobilefx.com' # The remote host
PORT   = 80                 # The same port as used by the server
XMLDOC = ...                #XML SMS Document according to specifications of this document
length = len(XMLDOC)

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.send("POST /web/sms.asp HTTP/1.0\r\n")
s.send("Content-Type: text/xml\r\n")
s.send("Content-Length: "+str(length)+"\r\n\r\n")
s.send(XMLDOC)

datarecv=s.recv(1024)
print "Reply Received: "+ str(datarecv)
s.close()

C# Sample Code

using System;
using System.Xml;
using System.Net.Sockets;
using System.IO;
using System.Text;
using System.Net;

class SendSMS
{

  public static int port = 80;
  public static string host = "https://www.mobilefx.com";
  public static string url = "/web/sms.asp";

  public static void Main(string[] args)
  {
    SendSMS sms = new SendSMS();
    sms.send();
  }

  private void send(string message)
  {
    HttpWebRequest httpRequest = (HttpWebRequest) WebRequest.Create(host + ":" + port + url);
    httpRequest.Method = "POST";
    httpRequest.ContentType = "text/xml";
    
    Stream requestStream = httpRequest.GetRequestStream();
    
    XmlTextWriter xmlTextWriter = new XmlTextWriter(requestStream, System.Text.Encoding.UTF8);
    // Write code to construct XML Document here...
    xmlTextWriter.Close();

    HttpWebResponse httpResponse = (HttpWebResponse) httpRequest.GetResponse();
    Console.WriteLine("Response is:");
    StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream(), System.Text.Encoding.UTF8);
    Console.WriteLine(streamReader.ReadToEnd());
    streamReader.Close();
    httpResponse.Close();
  }
}

Java Sample Code

import java.net.*;
import java.io.*;

public class SMS 
{
    String xmlURL = "https://www.mobilefx.com/web/sms.asp";
 
    SMS() {}

    public String send(int idsms, 
                       String number,
                       String message,
                       int flashing,
                       String URLDeliveryNotification,
                       String URLNonDeliveryNotification) 
    {

        StringBuffer content = new StringBuffer();
        // Construct XML here

        InetAddress inetAddr = null;
        String xmlResult = "";

        try 
        {
            URL mURL = new URL(xmlURL);
            URLConnection mConn = mURL.openConnection();

            mConn.setRequestProperty("Content-Type","text/xml");
            mConn.setDoOutput(true);
            mConn.setDoInput(true);

            PrintWriter out = new PrintWriter(mConn.getOutputStream());

            char[] buffer = new char[1024*10];
            buffer = content.toCharArray();

            out.write(buffer,0,content.length());
            out.close();

            BufferedReader in = new BufferedReader(new InputStreamReader(mConn.getInputStream()));

            String inputLine = null;
            while ((inputLine = in.readLine()) != null)
            {
                xmlResult = xmlResult + inputLine;
                System.out.println(inputLine); 
            }

            in.close();
        } 
        catch (Exception e) 
        {
            System.out.println(e.getMessage());
        }
        return xmlResult;
    }

    public static void main(String[] args) 
    {
        SMS testSMS = new SMS();
        String xmlResult = SMS.send(refnumber,handynumber,message,flashing,urldelivery_yes,urldelivery_no);
    }
}