ActiveXperts SMS Component Manual

© ActiveXperts Software B.V.  contact@activexperts.com

1. Introduction

1.1. Introduction

The ActiveXperts SMS Component enables application developers to add SMS and Pager functionality to their applications in a matter of minutes.

The SMS Component is an ActiveX/COM component. This component registers a number of objects which enable SMS and Pager functionality. With this toolkit you can send as well as receive SMS messages through:

  • GSM Modem
  • SMPP Provider
  • HTTP SMS provider

The SMS Component can also be used to setup you own SMPP Server or Gateway that accepts incoming SMPP connections.

It supports sending pager messages through:

  • SNPP Provider (alpha-numeric paging)

The SMS Component can be used on any 32- or 64-bit Windows platform.

Since the SMS Component is completely exposed through ActiveX/COM components it can be used in the following programming languages:

  • Visual Basic .NET - Windows .NET based application;
  • Visual C# .NET - Windows .NET based applications;
  • Visual Basic 6.x or higher - Windows based applications;
  • Visual C++ 6.x or higher - Windows based applications;
  • ASP .NET - Web site based on Active Server Pages and the .NET Framework;
  • ASP 2.x - Web site based on Active Server Pages (server-side scripting);
  • PHP - Embedded HTML scripting;
  • PowerShell - Windows based scripts;
  • VBScript - Windows based scripts;
  • Java/Javascript - Java based scripts;
  • HTML - Client scripts within HTML pages;
  • Delphi - Windows based applications;
  • Any other development platform that supports ActiveX/COM components.

1.2. Features

SMS features:

  • Send through GSM modem devices
  • Send through SMPP 3.3/3.4 and 5.0 providers
  • Setup an SMPP 3.4 compliant server
  • Full support for both IPv6 and IPv4 clients and servers
  • Send through HTTP and/or XML based API's
  • Send through dialup providers using TAP/XIO or UCP
  • Support for delivery reports
  • Supports text/Unicode and binary SMS messages
  • Sending and receiving multipart messages
  • Sending and receiving messages to specific application ports
  • Templates for often used binary messages (WAPPush, vCards)

Pager features:

  • Send alpha-numeric Pager messages through SNPP

Other features:

  • Troubleshooting facilities by tracing all protocol specific commands and responses
  • Samples included for various development platforms: MS Visual Basic, MS Visual Basic .NET, MS Visual C++, MS Visual C# .NET, ASP, ASP .NET and more
  • Support for multi-threading environments. The component is thread-safe as long as only one threads keeps and uses one instance of object(s)

1.3. Architecture

The core of SMS Component is an ActiveX/COM component that comes in a 32-bit and a 64-bit version:

  • AxSms32.dll The 'SMS Component COM Component' for 32-bit platforms
  • AxSms64.dll The 'SMS Component COM Component' for 64-bit platforms

The following objects are part of this component:

  • AxSms.Smpp This is the SMPP SMS protocol component
  • AxSms.SmppServer This is the SMPP SMS Server protocol component
  • AxSms.SmppSession This is the SMPP SMS Server session component
  • AxSms.Gsm This is the GSM modem SMS protocol component
  • AxSms.Http This is the HTTP SMS protocol component
  • AxSms.Dialup This is the Dialup SMS protocol component
  • AxSms.Message This is the SMS message component. SMS messages that are received and sent are kept in instances of this component
  • AxSms.TemplateWapPush This is the WAPPush SMS message template. Use this to quickly generate binary formatted WAPPush messages
  • AxSms.TemplatevCard This is the vCard SMS message template. Use this to quickly generate vCard formatted messages
  • AxSms.Tlv This is the TLV (Tag, Length, Value) component. It's only used with the SMPP component and can be part of an SMS message as well as a bind call
  • AxSms.Snpp This is the Pager SNPP protocol component
  • AxSms.Constants This component contains all constants that are used with SMS messages and the SMS protocols

2. System Requirements

2.1. Operating System

ActiveXperts SMS Component can be used on any of the following operating systems:

  • Windows Server 2012 R2 (64-bit)
  • Windows Server 2012 (64-bit)
  • Windows Server 2008 R2 (64-bit)
  • Windows Server 2008 (32-bit and 64-bit)
  • Windows Server 2003 (32-bit and 64-bit)
  • Windows 8 (32-bit and 64-bit)
  • Windows 7 (32-bit and 64-bit)
  • Windows Vista (32-bit and 64-bit)
  • Windows XP (32-bit and 64-bit)

2.2. .NET Framework

To use ActiveXperts SMS Component in an ASP .NET, Visual Basic .NET or Visual C#. NET environment, the .NET Framework 2.0 or higher must be installed on the system. The .NET Framework is part of Windows 2003 server platforms and higher, and on Windows Vista workstation platforms and higher. For other Windows platforms, it's available as a separate installation. Please visit the Technology Information for the .NET Framework page to download the .NET Framework.

2.3. Internet Information Server

Internet Information Server (IIS) Setup installs the Visual Basic Script and Java Script engines.
To run ASP/ASP.NET pages on Windows Servers, IIS 6.x must be installed. IIS is an optional 'Role' in Windows Server platforms.
To run ASP .NET samples, .NET Framework 2.0 or higher must be installed.

3. Installation

3.1. Introduction

The ActiveXperts SMS Component package consists of 3 modules; any combination of components can be installed:

  • The ActiveXperts SMS Component COM components - core components 'AxSms32.dll' (to embed in 32-bit applications) and 'AxSms64.dll' (to embed in 64-bit applications);
  • The ActiveXperts SMS Component Help Files - documentation;
  • The ActiveXperts SMS Component Sample Files - samples for various development platforms.

3.2. Installation (Automatic)

To automatically install ActiveXperts SMS Component, download AxSmsSetup.exe and start the installation. The InstallShield wizard will guide you through the rest of the setup.

On 32-bit operating systems, it will automatically register the 32-bit ActiveX DLL 'AxSms32.dll', to support 32-bit applications.

On 64-bit operating systems, it will automatically register the 64-bit ActiveX DLL 'AxSms64.dll', to support 64-bit applications; it will also automatically register the 32-bit ActiveX DLL 'AxSms32.dll', to support 32-bit applications.

3.3. Installation (Manual)

To manually install the ActiveXperts SMS Component core files, perform the following actions:

  • Perform one installation of ActiveXperts SMS Component on an available computer, to extract the 'AxSms32.dll' and 'AxSms64.dll' core ActiveX files
  • To embed ActiveXperts SMS Component in 64-bit applications, copy the 'AxSms64.dll' ActiveX file to the destination computer hard drive, and register the DLL by running the following command from the command-line on the destination computer:
    REGSVR32 <dest-location>\AxSms64.dll
  • To embed ActiveXperts SMS Component in 32-bit applications, copy the 'AxSms32.dll' ActiveX file to the destination computer hard drive, and register the DLL by running the following command from the command-line on the destination computer:
    REGSVR32 <dest-location>\AxSms32.dll

4. How to use

4.1. Introduction

The ActiveXperts SMS Component is an ActiveX component. ActiveX is a Microsoft framework for defining reusable software components in a programming language-independent way. This is why it's possible to use the SMS Components in most programming and scripting languages available for Windows.

One of the most important aspects to using the SMS Component may be creating an instance in the programming language of choice. Once a reference to the ActiveX component has been made and it's objects have been instantiated the use of this component should be very straightforward.

In this section a couple of programming environments are highlighted and their way to access the objects in the SMS Component is demonstrated.

4.2. Visual Basic .NET

Add a reference to the SMS Component object using the Visual Basic Solution Explorer:

  • Start the Solution Explorer view, go to the project's 'References' container
  • Choose 'Add Reference' from the context menu
  • Select the COM tab, choose the 'ActiveXperts SMS Component' component

The following code shows how to declare, create and use one of the SMS Component objects:

Imports AxSms

...

Dim objGsm As AxSms.Gsm                                ' Declaration
objGsm = New AxSms.Gsm()                               ' Creation

' Display version information
Console.WriteLine("ActiveXperts SMS Component {0}" & vbLf, objGsm.Version)

4.3. Visual C# .NET

Add a reference to the SMS Component object using the Visual C# Solution Explorer:

  • Start the Solution Explorer view, go to the project's 'References' container
  • Choose 'Add Reference' from the context menu
  • Select the COM tab, choose the 'ActiveXperts SMS Component' component

The following code shows how to declare, create and use one of the SMS Component objects:

using AxSms;

...
    
AxSms.Gsm objGsm;                                      // Declaration
objGsm = new AxSms.Gsm();                              // Creation

// Display version information
Console.WriteLine("ActiveXperts SMS Component {0}\n", objGsm.Version);

4.4. Visual Basic

The SMS Component can be used in Visual Basic 6.x or higher. In Visual Basic, go to the 'Project/References...' menu item and check the box next to SMS Component Type Library. Now, you can declare and create SMS Component objects.

The following code shows how to declare, create and use one of the SMS Component objects:

Dim objGsm As AxSms.Gsm                                ' Declaration
Set objGsm = New AxSms.Gsm                             ' Creation

' Display version information
Me.Caption = "ActiveXperts SMS Component " & objGsm.Version

4.5. Visual C++

ActiveXperts SMS Component can be used in Visual C++ projects. To do so:

  • Import: AxSms.tlb
  • Include: AxSmsConstants.h

The following code shows how to declare, create and use one of the SMS Component objects:

#import "AxSms.tlb"
#include "AxSmsConstants.h"

...

CoInitialize(NULL);                                    // Initialize COM

AxSms::IGsmPtr oGsm = NULL;                            // Declaration
oGsm.CreateInstance(__uuidof(AxSms::Gsm));             // Creation

' Display version information
_tprintf(_T("ActiveXperts SMS Component %s\n"), (LPCTSTR)oGsm->Version);

oGsm.Release();

CoUninitialize();

4.6. ASP Classic

To use the SMS Component objects in ASP classic make sure the component has been installed on the server.

The following code shows how to declare, create and use one of the SMS Component objects:

<html>
  <body>
    Version:
    <script language="vbscript" runat="server">
   
      Set objGsm = CreateObject("AxSms.Gsm")           ' Declaration and Creation

      ' Display version information
      Response.Write "ActiveXperts SMS Component " & objSmpp.Version

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

4.7. HTML/Javascript

On top of your HTML/Javascript code, refer to the ActiveXperts SMS Component in the following way:

<object codebase="http://activexperts.com/files/sms-component/cab/6.4/axsms32.cab" 
        classid="CLSID:B00F4729-F464-4690-88A0-E059489AF063" ></object>

The following code shows how to declare, create and use one of the SMS Component objects:

<script language="JavaScript" type="text/javascript">

  var objGsm = new ActiveXObject("AxSms.Gsm")          ' Declaration and Creation
  
  ' Display version information
  document.write("<h1>ActiveXperts SMS Component " + objGsm.Version + "</h1>");

</script>

4.8. Delphi 7.x or higher

First, add a reference to the SMS Component objects:

  • Go to Project->Import Type Library
  • Select 'ActiveXperts SMS Component Type Library'
  • Click 'Install'
  • The project 'dclusr.dpk' will be opened. Click 'Yes'

The following code shows how to declare, create and use one of the SMS Component objects:

program Project1;

{$APPTYPE CONSOLE}

' Use ActiveX, Windows and AXSMS_TLB
uses
  SysUtils, ActiveX, Windows,
  AXSMS_TLB;

var
 objGsm: Gsm;                                          ' Declaration

begin
  CoInitialize(nil);                                   ' Initialize COM

  objGsm := CoGsm.Create;                              ' Creation

  ' Display version information
  Writeln('ActiveXperts SMS Component ' + objGsm.Version);

  CoUninitialize
end.

5. Gsm

5.1. Introduction

The GSM protocol object is able to connect to most GSM modem devices. Either through the TAPI (Windows Telephony API) or directly through the COM interface. The GSM protocol only uses 'AT' commands to communicate with the device and send and receive messages.

In addition to sending and receiving SMS messages it's possible to send and receive custom commands. This could be used to, for instance, send a custom initialization string to the GSM modem before usage.

Send SMS using GSM modem

This sample will send out a single SMS messaging use the first TAPI device that's connected to the PC.

Set objGsm = CreateObject("AxSms.Gsm")                 ' Create GSM protocol object
Set objMessage = CreateObject("AxSms.Message")         ' Create SMS message object

' Show version information
WScript.Echo "SMS Component Version " & objGsm.Version & "; Build " & _
  objGsm.Build & "; Module " & objGsm.Module
WScript.Echo License Status: " & objGsm.LicenseStatus & vbCrLf

objGsm.Logfile = "log.txt"                             ' Keep a session log

' Open the first connected device
sDevName = objGsm.FindFirstDevice
objGsm.Open sDevName
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If

' Compose an SMS message
objMessage.ToAddress = "+31122334455"
objMessage.Body = "This is a short text message"

' Send an SMS message through the connected GSM modem device
objGsm.SendSms objMessage
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  objGsm.Close
  WScript.Quit 1
End If

' Make sure to close the device to allow other applications to access it.
objGsm.Close
WScript.Echo "Done !"

Receive SMS using GSM modem

Read all SMS messages and status reports that are already on the SIM and leave them on the SIM card

Set objGsm = CreateObject("AxSms.Gsm")                 ' Create GSM protocol object
Set objConst = CreateObject("AxSms.Constants")         ' Create global constants object
Set objMessage = CreateObject("AxSms.Message")         ' Create SMS message object

' Show version information
WScript.Echo "SMS Component Version " & objGsm.Version & "; Build " & _
  objGsm.Build & "; Module " & objGsm.Module
WScript.Echo "License Status: " & objGsm.LicenseStatus & vbCrLf

objGsm.Logfile = "log.txt"                             ' Keep a session log

' Open the first connected device
sDevName = objGsm.FindFirstDevice
objGsm.Open sDevName
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)    
  WScript.Quit 1
End If

' Receive messages from the SIM card and leave them on the SIM card
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  objGsm.Close
  WScript.Quit 1
End If

' Show all SMS messages
Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo objMessage.Body
  Set objMessage = objGsm.GetNextSms
Wend

' Show all status reports
Set objReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objReport.FromAddress & _
    "; reference: " & objReport.Reference
  Set objReport = objGsm.GetNextReport
Wend

' Make sure to close the device to allow other applications to access it.
objGsm.Close
WScript.Echo "Done !"

Using application ports

An SMS message can specify an application port. The usage of application ports is very much like the usage of ports in the IP based protocols. If a message specifies it's application ports it will specify both a source port as well as a destination port. The source port specifies which application sent the message. The destination port specifies to which application the message was intended.

An example of the use of application ports is the WAP Push message. A WAP Push message is a binary message which will push an URL to the MT. A WAP Push message will always be sent to application port 2948 where the Push application can pick-up the message and present it to the user.

Sending a message using an application port is just a matter of specifying the port(s) in either the 'ToAddress' of the message or the 'FromAddress' or both. For example, to send a message to "+31623350000" on port number "1000" use this:

Set objMessage = CreateObject("AxSms.Message")
...
objMessage.ToAddress = "31623350000:1000"

In this example the source port will be '0'. To also specify the source port use this:

Set objMessage = CreateObject("AxSms.Message")
...
objMessage.ToAddress = "31623350000:1000"
objMessage.FromAddress = ":1000"

To control the way message that are sent to a specific port are received you can use the property 'ExtractApplicationPort'

When this property is set to 'True' application port specifying UDH headers will be extracted from the SMS message and the application ports will be appended to the 'FromAddress' and the 'ToAddress' respectively. When this property is set to 'False' the application port specifying UDH headers will be ignored.

If the 'ExtractApplicationPort' property is set to true application ports will be properly extracted for 16 bit port headers as well as 8 bit port headers. When sending messages to a specific application port the 16 bit headers will always be used.

5.2. Properties

Property Type Read/Write Description
Version String Read Version number of the SMS Component
Build String Read Build number of the SMS Component
Module String Read Module name of the SMS Component
LicenseStatus String Out License Status
LicenseKey String In/Out License Key
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
Manufacturer String Read The manufacturer of the open device
Model String Read The model of the open device
Revision String Read The revision number of the open device
SerialNr String Read The serial number of the open device
AssembleMultipart Boolean Read/Write Whether multipart messages should be automatically assembled
ExtractApplicationPort Boolean Read/Write Whether the application port is extracted from the message
MessageMode Number Read/Write Whether the modem should be used in Text mode or PDU mode
PreferredSmsc String Read/Write Set the preferred SMSC
PrefixSmscMode Number Read/Write Whether or not to include the SMSC prefix in PDU's
SendEnabled Boolean Read Whether the GSM modem is able to send SMS messages
ReceiveEnabled Boolean Read Whether the GSM modem is able to receive SMS messages
ReportEnabled Boolean Read Whether the GSM modem is able to receive delivery reports
WaitForNetwork Boolean Read/Write Whether to wait for the device to register to a GSM network on open
NetworkTimeout Number Read/Write Timeout in milliseconds for registering on a GSM network
CommandTimeout Number Read/Write Timeout in milliseconds for sending commands to the device
InterCommandDelay Number Read/Write Time in milliseconds between sending commands to the device
InterCharacterDelay Number Read/Write Time in milliseconds between sending characters to the device

Version property

Return the version number of the SMS Component

Example:

Set objGsm = CreateObject("AxSms.Gsm")
WScript.Echo "SMS Component Version " & objGsm.Version & "; Build " & _
  objGsm.Build & "; Module " & objGsm.Module
WScript.Echo "License Status: " & objGsm.LicenseStatus & vbCrLf
...

Build property

Return the build number of the SMS Component.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
WScript.Echo "SMS Component Version " & objGsm.Version & "; Build " & _
objGsm.Build & "; Module " & objGsm.Module
WScript.Echo "License Status: " & objGsm.LicenseStatus & vbCrLf
...

Module property

Return the module name of the SMS Component.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
WScript.Echo "SMS Component Version " & objGsm.Version & "; Build " & _
objGsm.Build & "; Module " & objGsm.Module
WScript.Echo "License Status: " & objGsm.LicenseStatus & vbCrLf
...

LicenseStatus property

The status of your license. In case you have not licensed the product, the property holds the trial expiration date. For details, see Product Activation.

Example:

Set objGsm = CreateObject("AxSms.Gsm")                 ' Create new instance
WScript.Echo "License Status: " & objGsm.LicenseStatus
WScript.Echo "License Key: " & objGsm.LicenseKey

LicenseKey property

A license key is required to unlock this component after the trial period has expired. Assign the LicenseKey property every time a new instance of this component is created (see code below). Alternatively, the LicenseKey property can be set automatically. This requires the license key to be stored in the registry. For details, see Product Activation.

Example:

Set objGsm = CreateObject("AxSms.Gsm")                 ' Create new instance
objGsm.LicenseKey = "XXXXX-XXXXX-XXXXX"                ' Assign your license key 
WScript.Echo "LicenseKey: " & objGsm.LicenseKey

LastError property

Completion code of the last called method. To find the error description of a given error code, go to the online error codes codes page.

Example:

Set objGsm = CreateObject("AxSms.Gsm")  
...  
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
objGsm.SendSms objMessage
WScript.Echo "SendSms result:" &  objGsm.LastError ' Is message sent ?  
...

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the SMS Component will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

Set objGsm = CreateObject("AxSms.Gsm")   
objGsm.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
objGsm.SendSms objMessage
...

Manufacturer property

After opening a GSM device this property will return the manufacturer of the GSM device

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
sDevName = objGsm.FindFirstDevice
WScript.Echo "Opening: " & sDevName
objGsm.Open sDevName
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit
End If

WScript.Echo "Manufacturer: " & objGsm.Manufacturer
WScript.Echo "Model: " & objGsm.Model
WScript.Echo "Revision: " & objGsm.Revision
WScript.Echo "SerialNr: " & objGsm.SerialNr
...

Model property

After opening a GSM device this property will return the model of the GSM device

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
sDevName = objGsm.FindFirstDevice
WScript.Echo "Opening: " & sDevName
objGsm.Open sDevName
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit
End If

WScript.Echo "Manufacturer: " & objGsm.Manufacturer
WScript.Echo "Model: " & objGsm.Model
WScript.Echo "Revision: " & objGsm.Revision
WScript.Echo "SerialNr: " & objGsm.SerialNr
...

Revision property

After opening a GSM device this property will return the revision number of the GSM device

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
sDevName = objGsm.FindFirstDevice
WScript.Echo "Opening: " & sDevName
objGsm.Open sDevName
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit
End If

WScript.Echo "Manufacturer: " & objGsm.Manufacturer
WScript.Echo "Model: " & objGsm.Model
WScript.Echo "Revision: " & objGsm.Revision
WScript.Echo "SerialNr: " & objGsm.SerialNr
...

SerialNr property

After opening a GSM device this property will return the serial number of the GSM device

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
sDevName = objGsm.FindFirstDevice
WScript.Echo "Opening: " & sDevName
objGsm.Open sDevName
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit
End If

WScript.Echo "Manufacturer: " & objGsm.Manufacturer
WScript.Echo "Model: " & objGsm.Model
WScript.Echo "Revision: " & objGsm.Revision
WScript.Echo "SerialNr: " & objGsm.SerialNr
...

AssembleMultipart property

Set this property to true to have the SMS Component automatically assemble multipart messages on receiving them. If this property is set to false the SMS Component will return all of the individual parts on receiving a multipart message.

By default this property is set to true.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.AssembleMultipart = false
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If

Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo objMessage.Body
  Set objMessage = objGsm.GetNextSms
Wend
...

ExtractApplicationPort property

This property will only affect incoming SMS messages that contain an application port specifier. An SMS can contain an application port if it is meant to target a specific application. For example a WAP Push message will always have destination port 2948 to target the WAP Push application specifically.

If this property is set to 'True' the SMS Component will interpret the application port by appending the source port to the 'FromAddress' property and the destination port to the 'ToAddress' property separated by a colon character (':'). The SMS Component will remove the application port header from the SMS.

If this property is set to 'False' the SMS Component will not interpret the application port and leave the application port header in place. The application ports will not be added to the 'FromAddress' and 'ToAddress' properties.

By default this property is set to true.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.ExtractApplicationPort = false
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If

Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo objMessage.Body
  Set objMessage = objGsm.GetNextSms
Wend
...

MessageMode property

Most modems are able to send and receive SMS messages in either Text mode or PDU mode. In PDU mode all SMS Messaging features are available, in Text mode only a subset of the features are available. Some older or specific GSM modems only support Text mode. Set this value to one of these constants.

By default this value is set to 'GSM_MESSAGEFORMAT_AUTO'.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
Set objConst = CreateObject("AxSms.Constants")
Set objMessage = CreateObject("AxSms.Message")
...
objGsm.MessageMode = objConst.GSM_MESSAGEFORMAT_TEXT
objGsm.Open "COM1"
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...
objMessage.ToAddress = "+31611223344"
objMessage.Body = "I'm texting through the ActiveXperts SMS Component !"  
objGsm.SendSms(objMessage)
...

PreferredSmsc property

Use this property to set the preferred SMSC address. The SMSC address should be specified as an international number, including '+'.

The preferred SMSC should be set before calling the Open method.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
Set objConst = CreateObject("AxSms.Constants")
Set objMessage = CreateObject("AxSms.Message")
...
objGsm.PreferredSmsc = "+316540881000"
objGsm.Open "COM1"
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...
objMessage.ToAddress = "+31611223344"
objMessage.Body = "I'm texting through the ActiveXperts SMS Component !"  
objGsm.SendSms(objMessage)
...

PrefixSmscMode property

The prefix SMSC mode. Some GSM modems or older mobile phones don't support prefixing SMSC information in sending and/or receiving messages. Set this value to one of these constants.

By default this value is set to 'GSM_SMSPREFIX_AUTO'.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
Set objConst = CreateObject("AxSms.Constants")
Set objMessage = CreateObject("AxSms.Message")
...
objGsm.PrefixSmscMode = objConst.GSM_SMSPREFIX_DISABLED
objGsm.Open "COM1"
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...
objMessage.ToAddress = "+31611223344"
objMessage.Body = "I'm texting through the ActiveXperts SMS Component !"  
objGsm.SendSms(objMessage)
...

SendEnabled property

If the GSM modem is able to send SMS messages this property will return 'True'.

Example:

Set objGsm = CreateObject("AxSms.Gsm")   
...
objGsm.Open "COM1"
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If            
...
WScript.Echo "Modem capabilities:"
WScript.Echo "Receiving: " & objGsm.ReceiveEnabled
WScript.Echo "Sending: " & objGsm.SendEnabled
WScript.Echo "Delivery reports: " & objGsm.ReportEnabled
...

ReceiveEnabled property

If the GSM modem is able to receive SMS messages this property will return 'True'.

Example:

Set objGsm = CreateObject("AxSms.Gsm")   
...
objGsm.Open "COM1"
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If            
...
WScript.Echo "Modem capabilities:"
WScript.Echo "Receiving: " & objGsm.ReceiveEnabled
WScript.Echo "Sending: " & objGsm.SendEnabled
WScript.Echo "Delivery reports: " & objGsm.ReportEnabled
...

ReportEnabled property

If the GSM modem is able to receive delivery (status) reports this property will return 'True'.

Example:

Set objGsm = CreateObject("AxSms.Gsm")   
...
objGsm.Open "COM1"
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If            
...
WScript.Echo "Modem capabilities:"
WScript.Echo "Receiving: " & objGsm.ReceiveEnabled
WScript.Echo "Sending: " & objGsm.SendEnabled
WScript.Echo "Delivery reports: " & objGsm.ReportEnabled
...

WaitForNetwork property

This property specifies whether or not to wait for the device to register to a GSM network on calling the Open method.

After inserting the SIM card or switching on the power supply the device may require a couple of seconds to register to the GSM network. It is generally good practice to wait for this before continuing since sending out SMS messages before the device is registered on a network may result in an error.

De default value for this property is 'true'. Use the NetworkTimeout property to set maximum amount of time to wait.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.WaitForNetwork = true
objGsm.NetworkTimeout = 30000
objGsm.Open "COM2", "0000"
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...

NetworkTimeout property

This property specifies the maximum number of milliseconds to wait for the device to register to a GSM network on calling the Open method.

After inserting the SIM card or switching on the power supply the device may require a couple of seconds to register to the GSM network. It is generally good practice to wait for this before continuing since sending out SMS messages before the device is registered on a network may result in an error.

The default setting is 20000 milliseconds. Use the WaitForNetwork property to enable or disable waiting for registration.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.WaitForNetwork = true
objGsm.NetworkTimeout = 30000
objGsm.Open "COM2", "0000"
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...

CommandTimeout property

This controls the default timeout used for sending commands to the GSM device. For instance, the Open method sends a number of commands to the GSM device to make sure the device is in the correct state when the open function returns. This timeout controls how much time the Gsm object wait for a response from the device on each of these commands.

If the device does not respond within this timeout the operation has failed and LastError will be set to an error code.

The default setting is 10000 milliseconds (10 seconds).

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.NetworkTimeout = 30000
objGsm.CommandTimeout = 1000
objGsm.InterCommandDelay = 1000
objGsm.InterCharacterDelay = 100  
objGsm.Open "COM2", "0000"
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...

InterCommandDelay property

Some devices have trouble communicating at full speed and may need additional time between commands to process the commands properly. This property will support these devices by adding a set number of milliseconds of 'sleep' in between individual commands that are send to the device.

The default setting is 0 milliseconds (no delay).

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.NetworkTimeout = 30000
objGsm.InterCommandDelay = 1000
objGsm.InterCharacterDelay = 100  
objGsm.Open "COM2", "0000"
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...

InterCharacterDelay property

Some devices have trouble communicating at full speed and may need additional time between characters to process commands properly. This property will support these devices by adding a set number of milliseconds of 'sleep' in between individual characters that are send to the device.

The default setting is 0 milliseconds (no delay).

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.NetworkTimeout = 30000
objGsm.InterCommandDelay = 1000
objGsm.InterCharacterDelay = 100
objGsm.Open "COM2", "0000"
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...

5.3. Methods

Method Description
Clear Reset all properties to their default values
SaveLicenseKey Save the License Key in the registry
GetErrorDescription Get the description of the given error
Sleep Sleep for the specified number of milliseconds
FindFirstDevice Find the first connected Windows telephony device
FindNextDevice Find the next connected Windows telephony device
FindFirstPort Find the first COM port on this PC
FindNextPort Find the next COM port on this PC
Open Open a Windows telephony device or COM port
Close Close the device
SendCommand Send a custom command to the connected device
ReadResponse Read a string from the connected device
SendSms Send an SMS Message
Receive Receive SMS messages and status reports
DeleteSms Delete an SMS message
DeleteReport Delete a GsmDeliveryReport
GetFirstSms Get the first received SMS message
GetNextSms Get the next received SMS message
GetFirstReport Get the first received status report
GetNextReport Get the next received status report

Clear method

This method resets all properties to their default values.

Parameters:

  • None

Return value:

Always 0.

Example:
Set objGsm = CreateObject("AxSms.Gsm")
....
objGsm.Clear
...

SaveLicenseKey method

Description:

Use SaveLicenseKey to store the license key permanently in the registry. When a license key is saved, it is restored automatically every time a new instance of the object ('Gsm') is created. It is not recommended to save the license key if you distribute the component with your own software, because the key can be easily used by others.

Parameters:

  • None.
Return value:

Always 0. Check LastError property to see if the method was completed successfully.

Example:

Set objGsm = CreateObject("AxSms.Gsm")                 ' Create new instance
objGsm.LicenseKey = "XXXXX-XXXXX-XXXXX"
objGsm.SaveLicenseKey                                     ' Save license key to registry

For more information, see Product Activation.

GetErrorDescription method

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
Set objGsm = CreateObject("AxSms.Gsm")   
objGsm.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
objGsm.SendSms objMessage
WScript.Echo "SendSms result: " & objGsm.LastError & ", " & _
  objGsm.GetErrorDescription(objGsm.LastError)

Sleep method

This method suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
Set objGsm = CreateObject("AxSms.Gsm")
....
objGsm.Sleep 1000
...

FindFirstDevice method

This method finds the first of the connected Windows telephony devices. Use this in combination with FindNextDevice to get a list of connected telephony devices.

Parameters:

  • None

Return value:

The name of the first connected Windows telephony device

Example:
Set objGsm = CreateObject("AxSms.Gsm")
...
WScript.Echo "Connected devices: "
sDevName = objGsm.FindFirstDevice
While objGsm.LastError = 0
  WScript.Echo sDevName
  sDevName = objGsm.FindNextDevice
WEnd

FindNextDevice method

This method find the next of the connected Windows telephony devices. Use this in combination with FindFirstDevice to get a list of connected telephony devices.

Parameters:

  • None

Return value:

The name of the next connected Windows telephony device

Example:
Set objGsm = CreateObject("AxSms.Gsm")
...
WScript.Echo "Connected devices: "
sDevName = objGsm.FindFirstDevice
While objGsm.LastError = 0
  WScript.Echo sDevName
  sDevName = objGsm.FindNextDevice
WEnd

FindFirstPort method

This method finds the first COM port on this PC. Use this in combination with FindNextPort to get a list of COM ports on the PC.

Parameters:

  • None

Return value:

The name of the first COM port on this PC

Example:
Set objGsm = CreateObject("AxSms.Gsm")
...
WScript.Echo "Available COM ports: "
sPortName = objGsm.FindFirstPort
While objGsm.LastError = 0
  WScript.Echo sPortName
  sPortName = objGsm.FindNextPort
WEnd

FindNextPort method

This method find the next COM port on this PC. Use this in combination with FindFirstPort to get a list of COM ports on the PC.

Parameters:

  • None

Return value:

The name of the next COM port on this PC

Example:
Set objGsm = CreateObject("AxSms.Gsm")
...
WScript.Echo "Available COM ports: "
sPortName = objGsm.FindFirstPort
While objGsm.LastError = 0
  WScript.Echo sPortName
  sPortName = objGsm.FindNextPort
WEnd

Open method

This method opens the specified Windows telephony device or COM port. COM ports should be specified as 'COMn' where n is the number. Windows telephony devices should be specified by using the full name.

Parameters:

  • Name of the COM port of the Telephony device
  • (Optional) PIN number or an empty string
  • (Optional) Baudrate option, can be one of these constants

Return value:

Always 0.

Example:
Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Open "COM2", "0000"
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...

Close method

Closes any open device handles.

Parameters:

  • None

Return value:

Always 0.

Example:
Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Open "COM2", "0000"
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...
objGsm.Close

SendCommand method

With this method you can send a custom command to the connected device.

Parameters:

  • Command to send to the device

Return value:

Always 0.

Example:
Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.SendCommand "ATI"
sResp = objGsm.ReadResponse(1000)
While sResp <> "OK"
  WScript.Echo "  " & sResp
  sResp = objGsm.ReadResponse(1000)
WEnd

ReadResponse method

With this method you can read data from a connected device

Parameters:

  • (Optional) Timeout

Return value:

Data from the connected device or an empty string is no data is available

Example:
Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.SendCommand "ATI"
sResp = objGsm.ReadResponse(1000)
While sResp <> "OK"
  WScript.Echo "  " & sResp
  sResp = objGsm.ReadResponse(1000)
WEnd

SendSms method

This method sends an SMS message through the connected device.

Parameters:

  • The Message object
  • (Optional) Multipart flag, can be one of these constants
  • (Optional) Timeout in seconds

Return value:

The message reference(s). If it's a multipart message the references of the individual parts are comma separated.

Example:
Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
...
objGsm.SendSms objMessage
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  objGsm.Close
  WScript.Quit 1
End If

Receive method

This method receives SMS messages and status reports from the connected device. After calling this method use GetFirstSms/GetNextSms and GetFirstReport/GetNextReport to get the Message and GsmDeliveryReport objects.

Parameters:

  • Message status, can be one of these constants
  • (Optional) Whether or not to delete messages after receiving them
  • (Optional) Which storage type to use, can be one of these constants
  • (Optional) Receive timeout

Return value:

Always 0.

Example:
Set objGsm = CreateObject("AxSms.Gsm")
Set objConst = CreateObject("AxSms.Constants")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...

DeleteSms method

Use this method to delete SMS messages. The message will be removed from the storage it was retrieved from.

Parameters:

Return value:

Always 0.

Example:
Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = objGsm.GetFirstSms
...
While objGsm.LastError = 0
  If objMessage.FromAddress = "+31122334455" Then
    objGms.DeleteSms objMessage
  Else
    WScript.Echo "Received from: " & objMessage.FromAddress    
    WScript.Echo objMessage.Body
  End If
  Set objMessage = objGsm.GetNextSms
Wend
...

DeleteReport method

Use this method to delete delivery reports. The delivery report will be removed from the storage it was retrieved from.

Parameters:

Return value:

Always 0.

Example:
Set objGsm = CreateObject("AxSms.Gsm")
Set objReport = objGsm.GetFirstReport
...
While objGsm.LastError = 0
  If objReport.Reference <> "1" Then
    objGms.DeleteReport objReport
  Else
    WScript.Echo "Received reference: " & objReport.Reference    
    WScript.Echo objReport.Body
  End If
  Set objReport = objGsm.GetNextReport
Wend
...

GetFirstSms method

This method gets the first SMS message that was received through the Receive method.

Parameters:

  • None

Return value:

An SMS message

Example:
Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...
Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo objMessage.Body
  Set objMessage = objGsm.GetNextSms
Wend

GetNextSms method

This method gets the next SMS message that was received through the Receive method.

Parameters:

  • None

Return value:

An SMS message

Example:
Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...
Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo objMessage.Body
  Set objMessage = objGsm.GetNextSms
Wend

GetFirstReport method

This method gets the first delivery report that was received through the Receive method.

Parameters:

  • None

Return value:

A GSM delivery report

Example:
Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...            
Set objReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objReport.FromAddress & _
    "; reference: " & objReport.Reference
  Set objReport = objGsm.GetNextReport
WEnd

GetNextReport method

This method gets the next delivery report that was received through the Receive method.

Parameters:

  • None

Return value:

A GSM delivery report

Example:
Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If            
...
Set objReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objReport.FromAddress & _
    "; reference: " & objReport.Reference
  Set objReport = objGsm.GetNextReport
WEnd

6. Smpp

6.1. Introduction

The Smpp protocol object can be used to connect to remote SMSC's (SMS Centers) that support the SMPP protocol. The SMPP protocol supports sending and receiving SMS messages using only an internet connection. It's primarily used for high volumes / high performance applications.

This SMPP implementation is completely asynchronous for maximum performance. To facilitate this the component keeps an internal queue of incoming and outgoing messages. This is why the component does not support a 'send message' method but rather an 'submit message' method.

Send SMS using SMPP

Send an SMS though the SMPP protocol and wait for the server to return with a reference for this message

Set objSmpp = CreateObject("AxSms.Smpp")               ' Create SMPP protocol object
Set objConst = CreateObject("AxSms.Constants")         ' Create global constants object
Set objMessage = CreateObject("AxSms.Message")         ' Create SMS message object

' Show version information
WScript.Echo "SMS Component Version " & objSmpp.Version & "; Build " & _
objSmpp.Build & "; Module " & objSmpp.Module
WScript.Echo "License Status: " & objSmpp.LicenseStatus & vbCrLf

objSmpp.LogFile = "log.txt"                            

' Connect to the remote SMPP server
objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  WScript.Quit 1
End If

' Create a bind on the SMPP server
objSmpp.Bind objConst.SMPP_BIND_TRANSCEIVER, "CE658B84", "FAC1982E", "", _
objConst.SMPP_VERSION_34, 0, 0, "", 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  objSmpp.Disconnect
  WScript.Quit 1
End If

' Compose an SMS message. Make sure to assign an ID to the UserTag value to be able to
' recognise this message again when it has received a message reference.
objMessage.UserTag = 1
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"

' Send the SMS message through SMPP protocol
objSmpp.SubmitSms objMessage
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  objSmpp.Disconnect
  WScript.Quit 1
End If

' Wait for Sms updates to receive a message reference from the SMPP server
If objSmpp.WaitForSmsUpdate(1000) Then
  Set objMessage = objsmpp.FetchSmsUpdate
  If objSmpp.LastError = 0 Then
    WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag
    WScript.Sleep 1
  End If
Else
  WScript.Echo "Timeout while waiting for a response from the server"
End If

WScript.Echo "Done !"

' Unbind and disconnect if the server does not disconnect us after unbinding
objSmpp.Unbind
objSmpp.Disconnect

Receive SMS using SMPP

Receive SMS messages on an SMPP connection.

Set objSmpp = CreateObject("AxSms.Smpp")               ' Create the SMPP protocol object
Set objConst = CreateObject("AxSms.Constants")         ' Create the global constants object

WScript.Echo "SMS Component Version " & objSmpp.Version & "; Build " & _
objSmpp.Build & "; Module " & objSmpp.Module
WScript.Echo "License Status: " & objSmpp.LicenseStatus & vbCrLf

objSmpp.LogFile = "log.txt"                           

' Connect to the remote SMPP server
objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  WScript.Quit 1
End If

' Create a bind on the SMPP server
objSmpp.Bind objConst.SMPP_BIND_TRANSCEIVER, "CE658B84", "FAC1982E", "", _
objConst.SMPP_VERSION_34, 0, 0, "", 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  objSmpp.Disconnect
  WScript.Quit 1
End If

' While bound, show all incoming messages
WScript.Echo "Waiting for incoming messages..."
While objSmpp.IsBound

  Set objMessage = objSmpp.ReceiveMessage()
  While objSmpp.LastError = 0
    If objMessage.SmppIsDeliveryReport Then
      WScript.Echo "Delivery rpt for: " & Left(objMessage.Body, InStr(objMessage.Body, " ")) & _
        "State: " & Mid(objMessage.Body, InStr(objMessage.Body, "stat:")+5, 7)      
    Else
      WScript.Echo "Received toaddress: " & objMessage.ToAddress
      WScript.Echo "Body: " & objMessage.Body      
    End If
    Set objMessage = objSmpp.ReceiveMessage()      
  Wend

  objSmpp.Sleep 1000
Wend

WScript.Echo "Done !"

' Unbind and disconnect if the server does not disconnect us after unbinding
objSmpp.Unbind
objSmpp.Disconnect

Using application ports

An SMS messages can specify an application port. The usage of application ports is very much like the usage of ports in the IP based protocols. If a message specifies it's application ports it will specify both a source port as well as a destination port. The source port specifies which application send the message. The destination port specifies to which application the message was intended.

An example of the use of application ports is the WAP Push message. A WAP Push message is a binary message which will push an URL to the MT. A WAP Push message will always be send to application port 2948 where the Push application can pick-up the message and present it to the user.

To send a message using an application port you just need to specify the port(s) in either the 'ToAddress' of the message or the 'FromAddress' or both. For example, to send a message to "+31623350000" on port number "1000" use this:

Set objMessage = CreateObject("AxSms.Message")
...
objMessage.ToAddress = "31623350000:1000"

In this example the source port will be '0'. To also specify the source port use this:

Set objMessage = CreateObject("AxSms.Message")
...
objMessage.ToAddress = "31623350000:1000"
objMessage.FromAddress = "ActiveXprts:1000"

To control the way message that are send to a specific port are received you can use the property 'ExtractApplicationPort'

When this property is set to 'True' application port specifying UDH headers will be extracted from the SMS message and the application ports will be appended to the 'FromAddress' and the 'ToAddress' respectively. When this property is set to 'False' the application port specifying UDH headers will be ignored.

If the 'ExtractApplicationPort' property is set to true application ports will be properly extracted for 16 bit port headers as well as 8 bit port headers. When sending messages to a specific application port the 16 bit headers will always be used.

6.2. Properties

Property Type Read/Write Description
Version String Read Version number of the SMS Component
Build String Read Build number of the SMS Component
Module String Read Module name of the SMS Component
LicenseStatus String Out License Status
LicenseKey String In/Out License Key
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
LogPduDetails Boolean Read/Write Enable detailed PDU logging
AssembleMultipart Boolean Read/Write Whether multipart messages should be automatically assembled
MultipartTimeout Number Read/Write Number of seconds before an incomplete multipart message is returned
ExtractApplicationPort Boolean Read/Write Whether the application port is extracted from the message
MultipartMode Number Read/Write Specify how multipart messages should be sent
SubmitMode Number Read/Write Specify how SMS messages should be submitted to the SMSC
IsConnected Boolean Read Whether the SMPP component is connected
IsBound Boolean Read Whether the SMPP component is bound
UseGsmEncoding Boolean Read/Write User GSM encoding for text messages
MaxOutPendingPdus Number Read/Write Maximum number of outstanding PDU's
PduTimeout Number Read/Write Number of milliseconds before an outstanding PDU will timeout
EnquireInterval Number Read/Write Number of milliseconds between 'Enquire' commands
MaxSmsSubmissions Number Read/Write Maximum length of the SMS message queue
MaxSmsQueries Number Read/Write Maximum length of the SMS query queue
MaxSmsReceived Number Read/Write Maximum length of the received SMS queue
SmsSentPerSecond Number Read Number of SMS messages sent per second
SmsReceivedPerSecond Number Read Number of SMS messages received per second

Version property

Return the version number of the SMS Component

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
WScript.Echo "SMS Component Version " & objSmpp.Version & "; Build " & _
  objSmpp.Build & "; Module " & objSmpp.Module
WScript.Echo "License Status: " & objSmpp.LicenseStatus & vbCrLf
...

Build property

Return the build number of the SMS Component.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
WScript.Echo "SMS Component Version " & objSmpp.Version & "; Build " & _
  objSmpp.Build & "; Module " & objSmpp.Module
WScript.Echo "License Status: " & objSmpp.LicenseStatus & vbCrLf
...

Module property

Return the module name of the SMS Component.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
WScript.Echo "SMS Component Version " & objSmpp.Version & "; Build " & _
  objSmpp.Build & "; Module " & objSmpp.Module
WScript.Echo "License Status: " & objSmpp.LicenseStatus & vbCrLf
...

LicenseStatus property

The status of your license. In case you have not licensed the product, the property holds the trial expiration date. For details, see Product Activation.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")               ' Create new instance
WScript.Echo "License Status: " & objSmpp.LicenseStatus
WScript.Echo "License Key: " & objSmpp.LicenseKey

LicenseKey property

A license key is required to unlock this component after the trial period has expired. Assign the LicenseKey property every time a new instance of this component is created (see code below). Alternatively, the LicenseKey property can be set automatically. This requires the license key to be stored in the registry. For details, see Product Activation.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")               ' Create new instance
objSmpp.LicenseKey = "XXXXX-XXXXX-XXXXX"               ' Assign your license key 
WScript.Echo "LicenseKey: " & objSmpp.LicenseKey

LastError property

Completion code of the last called method. To find the error description of a given error code, go to the online error codes codes page.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")  
...  
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
objSmpp.SubmitSms objMessage
WScript.Echo "Send SMS result: " &  objSmpp.LastError    ' Is our message sent ?  
...

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the SMS Component will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")  
objSmpp.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
objSmpp.SubmitSms objMessage
...

LogPduDetails property

The SMPP protocol primitives are called 'Protocol Data Units' (PDU's). Set this property to true to add a detailed description of every PDU that's send or received including a HEX dump.

Set objSmpp = CreateObject("AxSms.Smpp")  
objSmpp.LogFile = "C:\temp\log.txt"
objSmpp.LogPduDetails = True
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
objSmpp.SubmitSms objMessage
...

AssembleMultipart property

Set this property to true to have the SMS Component automatically assemble multipart messages on receiving them. If this property is set to false the SMS Component will return all of the individual parts on receiving a multipart message.

By default this property is set to true.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
objSmpp.AssembleMultipart = false
While objSmpp.IsBound

  Set objMessage = objSmpp.ReceiveMessage()
  While objSmpp.LastError = 0
    WScript.Echo "Received toaddress: " & objMessage.ToAddress
    WScript.Echo "Body: " & objMessage.Body
    Set objMessage = objSmpp.ReceiveMessage()
  WEnd

  objSmpp.Sleep 1000
WEnd
...

MultipartTimeout property

Set this property to the number of seconds that the client should wait for a multipart message to complete. If a multipart message is received but it could not be assembled from all of its parts within this time the message will be returned anyway.

Parts that are missing will be marked with the text '**Missing Part!**'. The 'Incomplete' property of the SMS Message will be set to true.

This property will only be applied when the AssembleMultipart property is set to 'True'. Set this property to 0 to disable the timeout and wait indefinitely for a multipart message to complete.

Default is set to 300 seconds.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
...
objSmpp.LogFile = "log.txt"
objSmpp.AssembleMultipart = True
objSmpp.MultipartTimeout = 600
objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  WScript.Quit 1
End If
...

ExtractApplicationPort property

This property will only affect incoming SMS messages that contain an application port specifier. An SMS can contain an application port if it is meant to target a specific application. For example a WAP Push message will always have destination port 2948 to target the WAP Push application specifically.

If this property is set to 'True' the SMS Component will interpret the application port by appending the source port to the 'FromAddress' property and the destination port to the 'ToAddress' property separated by a colon character (':'). The SMS Component will remove the application port header from the SMS.

If this property is set to 'False' the SMS Component will not interpret the application port and leave the application port header in place. The application ports will not be added to the 'FromAddress' and 'ToAddress' properties.

By default this property is set to true.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
objSmpp.ExtractApplicationPort = false
While objSmpp.IsBound

  Set objMessage = objSmpp.ReceiveMessage()
  While objSmpp.LastError = 0
    WScript.Echo "Received toaddress: " & objMessage.ToAddress
    WScript.Echo "Body: " & objMessage.Body
    Set objMessage = objSmpp.ReceiveMessage()
  WEnd

  objSmpp.Sleep 1000
WEnd
...

MultipartMode property

In combination with the Multipart flag this property specifies how multipart messages should be sent if they should be automatically formatted as multipart.

This property does not affect how multipart messages are received. Incoming multipart messages will be correctly recognized if they use 8bit or 16 bit UDH's, SAR TLV's or Payload TLV's.

By default this property is set to SMPP_MULTIPARTMODE_UDH

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objConst = CreateObject("AxSms.Constants")
...
objSmpp.LogFile = "log.txt"
objSmpp.MultipartMode = objConst.SMPP_MULTIPARTMODE_SARTLV
objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  WScript.Quit 1
End If
...

SubmitMode property

This property indicates how SMS messages should be submitted to the SMSC.

If SMPP_SUBMITMODE_DATASM is selected the multipart mode should be set to SMPP_MULTIPARTMODE_PAYLOADTLV.

Incoming messages, whether 'data_sm' or 'submit_sm', will always be received, regardless of this setting.

By default this property is set to SMPP_SUBMITMODE_SUBMITSM

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objConst = CreateObject("AxSms.Constants")
...
objSmpp.LogFile = "log.txt"
objSmpp.SubmitMode = objConst.SMPP_SUBMITMODE_DATASM
objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  WScript.Quit 1
End If
...

IsConnected property

This property reflects whether the SMPP component is connected to the SMPP server. The property becomes false when the SMPP connection is interrupted or the Disconnect method is called.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
...
While objSmpp.IsConnected
  ...
  objSmpp.Sleep 1000
WEnd

IsBound property

This property reflects whether the SMPP component is bound to the SMPP server. This property becomes false when the SMPP session is unbind or disconnected or when the connection is interrupted.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
...
While objSmpp.IsBound
  ...
  objSmpp.Sleep 1000
WEnd

UseGsmEncoding property

Set this property to indicate whether GSM encoding should be used for incoming or outgoing text messages. Use one of these constants.

This only applies when the datacoding property is set to DATACODING_DEFAULT .

By default this is set to SMPP_USEGSMENCODING_DISABLED

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
Set objConst = CreateObject("AxSms.Constants")
...
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"

objSmpp.UseGsmEncoding = objConst.SMPP_USEGSMENCODING_INANDOUT
objSmpp.SubmitSms objMessage
...

MaxOutPendingPdus property

This property sets the maximum number of PDU's that can be pending for a reply from the server.

This number should be specified by the provider. If the provider does not specify this number it's safe to leave it on the default value.

Default is set to 10 PDU's

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
...
objSmpp.LogFile = "log.txt"
objSmpp.MaxOutPendingPdus = 100
objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  WScript.Quit 1
End If
...

PduTimeout property

Set this property to the number of milliseconds the server has to react to a given PDU before it times out. When a server fails to react to an outstanding PDU in a timely matter the connection will be closed.

Default is set to 5000 milliseconds

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
...
objSmpp.LogFile = "log.txt"
objSmpp.PduTimeout = 1000
objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  WScript.Quit 1
End If
...

EnquireInterval property

Set this property to the number of milliseconds between enquire commands. An enquire command is send to the server at regular intervals to keep the connection alive.

Default is set to 30000 milliseconds

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
...
objSmpp.LogFile = "log.txt"
objSmpp.EnquireInterval = 60000
objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  WScript.Quit 1
End If
...

MaxSmsSubmissions property

SMS Messages that are submitted to the SMS Component using the SubmitSms method are queued in the SMS message queue to be sent out at the earliest convenience though the SMPP connection.

Usually, in low volumes, the SMS message will be sent out immediately. On high volumes SMS messages may be queued if the SMSC side is unable to handle the messages as fast as they are submitted. This property sets the maximum size of the SMS submission queue.

The current size of the SMS submission queue can be found by calling CountSmsSubmitSpace.

Default is set to 100 SMS messages

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
...
objSmpp.LogFile = "log.txt"
objSmpp.MaxSmsSubmissions = 1000
objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  WScript.Quit 1
End If
...

MaxSmsQueries property

SMS queries that are submitted to the SMS Component using the QuerySms method are queued in the SMS queries queue to be sent out at the earliest convenience though the SMPP connection.

Usually, in low volumes, the SMS queries will be sent out immediately. On high volumes SMS queries may be queued if the SMSC side is unable to handle the queries as fast as they are submitted. This property sets the maximum size of the query submission queue.

The current size of the SMS submission queue can be found by calling CountSmsQuerySpace.

Default is set to 100 SMS queries

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
...
objSmpp.LogFile = "log.txt"
objSmpp.MaxSmsQueries = 1000
objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  WScript.Quit 1
End If
...

MaxSmsReceived property

This is the maximum number of SMS messages that can be received by the SMS Component while connected. If this limit is exceeded the SMS Component will respond with 'SMPP_ESME_RMSGQFUL' to incoming messages.

Messages can be taken off this queue by calling 'ReceiveMessage'.

Default is set to 100 incoming SMS messages

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
...
objSmpp.LogFile = "log.txt"
objSmpp.MaxSmsReceived = 1000
objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  WScript.Quit 1
End If
...

SmsSentPerSecond property

The number of SMS messages sent per second. This includes messages that will be rejected by the server.

This is informative. It can be used for performance measurements.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
...
While objSmpp.IsBound
  ...
  WScript.Echo "Sent: " & objSmpp.SmsSentPerSecond
  WScript.Echo "Received: " & objSmpp.SmsReceivedPerSecond
  ...
WEnd

SmsReceivedPerSecond property

The number of SMS messages received per second.

This is informative. It can be used for performance measurements.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
...
While objSmpp.IsBound
  ...
  WScript.Echo "Sent: " & objSmpp.SmsSentPerSecond
  WScript.Echo "Received: " & objSmpp.SmsReceivedPerSecond
  ...
WEnd

6.3. Methods

Method Description
Clear Reset all properties to their default values
SaveLicenseKey Save the License Key in the registry
GetErrorDescription Get the description of the given error
Sleep Sleep for the specified number of milliseconds
Connect Connect to an SMPP server
Bind Bind a session after connecting to an SMPP server
Unbind Unbind a session
Disconnect Disconnect from an SMPP server
AddBindTlv Add a TLV which should be send on a 'Bind'
SubmitSms Submit an SMS message to the SMSC
WaitForSmsUpdate Wait for an update on a 'submitted' or 'queried' SMS message
FetchSmsUpdate Fetch an updated SMS message object
QuerySms Query the status of an outgoing SMS message
ReceiveMessage Receive an incoming message
CountSmsSubmitSpace Count the space available in the SMS submit queue
CountSmsQuerySpace Count the space available in the query submit queue
CountSmsReceived Count the number of received SMS messages in the SMS queue
FetchNotUpdated Fetch message that was submitted but not updated
FetchNotSubmitted Fetch message that was submitted but not sent to the SMPP server
CountSmsReceived Count the number of received SMS messages in the SMS queue
GetFirstPart Split up a multipart message, get the first part.
GetNextPart Split up a multipart message, get the next part.
CountParts Count the number of parts required for a message.
AssembleSms Assemble a multipart SMS from its parts.
GetAssembledSms Get the first available assembled SMS.
ResetSmsAssembler Reset the SMS assembler cache.

Clear method

This method resets all properties to their default values.

Parameters:

  • None

Return value:

Always 0.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")   
....
objSmpp.Clear
...

SaveLicenseKey method

Description:

Use SaveLicenseKey to store the license key permanently in the registry. When a license key is saved, it is restored automatically every time a new instance of the object ('Smpp') is created. It is not recommended to save the license key if you distribute the component with your own software, because the key can be easily used by others.

Parameters:

  • None.
Return value:

Always 0. Check LastError property to see if the method was completed successfully.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")               ' Create new instance
objSmpp.LicenseKey = "XXXXX-XXXXX-XXXXX"
objSmpp.SaveLicenseKey                                    ' Save license key to registry

For more information, see Product Activation.

GetErrorDescription method

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
objSmpp.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
objSmpp.SubmitSms objMessage
WScript.Echo "SubmitSms result: " & objSmpp.LastError & ", " & _
  objSmpp.GetErrorDescription(objSmpp.LastError)

Sleep method

This method suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
....
objSmpp.Sleep 1000
...

Connect method

This method connects to the specified SMPP server.

If the host name resolves to an IPv6 as well as an IPv4 address the SMPP component will try to connect to the IPv6 address first and connect to the IPv4 address only if connecting to IPv6 fails.

Parameters:

  • Host to connect to
  • Port to connect to
  • Timeout before the connection fails

Return value:

Always 0.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
....
objSmpp.LogFile = "log.txt"
objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  WScript.Quit 1
End If
...

Bind method

This method creates a 'Bind' session on the connected server. To be able to send or receive messages connection needs to be bound.

Parameters:

  • Type of bind, can be one of these constants
  • SystemId
  • Password
  • SystemType
  • Version, can be one of these constants
  • Ton, can be one of these constants
  • Npi, can be one of these constants
  • Address range
  • Timeout

Return value:

Always 0.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objConst = CreateObject("AxSms.Constants")
...
objSmpp.Bind objConst.SMPP_BIND_TRANSCEIVER, "CE658B84", "FAC1982E", "", & _
  objConst.SMPP_VERSION_34, 0, 0, "", 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  objSmpp.Disconnect
  WScript.Quit 1
End If

Unbind method

Unbind a session on the server. This will cause most servers to close the connection.

Parameters:

  • None

Return value:

Always 0.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objConst = CreateObject("AxSms.Constants")
...
objSmpp.Bind objConst.SMPP_BIND_TRANSCEIVER, "CE658B84", "FAC1982E", "", & _
  objConst.SMPP_VERSION_34, 0, 0, "", 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  objSmpp.Disconnect
  WScript.Quit 1
End If
...
objSmpp.Unbind
objSmpp.Disconnect

Disconnect method

Disconnect a from a server.

Parameters:

  • None

Return value:

Always 0.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objConst = CreateObject("AxSms.Constants")
...
objSmpp.Bind objConst.SMPP_BIND_TRANSCEIVER, "CE658B84", "FAC1982E", "", & _
  objConst.SMPP_VERSION_34, 0, 0, "", 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  objSmpp.Disconnect
  WScript.Quit 1
End If
...
objSmpp.Unbind
objSmpp.Disconnect

AddBindTlv method

Add a TLV to the list of TLV's to be send with a session Bind

Parameters:

Return value:

Always 0.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objTlv = CreateObject("AxSms.Tlv")
...  
objTlv.Tag = 101
objTlv.ValueAsString = "Hello, World !"
objSmpp.AddBindTlv objTlv
objSmpp.Bind objConst.SMPP_BIND_TRANSCEIVER, "CE658B84", "FAC1982E", "", & _
  objConst.SMPP_VERSION_34, 0, 0, "", 2000
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  objSmpp.Disconnect
  WScript.Quit 1
End If
...

SubmitSms method

Submit an SMS message. This message will be added to the internal queue of outgoing messages The messages are sent asynchronously directly after adding them to the queue. To get the status and reference ID of these message use the FetchSmsUpdate method.

Parameters:

Return value:

Always 0.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"

objSmpp.SubmitSms objMessage
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  objSmpp.Disconnect
  WScript.Quit 1
End If
...

WaitForSmsUpdate method

If a message is submitted or if a message was queried this method will return if there is an update available for this message.

Because either submitting or querying a message is always an asynchronous operation the results of this operation will never be immediately available. This method can be used to wait until more information is available. If this method returns 'True' an updated SMS object can be retrieved using the FetchSmsUpdate method.

Parameters:

  • The maximum time to wait in milliseconds

Return value:

Wether there are SMS updates.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
While objSmpp.WaitForSmsUpdate
  Set objMessage = objsmpp.FetchSmsUpdate
  If objSmpp.LastError = 0 Then
    WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag
    WScript.Sleep 1
  End If
WEnd

FetchSmsUpdate method

Returns a message from the internal outgoing or query queue and remove this message from the queue. Use this method to get the status for messages that have been queued using SubmitSms or QuerySms.

Parameters:

  • None

Return value:

Always 0.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
objSmpp.SubmitSms objMessage
...
While objSmpp.WaitForSmsUpdate
  Set objMessage = objsmpp.FetchSmsUpdate
  If objSmpp.LastError = 0 Then
    WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag
    WScript.Sleep 1
  End If
WEnd

QuerySms method

Query the status of an outgoing message. This is an asynchronous operation, the message will be added to the internal queue. Use the FetchSmsUpdate method to get the status of these messages.

Note: This is not the preferred method of getting SMS status information on SMPP 3.4 or higher. Use 'RequestDeliveryReport' instead.

Parameters:

Return value:

Always 0.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
objSmpp.QuerySms objMessage
...
While objSmpp.WaitForSmsUpdate
  Set objMessage = objsmpp.FetchSmsUpdate
  If objSmpp.LastError = 0 Then
    WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag
    WScript.Sleep 1
  End If
WEnd

ReceiveMessage method

Receives an incoming message. Messages are buffered internally, calling this method will return the first received message and remove it from the internal buffer.

Parameters:

  • None

Return value:

SMS Message object

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
While objSmpp.IsBound

  Set objMessage = objSmpp.ReceiveMessage()
  While objSmpp.LastError = 0
    WScript.Echo "Received toaddress: " & objMessage.ToAddress
    WScript.Echo "Body: " & objMessage.Body     
    Set objMessage = objSmpp.ReceiveMessage()
  WEnd

  objSmpp.Sleep 1000
WEnd
...

CountSmsSubmitSpace method

This method returns the minimum number of SMS messages that can be added to the 'submit queue' using SubmitSms.

Use MaxSmsSubmissions to set the maximum number of SMS submissions in the SMS queue.

Parameters:

  • None

Return value:

The number of messages that can be added using SubmitSms

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
Set objCon = CreateObject("ADODB.Connection") 
Set objRs = CreateObject("ADODB.Recordset")   
...
While objSmpp.IsBound
  ...
  iMax = objSmpp.CountSmsSubmitSpace
  strQ = "SELECT TOP(" & iMax & ") FROM Messages"
  Set objRs = objCon.Execute(strQ)
  ...
  While Not objRs.EOF
    objMessage.ToAddress = objRs("ToAddress")
    objSmpp.SubmitSms objMessage
    ...
    objRs.MoveNext
  WEnd
  ...
  objSmpp.Sleep 1000
WEnd
...

CountSmsQuerySpace method

This method returns the minimum number of SMS messages that can be added to the 'submit queue' using Query.

Use MaxSmsQueries to set the maximum number of queries in the query queue.

Parameters:

  • None

Return value:

The number of queries in the queries submission queue.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
Set objCon = CreateObject("ADODB.Connection") 
Set objRs = CreateObject("ADODB.Recordset")   
...
While objSmpp.IsBound
  ...
  iMax = objSmpp.CountSmsQuerySpace
  strQ = "SELECT TOP(" & iMax & ") FROM Messages"
  Set objRs = objCon.Execute(strQ)
  ...
  While Not objRs.EOF
    objMessage.Reference = objRs("Reference")
    objSmpp.QuerySms objMessage
    ...
    objRs.MoveNext
  WEnd
  ...
  objSmpp.Sleep 1000
WEnd
...

CountSmsReceived method

This method returns the number of SMS messages in the receive queue.

Use MaxSmsReceived to set the maximum number of sms messages that can be queued.

NOTE: If AssembleMultipart is on and there are multipart messages in the queue this number may be higher than the actual number of messages returned from ReceiveMessage.

Parameters:

  • None

Return value:

The number of queries in the queries submission queue.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
While objSmpp.IsBound

  If objSmpp.CountSmsReceived() > 50 Then
    Set objMessage = objSmpp.ReceiveMessage()
    While objSmpp.LastError = 0
      WScript.Echo "Received toaddress: " & objMessage.ToAddress
      WScript.Echo "Body: " & objMessage.Body     
      Set objMessage = objSmpp.ReceiveMessage()
    WEnd
  End If

  objSmpp.Sleep 1000
WEnd
...

FetchNotUpdated method

Returns the next SMS Message that was submitted to the remote SMPP server but not acknowledged. This message will have a sequence number but the command status is undefined. Use the UserTag property to identify this message.

This method can only be called on a disconnected instance.

When no more messages are available LastError will be set.

Parameters:

  • None

Return value:

The next Message object that was not updated

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
WScript.Echo "Not updated:  "
Set objMessage = objSmpp.FetchNotUpdated
While objSmpp.LastError = 0
  WScript.Echo "Usertag: " & objMessage.Usertag & "; SequenceNumber: " & _
    objMessage.SmppSequenceNumber	
  Set objMessage = objSmpp.FetchNotUpdated
WEnd

WScript.Echo "Not submitted (seq is 0):  "
Set objMessage = objSmpp.FetchNotSubmitted
While objSmpp.LastError = 0
  WScript.Echo "Usertag: " & objMessage.Usertag & "; SequenceNumber: " & _
    objMessage.SmppSequenceNumber	
  Set objMessage = objSmpp.FetchNotSubmitted
WEnd

FetchNotSubmitted method

Returns the next SMS Message that was submitted to the submit queue but not sent to the remote SMPP server. This message will not have a sequence number and the command status is undefined. Use the UserTag property to identify this message.

This method can only be called on a disconnected instance.

When no more messages are available LastError will be set.

Parameters:

  • None

Return value:

The next Message object that was not submitted

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
WScript.Echo "Not updated:  "
Set objMessage = objSmpp.FetchNotUpdated
While objSmpp.LastError = 0
  WScript.Echo "Usertag: " & objMessage.Usertag & "; SequenceNumber: " & _
    objMessage.SmppSequenceNumber	
  Set objMessage = objSmpp.FetchNotUpdated
WEnd

WScript.Echo "Not submitted (seq is 0):  "
Set objMessage = objSmpp.FetchNotSubmitted
While objSmpp.LastError = 0
  WScript.Echo "Usertag: " & objMessage.Usertag & "; SequenceNumber: " & _
    objMessage.SmppSequenceNumber	
  Set objMessage = objSmpp.FetchNotSubmitted
WEnd

CountSmsReceived method

This method returns the number of SMS messages in the receive queue.

Use MaxSmsReceived to set the maximum number of queries in the query queue.

Parameters:

  • None

Return value:

The number of queries in the queries submission queue.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
While objSmpp.IsBound

  If objSmpp.CountSmsReceived() > 50 Then
    Set objMessage = objSmpp.ReceiveMessage()
    While objSmpp.LastError = 0
      WScript.Echo "Received toaddress: " & objMessage.ToAddress
      WScript.Echo "Body: " & objMessage.Body     
      Set objMessage = objSmpp.ReceiveMessage()
    WEnd
  End If

  objSmpp.Sleep 1000
WEnd
...

GetFirstPart method

This methods splits up a multipart message and returns the first part. If a message is not multipart it will return the original message formatted as HEX. Call GetNextPart to get the next part.

The returned message will be assigned a new multipart reference id that is kept and increased in this instance of the Smpp object.

The message will be formatted according to the current multipart mode.

Parameters:

  • Message object to be split

Return value:

The first part of the multipart message.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objSms = CreateObject("AxSms.Message")

...

iNumberOfParts = objSmpp.CountParts(objSms)
WScript.Echo "There are " & iNumberOfParts & " parts required"

ReDim arrParts(iNumberOfParts - 1)         ' ReDim always allocates one extra unit
iPartNumber = 1
Set objPart = objSmpp.GetFirstPart(objSms)
While objSmpp.LastError = 0	
  WScript.Echo "Part #" & iPartNumber & ", ref #" & objPart.MultipartRef & ": " & objPart.Body
  Set arrParts(iPartNumber - 1) = objPart  ' The array index starts at '0'
  iPartNumber = iPartNumber + 1	
  Set objPart = objSmpp.GetNextPart()
WEnd

GetNextPart method

This method returns the next part of a split up message. If no further parts are available the LastError code will be set. Call GetFirstPart before calling this method.

The message will be formatted according to the current multipart mode.

Parameters:

  • None

Return value:

The first part of the multipart message.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objSms = CreateObject("AxSms.Message")

...

iNumberOfParts = objSmpp.CountParts(objSms)
WScript.Echo "There are " & iNumberOfParts & " parts required"

ReDim arrParts(iNumberOfParts - 1)         ' ReDim always allocates one extra unit
iPartNumber = 1
Set objPart = objSmpp.GetFirstPart(objSms)
While objSmpp.LastError = 0	
  WScript.Echo "Part #" & iPartNumber & ", ref #" & objPart.MultipartRef & ": " & objPart.Body
  Set arrParts(iPartNumber - 1) = objPart  ' The array index starts at '0'
  iPartNumber = iPartNumber + 1	
  Set objPart = objSmpp.GetNextPart()
WEnd

CountParts method

This method returns the number of parts required to send the given Message object. This number will be calculated according to the current multipart mode.

Parameters:

  • None

Return value:

The first part of the multipart message.

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objSms = CreateObject("AxSms.Message")

...

iNumberOfParts = objSmpp.CountParts(objSms)
WScript.Echo "There are " & iNumberOfParts & " parts required"

ReDim arrParts(iNumberOfParts - 1)         ' ReDim always allocates one extra unit
iPartNumber = 1
Set objPart = objSmpp.GetFirstPart(objSms)
While objSmpp.LastError = 0	
  WScript.Echo "Part #" & iPartNumber & ", ref #" & objPart.MultipartRef & ": " & objPart.Body
  Set arrParts(iPartNumber - 1) = objPart  ' The array index starts at '0'
  iPartNumber = iPartNumber + 1	
  Set objPart = objSmpp.GetNextPart()
WEnd

AssembleSms method

This method assembles a multipart SMS message from its parts. Add parts through this function and check if assembled messages are ready through GetAssembledSms.

It's possible to assemble multiple multipart messages at the same time. This makes it possible to disable AssembleMultipart and feed all incoming messages directly through this method.

Use ResetSmsAssembler to clear the internal list of incomplete multipart messages.

Parameters:

Return value:

None

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objSms = CreateObject("AxSms.Message")

...

WScript.Echo "Assemble again from parts:"
objSmpp.ResetSmsAssembler
For Each objPart In arrParts
  objSmpp.AssembleSms objPart
Next

Set objSms = objSmpp.GetAssembledSms(true)
WScript.Echo objSms.Body

GetAssembledSms method

This method returns the first available assembled multipart SMS message. The message would be assembled from the parts inserted through the AssembleSms method.

Use ResetSmsAssembler to clear the internal list of incomplete multipart messages.

Use the 'Force' parameter to force assembly of the first stored (incomplete) multipart message. This may result in an incomplete message. An incomplete message will have Incomplete set to true.

If no multipart messages are available the LastError property will be set.

Parameters:

  • Force assemble to first available message

Return value:

None

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objSms = CreateObject("AxSms.Message")

...

WScript.Echo "Assemble again from parts:"
objSmpp.ResetSmsAssembler
For Each objPart In arrParts
  objSmpp.AssembleSms objPart
Next

Set objSms = objSmpp.GetAssembledSms(true)
WScript.Echo objSms.Body

ResetSmsAssembler method

Resets the SMS assembled cache. This clears all of the message parts added using the AssembleSms method as well as all of the completed message that would be retrieved through GetAssembledSms

Parameters:

  • None

Return value:

None

Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objSms = CreateObject("AxSms.Message")

...

WScript.Echo "Assemble again from parts:"
objSmpp.ResetSmsAssembler
For Each objPart In arrParts
  objSmpp.AssembleSms objPart
Next

Set objSms = objSmpp.GetAssembledSms(true)
WScript.Echo objSms.Body

7. SmppServer

7.1. Introduction

The SmppServer object can be used to accept incoming SMPP connections, effectively setting up you own SMSC. The SMPP protocol supports sending and receive SMS messages using only an internet connection. It's primarily used for high volumes / high performance applications.

The SmppServer implementation is completely asynchronous for maximum performance. After starting the SmppServer a separate thread will accept incoming connections on the specified port. For each incoming connection a dedicated worker thread will be started to handle the client connection, this is the SmppSession object. The session objects are used to exchange SMS messages with connected clients.

Send and receive SMS messages from multiple clients using SmppServer

Send and receive SMS messages to/from multiple clients simultaneously using the SmppServer object

Set objSmppServer = CreateObject("AxSms.SmppServer")   ' Create the SMPP server object
Set objConstants = CreateObject("AxSms.Constants")   ' Create the SMS constants object

' Show version information
WScript.Echo "SMS Component" & objSmppServer.Version & "; Build " & _
  objSmppServer.Build & "; Module " & objSmppServer.Module
WScript.Echo "License Status: " & objSmppServer.LicenseStatus & vbCrLf

' Set a logfile and start the server on both IPv6 and IPv4
objSmppServer.Logfile = "server.log"
objSmppServer.Start 2775, objConstants.SMPP_IPVERSION_BOTH
If objSmppServer.LastError <> 0 Then
  WScript.Echo "Error while starting SMPP server: " & _
    objSmppServer.GetErrorDescription(objSmppServer.LastError)
  WScript.Quit 1
End If
WScript.Echo "SMPP server started..."

While objSmppServer.IsStarted
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ' Accept all sessions that request a bind
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If    
    
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BOUND_TRX Then
      ' Receive incoming messages
      Set objMessage = objSmppSession.ReceiveSubmitSms
      While objSmppSession.LastError = 0
        WScript.Echo "Receive SMS from: " & objSmppSession.SystemId & "; to: " & _
          objMessage.ToAddress & "; suggested reference: " & objMessage.Reference
        
        ' Accept the incoming message with the suggested message reference
        objSmppSession.RespondToSubmitSms objMessage
        If objSmppSession.LastError <> 0 Then
          WScript.Echo "Error while responding: " & _
            objSmppSession.GetErrorDescription(objSmppSession.LastError)
          WScript.Quit 1
        End If
        
        ' Send a successful delivery report for the incoming message
        objMessage.SmppStatus = objConstants.SMPP_MESSAGESTATE_DELIVERED
        objSmppSession.DeliverReport objMessage
        If objSmppSession.LastError <> 0 Then
          WScript.Echo "Error while sending delivery report: " & _
            objSmppSession.GetErrorDescription(objSmppSession.LastError)
          WScript.Quit 1
        End If
        
        Set objMessage = objSmppSession.ReceiveSubmitSms
      WEnd

      ' Deliver a new message to the client
      Set objMessage = CreateObject("AxSms.Message")
      objMessage.ToAddress = "+31122334455"
      objMessage.FromAddress = "+35544332211"
      objMessage.Body = "Hello from the ActiveXperts Gateway !"
      objMessage.UserTag = 1 ' To identify this message when the client responds
      objSmppSession.DeliverSms objMessage
      If objSmppSession.LastError <> 0 Then
        WScript.Echo "Error while delivering: " & _
          objSmppSession.GetErrorDescription(objSmppSession.LastError)
        WScript.Quit 1
      End If
      
      ' Check if the client accepted any messages
      Set objMessage = objSmppSession.ReceiveDeliverResponse
      While objSmppSession.LastError = 0
        WScript.Echo "Response: " & objMessage.SmppCommandStatus & _
          " for UserTag: " & objMessage.UserTag
        Set objMessage = objSmppSession.ReceiveDeliverResponse
      WEnd
    End If
    
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

  objSmppServer.Sleep 1000
WEnd

objSmppServer.Stop

7.2. Properties

Property Type Read/Write Description
Version String Read Version number of the SMS Component
Build String Read Build number of the SMS Component
Module String Read Module name of the SMS Component
LicenseStatus String Out License Status
LicenseKey String In/Out License Key
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
IsStarted Boolean Read Whether the SMPP server is started and running
LastReference Number Read/Write The last suggested message reference
MaxClosedSessions Number Read/Write The maximum number of closed sessions to keep

Version property

Return the version number of the SMS Component

Example:

Set objSmppServer = CreateObject("AxSms.SmppServer")
WScript.Echo "SMS Component Version " & objSmppServer.Version & "; Build " & _
  objSmppServer.Build & "; Module " & objSmppServer.Module
WScript.Echo "License Status: " & objSmppServer.LicenseStatus & vbCrLf
...

Build property

Return the build number of the SMS Component.

Example:

Set objSmppServer = CreateObject("AxSms.SmppServer")
WScript.Echo "SMS Component Version " & objSmppServer.Version & "; Build " & _
  objSmppServer.Build & "; Module " & objSmppServer.Module
WScript.Echo "License Status: " & objSmppServer.LicenseStatus & vbCrLf
...

Module property

Return the module name of the SMS Component.

Example:

Set objSmppServer = CreateObject("AxSms.SmppServer")
WScript.Echo "SMS Component Version " & objSmppServer.Version & "; Build " & _
  objSmppServer.Build & "; Module " & objSmppServer.Module
WScript.Echo "License Status: " & objSmppServer.LicenseStatus & vbCrLf
...

LicenseStatus property

The status of your license. In case you have not licensed the product, the property holds the trial expiration date. For details, see Product Activation.

Example:

Set objSmppServer = CreateObject("AxSms.SmppServer")   ' Create new instance
WScript.Echo "License Status: " & objSmppServer.LicenseStatus
WScript.Echo "License Key: " & objSmppServer.LicenseKey

LicenseKey property

A license key is required to unlock this component after the trial period has expired. Assign the LicenseKey property every time a new instance of this component is created (see code below). Alternatively, the LicenseKey property can be set automatically. This requires the license key to be stored in the registry. For details, see Product Activation.

Example:

Set objSmppServer = CreateObject("AxSms.SmppServer")   ' Create new instance
objSmppServer.LicenseKey = "XXXXX-XXXXX-XXXXX"         ' Assign your license key 
WScript.Echo "LicenseKey: " & objSmppServer.LicenseKey

LastError property

Completion code of the last called method. To find the error description of a given error code, go to the online error codes codes page.

Example:

Set objSmppServer = CreateObject("AxSms.SmppServer")  
...
objSmppServer.Logfile = "server.log"
objSmppServer.Start 2775
If objSmppServer.LastError <> 0 Then
  WScript.Echo "Error: " & objSmppServer.LastError & "," & _
    objSmppServer.GetErrorDescription(objSmppServer.LastError)
  WScript.Quit 1
End If
...
objSmppServer.Stop

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the SMS Component will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

Set objSmppServer = CreateObject("AxSms.SmppServer")  
...
objSmppServer.Logfile = "server.log"
objSmppServer.Start 2775
If objSmppServer.LastError <> 0 Then
  WScript.Echo "Error: " & objSmppServer.LastError & "," & _
    objSmppServer.GetErrorDescription(objSmppServer.LastError)
  WScript.Quit 1
End If
...
objSmppServer.Stop

IsStarted property

If the SMPP server is started and running this property returns 'True'. If the server is stopped or not started yet, this property returns 'False'.

Example:

Set objSmppServer = CreateObject("AxSms.SmppServer")  
...
WScript.Echo "SMPP server started: " & objSmppServer.IsStarted
...

LastReference property

Every time a client submits a message to the SMPP server the SMPP server suggests message reference to return to the client. This message reference is an 8 digit hexadecimal number that is incremented for every message.

The message reference should uniquely identify an SMS message on the server.

When the message is received through the ReceiveSubmitSms method the suggested message reference is already set in the Reference property. This property can changed to suggest a different reference. The reference will be effective when calling RespondToSubmitSms.

Use this property to set a reference offset before starting or restarting the server to make sure no duplicate message references are issued. Store it regularly to keep track of the current last used message reference.

Example:

Set objSmppServer = CreateObject("AxSms.SmppServer")  
...
objSmppServer.LastReference = lLastReference + lRestartOffset
objSmppServer.Start 2775
If objSmppServer.LastError <> 0 Then
  WScript.Echo "Error: " & objSmppServer.LastError & "," & _
    objSmppServer.GetErrorDescription(objSmppServer.LastError)
  WScript.Quit 1
End If
...
objSmppServer.Stop

MaxClosedSessions property

After a SmppSession is closed a reference is kept in the closed sessions list. Recently closed sessions can be accessed using GetClosedSession.

By default this value is set to 100.

Example:

Set objSmppServer = CreateObject("AxSms.SmppServer")  
...
objSmppServer.LastReference = lLastReference + lRestartOffset
objSmppServer.MaxClosedSessions = 1000
objSmppServer.Start 2775
If objSmppServer.LastError <> 0 Then
  WScript.Echo "Error: " & objSmppServer.LastError & "," & _
    objSmppServer.GetErrorDescription(objSmppServer.LastError)
  WScript.Quit 1
End If
...
objSmppServer.Stop

7.3. Methods

Method Description
Clear Reset all properties to their default values
SaveLicenseKey Save the License Key in the registry
GetErrorDescription Get the description of the given error
Sleep Sleep for the specified number of milliseconds
Start Starts the SMPP server
Stop Stops the SMPP server
GetFirstSession Get first connected client session
GetNextSession Get next connected client session
GetSession Get the specified, connected, session
GetClosedSession Get a recently closed session

Clear method

This method resets all properties to their default values.

Parameters:

  • None

Return value:

Always 0.

Example:
Set objSmppServer = CreateObject("AxSms.SmppServer")
....
objSmppServer.Clear
...

SaveLicenseKey method

Description:

Use SaveLicenseKey to store the license key permanently in the registry. When a license key is saved, it is restored automatically every time a new instance of the object ('SmppServer') is created. It is not recommended to save the license key if you distribute the component with your own software, because the key can be easily used by others.

Parameters:

  • None.
Return value:

Always 0. Check LastError property to see if the method was completed successfully.

Example:

Set objSmppServer = CreateObject("AxSms.SmppServer ")  ' Create new instance
objSmppServer.LicenseKey = "XXXXX-XXXXX-XXXXX"
objSmppServer.SaveLicenseKey                              ' Save license key to registry

For more information, see Product Activation.

GetErrorDescription method

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
Set objSmppServer = CreateObject("AxSms.SmppServer")  
...
objSmppServer.Logfile = "server.log"
objSmppServer.Start 2775
If objSmppServer.LastError <> 0 Then
  WScript.Echo "Error: " & objSmppServer.LastError & "," & _
  objSmppServer.GetErrorDescription(objSmppServer.LastError)
  WScript.Quit 1
End If
...
objSmppServer.Stop

Sleep method

This method suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
Set objSmppServer = CreateObject("AxSms.SmppServer")
....
objSmppServer.Sleep 1000
...

Start method

Start the SMPP server on the specified port. A dedicated thread will be started in the background which listens on the specified port for incoming connections.

The server can be started, listening on IPv6, IPv4 or both. The both option is implemented as 'dual stack' which means that both an IPv4 and IPv6 socket are created. Use these constants to select the IP Version.

For each connection an SmppSession object will be created. Use the GetFirstSession and GetNextSession methods to access these session and interact with them.

Parameters:

  • Port number
  • IP version

Return value:

Always 0.

Example:
Set objSmppServer = CreateObject("AxSms.SmppServer")  
...
objSmppServer.Logfile = "server.log"
objSmppServer.Start 2775
If objSmppServer.LastError <> 0 Then
  WScript.Echo "Error: " & objSmppServer.LastError & "," & _
  objSmppServer.GetErrorDescription(objSmppServer.LastError)
  WScript.Quit 1
End If
...
objSmppServer.Stop

Stop method

Stop the SMPP server.

Parameters:

  • The error code

Return value:

The error string.

Example:
Set objSmppServer = CreateObject("AxSms.SmppServer")  
...
objSmppServer.Logfile = "server.log"
objSmppServer.Start 2775
If objSmppServer.LastError <> 0 Then
  WScript.Echo "Error: " & objSmppServer.LastError & "," & _
  objSmppServer.GetErrorDescription(objSmppServer.LastError)
  WScript.Quit 1
End If
...
objSmppServer.Stop

GetFirstSession method

This method returns the first connected session object. If no clients are connected nothing is returned and the LastError property is set.

Parameters:

  • None

Return value:

An SmppSession object.

Example:
Set objSmppServer = CreateObject("AxSms.SmppServer")
Set objConstants = CreateObject("AxSms.Constants")
...
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client Ip: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId      
    WScript.Echo "AddressRange: " & objSmppSession.AddressRange
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If    
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd
...

GetNextSession method

This method returns the next connected session object. If no clients are connected nothing is returned and the LastError property is set.

Parameters:

  • None

Return value:

Always 0.

Example:
Set objSmppServer = CreateObject("AxSms.SmppServer")
Set objConstants = CreateObject("AxSms.Constants")
...
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client Ip: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId      
    WScript.Echo "AddressRange: " & objSmppSession.AddressRange
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If    
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd
...

GetSession method

This method returns the specified session object. If the specified session is no longer connected the LastError property is set.

Parameters:

Return value:

The specified session

Example:
Set objSmppServer = CreateObject("AxSms.SmppServer")
...
Sub DeliverSms(SessionId, objSms)
  Set objSession = objSmppServer.GetSession(SessionId)
  If objSession.LastError <> 0 Then
    objSession.DeliverSms objSms
  End If
End Sub
...

GetClosedSession method

This method returns a recently closed session. If no closed sessions are available the LastError property is set.

The MaxClosedSessions property determines how many closed sessions are kept.

Parameters:

  • None

Return value:

A SmppSession object.

Example:
Set objSmppSession = objSmppServer.GetClosedSession
While objSmppServer.LastError = 0
  WScript.Echo "Session closed: " & objSmppSession.SystemId
			
  WScript.Echo "Not responded:  "
  Set objMessage = objSmppSession.FetchNotResponded
  While objSmppSession.LastError = 0
    WScript.Echo "Usertag: " & objMessage.Usertag & "; SequenceNumber: " & _
      objMessage.SmppSequenceNumber	
    Set objMessage = objSmppSession.FetchNotResponded
  WEnd

  WScript.Echo "Not delivered (seq is 0):  "
  Set objMessage = objSmppSession.FetchNotDelivered
  While objSmppSession.LastError = 0
    WScript.Echo "Usertag: " & objMessage.Usertag & "; SequenceNumber: " & _
      objMessage.SmppSequenceNumber	
    Set objMessage = objSmppSession.FetchNotDelivered
  WEnd
	
  Set objSmppSession = objSmppServer.GetClosedSession
WEnd

8. SmppSession

8.1. Introduction

The SmppSession object represents an SMPP client in the SmppServer object. The client can be either Connected, Binding, Bound or Disconnected. The only way to obtain a valid, 'Connected', SmppSession object is through the SmppServer object.

Use SmppSession instances to send SMS messages to and receive SMS messages from SMPP clients that are connected to your SMPP server.

To connect to an existing SMPP server use the Smpp object.

8.2. Properties

Property Type Read/Write Description
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
LogPduDetails Boolean Read/Write Enable detailed PDU logging
Id Number Read The ID for this session
Ip String Read The IP address of the remote client
Port Number Read The port number of the remote client
Version Number Read The SMPP client version of the remote client
SystemId String Read The system id of the remote client
Password String Read The password of the remote client
SystemType String Read The system type of the remote client
AddressRange String Read The address range of the remote client
AddressRangeNpi Number Read The address range NPI of the remote client
AddressRangeTon Number Read The address range TON for the remote client
ConnectionState Number Read The connection state for this session
RequestedBind Number Read The bind type this client requested
PduTimeout Number Read/Write Number of milliseconds before an outstanding PDU will timeout
EnquireInterval Number Read/Write Number of milliseconds between 'Enquire' commands
MultipartTimeout Number Read/Write Number of seconds before an incomplete multipart message is returned
UseGsmEncoding Boolean Read/Write User GSM encoding for text messages
MultipartMode Number Read/Write Specify how multipart messages should be sent
ExtractApplicationPort Boolean Read/Write Whether the application port is extracted from the message
DeliverMode Number Read/Write Specify how SMS messages should be submitted to the client
SmsSentPerSecond Number Read Number of SMS messages sent per second
SmsReceivedPerSecond Number Read Number of SMS messages received per second
MaxSmsDeliveries Number Read/Write Maximum length or the SMS deliver queue
MaxSmsSubmission Number Read/Write Maximum length of the SMS submit queue
MaxSmsQueries Number Read/Write Maximum length of the SMS query queue

LastError property

Completion code of the last called method. To find the error description of a given error code, go to the online error codes codes page.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  Set objMessage = CreateObject("AxSms.Message")
  objMessage.ToAddress = "+31122334455"
  objMessage.FromAddress = "+35544332211"
  objMessage.Body = "Hello from the ActiveXperts Gateway !"
  objMessage.UserTag = 1 ' To identify this message when the client responds
  objSmppSession.DeliverSms objMessage
  If objSmppSession.LastError <> 0 Then
    WScript.Echo "Error while delivering: " & _
      objSmppSession.GetErrorDescription(objSmppSession.LastError)
    WScript.Quit 1
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the SMS Component will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    WScript.Echo "AddressRange: " & objSmppSession.AddressRange
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

LogPduDetails property

The SMPP protocol primitives are called 'Protocol Data Units' (PDU's). Set this property to true to add a detailed description of every PDU that's send or received including a HEX dump.

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    WScript.Echo "AddressRange: " & objSmppSession.AddressRange
    objSmppSession.LogPduDetails = True
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

Id property

The ID for this session. When a new session is connect an ID is automatically assigned. This ID can be used to uniquely identify the session in the SmppServer object.

Id's for sessions that have been disconnected will not be re-used until the session ID wraps around the size of an unsigned 32 bit integer (4.294.967.295).

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Session Id: " & objSmppSession.Id
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

Ip property

The IP address of the remote client.

This can either be an IPv4 or an IPv6 address. This depends on how the SMPP server was started.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    WScript.Echo "AddressRange: " & objSmppSession.AddressRange
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

Port property

The port number of the remote client.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    WScript.Echo "AddressRange: " & objSmppSession.AddressRange
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

Version property

The SMPP client version of the remote client. Should be on of these constants.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SMPP Version: " & objSmppSession.Version
    WScript.Echo "AddressRange: " & objSmppSession.AddressRange
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

SystemId property

The system id of the remote client.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    WScript.Echo "AddressRange: " & objSmppSession.AddressRange
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

Password property

The password of the remote client.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    If objSmppSession.Password = "Secret" Then 
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    Else
      objSmppSession.RespondToBind objConstants.SMPP_ESME_RINVPASWD
    End If
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

SystemType property

The system type of the remote client.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    WScript.Echo "AddressRange: " & objSmppSession.AddressRange
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

AddressRange property

The address range of the remote client.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    WScript.Echo "AddressRange: " & objSmppSession.AddressRange
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

AddressRangeNpi property

The addres range NPI (Numbering Plan Indicator) of the remote host.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    WScript.Echo "AddressRange: " & objSmppSession.AddressRange
    WScript.Echo "AddressRange NPI: " & objSmppSession.AddressRangeNpi
    WScript.Echo "AddressRange TON: " & objSmppSession.AddressRangeTon
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

AddressRangeTon property

The address range TON (Type of Number) for the remote client.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    WScript.Echo "AddressRange: " & objSmppSession.AddressRange
    WScript.Echo "AddressRange NPI: " & objSmppSession.AddressRangeNpi
    WScript.Echo "AddressRange TON: " & objSmppSession.AddressRangeTon
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

ConnectionState property

The connection state for this session. This is one of these constants.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    WScript.Echo "AddressRange: " & objSmppSession.AddressRange
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

RequestedBind property

If the client requested a bind, this property will contain the type of bind this client requested. This is one of these constants.

The value of this property is only meaningful when the ConnectionState property is set to SMPP_SESSIONSTATE_BINDING.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    WScript.Echo "AddressRange: " & objSmppSession.AddressRange
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

PduTimeout property

Set this property to the number of milliseconds the remote client has to react to a given PDU before it times out. When a client fails to react to an outstanding PDU in a timely matter the connection will be closed.

Default is set to 5000 milliseconds

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objConstants = CreateObject("AxSms.Constants")
...
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      
      objSmppSession.PduTimeout 10000
      objSmppSession.EnquireInterval 30000
      objSmppSession.MultipartTimeout 300000
      objSmppSession.UseGsmEncoding objConstants.SMPP_USEGSMENCODING_INANDOUT
	  objSmppSession.MultipartMode objConstants.SMPP_MULTIPARTMODE_UDH
	  objSmppSession.DeliverMode false
	  objSmppSession.ExtractApplicationPort objConstants.SMPP_DELIVERMODE_DELIVERSM
	  
	  objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
	...
  WEnd

EnquireInterval property

Set this property to the number of milliseconds between enquire commands. An enquire command is send to the client at regular intervals to keep the connection alive.

Default is set to 30000 milliseconds

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objConstants = CreateObject("AxSms.Constants")
...
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      
      objSmppSession.PduTimeout 10000
      objSmppSession.EnquireInterval 30000
      objSmppSession.MultipartTimeout 300000
      objSmppSession.UseGsmEncoding objConstants.SMPP_USEGSMENCODING_INANDOUT
	  objSmppSession.MultipartMode objConstants.SMPP_MULTIPARTMODE_UDH
	  objSmppSession.DeliverMode false
	  objSmppSession.ExtractApplicationPort objConstants.SMPP_DELIVERMODE_DELIVERSM
	  
	  objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
	...
  WEnd

MultipartTimeout property

Set this property to the number of seconds that the session should wait for a multipart message to complete. If a multipart message is received but it could not be assembled from all of its parts within this time the message will be returned anyway.

Parts that are missing will be marked with the text '**Missing Part!**'. The 'Incomplete' property of the SMS Message will be set to true.

This property applies to the AssembleSms and GetAssembledSms methods.

Default is set to 300 seconds.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objConstants = CreateObject("AxSms.Constants")
...
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      
      objSmppSession.PduTimeout 10000
      objSmppSession.EnquireInterval 30000
      objSmppSession.MultipartTimeout 300000
      objSmppSession.UseGsmEncoding objConstants.SMPP_USEGSMENCODING_INANDOUT
	  objSmppSession.MultipartMode objConstants.SMPP_MULTIPARTMODE_UDH
	  objSmppSession.DeliverMode false
	  objSmppSession.ExtractApplicationPort objConstants.SMPP_DELIVERMODE_DELIVERSM
	  
	  objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
	...
  WEnd

UseGsmEncoding property

Set this property to indicate whether GSM encoding should be used for incoming or outgoing text messages. Use one of these constants.

This only applies when the datacoding property is set to DATACODING_DEFAULT .

By default this is set to SMPP_USEGSMENCODING_DISABLED

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objConstants = CreateObject("AxSms.Constants")
...
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      
      objSmppSession.PduTimeout 10000
      objSmppSession.EnquireInterval 30000
      objSmppSession.MultipartTimeout 300000
      objSmppSession.UseGsmEncoding objConstants.SMPP_USEGSMENCODING_INANDOUT
	  objSmppSession.MultipartMode objConstants.SMPP_MULTIPARTMODE_UDH
	  objSmppSession.DeliverMode false
	  objSmppSession.ExtractApplicationPort objConstants.SMPP_DELIVERMODE_DELIVERSM
	  
	  objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
	...
  WEnd

MultipartMode property

In combination with the Multipart flag this property specifies how multipart messages should be sent if they should be automatically formatted as multipart.

This property does not affect how multipart messages are received. Incoming multipart messages will be correctly recognized if they use 8bit or 16 bit UDH's, SAR TLV's or Payload TLV's.

By default this property is set to SMPP_MULTIPARTMODE_UDH

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objConstants = CreateObject("AxSms.Constants")
...
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      
      objSmppSession.PduTimeout 10000
      objSmppSession.EnquireInterval 30000
      objSmppSession.MultipartTimeout 300000
      objSmppSession.UseGsmEncoding objConstants.SMPP_USEGSMENCODING_INANDOUT
	  objSmppSession.MultipartMode objConstants.SMPP_MULTIPARTMODE_UDH
	  objSmppSession.DeliverMode false
	  objSmppSession.ExtractApplicationPort objConstants.SMPP_DELIVERMODE_DELIVERSM
	  
	  objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
	...
  WEnd

ExtractApplicationPort property

This property will only affect incoming SMS messages that contain an application port specifier. An SMS can contain an application port if it is meant to target a specific application. For example a WAP Push message will always have destination port 2948 to target the WAP Push application specifically.

If this property is set to 'True' the SMS Component will interpret the application port by appending the source port to the 'FromAddress' property and the destination port to the 'ToAddress' property separated by a colon character (':'). The SMS Component will remove the application port header from the SMS.

If this property is set to 'False' the SMS Component will not interpret the application port and leave the application port header in place. The application ports will not be added to the 'FromAddress' and 'ToAddress' properties.

By default this property is set to true.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objConstants = CreateObject("AxSms.Constants")
...
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      
      objSmppSession.PduTimeout 10000
      objSmppSession.EnquireInterval 30000
      objSmppSession.MultipartTimeout 300000
      objSmppSession.UseGsmEncoding objConstants.SMPP_USEGSMENCODING_INANDOUT
	  objSmppSession.MultipartMode objConstants.SMPP_MULTIPARTMODE_UDH
	  objSmppSession.DeliverMode false
	  objSmppSession.ExtractApplicationPort objConstants.SMPP_DELIVERMODE_DELIVERSM
	  
	  objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
	...
  WEnd

DeliverMode property

This property indicates how SMS messages should be submitted to the client.

If SMPP_DELIVERMODE_DATASM is selected the multipart mode should be set to SMPP_MULTIPARTMODE_PAYLOADTLV.

Incoming messages, whether 'data_sm' or 'submit_sm', will always be received, regardless of this setting.

By default this property is set to SMPP_DELIVERMODE_SUBMITSM

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objConstants = CreateObject("AxSms.Constants")
...
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      
      objSmppSession.PduTimeout 10000
      objSmppSession.EnquireInterval 30000
      objSmppSession.MultipartTimeout 300000
      objSmppSession.UseGsmEncoding objConstants.SMPP_USEGSMENCODING_INANDOUT
	  objSmppSession.MultipartMode objConstants.SMPP_MULTIPARTMODE_UDH
	  objSmppSession.DeliverMode false
	  objSmppSession.ExtractApplicationPort objConstants.SMPP_DELIVERMODE_DELIVERSM
	  
	  objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
	...
  WEnd

SmsSentPerSecond property

The number of SMS messages sent per second. This includes messages that will be rejected by the client.

This is informative. It can be used for performance measurements.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  WScript.Echo "Sent: " & objSmppSession.SmsSentPerSecond
  WScript.Echo "Received: " & objSmppSession.SmsReceivedPerSecond
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

SmsReceivedPerSecond property

The number of SMS messages received per second.

This is informative. It can be used for performance measurements.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  WScript.Echo "Sent: " & objSmppSession.SmsSentPerSecond
  WScript.Echo "Received: " & objSmppSession.SmsReceivedPerSecond
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

MaxSmsDeliveries property

SMS Messages that are to be delivered by this session using the DeliverSms method are queued in the delivery queue and sent out of the earliest convenience through the SMPP session.

The number of message in the deliver queue will increase if the remote client is too busy to accept any new messages. This property sets the maximum number of SMS messages that can be kept in the delivery queue.

By default this is set to 100 messages.

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    objSmppSession.MaxSmsDeliveries = 50
    objSmppSession.MaxSmsSubmission = 100
    objSmppSession.MaxSmsQueries = 100
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

MaxSmsSubmission property

Incoming SMS submissions are queued until they are read using ReceiveSubmitSms. This method sets the maximum size of the incoming SMS submission queue. If the queue is full new messages will be rejected using the 'SMPP_ESME_RMSGQFUL' status.

The default value is set to 15 messages

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    objSmppSession.MaxSmsDeliveries = 50
    objSmppSession.MaxSmsSubmission = 100
    objSmppSession.MaxSmsQueries = 100
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

MaxSmsQueries property

Incoming SMS queries are queued until they are read using ReceiveQuerySms. This method sets the maximum size of the incoming SMS queries queue. If the queue is full new queries will be rejected using the 'SMPP_ESME_RMSGQFUL' status.

The default value is set to 15 messages

Example:

Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    objSmppSession.MaxSmsDeliveries = 50
    objSmppSession.MaxSmsSubmission = 100
    objSmppSession.MaxSmsQueries = 100
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

8.3. Methods

Method Description
GetErrorDescription Get the description of the given error
RespondToBind Respond to a bind request
RespondToSubmitSms Respond to an SMS submission
ReceiveSubmitSms Receive an SMS submission
RespondToQuerySms Respond to an SMS query
ReceiveQuerySms Receive an SMS Query request
DeliverSms Deliver an SMS message to the remote client
DeliverReport Deliver a delivery report to the remote client
ReceiveDeliverResponse Receive a response on an SMS delivery or delivery report
Disconnect Disconnect this session
CountSmsSubmissions Count the number of received SMS messages in the submission queue
CountSmsQueries Count the number of received SMS queries in the query queue
CountSmsDeliverySpace Count the space available in the delivery queue
FetchNotResponded Fetch message that was delivered but without response
FetchNotDelivered Fetch message that was submitted but not sent to the client
GetFirstPart Split up a multipart message, get the first part.
GetNextPart Split up a multipart message, get the next part.
CountParts Count the number of parts required for a message.
AssembleSms Assemble a multipart SMS from its parts.
GetAssembledSms Get the first available assembled SMS.

GetErrorDescription method

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  Set objMessage = CreateObject("AxSms.Message")
  objMessage.ToAddress = "+31122334455"
  objMessage.FromAddress = "+35544332211"
  objMessage.Body = "Hello from the ActiveXperts Gateway !"
  objMessage.UserTag = 1 ' To identify this message when the client responds
  objSmppSession.DeliverSms objMessage
  If objSmppSession.LastError <> 0 Then
    WScript.Echo "Error while delivering: " & _
      objSmppSession.GetErrorDescription(objSmppSession.LastError)
    WScript.Quit 1
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

RespondToBind method

This method responds to an incoming bind request with the given SMPP status code. One of these constants can be used.

Use this method when the ConnectionState property is set to SMPP_SESSIONSTATE_BINDING.

If the response status is not '0' then the connection to this client will automatically be dropped and the sessions connections state set to SMPP_SESSIONSTATE_DISCONNECTED.

Parameters:

  • The status code

Return value:

Always 0

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
    WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
    WScript.Echo "SystemId: " & objSmppSession.SystemId
    WScript.Echo "AddressRange: " & objSmppSession.AddressRange
    objSmppSession.LogFile = objSmppSession.SystemId & ".log"
    objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
  End If
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

RespondToSubmitSms method

Respond to an SMS submission. Use ReceiveSubmitSms to receive SMS submissions and use this method to respond to the submissions with a status code.

Every received SMS message requires a response, either '0' to confirm the SMS or one of these status codes to reject an SMS.

Parameters:

  • The status code

Return value:

Always 0

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  Set objMessage = objSmppSession.ReceiveSubmitSms
  While objSmppSession.LastError = 0
    WScript.Echo "Receive SMS from: " & objSmppSession.SystemId & "; to: " & _
      objMessage.ToAddress & "; suggested reference: " & objMessage.Reference                
    
    ' Accept the incoming message with the suggested message reference
    objSmppSession.RespondToSubmitSms objMessage
    If objSmppSession.LastError <> 0 Then
      WScript.Echo "Error while responding: " & _
        objSmppSession.GetErrorDescription(objSmppSession.LastError)
      WScript.Quit 1
    End If
    
    ' Send a successful delivery report for the incoming message
    objMessage.SmppStatus = objConstants.SMPP_MESSAGESTATE_DELIVERED
    objSmppSession.DeliverReport objMessage
    If objSmppSession.LastError <> 0 Then
      WScript.Echo "Error while sending delivery report: " & _
        objSmppSession.GetErrorDescription(objSmppSession.LastError)
      WScript.Quit 1
    End If
    
    Set objMessage = objSmppSession.ReceiveSubmitSms
  WEnd
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

ReceiveSubmitSms method

Receive an SMS submission from the connected client. Every SMS needs to be responded to using the RespondToSubmitSms method.

If there are no more SMS submission pending nothing will be returned and LastError will be set.

Parameters:

  • None

Return value:

An Message object

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  Set objMessage = objSmppSession.ReceiveSubmitSms
  While objSmppSession.LastError = 0
    WScript.Echo "Receive SMS from: " & objSmppSession.SystemId & "; to: " & _
      objMessage.ToAddress & "; suggested reference: " & objMessage.Reference                
    
    ' Accept the incoming message with the suggested message reference
    objSmppSession.RespondToSubmitSms objMessage
    If objSmppSession.LastError <> 0 Then
      WScript.Echo "Error while responding: " & _
        objSmppSession.GetErrorDescription(objSmppSession.LastError)
      WScript.Quit 1
    End If
    
    ' Send a successful delivery report for the incoming message
    objMessage.SmppStatus = objConstants.SMPP_MESSAGESTATE_DELIVERED
    objSmppSession.DeliverReport objMessage
    If objSmppSession.LastError <> 0 Then
      WScript.Echo "Error while sending delivery report: " & _
        objSmppSession.GetErrorDescription(objSmppSession.LastError)
      WScript.Quit 1
    End If
    
    Set objMessage = objSmppSession.ReceiveSubmitSms
  WEnd
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

RespondToQuerySms method

Respond to an SMS Query request. Use ReceiveQuerySms to receive SMS queries and use this method to respond to the query with a status code.

This method requires the original SMS that way queried. Make sure the status is set to reflect the current status.

Every received SMS Query requires a response.

Parameters:

  • The Message object that was queried

Return value:

Always 0.

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  'Don't support query_sm
  Set objMessage = objSmppSession.ReceiveQuerySms
  While objSmppSession.LastError = 0
    objMessage.SmppCommandStatus = objConstants.SMPP_ESME_RINVCMDID
    objSmppSession.RespondToQuerySms objMessage
    Set objMessage = objSmppSession.ReceiveQuerySms
  WEnd
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

ReceiveQuerySms method

Receive an SMS query from the connected client. The client will send an SMS message reference to query. Every SMS Query requires a response using the RespondToQuerySms method.

If there are no more SMS queries pending nothing will be returned and LastError will be set.

Parameters:

  • None

Return value:

An Message object

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  'Don't support query_sm
  Set objMessage = objSmppSession.ReceiveQuerySms
  While objSmppSession.LastError = 0
    objMessage.SmppCommandStatus = objConstants.SMPP_ESME_RINVCMDID
    objSmppSession.RespondToQuerySms objMessage
    Set objMessage = objSmppSession.ReceiveQuerySms
  WEnd
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

DeliverSms method

Deliver an SMS message to the remote client. For every SMS that's deliverd the client should send a response which needs to be received using the ReceiveDeliverResponse method.

Parameters:

  • A Message object
  • (Optional) Multipart flag, can be one of these constants

Return value:

Always 0.

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  ' Deliver a new message to the client
  Set objMessage = CreateObject("AxSms.Message")
  objMessage.ToAddress = "+31122334455"
  objMessage.FromAddress = "+35544332211"
  objMessage.Body = "Hello from the ActiveXperts Gateway !"
  objMessage.UserTag = 1 ' To identify this message when the client responds
  objSmppSession.DeliverSms objMessage
  If objSmppSession.LastError <> 0 Then
    WScript.Echo "Error while delivering: " & _
      objSmppSession.GetErrorDescription(objSmppSession.LastError)
    WScript.Quit 1
  End If
  
  ' Check if the client accepted any messages
  Set objMessage = objSmppSession.ReceiveDeliverResponse
  While objSmppSession.LastError = 0
    WScript.Echo "Response: " & objMessage.SmppCommandStatus & _
      " for UserTag: " & objMessage.UserTag
    Set objMessage = objSmppSession.ReceiveDeliverResponse
  WEnd
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

DeliverReport method

Deliver a delivery report to the remote client. A delivery report is a special kind of SMS message that is formatted in a specific way. This method generates a delivery reports out of the original SMS that needs to be reported. Make sure that the final delivery status is set in this SMS message before passing to this method.

For every delivery report the client should send a response which needs to be received using the ReceiveDeliverResponse method.

Parameters:

  • The Message object that will be reported about

Return value:

Always 0.

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  Set objMessage = objSmppSession.ReceiveSubmitSms
  While objSmppSession.LastError = 0
    WScript.Echo "Receive SMS from: " & objSmppSession.SystemId & "; to: " & _
      objMessage.ToAddress & "; suggested reference: " & objMessage.Reference                
    
    ' Accept the incoming message with the suggested message reference
    objSmppSession.RespondToSubmitSms objMessage
    If objSmppSession.LastError <> 0 Then
      WScript.Echo "Error while responding: " & _
        objSmppSession.GetErrorDescription(objSmppSession.LastError)
      WScript.Quit 1
    End If
    
    ' Send a successful delivery report for the incoming message
    objMessage.SmppStatus = objConstants.SMPP_MESSAGESTATE_DELIVERED
    objSmppSession.DeliverReport objMessage
    If objSmppSession.LastError <> 0 Then
      WScript.Echo "Error while sending delivery report: " & _
        objSmppSession.GetErrorDescription(objSmppSession.LastError)
      WScript.Quit 1
    End If
    
    Set objMessage = objSmppSession.ReceiveSubmitSms
  WEnd
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

ReceiveDeliverResponse method

This method received the client's response on an SMS delivery or delivery report. The response will always be related to an earlier sent delivery report or SMS message. The response will contain the same UserTag value that was used in originally submitting the SMS message.

Parameters:

  • None

Return value:

The orginal Message object that was responed to.

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  ' Deliver a new message to the client
  Set objMessage = CreateObject("AxSms.Message")
  objMessage.ToAddress = "+31122334455"
  objMessage.FromAddress = "+35544332211"
  objMessage.Body = "Hello from the ActiveXperts Gateway !"
  objMessage.UserTag = 1 ' To identify this message when the client responds
  objSmppSession.DeliverSms objMessage
  If objSmppSession.LastError <> 0 Then
    WScript.Echo "Error while delivering: " & _
      objSmppSession.GetErrorDescription(objSmppSession.LastError)
    WScript.Quit 1
  End If
  
  ' Check if the client accepted any messages
  Set objMessage = objSmppSession.ReceiveDeliverResponse
  While objSmppSession.LastError = 0
    WScript.Echo "Response: " & objMessage.SmppCommandStatus & _
      " for UserTag: " & objMessage.UserTag
    Set objMessage = objSmppSession.ReceiveDeliverResponse
  WEnd
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

Disconnect method

Disconnect this session. The connection on the client side will be dropped immediately.

Parameters:

  • None

Return value:

Always 0.

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  objSmppSession.Disconnect
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

CountSmsSubmissions method

This is the number of messages that have been received by the session but still need to be collected through the ReceiveSubmitSms method.

Parameters:

  • None

Return value:

The number of received SMS submissions.

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  WScript.Echo "In submit queue: " & objSmppSession.CountSmsSubmissions
  WScript.Echo "In query queue: " & objSmppSession.CountSmsQueries
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

CountSmsQueries method

This is the number of message queries that have been received by the session but still need to be collected through the ReceiveQuerySms method.

Parameters:

  • None

Return value:

The number of received SMS queries.

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  WScript.Echo "In submit queue: " & objSmppSession.CountSmsSubmissions
  WScript.Echo "In query queue: " & objSmppSession.CountSmsQueries
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

CountSmsDeliverySpace method

This method returns the minimum number of SMS messages that can be added to the 'delivery queue' using DeliverSms.

Use to set the maximum number of messages in this queue.

Parameters:

  • None

Return value:

The number of SMS messages that can be added using DeliverSms.

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  iMax = objSmppSession.CountSmsDeliverySpace
  strQ = "SELECT TOP(" & iMax & ") FROM Messages"
  Set objRs = objCon.Execute(strQ)
  ...
  While Not objRs.EOF
    objMessage.ToAddress = objRs("ToAddress")
    objSmppSession.DeliverSms objMessage
    ...
    objRs.MoveNext
  WEnd    
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

FetchNotResponded method

Returns the next SMS Message that was submitted to the remote SMPP client but not acknowledged. This message will have a sequence number but the command status is undefined. Use the UserTag property to identify this message.

This method can only be called on a disconnected instance.

When no more messages are available LastError will be set.

Parameters:

  • None

Return value:

The next Message object that was not updated

Example:
Set objSmppSession = objSmppServer.GetClosedSession
While objSmppServer.LastError = 0
  WScript.Echo "Session closed: " & objSmppSession.SystemId
			
  WScript.Echo "Not responded:  "
  Set objMessage = objSmppSession.FetchNotResponded
  While objSmppSession.LastError = 0
    WScript.Echo "Usertag: " & objMessage.Usertag & "; SequenceNumber: " & objMessage.SmppSequenceNumber	
    Set objMessage = objSmppSession.FetchNotResponded
  WEnd

  WScript.Echo "Not delivered (seq is 0):  "
  Set objMessage = objSmppSession.FetchNotDelivered
  While objSmppSession.LastError = 0
    WScript.Echo "Usertag: " & objMessage.Usertag & "; SequenceNumber: " & objMessage.SmppSequenceNumber	
    Set objMessage = objSmppSession.FetchNotDelivered
  WEnd
	
  Set objSmppSession = objSmppServer.GetClosedSession
WEnd

FetchNotDelivered method

Returns the next SMS Message that was submitted to the submit queue but not sent to the remote SMPP server. This message will not have a sequence number and the command status is undefined. Use the UserTag property to identify this message.

This method can only be called on a disconnected instance.

When no more messages are available LastError will be set.

Parameters:

  • None

Return value:

The next Message object that was not submitted

Example:
Set objSmppSession = objSmppServer.GetClosedSession
While objSmppServer.LastError = 0
  WScript.Echo "Session closed: " & objSmppSession.SystemId
			
  WScript.Echo "Not responded:  "
  Set objMessage = objSmppSession.FetchNotResponded
  While objSmppSession.LastError = 0
    WScript.Echo "Usertag: " & objMessage.Usertag & "; SequenceNumber: " & objMessage.SmppSequenceNumber	
    Set objMessage = objSmppSession.FetchNotResponded
  WEnd

  WScript.Echo "Not delivered (seq is 0):  "
  Set objMessage = objSmppSession.FetchNotDelivered
  While objSmppSession.LastError = 0
    WScript.Echo "Usertag: " & objMessage.Usertag & "; SequenceNumber: " & objMessage.SmppSequenceNumber	
    Set objMessage = objSmppSession.FetchNotDelivered
  WEnd
	
  Set objSmppSession = objSmppServer.GetClosedSession
WEnd

GetFirstPart method

This methods splits up a multipart message and returns the first part. If a message is not multipart it will return the original message formatted as HEX. Call GetNextPart to get the next part.

The returned message will be assigned a new multipart reference id that is kept and increased in this session.

The message will be formatted according to the current multipart mode.

Parameters:

  • Message object to be split

Return value:

The first part of the multipart message.

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  iCredits = objSmpp.CountParts(objSms)

  Set objPart = objSmpp.GetFirstPart(objSms)
  While objSmpp.LastError = 0
    objSmppSession.DeliverSms objPart
    Set objPart = objSmpp.GetNextPart()
  WEnd
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

GetNextPart method

This method returns the next part of a split up message. If no further parts are available the LastError code will be set. Call GetFirstPart before calling this method.

The message will be formatted according to the current multipart mode.

Parameters:

  • None

Return value:

The first part of the multipart message.

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  iCredits = objSmpp.CountParts(objSms)

  Set objPart = objSmpp.GetFirstPart(objSms)
  While objSmpp.LastError = 0
    objSmppSession.DeliverSms objPart
    Set objPart = objSmpp.GetNextPart()
  WEnd
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

CountParts method

This method returns the number of parts required to send the given Message object. This number will be calculated according to the current multipart mode.

Parameters:

  • None

Return value:

The first part of the multipart message.

Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ...
  iCredits = objSmpp.CountParts(objSms)

  Set objPart = objSmpp.GetFirstPart(objSms)
  While objSmpp.LastError = 0
    objSmppSession.DeliverSms objPart
    Set objPart = objSmpp.GetNextPart()
  WEnd
  ...
  Set objSmppSession = objSmppServer.GetNextSession
WEnd

AssembleSms method

This method assembles a multipart SMS message from its parts. Add parts through this function and check if assembled messages are ready through GetAssembledSms.

It's possible to assemble multiple multipart messages at the same time.

Parameters:

Return value:

None

Example:
Set objSmppServer = CreateObject("AxSms.SmppServer")
...
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ' Receive incoming messages
  Set objMessage = objSmppSession.ReceiveSubmitSms
  While objSmppSession.LastError = 0
    objSmppSession.AssembleSms objMessage
    objSmppSession.RespondToSubmitSms objMessage
	...
    Set objMessage = objSmppSession.ReceiveSubmitSms
  WEnd

  ' Get assembled messages
  Set objMessage = objSmppSession.GetAssembledSms(false)
  While objSmppSession.LastError = 0
	WScript.Echo "Received: " & objMessage.Body
	Set objMessage = objSmppSession.GetAssembledSms(false)
  WEnd
  ...  
WEnd

GetAssembledSms method

This method returns the first available assembled multipart SMS message. The message would be assembled from the parts inserted through the AssembleSms method.

Use ResetSmsAssembler to clear the internal list of incomplete multipart messages.

Use the 'Force' parameter to force assembly of the first stored (incomplete) multipart message. This may result in an incomplete message. An incomplete message will have Incomplete set to true.

If no multipart messages are available the LastError property will be set.

Parameters:

  • Force assemble to first available message

Return value:

None

Example:
Set objSmppServer = CreateObject("AxSms.SmppServer")
...
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
  ' Receive incoming messages
  Set objMessage = objSmppSession.ReceiveSubmitSms
  While objSmppSession.LastError = 0
    objSmppSession.AssembleSms objMessage
    objSmppSession.RespondToSubmitSms objMessage
	...
    Set objMessage = objSmppSession.ReceiveSubmitSms
  WEnd

  ' Get assembled messages
  Set objMessage = objSmppSession.GetAssembledSms(false)
  While objSmppSession.LastError = 0
	WScript.Echo "Received: " & objMessage.Body
	Set objMessage = objSmppSession.GetAssembledSms(false)
  WEnd
  ...  
WEnd

9. Http

9.1. Introduction

A lot of bulk SMS providers or SMSC's will provide a custom, HTTP based, interface to their customers to send out SMS messages.

Providers usually employ HTTP based custom interface because of their simplicity relative to more complex protocols like SMPP. Performance wise it's roughly comparable to SMPP in medium to large volumes.

The drawback in using HTTP is that HTTP will only allow sending SMS messages. If the user needs to receive SMS messages or if the user needs to receive delivery reports the user will have to set up an HTTP server as well to receive HTTP requests from SMSC.

The Smpp object in the SMS Component is set up to support most HTTP providers. For simple provider configurations the user can set up Url and PostBody templates and use the SendSms method to send out SMS messages. For more complex configurations the Http object provides Post and Get methods to create your own URL / post body layout independent of the existing SMS message object.

9.2. Properties

Send SMS using HTTP

Send an SMS through the HTTP protocol object.

Set objHttp = CreateObject("AxSms.Http")               ' Create HTTP protocol object
Set objConst = CreateObject("AxSms.Constants")         ' Create global constants object
Set objMessage = CreateObject("AxSms.Message")         ' Create SMS message object

WScript.Echo "SMS Component Version " & objHttp.Version & "; Build " & _
  objHttp.Build & "; Module " & objHttp.Module
WScript.Echo "License Status: " & objHttp.LicenseStatus & vbCrLf

objHttp.Logfile = "log.txt"                            

' Configure the HTTP protocol object for sending out SMS messages
objHttp.Url = "http://post.activexperts-labs.com:8080/sendsms/default.asp"
objHttp.PostBody = "username=CE658B84&password=FAC1982E&text=" & _
  objConst.HTTP_PLACEHOLDER_BODY & "&to=" & objConst.HTTP_PLACEHOLDER_TOADDRESS

' Compose the SMS message
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short text message"

' Send the SMS though the HTTP protocol object
strResponse = objHttp.SendSms(objMessage)
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

' Echo the HTTP response
WScript.Echo strResponse
WScript.Echo "Done !"
Property Type Read/Write Description
Version String Read Version number of the SMS Component
Build String Read Build number of the SMS Component
Module String Read Module name of the SMS Component
LicenseStatus String Out License Status
LicenseKey String In/Out License Key
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
WebAccount String Read/Write Web login account if required
WebPassword String Read/Write Web password if required
ProxyServer String Read/Write ProxyServer URL if required
ProxyAccount String Read/Write Proxy login account if required
ProxyPassword String Read/Write Proxy password if required
LastResponseCode Number Read Last response code returned by the server
RequestTimeout Number Read/Write Request timeout in milliseconds
Url String Read/Write Default URL, including placeholders, when sending text messages
PostBody String Read/Write Default Post body, including placeholders, when sending text messages

Version property

Return the version number of the SMS Component

Example:

Set objHttp = CreateObject("AxSms.Http")
WScript.Echo "SMS Component Version " & objHttp.Version & "; Build " & _
  objHttp.Build & "; Module " & objHttp.Module
WScript.Echo "License Status: " & objHttp.LicenseStatus & vbCrLf
...

Build property

Return the build number of the SMS Component.

Example:

Set objHttp = CreateObject("AxSms.Http")
WScript.Echo "SMS Component Version " & objHttp.Version & "; Build " & _
  objHttp.Build & "; Module " & objHttp.Module
WScript.Echo "License Status: " & objHttp.LicenseStatus & vbCrLf
...

Module property

Return the module name of the SMS Component.

Example:

Set objHttp = CreateObject("AxSms.Http")
WScript.Echo "SMS Component Version " & objHttp.Version & "; Build " & _
  objHttp.Build & "; Module " & objHttp.Module
WScript.Echo "License Status: " & objHttp.LicenseStatus & vbCrLf
...

LicenseStatus property

The status of your license. In case you have not licensed the product, the property holds the trial expiration date. For details, see Product Activation.

Example:

Set objHttp = CreateObject("AxSms.Http")                 ' Create new instance
WScript.Echo "License Status: " & objHttp.LicenseStatus
WScript.Echo "License Key: " & objHttp.LicenseKey

LicenseKey property

A license key is required to unlock this component after the trial period has expired. Assign the LicenseKey property every time a new instance of this component is created (see code below). Alternatively, the LicenseKey property can be set automatically. This requires the license key to be stored in the registry. For details, see Product Activation.

Example:

Set objHttp = CreateObject("AxSms.Http")                 ' Create new instance
objHttp.LicenseKey = "XXXXX-XXXXX-XXXXX"                ' Assign your license key 
WScript.Echo "LicenseKey: " & objHttp.LicenseKey

LastError property

Completion code of the last called method. To find the error description of a given error code, go to the online error codes codes page.

Example:

Set objHttp = CreateObject("AxSms.Http")  
...  
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
objHttp.SendSms objMessage
WScript.Echo "Send SMS result: " &  objHttp.LastError    ' Is our message sent ?  
...

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the SMS Component will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

Set objHttp = CreateObject("AxSms.Http")   
objHttp.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
objHttp.SendSms objMessage
...

WebAccount property

Set the web login account if this is required.

Example:

Set objHttp = CreateObject("AxSms.Http")
Set objMessage = CreateObject("AxSms.Message")
...
objHttp.WebAccount = "Account"
objHttp.WebPassword = "Password"
...
objHttp.SendSms objMessage
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

WebPassword property

Set the web login password if this is required.

Example:

Set objHttp = CreateObject("AxSms.Http")   
Set objMessage = CreateObject("AxSms.Message")
...
objHttp.WebAccount = "Account"
objHttp.WebPassword = "Password"
...
objHttp.SendSms objMessage
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

ProxyServer property

Set the proxy server if this is required.

Example:

Set objHttp = CreateObject("AxSms.Http")   
Set objMessage = CreateObject("AxSms.Message")
...
objHttp.ProxyServer = "proxy.domain.com:8080"
objHttp.ProxyAccount = "Account"
objHttp.ProxyPassword = "Password"
...
objHttp.SendSms objMessage
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

ProxyAccount property

Set the proxy server login if this is required.

Example:

Set objHttp = CreateObject("AxSms.Http")   
Set objMessage = CreateObject("AxSms.Message")
...
objHttp.ProxyServer = "proxy.domain.com:8080"
objHttp.ProxyAccount = "Account"
objHttp.ProxyPassword = "Password"
...
objHttp.SendSms objMessage
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

ProxyPassword property

Set the proxy server password if this is required.

Example:

Set objHttp = CreateObject("AxSms.Http")   
Set objMessage = CreateObject("AxSms.Message")
...
objHttp.ProxyServer = "proxy.domain.com:8080"
objHttp.ProxyAccount = "Account"
objHttp.ProxyPassword = "Password"
...
objHttp.SendSms objMessage
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

LastResponseCode property

This property is set to the last response code received from the server.

Example:

Set objHttp = CreateObject("AxSms.Http")   
Set objMessage = CreateObject("AxSms.Message")
...
objHttp.SendSms objMessage
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If
WScript.Echo objSmpp.LastResponseCode

RequestTimeout property

This is the request timeout in milliseconds.

Default request timeout is 10000 milliseconds.

Example:

Set objHttp = CreateObject("AxSms.Http")   
Set objMessage = CreateObject("AxSms.Message")
...
objHttp.RequestTimeout = 50000
objHttp.SendSms objMessage
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

Url property

This is the default URL that is being used when sending text messages trough Send Sms.

Use these placeholders to insert dynamic fields into the URL.

Example:

Set objHttp = CreateObject("AxSms.Http")   
Set objMessage = CreateObject("AxSms.Message")
...
objHttp.Url = "http://post.activexperts-labs.com:8080/sendsms/default.asp"
objHttp.PostBody = "username=CE658B84&password=FAC1982E&text=" & _
  objConst.HTTP_PLACEHOLDER_BODY & "&to=" & objConst.HTTP_PLACEHOLDER_TOADDRESS 
...  
objHttp.SendSms objMessage
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

PostBody property

This is the default Post body that is being used when sending text messages trough Send Sms.

Use these placeholders to insert dynamic fields into the Post body.

Example:

Set objHttp = CreateObject("AxSms.Http")   
Set objMessage = CreateObject("AxSms.Message")
...
objHttp.Url = "http://post.activexperts-labs.com:8080/sendsms/default.asp"
objHttp.PostBody = "username=CE658B84&password=FAC1982E&text=" & _
  objConst.HTTP_PLACEHOLDER_BODY & "&to=" & objConst.HTTP_PLACEHOLDER_TOADDRESS
...  
objHttp.SendSms objMessage
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

9.3. Methods

Method Description
Clear Reset all properties to their default values
SaveLicenseKey Save the License Key in the registry
GetErrorDescription Get the description of the given error
Sleep Sleep for the specified number of milliseconds
SetHeader Set HTTP header to be sent
Get Get a web page
Post Post a post body to a web server
SendSms Send a text message through this HTTP connection
UrlEncode URL encode the given string
HexEncode Hex encode the given string
Base64Encode Base64 encode the given string
Base64EncodeFile Base64 encode the given file

Clear method

This method resets all properties to their default values.

Parameters:

  • None

Return value:

Always 0.

Example:
Set objHttp = CreateObject("AxSms.Http")
....
objHttp.Clear
...

SaveLicenseKey method

Description:

Use SaveLicenseKey to store the license key permanently in the registry. When a license key is saved, it is restored automatically every time a new instance of the object ('Http') is created. It is not recommended to save the license key if you distribute the component with your own software, because the key can be easily used by others.

Parameters:

  • None.
Return value:

Always 0. Check LastError property to see if the method was completed successfully.

Example:

Set objHttp = CreateObject("AxSms.Http")               ' Create new instance
objHttp.LicenseKey = "XXXXX-XXXXX-XXXXX"
objHttp.SaveLicenseKey                                    ' Save license key to registry

For more information, see Product Activation.

GetErrorDescription method

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
Set objHttp = CreateObject("AxSms.Http")   
objHttp.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
objHttp.SendSms objMessage
WScript.Echo "SendSms result: " & objHttp.LastError & ", " & _
  objHttp.GetErrorDescription(objHttp.LastError)

Sleep method

This method suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
Set objHttp = CreateObject("AxSms.Http")
....
objHttp.Sleep 1000
...

SetHeader method

Set a custom HTTP header which will be include in future requests or posts made to a web server. The header value will clear any header value of the same name that was previously set. To clear all header values call the Clear method.

Parameters:

  • Header - Name of the header
  • Value - Header value

Return value:

None

Example:
Set objHttp = CreateObject("AxSms.Http")            
Set objMessage = CreateObject("AxSms.Message")
...
objHttp.SetHeader("Content-Type", "application/x-www-form-urlencoded")
...
strResponse = objHttp.Post("http://post.activexperts-labs.com:8080/sendsms/default.asp", _
  "username=CE658B84&password=FAC1982E&text=" & objHttp.UrlEncode(objMessage.Body) & _
  "&to=" & objHttp.UrlEncode(objMessage.ToAddress))
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

WScript.Echo strResponse
...

Get method

Get the contents of a web page from a web server and return it as a string value. This method defaults to non secure connections using the default HTTP port 80. The use of SSL or a different port can be specified as usual, e.g. https://cruisecontrol.intra:8080/dashboard connects securely on port 8080.

Parameters:

  • URL

Return value:

The requested website as a string value.

Example:
Set objHttp = CreateObject("AxSms.Http")
Set objMessage = CreateObject("AxSms.Message")
...
strResponse = objHttp.Get("http://post.activexperts-labs.com:8080/sendsms/default.asp?" & _
  "username=CE658B84&password=FAC1982E&text=" & objHttp.UrlEncode(objMessage.Body) & _
  "&to=" & objHttp.UrlEncode(objMessage.ToAddress)
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

WScript.Echo strResponse
...

Post method

Post a string to a website and returns the result as a string value. This method defaults to non secure connections using the default HTTP port 80. The use of SSL or a different port can be specified as usual, e.g. https://cruisecontrol.intra:8080/dashboard connects securely on port 8080.

Parameters:

  • Url
  • Post body

Return value:

The requested website as a string value.

Example:
Set objHttp = CreateObject("AxSms.Http")
Set objMessage = CreateObject("AxSms.Message")
...
strResponse = objHttp.Post("http://post.activexperts-labs.com:8080/sendsms/default.asp", _
  "username=CE658B84&password=FAC1982E&text=" & objHttp.UrlEncode(objMessage.Body) & _
  "&to=" & objHttp.UrlEncode(objMessage.ToAddress))
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

WScript.Echo strResponse
...

SendSms method

This method sends an SMS through HTTP by replace the placeholders in the Url and PostBody parameters. If the PostBody parameter is not set it will use a 'GET' request type, otherwise a 'POST' request type will be used.

Parameters:

Return value:

The server response

Example:
Set objHttp = CreateObject("AxSms.Http")   
Set objMessage = CreateObject("AxSms.Message")
...
objHttp.Url = "http://post.activexperts-labs.com:8080/sendsms/default.asp"
objHttp.PostBody = "username=CE658B84&password=FAC1982E&text=" & _
  objConst.HTTP_PLACEHOLDER_BODY & "&to=" & objConst.HTTP_PLACEHOLDER_TOADDRESS
...  
WScript.Echo objHttp.SendSms(objMessage)
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

UrlEncode method

Use this method to 'URL encode' parameters before adding them to the URL or Post body.

Parameters:

  • The string to encode

Return value:

The encoded string

Example:
Set objHttp = CreateObject("AxSms.Http")
Set objMessage = CreateObject("AxSms.Message")
...
strResponse = objHttp.Get("http://post.activexperts-labs.com:8080/sendsms/default.asp?" & _
  "username=CE658B84&password=FAC1982E&text=" & objHttp.UrlEncode(objMessage.Body) & _
  "&to=" & objHttp.UrlEncode(objMessage.ToAddress)
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

WScript.Echo strResponse
...

HexEncode method

Use this method to 'Hex' encode strings before adding them as a GET argument or POST body.

Parameters:

  • The string to encode

Return value:

The encoded string

Example:
Set objHttp = CreateObject("AxSms.Http")
Set objMessage = CreateObject("AxSms.Message")
...
strResponse = objHttp.Get("http://post.activexperts-labs.com:8080/sendsms/default.asp?" & _
  "username=CE658B84&password=FAC1982E&text=" & objHttp.HexEncode(objMessage.Body) & _
  "&to=" & objHttp.HexEncode(objMessage.ToAddress)
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

WScript.Echo strResponse
...

Base64Encode method

Use this method to Base64 encode a string.

Parameters:

  • String to encode

Return value:

The encoded string

Example:
Set objHttp = CreateObject("AxSms.Http")
Set objMessage = CreateObject("AxSms.Message")
...
strResponse = objHttp.Get("http://post.httpprovider.com:8080/sendsms/default.asp?" & _
  "username=Name&password=Password&text=" & objHttp.Base64Encode(objMessage.Body) & _
  "&to=" & objHttp.UrlEncode(objMessage.ToAddress)
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

WScript.Echo strResponse
...

Base64EncodeFile method

Use this method to Base64 encode a file

Parameters:

  • The filename of the file to encode

Return value:

The encoded string

Example:
Set objHttp = CreateObject("AxSms.Http")
Set objMessage = CreateObject("AxSms.Message")
...
strResponse = objHttp.Get("http://post.httpprovider.com:8080/sendsms/default.asp?" & _
  "username=Name&password=Password&image=" & objHttp.Base64EncodeFile("logo.png") & _
  "&to=" & objHttp.UrlEncode(objMessage.ToAddress)
If objHttp.LastError <> 0 Then
  WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
  WScript.Quit 1
End If

WScript.Echo strResponse
...

10. Dialup

10.1. Introduction

The Dialup object enables you to send SMS messages using a normal Hayes compatible modem (1200 bps or higher). The modem connects to an SMSC dial-in service provider to deliver the SMS message.

You can use the Dialup object to send SMS messages; receiving messages is not supported by the nature of SMSC Service Providers. The Dialup object can only send messages one-by-one.

There are many SMSC dial-in service providers around the world; click here for a list of supported SMS providers.

The Dialup object communicates with a normal modem using either a direct COM port, or using a Windows telephony device. It is recommended to use Windows telephony devices, for instance 'Standard 9600 bps Modem'.

If a Windows telephony device is used, settings are controlled by the Windows telephony driver, and can be configured through the 'Phone and Modem' settings:

  1. Open the Windows Control Panel from the Start menu;
  2. Double-click on 'Phone and Modem Options' and select the 'Modems' tab;
  3. Select the preferred modem and click on 'Properties'; from here, you can change the settings.

You can only send plain text messages. To send advanced SMS messages (like: flash, multi-part messages, data, ringtones, Unicode, etc.) try the Gsm or Smpp object.

There are two types of SMSC dial-in providers:

  • TAP/XIO providers;
  • UCP providers.

The Dialup object supports them both. Our list of supported SMSC providers shows the type of provider (TAP/XIO or UCP) for each provider.

Send SMS using Dialup

Send an SMS through the Dialup (UCP/TAP-XIO) protocol object.

Set objDialup = CreateObject("AxSms.Dialup")           ' Create Dialup protocol object
Set objConstants = CreateObject("AxSms.Constants")     ' Create global constants object
Set objMessage = CreateObject("AxSms.Message")         ' Create SMS message object

WScript.Echo "SMS Component Version " & objDialup.Version & "; Build " & _
objDialup.Build & "; Module " & objDialup.Module
WScript.Echo "License Status: " & objDialup.LicenseStatus & vbCrLf

objDialup.LogFile = "log.txt"

objDialup.Device = "COM2"
objDialup.DeviceSpeed = 56000
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"            ' Dialup provider

objMessage.ToAddress = "31122334455"
objMessage.Body = "Hello, World!"

objDialup.Send objMessage                              ' Send SMS message
If objDialup.LastError <> 0 Then
  WScript.Echo "Error: " & objDialup.GetErrorDescription(objDialup.LastError)
  WScript.Quit 1
End If

10.2. Properties

Property Type Read/Write Description
Version String Read Version number of the SMS Component
Build String Read Build number of the SMS Component
Module String Read Module name of the SMS Component
LicenseStatus String Out License Status
LicenseKey String In/Out License Key
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
Device String Read/Write Name of the device you want to use for sending the SMS messages
DeviceSpeed Number Read/Write The baudrate of the communication session
DeviceSettings Number Read/Write Identifier indicating databits, parity and stopbits
DeviceInitString String Read/Write Initialization string for the device
Dialmode Number Read/Write Tone or Pulse. Default: Tone
ProviderDialString String Read/Write Dial-string to dial-up to the provider
ProviderPassword String Read/Write Optional password to log on to the provider (UCP only)
ProviderType Number Read/Write Type of provider; can be UCP or TAP
ProviderResponse String Read Last response from provider

Version property

Return the version number of the SMS Component

Example:

Set objDialup = CreateObject("AxSms.Dialup")
WScript.Echo "SMS Component Version " & objDialup.Version & "; Build " & _
  objDialup.Build & "; Module " & objDialup.Module
WScript.Echo "License Status: " & objDialup.LicenseStatus & vbCrLf
...

Build property

Return the build number of the SMS Component.

Example:

Set objDialup = CreateObject("AxSms.Dialup")
WScript.Echo "SMS Component Version " & objDialup.Version & "; Build " & _
  objDialup.Build & "; Module " & objDialup.Module
WScript.Echo "License Status: " & objDialup.LicenseStatus & vbCrLf
...

Module property

Return the module name of the SMS Component.

Example:

Set objDialup = CreateObject("AxSms.Dialup")
WScript.Echo "SMS Component Version " & objDialup.Version & "; Build " & _
  objDialup.Build & "; Module " & objDialup.Module
WScript.Echo "License Status: " & objDialup.LicenseStatus & vbCrLf
...

LicenseStatus property

The status of your license. In case you have not licensed the product, the property holds the trial expiration date. For details, see Product Activation.

Example:

Set objDialup = CreateObject("AxSms.Dialup")                 ' Create new instance
WScript.Echo "License Status: " & objDialup.LicenseStatus
WScript.Echo "License Key: " & objDialup.LicenseKey

LicenseKey property

A license key is required to unlock this component after the trial period has expired. Assign the LicenseKey property every time a new instance of this component is created (see code below). Alternatively, the LicenseKey property can be set automatically. This requires the license key to be stored in the registry. For details, see Product Activation.

Example:

Set objDialup = CreateObject("AxSms.Dialup")                 ' Create new instance
objDialup.LicenseKey = "XXXXX-XXXXX-XXXXX"                ' Assign your license key 
WScript.Echo "LicenseKey: " & objDialup.LicenseKey

LastError property

Completion code of the last called method. To find the error description of a given error code, go to the online error codes codes page.

Example:

Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
...  
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
...
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..
objDialup.Send objMessage
WScript.Echo "Send result: " &  objDialup.LastError    ' Is our message sent ?  
...

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the SMS Component will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
...
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..  
objDialup.Send objMessage
...

Device property

The preferred device for sending SMS messages. You can either use a Windows telephony device (recommended) or a physical COM port (directly).

Assign one of the following strings to the 'Device' property:

  • A valid Windows telephony device name - this must be the exact name as it appears in Modems tab of the Phone and Modems Options applet in the Control Panel. For instance: "Standard 9600 bps Modem";
  • Use the GetDevice method to retrieve Windows telephony device names;
  • A valid COM port string, formatted as COMx, where x is a valid COM port number. When you assign the 'Device' property with a COM port string, you bypass all Windows telephony intelligence, like dialing rules, port sharing and so on.

Windows telephony devices are highly recommended.

Example:

Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
...
objDialup.Device = "COM1"
objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..  
objDialup.Send objMessage
...

DeviceSpeed property

By default, the speed settings are inherited from the Windows telephony device, or (in case a direct COM port is used) the default COM settings are used.

Use one of these values.

Example:

Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")            
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
...
objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..  
objDialup.Send objMessage
...

DeviceSettings property

By default, the databits/parity/stopbits settings are inherited from the Windows telephony device, or (in case a direct COM port is used) the default COM settings are used (8 databits, no parity, 1 stopbit).

Use one of these values.

Example:

Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")            
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
...
objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
objDialup.DeviceSettings = objConstants.DIALUP_DEVICESETTINGS_8N1
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..  
objDialup.Send objMessage
...

DeviceInitString property

Initialization string for the modem. Following string is used to initialize a modem:

  • If a Windows telephony device is used, the Windows telephony initialization string is used (the 'DeviceInitString' property is ignored);
  • If a direct COM port is used, the 'DeviceInitString' property is used to initialize the device.

As said, the 'DeviceInitString' property is ignored if a Windows telephony device is used. If you are using a direct port device, and you assign a string to the 'DeviceInitString' property, the string will be used to initialize the modem.

Important: commands can be separated by the ';' character, and will issued separately. So, if 'DeviceInitString' property holds the "ATZ" string, the toolkit first issues ATZ, waits for the OK response, then issues the AT&C1&K0 command and again waits for the OK response.

Example:

Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")            
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
...
objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
objDialup.DeviceInitString = "AT&F;AT&C1&K0"
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..  
objDialup.Send objMessage
...

Dialmode property

Set the 'DialMode' property to specify 'Tone' or 'Pulse' dialing. Click here for the values.

Example:

Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")            
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
...
objDialup.Dialmode = objConstants.DIALUP_DIALMODE_TONE
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..  
objDialup.Send objMessage
...

ProviderDialString property

Dial string to dial-up to the provider.

Example:

Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
...
objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..  
objDialup.Send objMessage
...

ProviderPassword property

Password used to logon to the provider. The majority of the TAP/UCP providers do not require a password; however, if a password is required, you can set it here.

Example:

Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
...
objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
objDialup.ProviderPassword = "Passw0rd"
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..  
objDialup.Send objMessage
...

ProviderType property

Type of provider; click here for a list of values.

Example:

Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")            
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
...
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..  
objDialup.Send objMessage
...

ProviderResponse property

ProviderResponse holds the last response from the Dial-Up provider. Use it for troubleshooting.

Example:

Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")            
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
...
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..  
objDialup.Send objMessage
WScript.Echo objDialup.ProviderResponse
...

10.3. Methods

Method Description
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
Sleep Sleep for the specified number of milliseconds
GetDeviceCount Return the number of Windows telephony devices installed on the local computer
GetDevice Retrieve a Windows telephony device name
Send Deliver the message to the SMSC provider. The SMSC provider will send the SMS message to the recipient
ProviderLoadConfig Load SMSC specific parameters from a configuration file
ProviderSaveConfig Save SMSC specific parameters to a configuration file
SaveLicenseKey Save the License Key in the registry

Clear method

This method resets all properties to their default values.

Parameters:

  • None

Return value:

Always 0.

Example:
Set objDialup = CreateObject("AxSms.Dialup")
....
objDialup.Clear
...

GetErrorDescription method

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
Set objDialup = CreateObject("AxSms.Dialup")   
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
objDialup.Send objMessage
WScript.Echo "SendSms result: " & objDialup.LastError & ", " & _
  objDialup.GetErrorDescription(objDialup.LastError)

Sleep method

This method suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
Set objDialup = CreateObject("AxSms.Dialup")
....
objDialup.Sleep 1000
...

GetDeviceCount method

This method suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
Set objDialup = CreateObject("AxSms.Dialup")
....
n = objDialupProtocol.GetDeviceCount()
For i = 0 to n-1
   WScript.Echo "Device " & i & ": " & objDialupProtocol.GetDevice( i )
Next
...

GetDevice method

This method suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
Set objDialup = CreateObject("AxSms.Dialup")
....
n = objDialupProtocol.GetDeviceCount()
For i = 0 to n-1
   WScript.Echo "Device " & i & ": " & objDialupProtocol.GetDevice( i )
Next
...

Send method

This method suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
Set objDialup = CreateObject("AxSms.Dialup")
Set objConstants = CreateObject("AxSms.Constants")  
...
objMessage.ToAddress = "31623350218"
objMessage.Body = "Hello world!"
...
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
...
objDialup.Send objMessage

ProviderLoadConfig method

This method suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
Set objDialup = CreateObject("AxSms.Dialup")
Set objConstants = CreateObject("AxSms.Constants")  
...
objDialup.ProviderLoadConfig "D:\ActiveXperts\SMS Component\MyProvider.dial"

ProviderSaveConfig method

Save provider specific information to a SmsProtocolDialup configuration file.

Parameters:

  • A SmsProtocolDialup file. A previous SmsProtocolDialup file will be overwritten automatically.

Return value:

Always 0.

Example:
Set objDialup = CreateObject("AxSms.Dialup")
Set objConstants = CreateObject("AxSms.Constants")  
...  
objDialup.Dialmode = objConstants.DIALUP_DIALMODE_TONE
objDialup.ProviderPassword = "Passw0rd"
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
...
objDialup.ProviderSaveConfig "D:\ActiveXperts\SMS Component\MyProvider.dial"

SaveLicenseKey method

Description:

Use SaveLicenseKey to store the license key permanently in the registry. When a license key is saved, it is restored automatically every time a new instance of the object ('Dialup') is created. It is not recommended to save the license key if you distribute the component with your own software, because the key can be easily used by others.

Parameters:

  • None.
Return value:

Always 0. Check LastError property to see if the method was completed successfully.

Example:

Set objDialup = CreateObject("AxSms.Dialup")           ' Create new instance
objDialup.LicenseKey = "XXXXX-XXXXX-XXXXX"
objDialup.SaveLicenseKey                                  ' Save license key to registry

For more information, see Product Activation.

11. Message

11.1. Introduction

This object represents an SMS message. Any SMS Component protocol, Gsm, Smpp, SmppServer, Http and Dialup accept and return SMS message data by using this object.

Most properties and methods in the Message object are applicable to all or multiple protocols. Some properties will only be used in a specific protocol. The properties and methods that are specific to a protocol will be prefixed with the protocol name. For example: GsmFirstOctet or SmppPriority

11.2. Properties

Property Type Read/Write Description
LastError Number Read Result of the last called method
UserTag Number Read/Write User defined value to track this object
ToAddress String Read/Write The address to send this message to
FromAddress String Read/Write The address this message was received from
Body String Read/Write The body value of the SMS message
RequestDeliveryReport Boolean Read/Write Whether or not to request a delivery report
ToAddressTON String Read/Write Type of Number for the 'ToAddress'
ToAddressNPI String Read/Write Number Plan Indicator for the 'ToAddress'
FromAddressTON String Read/Write Type of Number for the 'FromAddress'
FromAddressNPI String Read/Write Number Plan Indicator for the 'FromAddress'
ProtocolId String Read/Write The protocol ID
ValidityPeriod Number Read/Write Validity Period in minutes
Reference String Read/Write Message reference
DataCoding Number Read/Write Data coding
BodyFormat Number Read/Write Body format
HasUdh Boolean Read/Write Whether a User Data Header is present
ReceiveTime String Read Receive time
ReceiveTimeInSeconds Number Read Receive time in seconds
TotalParts Number Read The total number of message parts
PartNumber Number Read The part number for this message
MultipartRef Number Read The multipart reference
Incomplete Boolean Read Whether this message is complete
GsmFirstOctet Number Read/Write GSM specific, First octet
GsmSmscAddress String Read GSM specific, SMSC address
GsmSmscAddressTON Number Read GSM specific, Address TON
GsmSmscAddressNPI Number Read GSM specific, Address NPI
GsmMemoryIndex String Read/Write GSM specific, Memory index
GsmMemoryLocation String Read/Write GSM specific, Memory location
SmppPriority Number Read/Write SMPP specific, priority
SmppServiceType String Read/Write SMPP specific, service type
SmppEsmClass Number Read/Write SMPP specific, ESM class
SmppStatus Number Read SMPP specific, message status
SmppError Number Read SMPP specific, message error code
SmppIsDeliveryReport Number Read/Write SMPP specific, whether this SMS message is a delivery report
SmppCommandStatus Number Read/Write SMPP specific, command status
SmppSequenceNumber Number Read SMPP specific, sequence number

LastError property

Completion code of the last called method. To find the error description of a given error code, go to the online error codes codes page.

Example:

Set objMessage = CreateObject("AxSms.Message")
...
Set objTlv = objMessage.SmppGetFirstTlv()
While objMessage.LastError = 0
  WScript.Echo "Tag: " & objTlv.Tag & "; Value: " & objTlv.ValueAsHexString
  Set objTlv = objMessage.SmppGetNextTlv()
Wend
...

UserTag property

This can be any value. Use this property to track an SMS message.

Example:

Set objMessage = CreateObject("AxSms.Message")
...
objMessage.UserTag = 1
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

ToAddress property

This property contains the address to send the SMS Message to.

Example:

Set objMessage = CreateObject("AxSms.Message")
...
objMessage.UserTag = 1
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

FromAddress property

This property contains the address this message was received from.

Example:

Set objMessage = CreateObject("AxSms.Message")
...
objMessage.FromAddress = "ActvXprts"
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

Body property

The body value of the SMS message. When setting or getting this property the format is determined by the BodyFormat property.

Example:

Set objMessage = CreateObject("AxSms.Message")
objMessage.FromAddress = "ActvXprts"
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

RequestDeliveryReport property

Use this property to request a delivery report when this message is sent. Setting this property to true has the same effect as setting SmppEsmClass to SMPP_ESM_2ESME_DELIVERY_RECEIPT when sending through SMPP or settings GsmFirstOctet to GSM_FO_STATUS_REPORT when sending through GSM.

Example:

Set objMessage = CreateObject("AxSms.Message")
objMessage.RequestDeliveryReport = true
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

ToAddressTON property

This is the type of number for the ToAddress property. Set this to one of these constants.

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objConst = CreateObject("AxSms.Constants")
...
objMessage.ToAddressTON = objConst.TON_INTERNATIONAL
objMessage.ToAddressNPI = objConst.NPI_ISDN
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

ToAddressNPI property

This is the number plan indicator for the ToAddress property. Set this to one of these constants.

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objConst = CreateObject("AxSms.Constants")
...
objMessage.ToAddressNPI = objConst.NPI_ISDN
objMessage.ToAddressTON = objConst.TON_INTERNATIONAL
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

FromAddressTON property

This is the type of number for the FromAddress property. Set this to one of these constants.

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objConst = CreateObject("AxSms.Constants")
...
objMessage.FromAddressNPI = objConst.NPI_ISDN
objMessage.FromAddressTON = objConst.TON_ALPHANUMERIC
objMessage.FromAddress = "ActvXprts"
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

FromAddressNPI property

This is the number plan indicator for the FromAddress property. Set this to one of these constants.

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objConst = CreateObject("AxSms.Constants")
...
objMessage.FromAddressNPI = objConst.NPI_ISDN
objMessage.FromAddressTON = objConst.TON_ALPHANUMERIC
objMessage.FromAddress = "ActvXprts"
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

ProtocolId property

This is the protocol ID that's going to be sent with this SMS message.

Example:

Set objMessage = CreateObject("AxSms.Message")
...
objMessage.ProtocolId = ""
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

ValidityPeriod property

This is the validity period for the SMS message in minutes. The validity period is the time the SMSC will try to deliver this message. If the SMSC is unable to deliver the message within its validity period the message is failed.

The default value is '0' which uses the SMSC default validity period.

Example:

Set objMessage = CreateObject("AxSms.Message")
...
objMessage.ValidityPeriod = 300
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

Reference property

This is the message reference. When using SMPP this is the reference obtained from SMSC, when using GSM this will be the reference obtained from the GSM modem.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
While objSmpp.WaitForSmsUpdate
  Set objMessage = objsmpp.FetchSmsUpdate
  If objSmpp.LastError = 0 Then
    WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag
    WScript.Sleep 1
  End If
WEnd

DataCoding property

Data coding byte. This property should be used to set the required datacoding of the property field, for instance, when a message should be sent as Unicode instead of the normal 7 bit GSM character set.

When setting this property use these constants.

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objConst = CreateObject("AxSms.Constants")
...
objMessage.DataCoding = objConst.DATACODING_UNICODE
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

BodyFormat property

The body format property. This specifies the format of the Body property. When setting this property use these constants

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objConst = CreateObject("AxSms.Constants")
...
objMessage.BodyFormat = objConst.BODYFORMAT_TEXT
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

HasUdh property

Whether a User Data Header is present. This specifies if the SMS message has a UDH header prefixing the message.

Since a UDH header is always binary the BodyFormat will always be set to BODYFORMAT_HEX on incoming messages that have a UDH header. When sending a message with a UDH header the message should be specified in HEX.

Depending on the multipart or application port settings on either the GSM or the SMPP protocol the SMS Component may generate UDH headers when sending and splitting up multipart messages or application port messages. In the same way the SMS Component may interpret UDH headers when receiving multipart or application port headers. In these cases the hasUdh property will remain 'false' unless a UDH header cannot be interpreted or does not need to be generated and ends up in the Message object.

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objConst = CreateObject("AxSms.Constants")
...
objMessage.BodyFormat = objConst.BODYFORMAT_TEXT
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

ReceiveTime property

This property will contain the receive time of this message.

Example:

Set objGsm = CreateObject("AxSms.Gsm")  
...
Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo "Receive time: " & objMessage.ReceiveTime
  WScript.Echo objMessage.Body
  Set objMessage = objGsm.GetNextSms
Wend

ReceiveTimeInSeconds property

This property will contain the receive time of this message in seconds.

The receive time is in seconds since 1/1/1970 (Unix time-stamp) format.

Example:

Set objGsm = CreateObject("AxSms.Gsm")  
...
Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo "Receive time in seconds: " & objMessage.ReceiveTimeInSeconds
  WScript.Echo objMessage.Body
  Set objMessage = objGsm.GetNextSms
Wend

TotalParts property

If this message is part of a multipart message this property will be set to the total number of parts the multipart message consists of. The 'PartNumber' property contains the part number for this message.

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objGsm = CreateObject("AxSms.Gsm")
Set objConst = CreateObject("AxSms.Constants")
...
objGsm.AssembleMultipart = false
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_UNREAD
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...
Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo objMessage.Body
  WScript.Echo "Part " & objMessage.PartNumber & " from " & objMessage.TotalParts    
  Set objMessage = objGsm.GetNextSms
Wend

PartNumber property

If this message is part of a multipart message this property will be set to the part number of this SMS message. The 'TotalParts' property contains the total number of parts for the entire message

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objGsm = CreateObject("AxSms.Gsm")
Set objConst = CreateObject("AxSms.Constants")
...
objGsm.AssembleMultipart = false
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_UNREAD
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...
Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo objMessage.Body
  WScript.Echo "Part " & objMessage.PartNumber & " from " & objMessage.TotalParts    
  Set objMessage = objGsm.GetNextSms
Wend

MultipartRef property

If the message is part of a multipart message this property will be set to the multipart reference number of this SMS message.

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objGsm = CreateObject("AxSms.Gsm")
Set objConst = CreateObject("AxSms.Constants")
...
objGsm.AssembleMultipart = false
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_UNREAD
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...
Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo objMessage.Body
  WScript.Echo "Multipart reference: " & objMessage.MultipartRef
  WScript.Echo "Part " & objMessage.PartNumber & " from " & objMessage.TotalParts    
  Set objMessage = objGsm.GetNextSms
Wend

Incomplete property

This property is set to true when one or more of the parts of this message have not been received (yet). For instance, incomplete messages can appear on a SIM card (using a Gsm device) or when a multipart message times out (using Smpp).

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objGsm = CreateObject("AxSms.Gsm")
Set objConst = CreateObject("AxSms.Constants")
...
objGsm.AssembleMultipart = true
objGsm.Receive objConst.GSM_MESSAGESTATE_ALL
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If
...
Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo "Incomplete: " & objMessage.Incomplete
  WScript.Echo objMessage.Body
  Set objMessage = objGsm.GetNextSms
Wend

GsmFirstOctet property

This is the first octet value. This property is used when a specific first octet setting is required which can not be set using other properties like RequestDeliveryReport

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objConst = CreateObject("AxSms.Constants")
...
objMessage.GsmFirstOctet = objConst.GSM_FO_UDHI
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

GsmSmscAddress property

The address for the SMSC that delivered this SMS. To specify a preferred SMS to delivery a message use the PreferredSmsc property on the Gsm object.

Example:

Set objGsm = CreateObject("AxSms.Gsm")  
...
Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo "Smsc address: " & objMessage.GsmSmscAddress
  WScript.Echo "Smsc address TON: " & objMessage.GsmSmscAddressTON
  WScript.Echo "Smsc address NPI: " & objMessage.GsmSmscAddressNPI
  WScript.Echo objMessage.Body
  Set objMessage = objGsm.GetNextSms
Wend

GsmSmscAddressTON property

The Type of Number for the SmscAddress. This will always be one of these constants.

Example:

Set objGsm = CreateObject("AxSms.Gsm")  
...
Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo "Smsc address: " & objMessage.GsmSmscAddress
  WScript.Echo "Smsc address TON: " & objMessage.GsmSmscAddressTON
  WScript.Echo "Smsc address NPI: " & objMessage.GsmSmscAddressNPI
  WScript.Echo objMessage.Body
  Set objMessage = objGsm.GetNextSms
Wend

GsmSmscAddressNPI property

The Numbering Plan Indicator for the SmscAddress. This will always be one of these constants.

Example:

Set objGsm = CreateObject("AxSms.Gsm")  
...
Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo "Smsc address: " & objMessage.GsmSmscAddress
  WScript.Echo "Smsc address TON: " & objMessage.GsmSmscAddressTON
  WScript.Echo "Smsc address NPI: " & objMessage.GsmSmscAddressNPI
  WScript.Echo objMessage.Body
  Set objMessage = objGsm.GetNextSms
Wend

GsmMemoryIndex property

If this message was received through GSM this property will contain the memory index that holds this message. Together with the MemoryLocation this property identifies where this message is located in the device.

Example:

Set objGsm = CreateObject("AxSms.Gsm")  
...
Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo "Memory index: " & objMessage.GsmMemoryIndex
  WScript.Echo "Memory location: " & objMessage.GsmMemoryLocation
  WScript.Echo objMessage.Body
  Set objMessage = objGsm.GetNextSms
Wend

GsmMemoryLocation property

If this message was received through GSM this property will contain the memory location that holds this message. Together with the MemoryIndex this property identifies where this message is located in the device.

Example:

Set objGsm = CreateObject("AxSms.Gsm")  
...
Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo "Memory index: " & objMessage.GsmMemoryIndex
  WScript.Echo "Memory location: " & objMessage.GsmMemoryLocation
  WScript.Echo objMessage.Body
  Set objMessage = objGsm.GetNextSms
Wend

SmppPriority property

Set this property to the message priority. Use one of these constants

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objConst = CreateObject("AxSms.Constants")
...
objMessage.SmppPriority = objConst.GSM_FO_UDHI
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

SmppServiceType property

Set this property to the service type. These are some service types that can be used:

  • "" - Empty string (default)
  • "CMT" - Cellular Messaging
  • "CPT" - Cellular Paging
  • "VMN" - Voice Mail Notification
  • "VMA" - Voice Mail Alerting
  • "WAP" - Wireless Application Protocol
  • "USSD" - Unstructured Supplementary Services Data
  • "CBS" - Cell Broadcast Service
  • "GUTS" - Generic UDP Transport Service

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objConst = CreateObject("AxSms.Constants")
...
objMessage.SmppServiceType = "USSD"
objMessage.ToAddress = "+31122334455"
objMessage.Body = "?*101#??"
...

SmppEsmClass property

This is the ESM class value. This property is used when a specific ESM class setting is required which can not be set using other properties like RequestDeliveryReport. Use one of these constants.

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objConst = CreateObject("AxSms.Constants")
...
objMessage.SmppEsmClass = objConst.SMPP_ESM_2ESME_DELIVERY_RECEIPT
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

SmppStatus property

This is the last known message status for an SMPP message. This property is always set to one of these constants.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
objSmpp.QuerySms objMessage
While objSmpp.WaitForSmsUpdate
  Set objMessage = objsmpp.FetchSmsUpdate
  If objSmpp.LastError = 0 Then
    WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag & _
      objMessage.SmppStatus
    WScript.Sleep 1
  End If
WEnd

SmppError property

This is the error code for this message. This will only be set by querying a message.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
objSmpp.QuerySms objMessage
While objSmpp.WaitForSmsUpdate
  Set objMessage = objsmpp.FetchSmsUpdate
  If objSmpp.LastError = 0 Then
    WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag & _
      objMessage.SmppError
    WScript.Sleep 1
  End If
WEnd

SmppIsDeliveryReport property

This property will be set to true if this message is a delivery report. Set this property to create a delivery report.

Using this property is equivalent to testing the 'SmppEsmClass' property for the 'SMPP_ESM_2ESME_DELIVERY_RECEIPT' bit.

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objSmpp = CreateObject("AxSms.Smpp")
...  
Set objMessage = objSmpp.ReceiveMessage()
While objSmpp.LastError = 0
  If objMessage.SmppIsDeliveryReport Then
    WScript.Echo "Delivery rpt for: " & Left(objMessage.Body, InStr(objMessage.Body, " ")) & _
      "State: " & Mid(objMessage.Body, InStr(objMessage.Body, "stat:")+5, 7)      
  Else
    WScript.Echo "Received toaddress: " & objMessage.ToAddress
    WScript.Echo "Body: " & objMessage.Body      
  End If
  Set objMessage = objSmpp.ReceiveMessage()
Wend  
...

SmppCommandStatus property

This is the command status from the 'SUBMIT_SM_RESP' command or the 'QUERY_SM_RESP' command if applicable. If an SMS message is rejected by the server this will contain a status code. This will always be set to one of these constants.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
objSmpp.SubmitSms objMessage
While objSmpp.WaitForSmsUpdate
  Set objMessage = objsmpp.FetchSmsUpdate
  If objSmpp.LastError = 0 And objMessage.SmppCommandStatus = 0 Then
    WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag &
  ElsIf objMessage.SmppCommandStatus <> 0 Then
    WScript.Echo "Status: " & objMessage.SmppCommandStatus
  End
  WScript.Sleep 1
WEnd

SmppSequenceNumber property

This is the sequence number associated with the message. This property is only set in the messages received from FetchSmsUpdate

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
objSmpp.SubmitSms objMessage
While objSmpp.WaitForSmsUpdate
  Set objMessage = objsmpp.FetchSmsUpdate
  If objSmpp.LastError = 0 And objMessage.SmppCommandStatus = 0 Then
    WScript.Echo "Sequence number: " & objMessage.SmppSequenceNumber
  ElsIf objMessage.SmppCommandStatus <> 0 Then
    WScript.Echo "Status: " & objMessage.SmppCommandStatus
  End
  WScript.Sleep 1
WEnd

11.3. Methods

Method Description
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
SmppAddTlv Add a TLV value to this message
SmppGetTlv Get a specific TLV value from this message
SmppGetFirstTlv Get the first TLV value attached to this message
SmppGetNextTlv Get the next TLV value attached to this message

Clear method

This method resets all properties to their default values.

Parameters:

  • None

Return value:

None

Example:
Set objMessage = CreateObject("AxSms.Message")
...
objMessage.Clear  
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

GetErrorDescription method

GetErrorDescription provides the error description of a given error code.

Parameters:

  • Error code

Return value:

The error string

Example:
Set objMessage = CreateObject("AxSms.Message")
...
Set objTlv = objSms.SmppGetFirstTlv()
While objSms.LastError = 0
  WScript.Echo "Tag: " & objTlv.Tag & "; Value: " & objTlv.ValueAsHexString
  Set objTlv = objSms.SmppGetNextTlv()
Wend
...
WScript.Echo objSms.GetErrorDescription(objSmpp.LastError)

SmppAddTlv method

Add a Tlv (Tag, Length, Value) object to this message.

Parameters:

Return value:

None

Example:
Set objMessage = CreateObject("AxSms.Message")
Set objTlv = CreateObject("AxSms.Tlv")  
...
objTlv.Tag = 100
objTlv.ValueAsString = "Hello"
objMessage.SmppAddTlv objTlv
...

SmppGetTlv method

This method returns a specific TLV (Tag, Length, Value) object according to the Tag value. This is a list of common TLV Tag values.

Parameters:

  • The Tag value

Return value:

Tlv object

Example:
Set objMessage = CreateObject("AxSms.Message")
...
Set objTlv = objMessage.SmppGetTlv(100)
WScript.Echo objTlv.ValueAsHexString  
...

SmppGetFirstTlv method

This method return the first TLV value attached to this message.

Parameters:

  • None

Return value:

Tlv object

Example:
Set objMessage = CreateObject("AxSms.Message")
...
Set objTlv = objMessage.SmppGetFirstTlv()
While objMessage.LastError = 0
  WScript.Echo "Tag: " & objTlv.Tag & "; Value: " & objTlv.ValueAsHexString
  Set objTlv = objMessage.SmppGetNextTlv()
Wend

SmppGetNextTlv method

This method return the first TLV value attached to this message

Parameters:

  • None

Return value:

Tlv object

Example:
Set objMessage = CreateObject("AxSms.Message")
...
Set objTlv = objMessage.SmppGetFirstTlv()
While objMessage.LastError = 0
  WScript.Echo "Tag: " & objTlv.Tag & "; Value: " & objTlv.ValueAsHexString
  Set objTlv = objMessage.SmppGetNextTlv()
WEnd

12. TemplateWapPush

12.1. Introduction

The Template... objects are used to generate SMS messages with special methods. You can set the properties according to your needs and call the Encode method to generate a message body. Set this body into an SMS and set the HasUdh property to true and the BodyFormat property to 'BODYFORMAT_HEX'.

A WAPPush message can be used to push an URL to a mobile phone. The phone will show the URL along with a description and the option to visit this URL.

Note: Most modern smart phones, like the iPhone and recent Android based phones, no longer support this message type.

12.2. Properties

Property Type Read/Write Description
Url String Read/Write The URL to send
Description String Read/Write The description to send
SignalAction Number Read/Write The type of WAPPush action
Data String Read/Write The actual WAPPush message
LastError String Read Result of the last called method

Url property

This is the URL to send to the mobile device.

Example:

  Set objGsm = CreateObject("AxSms.Gsm")
  Set objMessage = CreateObject("AxSms.Message")
  Set objWapPush = CreateObject("AxSms.TemplateWapPush")
  Set objConst = CreateObject("AxSms.Constants")
  ...
  objWapPush.Description = "Innovators in Communication"
  objWapPush.Url = "www.ActiveXperts.com"
  objWapPush.Signal = objConst.WAPPUSH_SIGNAL_MEDIUM
  objWapPush.Encode

  objMessage.ToAddress = "+31122334455"
  objMessage.Body = objWapPush.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX

  objGsm.SendSms objMessage
  ...

Description property

This is the description to go with the URL

Example:

  Set objGsm = CreateObject("AxSms.Gsm")
  Set objMessage = CreateObject("AxSms.Message")
  Set objWapPush = CreateObject("AxSms.TemplateWapPush")
  Set objConst = CreateObject("AxSms.Constants")
  ...
  objWapPush.Description = "Innovators in Communication"
  objWapPush.Url = "www.ActiveXperts.com"
  objWapPush.SignalAction = objConst.WAPPUSH_SIGNAL_MEDIUM
  objWapPush.Encode

  objMessage.ToAddress = "+31122334455"
  objMessage.Body = objWapPush.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX

  objGsm.SendSms objMessage
  ...

SignalAction property

This is the signal action that should be used. It is either the priority of the WAPPush message or sets it to delete.

Example:

  Set objGsm = CreateObject("AxSms.Gsm")
  Set objMessage = CreateObject("AxSms.Message")
  Set objWapPush = CreateObject("AxSms.TemplateWapPush")
  Set objConst = CreateObject("AxSms.Constants")
  ...
  objWapPush.Description = "Innovators in Communication"
  objWapPush.Url = "www.ActiveXperts.com"
  objWapPush.SignalAction = objConst.WAPPUSH_SIGNAL_MEDIUM
  objWapPush.Encode

  objMessage.ToAddress = "+31122334455"
  objMessage.Body = objWapPush.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX

  objGsm.SendSms objMessage
  ...

Data property

After calling the Encode method this property will contain the WAPPush body as a HEX encoded string. To send this message set this body into an SMS and set the HasUdh property to true and the BodyFormat property to 'BODYFORMAT_HEX'.

Example:

  Set objGsm = CreateObject("AxSms.Gsm")
  Set objMessage = CreateObject("AxSms.Message")
  Set objWapPush = CreateObject("AxSms.TemplateWapPush")
  Set objConst = CreateObject("AxSms.Constants")
  ...
  objWapPush.Description = "Innovators in Communication"
  objWapPush.Url = "www.ActiveXperts.com"
  objWapPush.SignalAction = objConst.WAPPUSH_SIGNAL_MEDIUM
  objWapPush.Encode

  objMessage.ToAddress = "+31122334455"
  objMessage.Body = objWapPush.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX

  objGsm.SendSms objMessage
  ...

LastError property

Completion code of the last called method. To find the error description of a given error code, go to the online error codes codes page.

Example:

  Set objGsm = CreateObject("AxSms.Gsm")
  Set objMessage = CreateObject("AxSms.Message")
  Set objWapPush = CreateObject("AxSms.TemplateWapPush")
  Set objConst = CreateObject("AxSms.Constants")
  ...
  objWapPush.Description = "Innovators in Communication"
  objWapPush.Url = "www.ActiveXperts.com"
  objWapPush.SignalAction = objConst.WAPPUSH_SIGNAL_MEDIUM
  objWapPush.Encode
  If objWapPush.LastError <> 0 Then
    WScript.Echo objWapPush.GetErrorDescription(objWapPush.LastError)
    WScript.Quit
  End If
  ...

12.3. Methods

Method Description
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
Encode Creates the actual WAPPush message out of the property settings

Clear method

This method resets all properties to their default values.

Parameters:

  • None

Return value:

None

Example:
Set objWapPush = CreateObject("AxSms.TemplateWapPush")
...
objWapPush.Clear
...

GetErrorDescription method

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
Set objWapPush = CreateObject("AxSms.TemplateWapPush")
Set objConst = CreateObject("AxSms.Constants")
...
objWapPush.Description = "Innovators in Communication"
objWapPush.Url = "www.ActiveXperts.com"
objWapPush.SignalAction = objConst.WAPPUSH_SIGNAL_MEDIUM
objWapPush.Encode
If objWapPush.LastError <> 0 Then
  WScript.Echo objWapPush.GetErrorDescription(objWapPush.LastError)
  WScript.Quit
End If
...

Encode method

Creates WAPPush message according to the current settings. After calling this method the Data property will contain the WAPPush body as a HEX encoded string. To send this message set this body into an SMS and set the HasUdh property to true and the BodyFormat property to 'BODYFORMAT_HEX'.

Parameters:

  • None

Return value:

Always returns 0

Example:
Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
Set objWapPush = CreateObject("AxSms.TemplateWapPush")
Set objConst = CreateObject("AxSms.Constants")
...
objWapPush.Description = "Innovators in Communication"
objWapPush.Url = "www.ActiveXperts.com"
objWapPush.SignalAction = objConst.WAPPUSH_SIGNAL_MEDIUM
objWapPush.Encode

objMessage.ToAddress = "+31122334455"
objMessage.Body = objWapPush.Data
objMessage.HasUdh = true
objMessage.BodyFormat = objConst.BODYFORMAT_HEX

objGsm.SendSms objMessage
...

13. TemplatevCard

13.1. Introduction

The Template.. objects are used to generate SMS messages with special methods. You can set the properties according to your needs and call the Encode method to generate a message body. Set this body into an SMS and set the HasUdh property to true and the BodyFormat property to 'BODYFORMAT_HEX'.

A vCard message can be used to push a virtual business card to a mobile phone.

Note: Most modern smart phones, like the iPhone and recent Android based phones, no longer support this message type.

13.2. Properties

Property Type Read/Write Description
Url String Read/Write URL pointing to the website of the contact
Title String Read/Write The title of the contact
EMail String Read/Write E-mail address
Fax String Read/Write Fax number
Pager String Read/Write Pager number
Mobile String Read/Write Mobile number
PhoneHome String Read/Write Home phone number
Phone String Read/Write Phone number
Name String Read/Write Name
Data String Read/Write The actual vCard message
LastError String Read Result of the last called method

Url property

This is the URL pointing to the website of the contact

Example:

Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
Set objvCard = CreateObject("AxSms.TemplatevCard")
Set objConst = CreateObject("AxSms.Constants")
          
objvCard.Url = "http://www.ActiveXperts.com"
objvCard.Title = "Customer support"
objvCard.EMail = "support(at)activexperts.com"
objvCard.Phone = "+31122334455"
objvCard.Name = "Customer Support ActiveXperts"
objvCard.Encode

objMessage.Body = objvCard.Data
objMessage.HasUdh = true
objMessage.BodyFormat = objConst.BODYFORMAT_HEX

strRef = objGsm.SendSms(objMessage)  
...

Title property

This is the title of the contact

Example:

Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
Set objvCard = CreateObject("AxSms.TemplatevCard")
Set objConst = CreateObject("AxSms.Constants")
          
objvCard.Url = "http://www.ActiveXperts.com"
objvCard.Title = "Customer support"
objvCard.EMail = "support(at)activexperts.com"
objvCard.Phone = "+31122334455"
objvCard.Name = "Customer Support ActiveXperts"
objvCard.Encode

objMessage.Body = objvCard.Data
objMessage.HasUdh = true
objMessage.BodyFormat = objConst.BODYFORMAT_HEX

strRef = objGsm.SendSms(objMessage)  
...

EMail property

This is the e-mail address of the contact

Example:

Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
Set objvCard = CreateObject("AxSms.TemplatevCard")
Set objConst = CreateObject("AxSms.Constants")
          
objvCard.Url = "http://www.ActiveXperts.com"
objvCard.Title = "Customer support"
objvCard.EMail = "support(at)activexperts.com"
objvCard.Phone = "+31122334455"
objvCard.Name = "Customer Support ActiveXperts"
objvCard.Encode

objMessage.Body = objvCard.Data
objMessage.HasUdh = true
objMessage.BodyFormat = objConst.BODYFORMAT_HEX

strRef = objGsm.SendSms(objMessage)  
...

Fax property

This is the fax number of the contact

Example:

Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
Set objvCard = CreateObject("AxSms.TemplatevCard")
Set objConst = CreateObject("AxSms.Constants")
          
objvCard.Url = "http://www.ActiveXperts.com"
objvCard.Title = "Customer support"
objvCard.EMail = "support(at)activexperts.com"
objvCard.Fax = "+31122334455"
objvCard.Name = "Customer Support ActiveXperts"
objvCard.Encode

objMessage.Body = objvCard.Data
objMessage.HasUdh = true
objMessage.BodyFormat = objConst.BODYFORMAT_HEX

strRef = objGsm.SendSms(objMessage)  
...

Pager property

This is the pager number of the contact

Example:

Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
Set objvCard = CreateObject("AxSms.TemplatevCard")
Set objConst = CreateObject("AxSms.Constants")
          
objvCard.Url = "http://www.ActiveXperts.com"
objvCard.Title = "Customer support"
objvCard.EMail = "support(at)activexperts.com"
objvCard.Pager = "+31122334455"
objvCard.Name = "Customer Support ActiveXperts"
objvCard.Encode

objMessage.Body = objvCard.Data
objMessage.HasUdh = true
objMessage.BodyFormat = objConst.BODYFORMAT_HEX

strRef = objGsm.SendSms(objMessage)  
...

Mobile property

This is the mobile number of the contact

Example:

Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
Set objvCard = CreateObject("AxSms.TemplatevCard")
Set objConst = CreateObject("AxSms.Constants")
          
objvCard.Url = "http://www.ActiveXperts.com"
objvCard.Title = "Customer support"
objvCard.EMail = "support(at)activexperts.com"
objvCard.Mobile = "+31122334455"
objvCard.Name = "Customer Support ActiveXperts"
objvCard.Encode

objMessage.Body = objvCard.Data
objMessage.HasUdh = true
objMessage.BodyFormat = objConst.BODYFORMAT_HEX

strRef = objGsm.SendSms(objMessage)  
...

PhoneHome property

This is the home phone number of the contact

Example:

Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
Set objvCard = CreateObject("AxSms.TemplatevCard")
Set objConst = CreateObject("AxSms.Constants")
          
objvCard.Url = "http://www.ActiveXperts.com"
objvCard.Title = "Customer support"
objvCard.EMail = "support(at)activexperts.com"
objvCard.PhoneHome = "+31122334455"
objvCard.Name = "Customer Support ActiveXperts"
objvCard.Encode

objMessage.Body = objvCard.Data
objMessage.HasUdh = true
objMessage.BodyFormat = objConst.BODYFORMAT_HEX

strRef = objGsm.SendSms(objMessage)  
...

Phone property

This is a general phone number of the contact

Example:

Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
Set objvCard = CreateObject("AxSms.TemplatevCard")
Set objConst = CreateObject("AxSms.Constants")
          
objvCard.Url = "http://www.ActiveXperts.com"
objvCard.Title = "Customer support"
objvCard.EMail = "support(at)activexperts.com"
objvCard.PhoneWork = "+31122334455"
objvCard.Name = "Customer Support ActiveXperts"
objvCard.Encode

objMessage.Body = objvCard.Data
objMessage.HasUdh = true
objMessage.BodyFormat = objConst.BODYFORMAT_HEX

strRef = objGsm.SendSms(objMessage)  
...

Name property

The name of the contact

Example:

Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
Set objvCard = CreateObject("AxSms.TemplatevCard")
Set objConst = CreateObject("AxSms.Constants")
          
objvCard.Url = "http://www.ActiveXperts.com"
objvCard.Title = "Customer support"
objvCard.EMail = "support(at)activexperts.com"
objvCard.Name = "Customer Support ActiveXperts"
objvCard.Encode

objMessage.Body = objvCard.Data
objMessage.HasUdh = true
objMessage.BodyFormat = objConst.BODYFORMAT_HEX

strRef = objGsm.SendSms(objMessage)  
...

Data property

After calling the Encode method this property will contain the WAPPush body as a HEX encoded string. To send this message set this body into an SMS and set the HasUdh property to true and the BodyFormat property to 'BODYFORMAT_HEX'.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
Set objvCard = CreateObject("AxSms.TemplatevCard")
Set objConst = CreateObject("AxSms.Constants")
          
objvCard.Url = "http://www.ActiveXperts.com"
objvCard.Title = "Customer support"
objvCard.EMail = "support(at)activexperts.com"
objvCard.Name = "Customer Support ActiveXperts"
objvCard.Encode

objMessage.Body = objvCard.Data
objMessage.HasUdh = true
objMessage.BodyFormat = objConst.BODYFORMAT_HEX

strRef = objGsm.SendSms(objMessage)  
...

LastError property

Completion code of the last called method. To find the error description of a given error code, go to the online error codes codes page.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
Set objvCard = CreateObject("AxSms.TemplatevCard")
Set objConst = CreateObject("AxSms.Constants")
          
objvCard.Url = "http://www.ActiveXperts.com"
objvCard.Title = "Customer support"
objvCard.EMail = "support(at)activexperts.com"
objvCard.Phone = "+31122334455"
objvCard.Name = "Customer Support ActiveXperts"
objvCard.Encode
If objvCard.LastError <> 0 Then
  WScript.Echo objvCard.GetErrorDescription(objvCard.LastError)
End If  
...

13.3. Methods

Method Description
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
Encode Creates the actual vCard message out of the property settings

Clear method

This method resets all properties to their default values.

Parameters:

  • None

Return value:

None

Example:
Set objvCard = CreateObject("AxSms.TemplatevCard")
...
objvCard.Clear
...

GetErrorDescription method

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
Set objvCard = CreateObject("AxSms.TemplatevCard")
Set objConst = CreateObject("AxSms.Constants")
          
objvCard.Url = "http://www.ActiveXperts.com"
objvCard.Title = "Customer support"
objvCard.EMail = "support(at)activexperts.com"
objvCard.Phone = "+31122334455"
objvCard.Name = "Customer Support ActiveXperts"
objvCard.Encode
If objvCard.LastError <> 0 Then
  WScript.Echo objvCard.GetErrorDescription(objvCard.LastError)
End If  
...

Encode method

Creates vCard message according to the current settings. After calling this method the Data property will contain the vCard body as a HEX encoded string. To send this message set this body into an SMS and set the HasUdh property to true and the BodyFormat property to 'BODYFORMAT_HEX'.

Parameters:

  • None

Return value:

Always returns 0

Example:
Set objGsm = CreateObject("AxSms.Gsm")
Set objMessage = CreateObject("AxSms.Message")
Set objvCard = CreateObject("AxSms.TemplatevCard")
Set objConst = CreateObject("AxSms.Constants")
          
objvCard.Url = "http://www.ActiveXperts.com"
objvCard.Title = "Customer support"
objvCard.EMail = "support(at)activexperts.com"
objvCard.Phone = "+31122334455"
objvCard.Name = "Customer Support ActiveXperts"
objvCard.Encode
If objvCard.LastError <> 0 Then
  WScript.Echo objvCard.GetErrorDescription(objvCard.LastError)
End If  
...

14. GsmDeliveryReport

14.1. Introduction

This is a delivery report that is received from a GSM device. On GSM devices delivery reports are sometimes called 'Status Reports'. In the SMS Component this is meant to be the same thing.

A delivery report can be requested by setting the RequestDeliveryReport property to True. It's up to the provider to send the delivery report.

A delivery report will normally be sent as soon as the SMS message has reached a final state, either 'Delivered' or some error state. Normally a delivery report should arrive within seconds or minutes after sending a message. In some cases it can take a couple of hours, depending on the ValidityPeriod of the message.

Some GSM modems don't support receiving and storing delivery reports. Use the ReportEnabled property to find out if the open GSM device supports receiving and storing delivery reports.

14.2. Properties

Property Type Read/Write Description
Reference String Read The message reference
UserTag Number Read/Write User defined value to track this object
SmscAddress Number Read SMSC address
SmscTime String Read SMSC Time
SmscTimeInSeconds Number Read SMSC time in seconds
DischargeTime String Read Discharge time
DischargeTimeInSeconds Number Read Discharge time in seconds
MemoryIndex String Read The memory index for this delivery report
FirstOctet Number Read First octet
SmscTON Number Read The type of number of the SMSC address
SmscNPI Number Read The number plan indicator for the SMSC address.
Status Number Read The message delivery status
FromAddress String Read The address the original SMS message was send to

Reference property

The message reference for the delivery report. This should match with the message reference received when sending the SMS message out through the GSM object.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
...
Set objGsmDeliveryReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  ...
  WScript.Echo objGsmDeliveryReport.Reference
  WScript.Echo objGsmDeliveryReport.SmscAddress
  WScript.Echo objGsmDeliveryReport.SmscTime
  ...
  Set objGsmDeliveryReport = objGsm.GetNextReport
WEnd
...

UserTag property

This can be any value. Use this property to track a delivery report.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
...
Set objGsmDeliveryReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  ...
  WScript.Echo objGsmDeliveryReport.Reference
  WScript.Echo objGsmDeliveryReport.UserTag
  WScript.Echo objGsmDeliveryReport.SmscTime
  ...
  Set objGsmDeliveryReport = objGsm.GetNextReport
WEnd
...

SmscAddress property

The address of the SMS that originated this report

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
...
Set objGsmDeliveryReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  ...
  WScript.Echo objGsmDeliveryReport.Reference
  WScript.Echo objGsmDeliveryReport.UserTag
  WScript.Echo objGsmDeliveryReport.SmscAddress
  ...
  Set objGsmDeliveryReport = objGsm.GetNextReport
WEnd
...

SmscTime property

The time the original SMS message was received

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
...
Set objGsmDeliveryReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  ...
  WScript.Echo objGsmDeliveryReport.Reference
  WScript.Echo objGsmDeliveryReport.SmscAddress
  WScript.Echo objGsmDeliveryReport.SmscTime
  ...
  Set objGsmDeliveryReport = objGsm.GetNextReport
WEnd
...

SmscTimeInSeconds property

The time the original SMS message was received in seconds since 1/1/1970

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
...
Set objGsmDeliveryReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  ...
  WScript.Echo objGsmDeliveryReport.SmscAddress
  WScript.Echo objGsmDeliveryReport.SmscTime
  WScript.Echo objGsmDeliveryReport.SmscTimeInSeconds
  ...
  Set objGsmDeliveryReport = objGsm.GetNextReport
WEnd
...

DischargeTime property

The time the status in this report was achieved.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
...
Set objGsmDeliveryReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  ...
  WScript.Echo objGsmDeliveryReport.SmscAddress
  WScript.Echo objGsmDeliveryReport.SmscTime
  WScript.Echo objGsmDeliveryReport.DischargeTime
  ...
  Set objGsmDeliveryReport = objGsm.GetNextReport
WEnd
...

DischargeTimeInSeconds property

The time the status in this report was achieved in seconds since 1/1/1970

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
...
Set objGsmDeliveryReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  ...
  WScript.Echo objGsmDeliveryReport.SmscAddress
  WScript.Echo objGsmDeliveryReport.DischargeTime
  WScript.Echo objGsmDeliveryReport.DischargeTimeInSeconds
  ...
  Set objGsmDeliveryReport = objGsm.GetNextReport
WEnd
...

MemoryIndex property

This property holds the memory index in the modems memory for this delivery report

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
...
Set objGsmDeliveryReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  ...
  WScript.Echo objGsmDeliveryReport.FromAddress
  WScript.Echo objGsmDeliveryReport.MemoryIndex
  ...
  Set objGsmDeliveryReport = objGsm.GetNextReport
WEnd
...

FirstOctet property

This property holds the first octet value for this delivery report

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
...
Set objGsmDeliveryReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  ...
  WScript.Echo objGsmDeliveryReport.FromAddress
  WScript.Echo objGsmDeliveryReport.FirstOctet
  ...
  Set objGsmDeliveryReport = objGsm.GetNextReport
WEnd
...

SmscTON property

This property holds the Type of Number for the SmscAddress property. Will be one of these constants.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
...
Set objGsmDeliveryReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  ...
  WScript.Echo objGsmDeliveryReport.SmscAddress
  WScript.Echo objGsmDeliveryReport.SmscTON
  WScript.Echo objGsmDeliveryReport.SmscNPI
  ...
  Set objGsmDeliveryReport = objGsm.GetNextReport
WEnd
...

SmscNPI property

This property holds the Number Plan Identification for the SmscAddress property. Will be one of these constants.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
...
Set objGsmDeliveryReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  ...
  WScript.Echo objGsmDeliveryReport.SmscAddress
  WScript.Echo objGsmDeliveryReport.SmscTON
  WScript.Echo objGsmDeliveryReport.SmscNPI
  ...
  Set objGsmDeliveryReport = objGsm.GetNextReport
WEnd
...

Status property

This is the message delivery status for this message. Will be one of these constants

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
...
Set objGsmDeliveryReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  ...
  WScript.Echo objGsmDeliveryReport.FromAddress
  WScript.Echo objGsmDeliveryReport.Status
  ...
  Set objGsmDeliveryReport = objGsm.GetNextReport
WEnd
...

FromAddress property

The from address in the delivery report will be the address the original SMS message was send to.

Example:

Set objGsm = CreateObject("AxSms.Gsm")
...
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
...
Set objGsmDeliveryReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  ...
  WScript.Echo objGsmDeliveryReport.FromAddress
  WScript.Echo objGsmDeliveryReport.Status
  ...
  Set objGsmDeliveryReport = objGsm.GetNextReport
WEnd
...

14.3. Methods

Method Description
Clear Reset all properties to their default values

Clear method

This method resets all properties to their default values.

Parameters:

  • None

Return value:

None

Example:
Set objGsmDeliveryReport = CreateObject("AxSms.GsmDeliveryReport")
...
objGsmDeliveryReport.Clear
...

15. Tlv

15.1. Introduction

This is a Tlv (Tag, Length, Value). TLV's are only applicable in the SMPP protocol. TLV's are optional values that may be attached to an SMS message.

There are a number of possible TLV's specified in the SMPP protocol. Their TAG values have constants defined here. Other TLV values may be defined by operators.

15.2. Properties

Property Type Read/Write Description
Tag Number Read/Write The 'Tag' value identifies the TLV
Length Number Read The length in bytes of the TLV 'Value' field.
ValueAsString String Read/Write The value represented as a string
ValueAsHexString String Read/Write The value represented as a hexadecimal string
ValueAsInt32 Number Read/Write The value represented as a 32 bit integer
ValueAsInt16 Number Read/Write The value represented as a 16 bit integer
ValueAsInt8 String Read/Write The value represented as an 8 bit integer

Tag property

The 'Tag' value identifies the TLV. TLV's are additional, often optional information that can be attached to any of the packets that are specified in the SMPP 3.4 or 5.0 protocol. Here's a list of TLV's that have been proposed in SMPP 3.4. You provider may use other, specific TLV's, find these in the providers documentation.

Example:

Set objTlv = CreateObject("AxSms.Tlv")   
objTlv.Tag = 100
objTlv.ValueAsString = "Hello, World !"
WScript.Echo objTlv.Length
...

Length property

This is the length in bytes of the TLV 'Value' field. This property is read-only since it's always inferred from the value field.

Example:

Set objTlv = CreateObject("AxSms.Tlv")   
objTlv.Tag = 100
objTlv.ValueAsString = "Hello, World !"
WScript.Echo objTlv.Length
...

ValueAsString property

Use this property to set or read a TLV Value that is specified as a 'C-Octet' string.

Example:

Set objTlv = CreateObject("AxSms.Tlv")   
objTlv.Tag = 100
objTlv.ValueAsString = "Hello, World !"
WScript.Echo objTlv.Length
...

ValueAsHexString property

Use this property to set or read a TLV Value that is specified as 'Octet Data' or 'Octet String'.

Example:

Set objTlv = CreateObject("AxSms.Tlv")   
objTlv.Tag = 100
objTlv.ValueAsString = "Hello, World !"
WScript.Echo objTlv.Length
WScript.Echo objTlv.ValueAsHexString
...

ValueAsInt32 property

Use this property to set or read a TLV Value that is specified as a '4 Octet' value.

Example:

Set objTlv = CreateObject("AxSms.Tlv")   
objTlv.Tag = 100
objTlv.ValueAsInt32 = 1
WScript.Echo objTlv.Length
WScript.Echo objTlv.ValueAsHexString
...

ValueAsInt16 property

Use this property to set or read a TLV Value that is specified as a '2 Octet' value.

Example:

Set objTlv = CreateObject("AxSms.Tlv")   
objTlv.Tag = 100
objTlv.ValueAsInt16 = 1
WScript.Echo objTlv.Length
WScript.Echo objTlv.ValueAsHexString
...

ValueAsInt8 property

Use this property to set or read a TLV Value that is specified as an 'Octet' value.

Example:

Set objTlv = CreateObject("AxSms.Tlv")   
objTlv.Tag = 100
objTlv.ValueAsInt8 = 1
WScript.Echo objTlv.Length
WScript.Echo objTlv.ValueAsHexString
...

15.3. Methods

Method Description
Clear Reset all properties to their default values

Clear method

This method resets all properties to their default values.

Parameters:

  • None

Return value:

None

Example:
Set objTlv = CreateObject("AxSms.Tlv")
objTlv.Clear
objTlv.Tag = 100
objTlv.ValueAsInt8 = 1
WScript.Echo objTlv.Length
WScript.Echo objTlv.ValueAsHexString
...

16. Snpp

16.1. Introduction

With ActiveXperts SMS Component Pager messages can be sent through SNPP. SNPP (Simple Network Paging Protocol) is a standard for sending wireless messages to paging devices. SNPP provides a simple way to make a link between the Internet and a SNPP compliant paging terminal.

Page using SNPP

Sending a pager message through the SNPP protocol.

Set objSnpp = CreateObject("AxSms.Snpp")               ' Create Snpp instance

Wscript.Echo "SMS Component Version " & objSnpp.Version & "; Build " & _
  objSnpp.Build & "; Module " & objSnpp.Module
WScript.Echo "License Status: " & objSnpp.LicenseStatus & vbCrLf  

objSnpp.Server = "snpp.pageallcom.com"
objSnpp.ServerPort = 444
objSnpp.ServerTimeout = 2500                           ' Set timeout to 2500 msecs

objSnpp.Send("5551234", Hello, World!)                 ' Send the pager message

WScript.Echo "Send, result; " & objSnpp.LastError
WScript.Echo "Last response from SNPP provider: " & objSnpp.ProviderResponse

16.2. Properties

Property Type Read/Write Description
Version String Read Version number of the SMS Component
Build String Read Build number of the SMS Component
Module String Read Module name of the SMS Component
LicenseStatus String Out License Status
LicenseKey String In/Out License Key
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
Server String Read/Write SNPP server host name or IP Address
ServerPort String Read/Write SNPP server TCP port. Default: 444
ServerTimeout String Read/Write SNPP server command timeout in milliseconds. Default: 2000 milliseconds
ProviderUsername String Read/Write Optional username used by SNPP provider
ProviderPassword String Read/Write Optional password used by SNPP provider
ProviderResponse String Read Last response from provider

Version property

Return the version number of the SMS Component

Example:

Set objSnpp = CreateObject("AxSms.Snpp")
WScript.Echo "SMS Component Version " & objSnpp.Version & "; Build " & _
  objSnpp.Build & "; Module " & objSnpp.Module
WScript.Echo "License Status: " & objSnpp.LicenseStatus & vbCrLf
...

Build property

Return the build number of the SMS Component.

Example:

Set objSnpp = CreateObject("AxSms.Snpp")
WScript.Echo "SMS Component Version " & objSnpp.Version & "; Build " & _
  objSnpp.Build & "; Module " & objSnpp.Module
WScript.Echo "License Status: " & objSnpp.LicenseStatus & vbCrLf
...

Module property

Return the module name of the SMS Component.

Example:

Set objSnpp = CreateObject("AxSms.Snpp")
WScript.Echo "SMS Component Version " & objSnpp.Version & "; Build " & _
  objSnpp.Build & "; Module " & objSnpp.Module
WScript.Echo "License Status: " & objSnpp.LicenseStatus & vbCrLf
...

LicenseStatus property

The status of your license. In case you have not licensed the product, the property holds the trial expiration date. For details, see Product Activation.

Example:

Set objSnpp = CreateObject("AxSms.Snpp")                 ' Create new instance
WScript.Echo "License Status: " & objSnpp.LicenseStatus
WScript.Echo "License Key: " & objSnpp.LicenseKey

LicenseKey property

A license key is required to unlock this component after the trial period has expired. Assign the LicenseKey property every time a new instance of this component is created (see code below). Alternatively, the LicenseKey property can be set automatically. This requires the license key to be stored in the registry. For details, see Product Activation.

Example:

Set objSnpp = CreateObject("AxSms.Snpp")                 ' Create new instance
objSnpp.LicenseKey = "XXXXX-XXXXX-XXXXX"                ' Assign your license key 
WScript.Echo "LicenseKey: " & objSnpp.LicenseKey

LastError property

Completion code of the last called method. To find the error description of a given error code, go to the online error codes codes page.

Example:

Set objSnpp = CreateObject("AxSms.Snpp")
...  
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
objSnpp.SendSms objMessage
WScript.Echo "Send SMS result: " &  objSnpp.LastError    ' Is our message sent ?  
...

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the SMS Component will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

Set objSnpp = CreateObject("AxSms.Snpp")
objSnpp.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
objSnpp.SendSms objMessage
...

Server property

Sets the host name or TCP/IP address of the SNPP server provider.

Example:

Set objSnpp = CreateObject(AxSms.Snpp")
objSnpp.Server= "snpp.pageallcom.com"                              
...
objSnpp.Send( .. )

ServerPort property

Sets the TCP port for the SNPP connection. This property is optional, the default value is 444.

Example:

Set objSnpp = CreateObject("AxSms.Snpp")
objSnpp.Server= "snpp.pageallcom.com"                              
objSnpp.ServerPort = 4040
...
objSnpp.Send( .. )

ServerTimeout property

Maximum time (in milliseconds) before a Send operation will timeout. Default value: 2000 milliseconds.

Example:

Set objSnpp = CreateObject("AxSms.Snpp")  
objSnpp.Server= "snpp.pageallcom.com"                              
objSnpp.ServerTimeout = 5000
...
objSnpp.Send( .. )

ProviderUsername property

The username to be used with the provider

Example:

Set objSnpp = CreateObject("AxSms.Snpp")

strRecipient = 5551234
strMessage = "Hello World !!!"

objSnpp.Server = "snpp.pageallcom.com"
objSnpp.ServerPort = 444
objSnpp.ProviderUsername = "secretuser"
objSnpp.ProviderPassword = "secret"
objSnpp.Send( strRecipient, strMessage )

WScript.Echo "Send, result; " & objSnpp.LastError
WScript.Echo "Last response from SNPP provider: " & objSnpp.ProviderResponse

ProviderPassword property

The password to be used with the provider.

Example:

Set objSnpp = CreateObject("AxSms.Snpp")

strRecipient = 5551234
strMessage = "Hello World !!!"

objSnpp.Server = "snpp.pageallcom.com"
objSnpp.ServerPort = 444
objSnpp.ProviderPassword = "secret"
objSnpp.Send( strRecipient, strMessage )

WScript.Echo "Send, result; " & objSnpp.LastError
WScript.Echo "Last response from SNPP provider: " & objSnpp.ProviderResponse

ProviderResponse property

The last response from the provider. You can use this property for troubleshooting purposes. The property is read-only; you cannot assign a value to it.

Example:

Set objSnpp = CreateObject("AxSms.Snpp")

strMessage = 5551234
strRecipient = "Hello World !!!"

objSnpp.Server = "snpp.pageallcom.com"
objSnpp.ServerPort = 444
objSnpp.ProviderPassword = "secret"
objSnpp.Send(strRecipient, strMessage)

WScript.Echo "Send, result; " & objSnpp.LastError
WScript.Echo "Last response from SNPP provider: " & objSnpp.ProviderResponse

16.3. Methods

Method Description
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
Sleep Sleep for the specified number of milliseconds
Send Send a Pager message
SaveLicenseKey Save the License Key in the registry

Clear method

This method resets all properties to their default values.

Parameters:

  • None

Return value:

Always 0.

Example:
Set objSnpp = CreateObject("AxSms.Snpp")
....
objSnpp.Clear
...

GetErrorDescription method

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
Set objSnpp = CreateObject("AxSms.Snpp")   
objSnpp.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"  
objSnpp.SendSms objMessage
WScript.Echo "SendSms result: " & objSnpp.LastError & ", " & _
  objSnpp.GetErrorDescription(objSnpp.LastError)

Sleep method

This method suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
Set objSnpp = CreateObject("AxSms.Snpp")
....
objSnpp.Sleep 1000
...

Send method

Deliver the message to the SMSC provider. The SMSC provider will send the SMS message to the recipient

Parameters:

  • Recipient
  • Message

Return value:

Always 0.

Example:
Set objSnpp = CreateObject("AxSms.Snpp")

strRecipient = 5551234
strMessage = "Hello World !!!"

objSnpp.Server = "snpp.pageallcom.com"
objSnpp.ServerPort = 444
objSnpp.ProviderPassword = "secret"
objSnpp.Send(strRecipient, strMessage)

WScript.Echo "Send, result; " & objSnpp.LastError
WScript.Echo "Last response from SNPP provider: " & objSnpp.ProviderResponse

SaveLicenseKey method

Description:

Use SaveLicenseKey to store the license key permanently in the registry. When a license key is saved, it is restored automatically every time a new instance of the object ('Snpp') is created. It is not recommended to save the license key if you distribute the component with your own software, because the key can be easily used by others.

Parameters:

  • None.
Return value:

Always 0. Check LastError property to see if the method was completed successfully.

Example:

Set objSnpp = CreateObject("AxSms.Snpp")               ' Create new instance
objSnpp.LicenseKey = "XXXXX-XXXXX-XXXXX"
objSnpp.SaveLicenseKey                                    ' Save license key to registry

For more information, see Product Activation.

17. Constants

17.1. Introduction

The 'AxSms.Constants' object contains symbols for all constant values that are available in the ActiveXperts SMS Component.

It is recommended to use these symbols whenever possible. The constant symbol should always be more descriptive than the constant value.

17.2. Constants

TON (Type Of Number) definitions

Constant Value Description
TON_UNKNOWN 0 Unknown
TON_INTERNATIONAL 1 International
TON_NATIONAL 2 National
TON_NETWORK_SPECIFIC 3 Network specific
TON_SUBSCRIBER_NUMBER 4 Subscriber number
TON_ALPHANUMERIC 5 Alphanumeric
SMPP_TON_ABBREVIATED 6 Abbreviated

NPI (Number Plan Identification) definitions

Constant Value Description
NPI_UNKNOWN 0 Unknown
NPI_ISDN 1 ISDN
NPI_DATA 3 Data
NPI_TELEX 4 Telex
NPI_NATIONAL 8 National
NPI_PRIVATE 9 Private
NPI_ERMES 10 Ermes
SMPP_NPI_INTERNET 14 Internet

Multipart definitions

Constant Value Description
MULTIPART_ACCEPT 0 Send long messages as multipart
MULTIPART_TRUNCATE 1 Truncate long messages
MULTIPART_REJECT 2 Fail messages that are to long

Body format definitions

Constant Value Description
BODYFORMAT_TEXT 0 The message body is unformatted text
BODYFORMAT_HEX 2 The message body is formatted as HEX data (e.g.: '10abcdef')

Datacoding definitions

Constant Value Description
DATACODING_DEFAULT 0 Default
DATACODING_8BIT_DATA 4 8Bit data
DATACODING_UNICODE 8 Unicode
DATACODING_FLASH 16 Flash
GSM_DATACODING_ME_SPECIFIC 1 (GSM only) ME Specific
GSM_DATACODING_SIM_SPECIFIC 2 (GSM only) SIM Specific
GSM_DATACODING_TE_SPECIFIC 3 (GSM only) TE Specific
SMPP_DATACODING_ASCII 1 (SMPP only) IA5 (CCITT T.50)/ASCII (ANSI X3.4)
SMPP_DATACODING_OCTET_UNSPEC 2 (SMPP only) Octet unspecified (8-bit binary)
SMPP_DATACODING_LATIN 3 (SMPP only) Latin 1 (ISO-8859-1)
SMPP_DATACODING_JIS_KANJI 5 (SMPP only) JIS (X 0208-1990)
SMPP_DATACODING_CYRILLIC 6 (SMPP only) Cyrllic (ISO-8859-5)
SMPP_DATACODING_LATIN_HEBREW 7 (SMPP only) Latin/Hebrew (ISO-8859-8)
SMPP_DATACODING_PICTOGRAM 9 (SMPP only) Pictogram Encoding
SMPP_DATACODING_ISO_2022_JP 10 (SMPP only) ISO-2022-JP (Music Codes)
SMPP_DATACODING_EXTENDED_KANJI_JIS 13 (SMPP only) Extended Kanji JIS(X 0212-1990)
SMPP_DATACODING_KS_C_5601 14 (SMPP only) KS C 5601

Baudrate definitions

Constant Value Description
GSM_BAUDRATE_110 110 110 bps
GSM_BAUDRATE_300 300 300 bps
GSM_BAUDRATE_600 600 600 bps
GSM_BAUDRATE_1200 1200 1200 bps
GSM_BAUDRATE_2400 2400 2400 bps
GSM_BAUDRATE_4800 4800 4800 bps
GSM_BAUDRATE_9600 9600 9600 bps
GSM_BAUDRATE_14400 14400 14400 bps
GSM_BAUDRATE_19200 19200 19200 bps
GSM_BAUDRATE_38400 38400 38400 bps
GSM_BAUDRATE_56000 56000 56000 bps
GSM_BAUDRATE_57600 57600 57600 bps
GSM_BAUDRATE_64000 64000 64000 bps
GSM_BAUDRATE_115200 115200 115200 bps
GSM_BAUDRATE_128000 128000 128000 bps
GSM_BAUDRATE_230400 230400 230400 bps
GSM_BAUDRATE_256000 256000 256000 bps
GSM_BAUDRATE_460800 460800 460800 bps
GSM_BAUDRATE_921600 921600 921600 bps

GSM first octet definitions

Constant Value Description
GSM_FO_REPLYPATH_EXISTS 128 Reply path exists
GSM_FO_UDHI 64 UDH Indicator
GSM_FO_STATUS_REPORT 32 Status report
GSM_FO_VALIDITY_NONE 0 Validity none
GSM_FO_VALIDITY_RELATIVE 16 Validity relative
GSM_FO_VALIDITY_ENHANCED 8 Validity enhanced
GSM_FO_VALIDITY_ABSOLUTE 24 Validity absolute
GSM_FO_REJECT_DUPLICATES 4 Reject duplicates
GSM_FO_SUBMIT_SM 1 Submit SM
GSM_FO_DELIVER_SM 0 Deliver SM
GSM_FO_STATUS_SM 2 Status SM

GSM message status definitions

Constant Value Description
GSM_STATUS_MESSAGE_DELIVERED_SUCCESSFULLY 0x00 Message delivered successfully
GSM_STATUS_FORWARDED_STATUS_UNKNOWN 0x01 Forwarded status unknown
GSM_STATUS_REPLACED 0x02 Replaced
GSM_STATUS_CONGESTION_STILL_TRYING 0x20 Congestion, still trying
GSM_STATUS_RECIPIENT_BUSY_STILL_TRYING 0x21 Recipient busy, still trying
GSM_STATUS_NO_RESPONSE_STILL_TRYING 0x22 No response, still trying
GSM_STATUS_SERVICE_REJECTED_STILL_TRYING 0x23 Service rejected, still trying
GSM_STATUS_QOS_NOT_AVAILABLE_STILL_TRYING 0x24 QOS not available, still trying
GSM_STATUS_RECIPIENT_ERROR_STILL_TRYING 0x25 Recipient error, still trying
GSM_STATUS_RPC_ERROR 0x40 RCP error
GSM_STATUS_INCOMPATIBLE_DESTINATION 0x41 Incompatible destination
GSM_STATUS_CONNECTION_REJECTED 0x42 Connection rejected
GSM_STATUS_NOT_OBTAINABLE 0x43 Not obtainable
GSM_STATUS_QOS_NOT_AVAILABLE 0x44 QOS not available
GSM_STATUS_NO_INTERNETWORKING_AVAILABLE 0x45 No internetworking available
GSM_STATUS_MESSAGE_EXPIRED 0x46 Message expired
GSM_STATUS_MESSAGE_DELETED_BY_SENDER 0x47 Message deleted by sender
GSM_STATUS_MESSAGE_DELETED_BY_SMSC 0x48 Message deleted by SMSC
GSM_STATUS_DOES_NOT_EXIST 0x49 Does not exist

GSM memory state definitions

Constant Value Description
GSM_MESSAGESTATE_RECEIVED_UNREAD 0 Received unread
GSM_MESSAGESTATE_RECEIVED_READ 1 Received read
GSM_MESSAGESTATE_STORED_UNSENT 2 Stored unsent
GSM_MESSAGESTATE_STORED_SENT 3 Stored sent
GSM_MESSAGESTATE_ALL 4 All

GSM storage type definitions

Constant Value Description
GSM_STORAGETYPE_SIM 1 SIM storage ('SM')
GSM_STORAGETYPE_MEMORY 2 Memory storage ('ME')
GSM_STORAGETYPE_COMBINED 3 Combined storage ('MT')
GSM_STORAGETYPE_STATUS 4 Status reports storage ('SR')
GSM_STORAGETYPE_ALL 5 Use all storage types

GSM message format definitions

Constant Value Description
GSM_MESSAGEFORMAT_PDU 0 PDU mode
GSM_MESSAGEFORMAT_TEXT 1 Text mode
GSM_MESSAGEFORMAT_AUTO 2 Auto detect

GSM prefix SMSC definitions

Constant Value Description
GSM_PREFIXSMSC_ENABLED 0 Enabled
GSM_PREFIXSMSC_DISABLED 1 Disabled
GSM_PREFIXSMSC_AUTO 2 Auto detect

SMPP IP Version definitions

Constant Value Description
SMPP_IPVERSION_4 1 Listen on IPv4
SMPP_IPVERSION_6 2 Listen on IPv6
SMPP_IPVERSION_BOTH 3 Listen on both IPv4 and IPv6

SMPP bind definitions

Constant Value Description
SMPP_BIND_TRANSMITTER 1 Bind as transmitter
SMPP_BIND_TRANSCEIVER 2 Bind as transceiver
SMPP_BIND_RECEIVER 3 Bind as receiver

SMPP version definitions

Constant Value Description
SMPP_VERSION_33 0x33 Version 3.3
SMPP_VERSION_34 0x34 Version 3.4
SMPP_VERSION_50 0x50 Version 5.0

SMPP ESM definitions

Constant Value Description
SMPP_ESM_2ESME_DEFAULT 0 Default
SMPP_ESM_2ESME_DELIVERY_RECEIPT 4 SMSC delivery receipt
SMPP_ESM_2ESME_DELIVERY_ACK 8 SME delivery ACK
SMPP_ESM_2ESME_MANUAL_ACK 16 SME manual ACK
SMPP_ESM_2ESME_CONVERSATION_ABORT 18 Conversation abort
SMPP_ESM_2ESME_INTERMEDIATE_DELIVERY_NOTIFY 32 Intermediate delivery notify
SMPP_ESM_2SMSC_MODE_DEFAULT 0 Mode default
SMPP_ESM_2SMSC_MODE_STOREFORWARD 3 Mode store and forward
SMPP_ESM_2SMSC_MODE_DATAGRAM 1 Mode datagram
SMPP_ESM_2SMSC_MODE_FORWARD 2 Mode forward
SMPP_ESM_2SMSC_TYPE_DEFAULT 0 Type default
SMPP_ESM_2SMSC_TYPE_DELIVERY_ACK 8 Type delivery ACK
SMPP_ESM_2SMSC_TYPE_MANUAL_ACK 16 Type manual ACK
SMPP_ESM_2SMSC_FEAT_NOTHING 0 Feat nothing
SMPP_ESM_2SMSC_FEAT_UDHI 64 Feat User Data Indicator
SMPP_ESM_2SMSC_FEAT_SRP 128 Feat Set Reply Path

SMPP priority definitions

Constant Value Description
SMPP_PRIORITYFLAG_BULK 0 Bulk
SMPP_PRIORITYFLAG_NORMAL 1 Normal
SMPP_PRIORITYFLAG_URGENT 2 Urgent
SMPP_PRIORITYFLAG_VERY_URGENT 3 Very urgent

SMPP message state definitions

Constant Value Description
SMPP_MESSAGESTATE_AX_WAITRESP 0 Waiting for server response
SMPP_MESSAGESTATE_ENROUTE 1 Enroute
SMPP_MESSAGESTATE_DELIVERED 2 Delivered
SMPP_MESSAGESTATE_EXPIRED 3 Expired
SMPP_MESSAGESTATE_DELETED 4 Deleted
SMPP_MESSAGESTATE_UNDELIVERABLE 5 Undeliverable
SMPP_MESSAGESTATE_ACCEPTED 6 Accepted
SMPP_MESSAGESTATE_UNKNOWN 7 Unknown
SMPP_MESSAGESTATE_REJECTED 8 Rejected
SMPP_MESSAGESTATE_AX_RESPERROR 96 Error in response
SMPP_MESSAGESTATE_AX_NOCREDITS 97 Out of credits (ActiveXperts demo gateway)
SMPP_MESSAGESTATE_AX_RESPTO 98 Timeout in response
SMPP_MESSAGESTATE_AX_RESPONDED 99 Message accepted

SMPP Multipart Mode definitions

Constant Value Description
SMPP_MULTIPARTMODE_UDH 1 Split up using UDH and 8 bit reference number
SMPP_MULTIPARTMODE_UDH16BIT 2 Split up using UDH and 16 bit reference number
SMPP_MULTIPARTMODE_SARTLV 3 Split up using 'SMPP_TLV_SAR_MSG_REF_NUM', 'SMPP_TLV_SAR_TOTAL_SEGMENTS' and 'SMPP_TLV_SAR_SEGMENT_SEQNUM' TLV's
SMPP_MULTIPARTMODE_PAYLOADTLV 4 Send entire body as 'SMPP_TLV_MESSAGE_PAYLOAD' TLV

SMPP Submit Mode definitions

Constant Value Description
SMPP_SUBMITMODE_SUBMITSM 1 Send outgoing SMS messages using the 'submit_sm' command
SMPP_SUBMITMODE_DATASM 2 Send outgoing SMS messages using the 'data_sm' command

SMPP Deliver Mode definitions

Constant Value Description
SMPP_DELIVERMODE_DELIVERSM 1 Deliver SMS messages using the 'deliver_sm' command
SMPP_DELIVERMODE_DATASM 2 Deliver SMS messages using the 'data_sm' command

SMPP Use GSM encoding definitions

Constant Value Description
SMPP_USEGSMENCODING_DISABLED 0 GSM encoding/decoding disabled
SMPP_USEGSMENCODING_INCOMING -1 Incoming messages are decoded (7bit)
SMPP_USEGSMENCODING_OUTGOING -2 Outgoing messages are encoded (7bit)
SMPP_USEGSMENCODING_INANDOUT -3 In- and outgoing messages are decoded/encoded (7bit)
SMPP_USEGSMENCODING_INCHARSET -4 Incoming messages use GSM character set (8bit)
SMPP_USEGSMENCODING_OUTCHARSET -5 Outgoing messages use GSM character set (8bit)
SMPP_USEGSMENCODING_INOUTCHARS -6 In- and outgoing messages use GSM character set (8bit)

SMPP session state definitions

Constant Value Description
SMPP_SESSIONSTATE_DISCONNECTED 1 The session is disconnected
SMPP_SESSIONSTATE_CONNECTED 2 The session is connected to a client
SMPP_SESSIONSTATE_BINDING 3 The session has a bind request pending
SMPP_SESSIONSTATE_BOUND_TX 4 The session is connected and bound as transmitter
SMPP_SESSIONSTATE_BOUND_RX 5 The session is connected and bound as receiver
SMPP_SESSIONSTATE_BOUND_TRX 6 The session is connected and bound as transceiver

SMPP TLV definitions

Constant Value Description
SMPP_TLV_DEST_ADDR_SUBUNIT 0x0005 dest addr subunit (GSM)
SMPP_TLV_DEST_NETWORK_TYPE 0x0006 dest network type (Generic)
SMPP_TLV_DEST_BEARER_TYPE 0x0007 dest bearer type (Generic)
SMPP_TLV_DEST_TELEMATICS_ID 0x0008 dest telematics id (GSM)
SMPP_TLV_SOURCE_ADDR_SUBUNIT 0x000D source addr subunit (GSM)
SMPP_TLV_SOURCE_NETWORK_TYPE 0x000E source network type (Generic)
SMPP_TLV_SOURCE_BEARER_TYPE 0x000F source bearer type (Generic)
SMPP_TLV_SOURCE_TELEMATICS_ID 0x0010 source telematics id (GSM)
SMPP_TLV_QOS_TIME_TO_LIVE 0x0017 qos time to live (Generic)
SMPP_TLV_PAYLOAD_TYPE 0x0019 payload type (Generic)
SMPP_TLV_ADDITIONAL_STATUS_INFO_TEXT 0x001D additional status info text (Generic)
SMPP_TLV_RECEIPTED_MESSAGE_ID 0x001E receipted message id (Generic)
SMPP_TLV_MS_MSG_WAIT_FACILITIES 0x0030 ms msg wait facilities (GSM)
SMPP_TLV_PRIVACY_INDICATOR 0x0201 privacy indicator (CDMA, TDMA)
SMPP_TLV_SOURCE_SUBADDRESS 0x0202 source subaddress (CDMA, TDMA)
SMPP_TLV_DEST_SUBADDRESS 0x0203 dest subaddress (CDMA, TDMA)
SMPP_TLV_USER_MESSAGE_REFERENCE 0x0204 user message reference (Generic)
SMPP_TLV_USER_RESPONSE_CODE 0x0205 user response code (CDMA, TDMA)
SMPP_TLV_SOURCE_PORT 0x020A source port (Generic)
SMPP_TLV_DESTINATION_PORT 0x020B destination port (Generic)
SMPP_TLV_SAR_MSG_REF_NUM 0x020C sar msg ref num (Generic)
SMPP_TLV_LANGUAGE_INDICATOR 0x020D language indicator (CDMA, TDMA)
SMPP_TLV_SAR_TOTAL_SEGMENTS 0x020E sar total segments (Generic)
SMPP_TLV_SAR_SEGMENT_SEQNUM 0x020F sar segment seqnum (Generic)
SMPP_TLV_SC_INTERFACE_VERSION 0x0210 SC_interface version (Generic)
SMPP_TLV_CALLBACK_NUM_PRES_IND 0x0302 callback num pres ind (TDMA)
SMPP_TLV_CALLBACK_NUM_ATAG 0x0303 callback num atag (TDMA)
SMPP_TLV_NUMBER_OF_MESSAGES 0x0304 number of messages (CDMA)
SMPP_TLV_CALLBACK_NUM 0x0381 callback num (CDMA, TDMA, GSM, iDEN)
SMPP_TLV_DPF_RESULT 0x0420 dpf result (Generic)
SMPP_TLV_SET_DPF 0x0421 set dpf (Generic)
SMPP_TLV_MS_AVAILABILITY_STATUS 0x0422 ms availability status (Generic)
SMPP_TLV_NETWORK_ERROR_CODE 0x0423 network error code (Generic)
SMPP_TLV_MESSAGE_PAYLOAD 0x0424 message payload (Generic)
SMPP_TLV_DELIVERY_FAILURE_REASON 0x0425 delivery failure reason (Generic)
SMPP_TLV_MORE_MESSAGES_TO_SEND 0x0426 more messages to send (GSM)
SMPP_TLV_MESSAGE_STATE 0x0427 message state (Generic)
SMPP_TLV_USSD_SERVICE_OP 0x0501 ussd service op (GSM (USSD))
SMPP_TLV_DISPLAY_TIME 0x1201 display time (CDMA, TDMA)
SMPP_TLV_SMS_SIGNAL 0x1203 SMS signal (TDMA)
SMPP_TLV_MS_VALIDITY 0x1204 ms validity (CDMA, TDMA)
SMPP_TLV_ALERT_ON_MESSAGE_DELIVERY 0x130C alert on message delivery (CDMA)
SMPP_TLV_ITS_REPLY_TYPE 0x1380 its reply type (CDMA)
SMPP_TLV_ITS_SESSION_INFO 0x1383 its session info (CDMA)

SMPP status code definitions

Constant Value Description
SMPP_ESME_ROK 0x00 No Error
SMPP_ESME_RINVMSGLEN 0x01 Message Length is invalid
SMPP_ESME_RINVCMDLEN 0x02 Command Length is invalid
SMPP_ESME_RINVCMDID 0x03 Invalid Command ID
SMPP_ESME_RINVBNDSTS 0x04 Incorrect BIND Status for given command
SMPP_ESME_RALYBND 0x05 ESME Already in Bound State
SMPP_ESME_RINVPRTFLG 0x06 Invalid Priority Flag
SMPP_ESME_RINVREGDLVFLG 0x07 Invalid Registered Delivery Flag
SMPP_ESME_RSYSERR 0x08 System Error
SMPP_ESME_RINVSRCADR 0x0A Invalid Source Address
SMPP_ESME_RINVDSTADR 0x0B Invalid Dest Addr
SMPP_ESME_RINVMSGID 0x0C Message ID is invalid
SMPP_ESME_RBINDFAIL 0x0D Bind Failed
SMPP_ESME_RINVPASWD 0x0E Invalid Password
SMPP_ESME_RINVSYSID 0x0F Invalid System ID
SMPP_ESME_RCANCELFAIL 0x11 Cancel SM Failed
SMPP_ESME_RREPLACEFAIL 0x13 Replace SM Failed
SMPP_ESME_RMSGQFUL 0x14 Message Queue Full
SMPP_ESME_RINVSERTYP 0x15 Invalid Service Type
SMPP_ESME_RINVNUMDESTS 0x33 Invalid number of destinations
SMPP_ESME_RINVDLNAME 0x34 Invalid Distribution List name
SMPP_ESME_RINVDESTFLAG 0x40 Destination flag is invalid (submit_multi)
SMPP_ESME_RINVSUBREP 0x42 Invalid 'submit with replace' request (i.e. submit_sm with replace_if_present_flag set)
SMPP_ESME_RINVESMCLASS 0x43 Invalid esm_class field data
SMPP_ESME_RCNTSUBDL 0x44 Cannot Submit to Distribution List
SMPP_ESME_RSUBMITFAIL 0x45 submit_sm or submit_multi failed
SMPP_ESME_RINVSRCTON 0x48 Invalid Source address TON
SMPP_ESME_RINVSRCNPI 0x49 Invalid Source address NPI
SMPP_ESME_RINVDSTTON 0x50 Invalid Destination address TON
SMPP_ESME_RINVDSTNPI 0x51 Invalid Destination address NPI
SMPP_ESME_RINVSYSTYP 0x53 Invalid system_type field
SMPP_ESME_RINVREPFLAG 0x54 Invalid replace_if_present flag
SMPP_ESME_RINVNUMMSGS 0x55 Invalid number of messages
SMPP_ESME_RTHROTTLED 0x58 Throttling error (ESME has exceeded allowed message limits)
SMPP_ESME_RINVSCHED 0x61 Invalid Scheduled Delivery Time
SMPP_ESME_RINVEXPIRY 0x62 Invalid message validity period (Expiry time)
SMPP_ESME_RINVDFTMSGID 0x63 Predefined Message Invalid or Not Found
SMPP_ESME_RX_T_APPN 0x64 ESME Receiver Temporary App Error Code
SMPP_ESME_RX_P_APPN 0x65 ESME Receiver Permanent App Error Code
SMPP_ESME_RX_R_APPN 0x66 ESME Receiver Reject Message Error Code
SMPP_ESME_RQUERYFAIL 0x67 query_sm request failed
SMPP_ESME_RINVOPTPARSTREAM 0xC0 Error in the optional part of the PDU Body.
SMPP_ESME_ROPTPARNOTALLWD 0xC1 Optional Parameter not allowed
SMPP_ESME_RINVPARLEN 0xC2 Invalid Parameter Length.
SMPP_ESME_RMISSINGOPTPARAM 0xC3 Expected Optional Parameter missing
SMPP_ESME_RINVOPTPARAMVAL 0xC4 Invalid Optional Parameter Value
SMPP_ESME_RDELIVERYFAILURE 0xFE Delivery Failure (used for data_sm_resp)
SMPP_ESME_RUNKNOWNERR 0xFE Unknown error

HTTP placeholder definitions

Constant Value Description
HTTP_PLACEHOLDER_USERTAG %USERTAG% Usertag
HTTP_PLACEHOLDER_TOADDRESS %TOADDRESS% To address
HTTP_PLACEHOLDER_FROMADDRESS %FROMADDRESS% From address
HTTP_PLACEHOLDER_BODY %BODY% Body
HTTP_PLACEHOLDER_BODYASHEX %BODYAXHEX% Body formatted as an hexadecimal string (e.g. '0a0b0c')
HTTP_PLACEHOLDER_BODYASBASE64 %BODYASBASE64% Body encoded in Base64
HTTP_PLACEHOLDER_DELIVERYREPORT %DELIVERYREPORT% 'true' or 'false' according to wether a delivery report was requested
HTTP_PLACEHOLDER_TOADDRESSTON %TOADDRESSTON% To address type of number
HTTP_PLACEHOLDER_TOADDRESSNPI %TOADDRESSNPI% To address numbering plan indicator
HTTP_PLACEHOLDER_FROMADDRESSTON %FROMADDRESSTON% From address type of number
HTTP_PLACEHOLDER_FROMADDRESSNPI %FROMADDRESSNPI% From address numbering plan indicator
HTTP_PLACEHOLDER_PROTOCOLID %PROTOCOLID% The protocol ID.
HTTP_PLACEHOLDER_UDHI %UDHI% 'true' or 'false' according to wether a user data header is present
HTTP_PLACEHOLDER_DATACODING %DATACODING% The datacoding for this SMS

Provider type definitions

Constant Value Description
DIALUP_PROVIDERTYPE_UCP 0 UCP protocol
DIALUP_PROVIDERTYPE_TAP_DEFAULT 1 TAP protocol
DIALUP_PROVIDERTYPE_TAP_NOLF 2 TAP protocol, no request for linefeed
DIALUP_PROVIDERTYPE_TAP_NOEOT 3 TAP protocol, no request for EOT

Device setting definitions

Constant Value Description
DIALUP_DEVICESETTINGS_DEFAULT 0 Default device settings
DIALUP_DEVICESETTINGS_8N1 1 No parity, 8 databits 1 stop bit
DIALUP_DEVICESETTINGS_7E1 2 Even parity, 7 databits 1 stop bit

Dialmode definitions

Constant Value Description
DIALUP_DIALMODE_TONE 0 Dialmode tone
DIALUP_DIALMODE_PULSE 1 Dialmode pulse

18. Error codes

18.1. Error codes

When a method is called, the result of the method is stored in the object's 'LastError' property. When 'LastError' is 0, it means that the last called method completed successfully; otherwise, an error occurred.

The value of the LastError tells you why the method failed. All error codes are listed on the ActiveXperts web site, here.

Alternatively, the 'GetErrorDescription' method can be used to find the error description for a given error code.

19. Support

19.1. API Samples

Samples for Visual Basic, Visual Basic .NET, Visual C++, Visual C# .NET, ASP and VBScript are included as part of the installation.

19.2. ActiveXperts support

Visit the ActiveXperts Support Site for a complete list of FAQ items at: http://www.activexperts.com/support

To contact support, please send an e-mail to: support@activexperts.com

20. Purchase and Product Activation

20.1. Purchase

Please visit www.activexperts.com/sales to buy the product. Here, you can also find the latest prices.

You can also contact us via email: sales@activexperts.com

After purchasing the product, you will receive one or more product registration keys.

20.2. Product Activation

After purchasing the product, you will receive a license key.

There are four ways to activate (unlock) the component using this license key:

1. Directly from your program code

You can unlock the component by using the LicenseKey property. This way, the license is NOT stored in the registry of the computer. This is the recommended way when distributing this component with your own software.

2. Store the license key in the registry - Installation

When the license key is entered during Setup (AxSmsSetup.exe, available from the ActiveXperts download site), the license key will be saved in the following registry key:
'HKEY_LOCAL_MACHINE\Software\ActiveXperts\SMS Component\LicenseKey'

Once the license key is stored in the registry, the LicenseKey property will be assigned automatically with that value each time the object is instantiated.

3. Store the license key in the registry - Manually

You can enter the license key manually (e.g. through REGEDIT.EXE) in following registry key:
'HKEY_LOCAL_MACHINE\Software\ActiveXperts\SMS Component\LicenseKey'

Once the license key is stored in the registry, the LicenseKey property will be assigned automatically with that value each time the object is instantiated.

4. Store the license key in the registry - SaveLicenseKey method

You can enter the license key by calling the SaveLicenseKey method. You need to call SaveLicenseKey only once.

Set objGsm = CreateObject("AxSms.Gsm") ' Create new instance
objGsm.LicenseKey = "XXXXX-XXXXX-XXXXX"       ' Replace XXXXX-XXXXX-XXXXX by your own key
objGsm.SaveLicenseKey

Once the license key is stored in the registry, the LicenseKey property will be assigned automatically with that value each time the object is instantiated.

20.3. Distribution License

For information about how to use the registration code with a Distribution License, please read the following document: How to distribute an ActiveXperts Component.

Appendix A License Agreement

  PLEASE READ THIS SOFTWARE LICENSE AGREEMENT CAREFULLY BEFORE 
  DOWNLOADING OR USING THE SOFTWARE.  BY CLICKING ON THE 
  "ACCEPT" BUTTON, OPENING THE PACKAGE, DOWNLOADING THE PRODUCT, 
  OR USING THE EQUIPMENT THAT CONTAINS THIS PRODUCT, YOU ARE 
  CONSENTING TO BE BOUND BY THIS AGREEMENT. IF YOU DO NOT AGREE 
  TO ALL OF THE TERMS OF THIS AGREEMENT, CLICK THE "DO NOT 
  ACCEPT" BUTTON AND THE INSTALLATION PROCESS WILL NOT CONTINUE, 
  RETURN THE PRODUCT TO THE PLACE OF PURCHASE FOR A FULL REFUND, 
  OR DO NOT DOWNLOAD THE PRODUCT.
  
  GENERAL
  In this Software License Agreement:
  (i) "ActiveXperts" means ActiveXperts Software B.V.
  (ii) "Customer" means the individual(s), organization or business entity 
  buying a license of the Software from ActiveXperts or its Distributors 
  or its Resellers.
  (iii) "Software" means computer programs (and their storage medium) 
  supplied by ActiveXperts and known collectively as "SMS Component" 
  in which ActiveXperts has property rights and any user manuals, 
  operating instructions, brochures and all other documentation relating 
  to the said computer programs (the expression "Software" to include all 
  or any part or any combination of Software).
  
  1. LICENSE GRANT
  ActiveXperts grants Customer the following rights provided that you 
  comply with all terms and conditions of this License Agreement:
  
  (a) Installation and use. Customer may install, use, access, display and 
  run one copy of the Software on a single computer, such as a 
  workstation, terminal or other device ("Workstation Computer"). A 
  "License Pack" allows you to install, use, access, display and run 
  additional copies of the Software up to the number of "Licensed Copies" 
  specified above.
  
  (b) Reservation of Rights. ActiveXperts reserves all rights not 
  expressly granted to you in this License Agreement.
  
  2. UPGRADES AND SUPPLEMENTS
  To use a product identified as an upgrade, you must first be licensed 
  for the Software as eligible for the upgrade. After upgrading, Customer 
  may no longer use the product that formed the basis for Customer's 
  upgrade eligibility.
  
  This License Agreement applies to updates or supplements to the original 
  Software provided by ActiveXperts, unless we provide other terms along 
  with the update or supplement.
  
  3. LIMITATION ON REVERSE ENGINEERING,DECOMPILATION, AND DISASSEMBLY
  Customer may not reverse engineer, decompile, or disassemble the 
  Software, except and only to the extent that it is expressly permitted 
  by applicable law notwithstanding this limitation.
  
  4. TERMINATION
  Without prejudice to any other rights, ActiveXperts may cancel this 
  License Agreement if Customer does not abide by the terms and conditions 
  of this License Agreement, in which case you must destroy all copies of 
  the Software and all of its component parts.
  
  5. NOT FOR RESALE SOFTWARE
  Software identified as "Not for Resale" or "NFR," may not be resold, 
  transferred or used for any purpose other than demonstration, test or 
  evaluation.
  
  6. LIMITED WARRANTY
  ActiveXperts warrants that for a period of ninety (90) days from the 
  date of shipment from ActiveXperts: (i) the media on which the Software 
  is furnished will be free of defects in materials and workmanship under 
  normal use; and (ii) the Software substantially conforms to its 
  published specifications. Except for the foregoing, the Software is 
  provided AS IS. This limited warranty extends only to Customer as the 
  original licensee. Customer's exclusive remedy and the entire liability 
  of ActiveXperts and its suppliers under this limited warranty will be, 
  at ActiveXperts or its service center's option, repair, replacement, or 
  refund of the Software if reported (or, upon request, returned) to the 
  party supplying the Software to Customer. In no event does ActiveXperts 
  warrant that the Software is error free or that Customer will be able to 
  operate the Software without problems or interruptions.
  This warranty does not apply if the software (a) has been altered, 
  except by ActiveXperts, (b) has not been installed, operated, repaired, 
  or maintained in accordance with instructions supplied by ActiveXperts, 
  (c) has been subjected to abnormal physical or electrical stress, 
  misuse, negligence, or accident, or (d) is used in ultrahazardous 
  activities.
  
  
  7. LIMITATION OF LIABILITY AND REMEDIES.
  Notwithstanding any damages that you might incur for any reason 
  whatsoever (including, without limitation, all damages referenced above 
  and all direct or general damages), the entire liability of ActiveXperts 
  and any of its suppliers under any provision of this License Agreement 
  and your exclusive remedy for all of the foregoing (except for any 
  remedy of repair or replacement elected by ActiveXperts with respect to 
  any breach of the Limited Warranty) shall be limited to the greater of 
  the amount actually paid by you for the Software or U.S.$5.00. The 
  foregoing limitations, exclusions and disclaimers (including Sections 4, 
  5 and 6 above) shall apply to the maximum extent permitted by applicable 
  law, even if any remedy fails its essential purpose.
  
  8. ENTIRE AGREEMENT
  
  This License Agreement (including any addendum or amendment to this 
  License Agreements which is included with the Software) are the entire 
  agreement between you and ActiveXperts relating to the Software and the 
  support services (if any) and they supersede all prior or 
  contemporaneous oral or written communications, proposals and 
  representations with respect to the Software or any other subject matter 
  covered by this License Agreement. To the extent the terms of any 
  ActiveXperts policies or programs for support services conflict with the 
  terms of this License Agreement, the terms of this License Agreement 
  shall control.
  
  This Agreement shall be construed in accordance with the laws of The 
  Netherlands and the Dutch courts shall have sole jurisdiction in any 
  dispute relating to these conditions. If any part of these conditions 
  shall be or become invalid or unenforceable in any way and to any extent 
  by any existing or future rule of law, order, statute or regulation 
  applicable thereto, then the same shall to the extent of such invalidity 
  or enforceability be deemed to have been deleted from the conditions 
  which shall remain in full force and effect as regards all other 
  provisions.
  
  9. Copyright
  The Software is protected by copyright and other intellectual property 
  laws and treaties. ActiveXperts or its suppliers own the title, 
  copyright, and other intellectual property rights in the Software. The 
  Software is licensed, not sold.