How can we help?

AxSms.Smpp


Introduction

Skip to properties and methods

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 "gateway.auronsoftware.com.com", 2775, 2000, False
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
' recognize 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 "gateway.auronsoftware.com.com", 2775, 2000, False
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.

Using national language shift tables

The national language shift tables are an extension to the GSM 03.38 standard that introduces different language character sets.

This means that for those languages that are present in the national language shift tables you can send SMS messages without using the Unicode character set. A single part Unicode message can only use 70 characters while a single part SMS that uses the national language shift tables can contain up to 152 characters. Or 155 when only the locking shift table is used.

Send an SMS using the national language shift table by simply setting the LanguageLockingShift and the LanguageSingleShift properties.

To be able to use the national language shift tables please make sure that UseGsmEncoding is set to either a 7bit or 8bit GSM option


Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
...
objMessage.LanguageLockingShift = objConstants.LANGUAGE_LOCKINGSHIFT_HINDI
objMessage.LanguageSingleShift = objConstants.LANGUAGE_SINGLESHIFT_HINDI
objMessage.Body = "नमस्ते दुनिया!"

To control the way that messages with the language shift tables are received please look at the ExtractLanguageShift property.

Properties and Methods

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 Read License Status
LicenseKey String Read/Write 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
LogLevel Integer Read/Write Set how much information will be logged
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
ExtractLanguageShift Boolean Read/Write Whether language shift should be applied
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
LocalIpAddress String Read/Write The local IP address to use when connecting
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

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.

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.

Enabling LogPduDetails is the same as setting the LogLevel to SMPP_LOGLEVEL_VERBOSE.

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
...

LogLevel property

The log level determines how much information is logged to file when logging is enabled. Use one of these constants.

Example:

Set objSmpp = CreateObject("AxSms.Smpp") 
Set objConstants = CreateObject("AxSms.Constants")
 
objSmpp.LogFile = "C:\temp\log.txt"
objSmpp.LogLevel = objConstants.SMPP_LOGLEVEL_VERBOSE
...
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 "gateway.auronsoftware.com.com", 2775, 2000, False
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
...

ExtractLanguageShift property

This property controls if the language shift tables should be applied. This only applies when receiving SMS messages that include a national language shift user data header (UDH).

With this property set to True the UDH is extracted and the appropriate national language tables are used automatically.

If this property is set to False the message the UDH is left in place and the message will be HEX formatted.

To send SMS messages using one of the language shift tables use the LanguageLockingShift and the LanguageSingleShift properties.

Make sure that the UseGsmEncoding property is set to either 7 bit or 8 bit on incoming messages for national language shift tables to work.

By default this property is set to true.

Example:

Set objConstants = CreateObject("AxSms.Constants")
Set objSmpp = CreateObject("AxSms.Smpp")
Set objMessage = CreateObject("AxSms.Message")
...
objSmpp.UseGsmEncoding = objConstants.SMPP_USEGSMENCODING_INOUTCHARS
objSmpp.ExtractLanguageShift = True
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 "gateway.auronsoftware.com.com", 2775, 2000, False
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 "gateway.auronsoftware.com.com", 2775, 2000, False
If objSmpp.LastError <> 0 Then
  WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
  WScript.Quit 1
End If
...

LocalIpAddress property

The local IP address that should be used when connecting to a server.

This property should be set to either an IPv4 or an IPv6 address.
Leave this property blank to let the operating system choose the IP address to use.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
....
objSmpp.LogFile = "log.txt"
objSmpp.LocalIpAddress = "192.168.1.20" 
objSmpp.Connect "gateway.auronsoftware.com.com", 2775, 2000, False
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 "gateway.auronsoftware.com.com", 2775, 2000, False
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 "gateway.auronsoftware.com.com", 2775, 2000, False
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 "gateway.auronsoftware.com.com", 2775, 2000, False
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 "gateway.auronsoftware.com.com", 2775, 2000, False
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 "gateway.auronsoftware.com.com", 2775, 2000, False
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 "gateway.auronsoftware.com.com", 2775, 2000, False
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

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.

Set the secure flag parameter to ‘True’ to be able to connect to a secure SMPP Server that uses a TLS/SSL encrypted connection.

Parameters:

  • Host to connect to
  • Port to connect to
  • Timeout before the connection fails
  • (Optional) Secure flag

Return value:

Always 0.

Example:

Set objSmpp = CreateObject("AxSms.Smpp")
....
objSmpp.LogFile = "log.txt"
objSmpp.Connect "gateway.auronsoftware.com.com", 2775, 2000, False
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

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 "gateway.auronsoftware.com.com", 2775, 2000, False
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
' recognize 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 "gateway.auronsoftware.com.com", 2775, 2000, False
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.

Using national language shift tables

The national language shift tables are an extension to the GSM 03.38 standard that introduces different language character sets.

This means that for those languages that are present in the national language shift tables you can send SMS messages without using the Unicode character set. A single part Unicode message can only use 70 characters while a single part SMS that uses the national language shift tables can contain up to 152 characters. Or 155 when only the locking shift table is used.

Send an SMS using the national language shift table by simply setting the LanguageLockingShift and the LanguageSingleShift properties.

To be able to use the national language shift tables please make sure that UseGsmEncoding is set to either a 7bit or 8bit GSM option


Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
...
objMessage.LanguageLockingShift = objConstants.LANGUAGE_LOCKINGSHIFT_HINDI
objMessage.LanguageSingleShift = objConstants.LANGUAGE_SINGLESHIFT_HINDI
objMessage.Body = "नमस्ते दुनिया!"

To control the way that messages with the language shift tables are received please look at the ExtractLanguageShift property.