How can we help?

AxSms.Message


Introduction

Skip to properties and methods

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

Properties and Methods

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
LanguageLockingShift Number Read/Write Language locking shift table
LanguageSingleShift Number Read/Write Language single shift table
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/Write SMPP specific, sequence number
SmppServerSubmitDate String Read SMPP Server specific, message submit timestamp
SmppServerFinalDate String Read SMPP Server specific, timestamp of the final status

Method Description
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
ToJSon Serialize this message to a JSON string
FromJSon Deserialize into this message object from a JSON string
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
SmppDeleteTlv Delete a TLV value from this message

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

LanguageLockingShift property

Get or set the national language locking shift table for this message. The locking shift table determines which character set is active by default.

Use this property when sending SMS messages in any of these languages instead of setting the datacoding to Unicode. When using the LanguageLockingShift / LanguageSingleShift properties you can sent up to 152 characters in a single SMS message instead of only 70 when using Unicode.

Use this property together with LanguageSingleShift on GSM, SMPP or SMPP Server. When using this property with SMPP please make sure that the UseGsmEncoding is not set to disabled.

When setting this property use these constants.

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objConst = CreateObject("AxSms.Constants")
...
objMessage.DataCoding = objConst.DATACODING_DEFAULT
objMessage.LanguageLockingShift = objConst.LANGUAGE_LOCKINGSHIFT_HINDI
objMessage.LanguageSingleShift = objConst.LANGUAGE_SINGLESHIFT_HINDI
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

LanguageSingleShift property

Get or set the national language single shift table for this message. The single shift table determines which character set is available for extended (shifted) characters.

Use this property when sending SMS messages in any of these languages instead of setting the datacoding to Unicode. When using the LanguageLockingShift / LanguageSingleShift properties you can sent up to 152 characters in a single SMS message instead of only 70 when using Unicode.

Use this property together with LanguageLockingShift on GSM, SMPP or SMPP Server. When using this property with SMPP please make sure that the UseGsmEncoding is not set to disabled.

When setting this property use these constants.

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objConst = CreateObject("AxSms.Constants")
...
objMessage.DataCoding = objConst.DATACODING_DEFAULT
objMessage.LanguageLockingShift = objConst.LANGUAGE_LOCKINGSHIFT_HINDI
objMessage.LanguageSingleShift = objConst.LANGUAGE_SINGLESHIFT_HINDI
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

SmppServerSubmitDate property

This is the submit timestamp of an SMS message. The property is automatically set by the SMS component when a submit is received.

This timestamp is used when automatically creating a delivery report for the client using DeliverReport.

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

SmppServerFinalDate property

The is the timestamp of the final status of the message. That is the timestamp of the message delivery or the timestamp of the delivery failure.

This timestamp value is set to the current time when automatically creating a delivery report for the client using DeliverReport.

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

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)

ToJSon method

Serialize this message to JSON string. Deserialize this message using FromJSon.

Parameters:

  • none

Return value:

JSON formatted representation of this message contents

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objOtherMessage = CreateObject("AxSms.Message")
...
sJSonDump = objMessage.ToJSon()
WScript.Echo sJSonDump
objOtherMessage.FromJSon(sJSonDump)
...

FromJSon method

Deserialize into this message object from a JSON string. Serialize using ToJSon.

Parameters:

  • JSON formatted string

Return value:

None

Example:

Set objMessage = CreateObject("AxSms.Message")
Set objOtherMessage = CreateObject("AxSms.Message")
...
sJSonDump = objMessage.ToJSon()
WScript.Echo sJSonDump
objOtherMessage.FromJSon(sJSonDump)
...

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

SmppDeleteTlv method

Delete a Tlv (Tag, Length, Value) object from this message.

Parameters:

  • Tag value

Return value:

None

Example:

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