ℹ️ The Auron SMS Server is now Auron Omni. Learn more here.

How can we help?

AxSms.Message


Introduction

Skip to properties and methods

This object represents an SMS message. All SMS Component protocols, Gsm, Smpp, SmppServer, Http and Dialup, use this object to send and receive SMS message data.

Most properties and methods on the Message object work with all protocols. Some properties apply only to a specific protocol. Protocol-specific properties and methods use a prefix. 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 destination address
FromAddress String Read/Write The source address
Body String Read/Write The message body
RequestDeliveryReport Boolean Read/Write Request a delivery report
ToAddressTON String Read/Write Type of Number for ToAddress
ToAddressNPI String Read/Write Number Plan Indicator for ToAddress
FromAddressTON String Read/Write Type of Number for FromAddress
FromAddressNPI String Read/Write Number Plan Indicator for FromAddress
ProtocolId String Read/Write 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 since 1970
TotalParts Number Read Total number of message parts
PartNumber Number Read Part number of this message
MultipartRef Number Read Multipart reference number
Incomplete Boolean Read Whether the message is incomplete
GsmFirstOctet Number Read/Write GSM specific, First octet
GsmSmscAddress String Read GSM specific, SMSC address
GsmSmscAddressTON Number Read GSM specific, SMSC address TON
GsmSmscAddressNPI Number Read GSM specific, SMSC 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, is this 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, submit timestamp
SmppServerFinalDate String Read SMPP Server specific, final status timestamp

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 a JSON string into this message object
SmppAddTlv Add a TLV to this message
SmppGetTlv Get a specific TLV from this message
SmppGetFirstTlv Get the first TLV attached to this message
SmppGetNextTlv Get the next TLV attached to this message
SmppDeleteTlv Delete a TLV from this message

LastError property

Completion code of the last called method. To see the description of an error code, visit the online error codes page.

Example:

$objMessage = New-Object -ComObject AxSms.Message
...
$objTlv = $objMessage.SmppGetFirstTlv()
While ($objMessage.LastError -eq 0) {
    Write-Host "Tag: $($objTlv.Tag); Value: $($objTlv.ValueAsHexString)"
    $objTlv = $objMessage.SmppGetNextTlv()
}
...
var objMessage = new AxSms.Message();
...
var objTlv = objMessage.SmppGetFirstTlv();
while (objMessage.LastError == 0)
{
    Console.WriteLine("Tag: " + objTlv.Tag + "; Value: " + objTlv.ValueAsHexString);
    objTlv = objMessage.SmppGetNextTlv();
}
...
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

You can store any value here. Use this property to track individual SMS messages.

Example:

$objMessage = New-Object -ComObject AxSms.Message
...
$objMessage.UserTag = 1
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
...
objMessage.UserTag = 1;
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
Set objMessage = CreateObject("AxSms.Message")
...
objMessage.UserTag = 1
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

ToAddress property

The address where this SMS message will be sent.

Example:

$objMessage = New-Object -ComObject AxSms.Message
...
$objMessage.UserTag = 1
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
...
objMessage.UserTag = 1;
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
Set objMessage = CreateObject("AxSms.Message")
...
objMessage.UserTag = 1
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

FromAddress property

The address this message was received from.

Example:

$objMessage = New-Object -ComObject AxSms.Message
...
$objMessage.FromAddress = "ActvXprts"
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
...
objMessage.FromAddress = "ActvXprts";
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
Set objMessage = CreateObject("AxSms.Message")
...
objMessage.FromAddress = "ActvXprts"
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

Body property

The body of the SMS message. The format depends on the BodyFormat property.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objMessage.FromAddress = "ActvXprts"
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
objMessage.FromAddress = "ActvXprts";
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.FromAddress = "ActvXprts"
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

RequestDeliveryReport property

Set this property to true to request a delivery report when the message is sent. This has the same effect as setting SmppEsmClass to SMPP_ESM_2ESME_DELIVERY_RECEIPT for SMPP or GsmFirstOctet to GSM_FO_STATUS_REPORT for GSM.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objMessage.RequestDeliveryReport = $true
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
objMessage.RequestDeliveryReport = true;
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.RequestDeliveryReport = true
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

ToAddressTON property

Type of Number for the ToAddress property. Use one of these constants.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objConst = New-Object -ComObject AxSms.Constants
...
$objMessage.ToAddressTON = $objConst.TON_INTERNATIONAL
$objMessage.ToAddressNPI = $objConst.NPI_ISDN
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
var objConst = new AxSms.Constants();
...
objMessage.ToAddressTON = objConst.TON_INTERNATIONAL;
objMessage.ToAddressNPI = objConst.NPI_ISDN;
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
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

Number Plan Indicator for the ToAddress property. Use one of these constants.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objConst = New-Object -ComObject AxSms.Constants
...
$objMessage.ToAddressNPI = $objConst.NPI_ISDN
$objMessage.ToAddressTON = $objConst.TON_INTERNATIONAL
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
var objConst = new AxSms.Constants();
...
objMessage.ToAddressNPI = objConst.NPI_ISDN;
objMessage.ToAddressTON = objConst.TON_INTERNATIONAL;
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
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

Type of Number for the FromAddress property. Use one of these constants.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objConst = New-Object -ComObject AxSms.Constants
...
$objMessage.FromAddressNPI = $objConst.NPI_ISDN
$objMessage.FromAddressTON = $objConst.TON_ALPHANUMERIC
$objMessage.FromAddress = "ActvXprts"
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
var objConst = new AxSms.Constants();
...
objMessage.FromAddressNPI = objConst.NPI_ISDN;
objMessage.FromAddressTON = objConst.TON_ALPHANUMERIC;
objMessage.FromAddress = "ActvXprts";
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
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

Number Plan Indicator for the FromAddress property. Use one of these constants.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objConst = New-Object -ComObject AxSms.Constants
...
$objMessage.FromAddressNPI = $objConst.NPI_ISDN
$objMessage.FromAddressTON = $objConst.TON_ALPHANUMERIC
$objMessage.FromAddress = "ActvXprts"
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
var objConst = new AxSms.Constants();
...
objMessage.FromAddressNPI = objConst.NPI_ISDN;
objMessage.FromAddressTON = objConst.TON_ALPHANUMERIC;
objMessage.FromAddress = "ActvXprts";
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
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

The protocol ID sent with this SMS message.

Example:

$objMessage = New-Object -ComObject AxSms.Message
...
$objMessage.ProtocolId = ""
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
...
objMessage.ProtocolId = "";
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
Set objMessage = CreateObject("AxSms.Message")
...
objMessage.ProtocolId = ""
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

ValidityPeriod property

The validity period for this SMS message in minutes. The SMSC tries to deliver the message during this time. If it cannot deliver within the validity period, the message fails.

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

Example:

$objMessage = New-Object -ComObject AxSms.Message
...
$objMessage.ValidityPeriod = 300
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
...
objMessage.ValidityPeriod = 300;
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
Set objMessage = CreateObject("AxSms.Message")
...
objMessage.ValidityPeriod = 300
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

Reference property

The message reference. For SMPP this is the reference returned by the SMSC. For GSM this is the reference returned by the GSM modem.

Example:

$objSmpp = New-Object -ComObject AxSms.Smpp
$objMessage = New-Object -ComObject AxSms.Message
...
While ($objSmpp.WaitForSmsUpdate) {
    $objMessage = $objSmpp.FetchSmsUpdate
    If ($objSmpp.LastError -eq 0) {
        Write-Host "Reference: $($objMessage.Reference); UserTag: $($objMessage.UserTag)"
        Start-Sleep -Milliseconds 1
    }
}
var objSmpp = new AxSms.Smpp();
var objMessage = new AxSms.Message();
...
while (objSmpp.WaitForSmsUpdate)
{
    objMessage = objSmpp.FetchSmsUpdate;
    if (objSmpp.LastError == 0)
    {
        Console.WriteLine("Reference: " + objMessage.Reference + 
            "; UserTag: " + objMessage.UserTag);
        System.Threading.Thread.Sleep(1);
    }
}
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

The data coding byte. Use this property to set special encodings, for example to send a message as Unicode instead of the default 7-bit GSM character set.

Use one of these constants.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objConst = New-Object -ComObject AxSms.Constants
...
$objMessage.DataCoding = $objConst.DATACODING_UNICODE
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
var objConst = new AxSms.Constants();
...
objMessage.DataCoding = objConst.DATACODING_UNICODE;
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
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

The national language locking shift table for this message. The locking shift table defines the default character set.

Use this property together with LanguageSingleShift when sending messages in supported languages instead of Unicode. This allows up to 152 characters per SMS instead of only 70 with Unicode.

Use these properties with GSM, SMPP or SmppServer. For SMPP make sure UseGsmEncoding is not disabled.

Use one of these constants.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objConst = New-Object -ComObject 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"
...
var objMessage = new AxSms.Message();
var objConst = new 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";
...
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

The national language single shift table for this message. The single shift table defines extended characters.

Use this property together with LanguageLockingShift when sending messages in supported languages instead of Unicode. This allows up to 152 characters per SMS instead of only 70 with Unicode.

Use these properties with GSM, SMPP or SmppServer. For SMPP make sure UseGsmEncoding is not disabled.

Use one of these constants.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objConst = New-Object -ComObject 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"
...
var objMessage = new AxSms.Message();
var objConst = new 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";
...
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 format of the Body property. Use one of these constants.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objConst = New-Object -ComObject AxSms.Constants
...
$objMessage.BodyFormat = $objConst.BODYFORMAT_TEXT
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
var objConst = new AxSms.Constants();
...
objMessage.BodyFormat = objConst.BODYFORMAT_TEXT;
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
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

Indicates if the SMS message has a User Data Header (UDH) prefix.

When a UDH is present on incoming messages, BodyFormat is automatically set to BODYFORMAT_HEX. When sending with a UDH, provide the body in HEX format.

The component automatically adds or interprets UDH for multipart and application port messages on GSM and SMPP. In those cases HasUdh remains false unless the UDH cannot be handled automatically.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objConst = New-Object -ComObject AxSms.Constants
...
$objMessage.BodyFormat = $objConst.BODYFORMAT_TEXT
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
var objConst = new AxSms.Constants();
...
objMessage.BodyFormat = objConst.BODYFORMAT_TEXT;
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
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

The time this message was received.

Example:

$objGsm = New-Object -ComObject AxSms.Gsm
...
$objMessage = $objGsm.GetFirstSms
While ($objGsm.LastError -eq 0) {
    Write-Host "Received from: $($objMessage.FromAddress)"
    Write-Host "Receive time: $($objMessage.ReceiveTime)"
    Write-Host $objMessage.Body
    $objMessage = $objGsm.GetNextSms
}
var objGsm = new AxSms.Gsm();
...
var objMessage = objGsm.GetFirstSms;
while (objGsm.LastError == 0)
{
    Console.WriteLine("Received from: " + objMessage.FromAddress);
    Console.WriteLine("Receive time: " + objMessage.ReceiveTime);
    Console.WriteLine(objMessage.Body);
    objMessage = objGsm.GetNextSms;
}
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

The receive time of this message in seconds since January 1, 1970 (Unix timestamp).

Example:

$objGsm = New-Object -ComObject AxSms.Gsm
...
$objMessage = $objGsm.GetFirstSms
While ($objGsm.LastError -eq 0) {
    Write-Host "Received from: $($objMessage.FromAddress)"
    Write-Host "Receive time in seconds: $($objMessage.ReceiveTimeInSeconds)"
    Write-Host $objMessage.Body
    $objMessage = $objGsm.GetNextSms
}
var objGsm = new AxSms.Gsm();
...
var objMessage = objGsm.GetFirstSms;
while (objGsm.LastError == 0)
{
    Console.WriteLine("Received from: " + objMessage.FromAddress);
    Console.WriteLine("Receive time in seconds: " + objMessage.ReceiveTimeInSeconds);
    Console.WriteLine(objMessage.Body);
    objMessage = objGsm.GetNextSms;
}
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 shows the total number of parts. Use PartNumber to see the position of this part.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objGsm = New-Object -ComObject AxSms.Gsm
$objConst = New-Object -ComObject AxSms.Constants
...
$objGsm.AssembleMultipart = $false
$objGsm.Receive($objConst.GSM_MESSAGESTATE_RECEIVED_UNREAD)
If ($objGsm.LastError -ne 0) {
    Write-Host "Error: $($objGsm.GetErrorDescription($objGsm.LastError))"
    exit 1
}
...
$objMessage = $objGsm.GetFirstSms
While ($objGsm.LastError -eq 0) {
    Write-Host "Received from: $($objMessage.FromAddress)"
    Write-Host $objMessage.Body
    Write-Host "Part $($objMessage.PartNumber) from $($objMessage.TotalParts)"
    $objMessage = $objGsm.GetNextSms
}
var objMessage = new AxSms.Message();
var objGsm = new AxSms.Gsm();
var objConst = new AxSms.Constants();
...
objGsm.AssembleMultipart = false;
objGsm.Receive(objConst.GSM_MESSAGESTATE_RECEIVED_UNREAD);
if (objGsm.LastError != 0)
{
    Console.WriteLine("Error: " + objGsm.GetErrorDescription(objGsm.LastError));
    return 1;
}
...
objMessage = objGsm.GetFirstSms;
while (objGsm.LastError == 0)
{
    Console.WriteLine("Received from: " + objMessage.FromAddress);
    Console.WriteLine(objMessage.Body);
    Console.WriteLine("Part " + objMessage.PartNumber + " from " + objMessage.TotalParts);
    objMessage = objGsm.GetNextSms;
}
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 shows the part number. Use TotalParts to see the total number of parts.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objGsm = New-Object -ComObject AxSms.Gsm
$objConst = New-Object -ComObject AxSms.Constants
...
$objGsm.AssembleMultipart = $false
$objGsm.Receive($objConst.GSM_MESSAGESTATE_RECEIVED_UNREAD)
If ($objGsm.LastError -ne 0) {
    Write-Host "Error: $($objGsm.GetErrorDescription($objGsm.LastError))"
    exit 1
}
...
$objMessage = $objGsm.GetFirstSms
While ($objGsm.LastError -eq 0) {
    Write-Host "Received from: $($objMessage.FromAddress)"
    Write-Host $objMessage.Body
    Write-Host "Part $($objMessage.PartNumber) from $($objMessage.TotalParts)"
    $objMessage = $objGsm.GetNextSms
}
var objMessage = new AxSms.Message();
var objGsm = new AxSms.Gsm();
var objConst = new AxSms.Constants();
...
objGsm.AssembleMultipart = false;
objGsm.Receive(objConst.GSM_MESSAGESTATE_RECEIVED_UNREAD);
if (objGsm.LastError != 0)
{
    Console.WriteLine("Error: " + objGsm.GetErrorDescription(objGsm.LastError));
    return 1;
}
...
objMessage = objGsm.GetFirstSms;
while (objGsm.LastError == 0)
{
    Console.WriteLine("Received from: " + objMessage.FromAddress);
    Console.WriteLine(objMessage.Body);
    Console.WriteLine("Part " + objMessage.PartNumber + " from " + objMessage.TotalParts);
    objMessage = objGsm.GetNextSms;
}
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 this message is part of a multipart message, this property contains the multipart reference number.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objGsm = New-Object -ComObject AxSms.Gsm
$objConst = New-Object -ComObject AxSms.Constants
...
$objGsm.AssembleMultipart = $false
$objGsm.Receive($objConst.GSM_MESSAGESTATE_RECEIVED_UNREAD)
If ($objGsm.LastError -ne 0) {
    Write-Host "Error: $($objGsm.GetErrorDescription($objGsm.LastError))"
    exit 1
}
...
$objMessage = $objGsm.GetFirstSms
While ($objGsm.LastError -eq 0) {
    Write-Host "Received from: $($objMessage.FromAddress)"
    Write-Host $objMessage.Body
    Write-Host "Multipart reference: $($objMessage.MultipartRef)"
    Write-Host "Part $($objMessage.PartNumber) from $($objMessage.TotalParts)"
    $objMessage = $objGsm.GetNextSms
}
var objMessage = new AxSms.Message();
var objGsm = new AxSms.Gsm();
var objConst = new AxSms.Constants();
...
objGsm.AssembleMultipart = false;
objGsm.Receive(objConst.GSM_MESSAGESTATE_RECEIVED_UNREAD);
if (objGsm.LastError != 0)
{
    Console.WriteLine("Error: " + objGsm.GetErrorDescription(objGsm.LastError));
    return 1;
}
...
objMessage = objGsm.GetFirstSms;
while (objGsm.LastError == 0)
{
    Console.WriteLine("Received from: " + objMessage.FromAddress);
    Console.WriteLine(objMessage.Body);
    Console.WriteLine("Multipart reference: " + objMessage.MultipartRef);
    Console.WriteLine("Part " + objMessage.PartNumber + " from " + objMessage.TotalParts);
    objMessage = objGsm.GetNextSms;
}
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

True when one or more parts of a multipart message have not been received yet. This can happen on a SIM card (GSM) or when a multipart message times out (SMPP).

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objGsm = New-Object -ComObject AxSms.Gsm
$objConst = New-Object -ComObject AxSms.Constants
...
$objGsm.AssembleMultipart = $true
$objGsm.Receive($objConst.GSM_MESSAGESTATE_ALL)
If ($objGsm.LastError -ne 0) {
    Write-Host "Error: $($objGsm.GetErrorDescription($objGsm.LastError))"
    exit 1
}
...
$objMessage = $objGsm.GetFirstSms
While ($objGsm.LastError -eq 0) {
    Write-Host "Received from: $($objMessage.FromAddress)"
    Write-Host "Incomplete: $($objMessage.Incomplete)"
    Write-Host $objMessage.Body
    $objMessage = $objGsm.GetNextSms
}
var objMessage = new AxSms.Message();
var objGsm = new AxSms.Gsm();
var objConst = new AxSms.Constants();
...
objGsm.AssembleMultipart = true;
objGsm.Receive(objConst.GSM_MESSAGESTATE_ALL);
if (objGsm.LastError != 0)
{
    Console.WriteLine("Error: " + objGsm.GetErrorDescription(objGsm.LastError));
    return 1;
}
...
objMessage = objGsm.GetFirstSms;
while (objGsm.LastError == 0)
{
    Console.WriteLine("Received from: " + objMessage.FromAddress);
    Console.WriteLine("Incomplete: " + objMessage.Incomplete);
    Console.WriteLine(objMessage.Body);
    objMessage = objGsm.GetNextSms;
}
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

The first octet value. Use this property when you need a specific first octet setting that cannot be set with other properties such as RequestDeliveryReport.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objConst = New-Object -ComObject AxSms.Constants
...
$objMessage.GsmFirstOctet = $objConst.GSM_FO_UDHI
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
var objConst = new AxSms.Constants();
...
objMessage.GsmFirstOctet = objConst.GSM_FO_UDHI;
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
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 SMSC address that delivered this SMS. To choose a preferred SMSC for sending, use the PreferredSmsc property on the Gsm object.

Example:

$objGsm = New-Object -ComObject AxSms.Gsm
...
$objMessage = $objGsm.GetFirstSms
While ($objGsm.LastError -eq 0) {
    Write-Host "Received from: $($objMessage.FromAddress)"
    Write-Host "Smsc address: $($objMessage.GsmSmscAddress)"
    Write-Host "Smsc address TON: $($objMessage.GsmSmscAddressTON)"
    Write-Host "Smsc address NPI: $($objMessage.GsmSmscAddressNPI)"
    Write-Host $objMessage.Body
    $objMessage = $objGsm.GetNextSms
}
var objGsm = new AxSms.Gsm();
...
var objMessage = objGsm.GetFirstSms;
while (objGsm.LastError == 0)
{
    Console.WriteLine("Received from: " + objMessage.FromAddress);
    Console.WriteLine("Smsc address: " + objMessage.GsmSmscAddress);
    Console.WriteLine("Smsc address TON: " + objMessage.GsmSmscAddressTON);
    Console.WriteLine("Smsc address NPI: " + objMessage.GsmSmscAddressNPI);
    Console.WriteLine(objMessage.Body);
    objMessage = objGsm.GetNextSms;
}
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

Type of Number for the GsmSmscAddress. This is always one of these constants.

Example:

$objGsm = New-Object -ComObject AxSms.Gsm
...
$objMessage = $objGsm.GetFirstSms
While ($objGsm.LastError -eq 0) {
    Write-Host "Received from: $($objMessage.FromAddress)"
    Write-Host "Smsc address: $($objMessage.GsmSmscAddress)"
    Write-Host "Smsc address TON: $($objMessage.GsmSmscAddressTON)"
    Write-Host "Smsc address NPI: $($objMessage.GsmSmscAddressNPI)"
    Write-Host $objMessage.Body
    $objMessage = $objGsm.GetNextSms
}
var objGsm = new AxSms.Gsm();
...
var objMessage = objGsm.GetFirstSms;
while (objGsm.LastError == 0)
{
    Console.WriteLine("Received from: " + objMessage.FromAddress);
    Console.WriteLine("Smsc address: " + objMessage.GsmSmscAddress);
    Console.WriteLine("Smsc address TON: " + objMessage.GsmSmscAddressTON);
    Console.WriteLine("Smsc address NPI: " + objMessage.GsmSmscAddressNPI);
    Console.WriteLine(objMessage.Body);
    objMessage = objGsm.GetNextSms;
}
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

Number Plan Indicator for the GsmSmscAddress. This is always one of these constants.

Example:

$objGsm = New-Object -ComObject AxSms.Gsm
...
$objMessage = $objGsm.GetFirstSms
While ($objGsm.LastError -eq 0) {
    Write-Host "Received from: $($objMessage.FromAddress)"
    Write-Host "Smsc address: $($objMessage.GsmSmscAddress)"
    Write-Host "Smsc address TON: $($objMessage.GsmSmscAddressTON)"
    Write-Host "Smsc address NPI: $($objMessage.GsmSmscAddressNPI)"
    Write-Host $objMessage.Body
    $objMessage = $objGsm.GetNextSms
}
var objGsm = new AxSms.Gsm();
...
var objMessage = objGsm.GetFirstSms;
while (objGsm.LastError == 0)
{
    Console.WriteLine("Received from: " + objMessage.FromAddress);
    Console.WriteLine("Smsc address: " + objMessage.GsmSmscAddress);
    Console.WriteLine("Smsc address TON: " + objMessage.GsmSmscAddressTON);
    Console.WriteLine("Smsc address NPI: " + objMessage.GsmSmscAddressNPI);
    Console.WriteLine(objMessage.Body);
    objMessage = objGsm.GetNextSms;
}
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

When received through GSM, this property contains the memory index where the message is stored. Together with GsmMemoryLocation it identifies the exact location in the device.

Example:

$objGsm = New-Object -ComObject AxSms.Gsm
...
$objMessage = $objGsm.GetFirstSms
While ($objGsm.LastError -eq 0) {
    Write-Host "Received from: $($objMessage.FromAddress)"
    Write-Host "Memory index: $($objMessage.GsmMemoryIndex)"
    Write-Host "Memory location: $($objMessage.GsmMemoryLocation)"
    Write-Host $objMessage.Body
    $objMessage = $objGsm.GetNextSms
}
var objGsm = new AxSms.Gsm();
...
var objMessage = objGsm.GetFirstSms;
while (objGsm.LastError == 0)
{
    Console.WriteLine("Received from: " + objMessage.FromAddress);
    Console.WriteLine("Memory index: " + objMessage.GsmMemoryIndex);
    Console.WriteLine("Memory location: " + objMessage.GsmMemoryLocation);
    Console.WriteLine(objMessage.Body);
    objMessage = objGsm.GetNextSms;
}
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

When received through GSM, this property contains the memory location where the message is stored. Together with GsmMemoryIndex it identifies the exact location in the device.

Example:

$objGsm = New-Object -ComObject AxSms.Gsm
...
$objMessage = $objGsm.GetFirstSms
While ($objGsm.LastError -eq 0) {
    Write-Host "Received from: $($objMessage.FromAddress)"
    Write-Host "Memory index: $($objMessage.GsmMemoryIndex)"
    Write-Host "Memory location: $($objMessage.GsmMemoryLocation)"
    Write-Host $objMessage.Body
    $objMessage = $objGsm.GetNextSms
}
var objGsm = new AxSms.Gsm();
...
var objMessage = objGsm.GetFirstSms;
while (objGsm.LastError == 0)
{
    Console.WriteLine("Received from: " + objMessage.FromAddress);
    Console.WriteLine("Memory index: " + objMessage.GsmMemoryIndex);
    Console.WriteLine("Memory location: " + objMessage.GsmMemoryLocation);
    Console.WriteLine(objMessage.Body);
    objMessage = objGsm.GetNextSms;
}
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

The message priority. Use one of these constants.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objConst = New-Object -ComObject AxSms.Constants
...
$objMessage.SmppPriority = $objConst.SMPP_PRIORITY_NORMAL
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
var objConst = new AxSms.Constants();
...
objMessage.SmppPriority = objConst.SMPP_PRIORITY_NORMAL;
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
Set objMessage = CreateObject("AxSms.Message")
Set objConst = CreateObject("AxSms.Constants")
...
objMessage.SmppPriority = objConst.SMPP_PRIORITY_NORMAL
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

SmppServiceType property

The service type for this message. Common values include:

  • “” – default (empty string)
  • “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:

$objMessage = New-Object -ComObject AxSms.Message
...
$objMessage.SmppServiceType = "USSD"
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "?*101#??"
...
var objMessage = new AxSms.Message();
...
objMessage.SmppServiceType = "USSD";
objMessage.ToAddress = "+31122334455";
objMessage.Body = "?*101#??";
...
Set objMessage = CreateObject("AxSms.Message")
...
objMessage.SmppServiceType = "USSD"
objMessage.ToAddress = "+31122334455"
objMessage.Body = "?*101#??"
...

SmppEsmClass property

The ESM class value. Use this when you need a specific ESM class that cannot be set with other properties such as RequestDeliveryReport. Use one of these constants.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objConst = New-Object -ComObject AxSms.Constants
...
$objMessage.SmppEsmClass = $objConst.SMPP_ESM_2ESME_DELIVERY_RECEIPT
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
var objConst = new AxSms.Constants();
...
objMessage.SmppEsmClass = objConst.SMPP_ESM_2ESME_DELIVERY_RECEIPT;
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
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

The last known status of an SMPP message. This is always one of these constants.

Example:

$objSmpp = New-Object -ComObject AxSms.Smpp
$objMessage = New-Object -ComObject AxSms.Message
...
$objSmpp.QuerySms($objMessage)
While ($objSmpp.WaitForSmsUpdate) {
    $objMessage = $objSmpp.FetchSmsUpdate
    If ($objSmpp.LastError -eq 0) {
        Write-Host ("Reference: " + $objMessage.Reference + "; UserTag: " + `
            $objMessage.UserTag + "; Status: " + $objMessage.SmppStatus)
        Start-Sleep -Milliseconds 1
    }
}
var objSmpp = new AxSms.Smpp();
var objMessage = new AxSms.Message();
...
objSmpp.QuerySms(objMessage);
while (objSmpp.WaitForSmsUpdate)
{
    objMessage = objSmpp.FetchSmsUpdate;
    if (objSmpp.LastError == 0)
    {
        Console.WriteLine("Reference: " + objMessage.Reference + "; UserTag: " + 
            objMessage.UserTag + "; Status: " + objMessage.SmppStatus);
        System.Threading.Thread.Sleep(1);
    }
}
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 & _
            "; Status: " & objMessage.SmppStatus
        WScript.Sleep 1
    End If
WEnd

SmppError property

The error code for this message. This value is only set when you query a message.

Example:

$objSmpp = New-Object -ComObject AxSms.Smpp
$objMessage = New-Object -ComObject AxSms.Message
...
$objSmpp.QuerySms($objMessage)
While ($objSmpp.WaitForSmsUpdate) {
    $objMessage = $objSmpp.FetchSmsUpdate
    If ($objSmpp.LastError -eq 0) {
        Write-Host ("Reference: " + $objMessage.Reference + "; UserTag: " + `
            $objMessage.UserTag + "; Error: " + $objMessage.SmppError)
        Start-Sleep -Milliseconds 1
    }
}
var objSmpp = new AxSms.Smpp();
var objMessage = new AxSms.Message();
...
objSmpp.QuerySms(objMessage);
while (objSmpp.WaitForSmsUpdate)
{
    objMessage = objSmpp.FetchSmsUpdate;
    if (objSmpp.LastError == 0)
    {
        Console.WriteLine("Reference: " + objMessage.Reference + "; UserTag: " + 
            objMessage.UserTag + "; Error: " + objMessage.SmppError);
        System.Threading.Thread.Sleep(1);
    }
}
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 & _
            "; Error: " & objMessage.SmppError
        WScript.Sleep 1
    End If
WEnd

SmppIsDeliveryReport property

True when this message is a delivery report. Set this property to create a delivery report.

This is equivalent to checking the SmppEsmClass for the SMPP_ESM_2ESME_DELIVERY_RECEIPT bit.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objSmpp = New-Object -ComObject AxSms.Smpp
...
$objMessage = $objSmpp.ReceiveMessage()
While ($objSmpp.LastError -eq 0) {
    If ($objMessage.SmppIsDeliveryReport) {
        $ref = $objMessage.Body.Substring(0, $objMessage.Body.IndexOf(" "))
        $statIdx = $objMessage.Body.IndexOf("stat:") + 5
        $stat = $objMessage.Body.Substring($statIdx, 7)
        Write-Host "Delivery report for: $ref State: $stat"
    } Else {
        Write-Host "Received to: $($objMessage.ToAddress)"
        Write-Host "Body: $($objMessage.Body)"
    }
    $objMessage = $objSmpp.ReceiveMessage()
}
...
var objMessage = new AxSms.Message();
var objSmpp = new AxSms.Smpp();
...
objMessage = objSmpp.ReceiveMessage();
while (objSmpp.LastError == 0)
{
    if (objMessage.SmppIsDeliveryReport)
    {
        string body = objMessage.Body;
        string refPart = body.Substring(0, body.IndexOf(" "));
        string stat = body.Substring(body.IndexOf("stat:") + 5, 7);
        Console.WriteLine("Delivery report for: " + refPart + " State: " + stat);
    }
    else
    {
        Console.WriteLine("Received to: " + objMessage.ToAddress);
        Console.WriteLine("Body: " + objMessage.Body);
    }
    objMessage = objSmpp.ReceiveMessage();
}
...
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 report for: " & Left(objMessage.Body, InStr(objMessage.Body, " ")) & _
            " State: " & Mid(objMessage.Body, InStr(objMessage.Body, "stat:")+5, 7)
    Else
        WScript.Echo "Received to: " & objMessage.ToAddress
        WScript.Echo "Body: " & objMessage.Body
    End If
    Set objMessage = objSmpp.ReceiveMessage()
Wend
...

SmppCommandStatus property

The command status from SUBMIT_SM_RESP or QUERY_SM_RESP. If the server rejects the message, this contains the status code. It is always one of these constants.

Example:

$objSmpp = New-Object -ComObject AxSms.Smpp
$objMessage = New-Object -ComObject AxSms.Message
...
$objSmpp.SubmitSms($objMessage)
While ($objSmpp.WaitForSmsUpdate) {
    $objMessage = $objSmpp.FetchSmsUpdate
    If (($objSmpp.LastError -eq 0) -and ($objMessage.SmppCommandStatus -eq 0)) {
        Write-Host "Reference: $($objMessage.Reference); UserTag: $($objMessage.UserTag)"
    } ElseIf ($objMessage.SmppCommandStatus -ne 0) {
        Write-Host "Status: $($objMessage.SmppCommandStatus)"
    }
    Start-Sleep -Milliseconds 1
}
var objSmpp = new AxSms.Smpp();
var objMessage = new AxSms.Message();
...
objSmpp.SubmitSms(objMessage);
while (objSmpp.WaitForSmsUpdate)
{
    objMessage = objSmpp.FetchSmsUpdate;
    if (objSmpp.LastError == 0 && objMessage.SmppCommandStatus == 0)
    {
        Console.WriteLine("Reference: " + objMessage.Reference + 
            "; UserTag: " + objMessage.UserTag);
    }
    else if (objMessage.SmppCommandStatus != 0)
    {
        Console.WriteLine("Status: " + objMessage.SmppCommandStatus);
    }
    System.Threading.Thread.Sleep(1);
}
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
    ElseIf objMessage.SmppCommandStatus <> 0 Then
        WScript.Echo "Status: " & objMessage.SmppCommandStatus
    End If
    WScript.Sleep 1
WEnd

SmppSequenceNumber property

The sequence number associated with the message. This is only set on messages received from FetchSmsUpdate.

Example:

$objSmpp = New-Object -ComObject AxSms.Smpp
$objMessage = New-Object -ComObject AxSms.Message
...
$objSmpp.SubmitSms($objMessage)
While ($objSmpp.WaitForSmsUpdate) {
    $objMessage = $objSmpp.FetchSmsUpdate
    If (($objSmpp.LastError -eq 0) -and ($objMessage.SmppCommandStatus -eq 0)) {
        Write-Host "Sequence number: $($objMessage.SmppSequenceNumber)"
    } ElseIf ($objMessage.SmppCommandStatus -ne 0) {
        Write-Host "Status: $($objMessage.SmppCommandStatus)"
    }
    Start-Sleep -Milliseconds 1
}
var objSmpp = new AxSms.Smpp();
var objMessage = new AxSms.Message();
...
objSmpp.SubmitSms(objMessage);
while (objSmpp.WaitForSmsUpdate)
{
    objMessage = objSmpp.FetchSmsUpdate;
    if (objSmpp.LastError == 0 && objMessage.SmppCommandStatus == 0)
    {
        Console.WriteLine("Sequence number: " + objMessage.SmppSequenceNumber);
    }
    else if (objMessage.SmppCommandStatus != 0)
    {
        Console.WriteLine("Status: " + objMessage.SmppCommandStatus);
    }
    System.Threading.Thread.Sleep(1);
}
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
    ElseIf objMessage.SmppCommandStatus <> 0 Then
        WScript.Echo "Status: " & objMessage.SmppCommandStatus
    End If
    WScript.Sleep 1
WEnd

SmppServerSubmitDate property

The submit timestamp of the SMS message. The component sets this automatically when a submit is received.

This timestamp is used when the component automatically creates a delivery report with DeliverReport.

Example:

$objSmppSession = $objSmppServer.GetFirstSession
While ($objSmppServer.LastError -eq 0) {
    ...
    $objMessage = $objSmppSession.ReceiveSubmitSms
    While ($objSmppSession.LastError -eq 0) {
        Write-Host ("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 -ne 0) {
            Write-Host ("Error while responding: " + `
                $objSmppSession.GetErrorDescription($objSmppSession.LastError))
            exit 1
        }

        # Send a successful delivery report for the incoming message
        $objMessage.SmppStatus = $objConstants.SMPP_MESSAGESTATE_DELIVERED
        $objSmppSession.DeliverReport($objMessage)
        If ($objSmppSession.LastError -ne 0) {
            Write-Host ("Error while sending delivery report: " + `
                $objSmppSession.GetErrorDescription($objSmppSession.LastError))
            exit 1
        }

        $objMessage = $objSmppSession.ReceiveSubmitSms
    }
    ...
    $objSmppSession = $objSmppServer.GetNextSession
}
var objSmppSession = objSmppServer.GetFirstSession;
while (objSmppServer.LastError == 0)
{
    ...
    var objMessage = objSmppSession.ReceiveSubmitSms;
    while (objSmppSession.LastError == 0)
    {
        Console.WriteLine("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)
        {
            Console.WriteLine("Error while responding: " +
                objSmppSession.GetErrorDescription(objSmppSession.LastError));
            return 1;
        }

        // Send a successful delivery report for the incoming message
        objMessage.SmppStatus = objConstants.SMPP_MESSAGESTATE_DELIVERED;
        objSmppSession.DeliverReport(objMessage);
        if (objSmppSession.LastError != 0)
        {
            Console.WriteLine("Error while sending delivery report: " +
                objSmppSession.GetErrorDescription(objSmppSession.LastError));
            return 1;
        }

        objMessage = objSmppSession.ReceiveSubmitSms;
    }
    ...
    objSmppSession = objSmppServer.GetNextSession;
}
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 timestamp of the final status (delivery or failure) of the message.

The component sets this to the current time when it automatically creates a delivery report with DeliverReport.

Example:

$objSmppSession = $objSmppServer.GetFirstSession
While ($objSmppServer.LastError -eq 0) {
    ...
    $objMessage = $objSmppSession.ReceiveSubmitSms
    While ($objSmppSession.LastError -eq 0) {
        Write-Host ("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 -ne 0) {
            Write-Host ("Error while responding: " + `
                $objSmppSession.GetErrorDescription($objSmppSession.LastError))
            exit 1
        }

        # Send a successful delivery report for the incoming message
        $objMessage.SmppStatus = $objConstants.SMPP_MESSAGESTATE_DELIVERED
        $objSmppSession.DeliverReport($objMessage)
        If ($objSmppSession.LastError -ne 0) {
            Write-Host ("Error while sending delivery report: " + `
                $objSmppSession.GetErrorDescription($objSmppSession.LastError))
            exit 1
        }

        $objMessage = $objSmppSession.ReceiveSubmitSms
    }
    ...
    $objSmppSession = $objSmppServer.GetNextSession
}
var objSmppSession = objSmppServer.GetFirstSession;
while (objSmppServer.LastError == 0)
{
    ...
    var objMessage = objSmppSession.ReceiveSubmitSms;
    while (objSmppSession.LastError == 0)
    {
        Console.WriteLine("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)
        {
            Console.WriteLine("Error while responding: " +
                objSmppSession.GetErrorDescription(objSmppSession.LastError));
            return 1;
        }

        // Send a successful delivery report for the incoming message
        objMessage.SmppStatus = objConstants.SMPP_MESSAGESTATE_DELIVERED;
        objSmppSession.DeliverReport(objMessage);
        if (objSmppSession.LastError != 0)
        {
            Console.WriteLine("Error while sending delivery report: " +
                objSmppSession.GetErrorDescription(objSmppSession.LastError));
            return 1;
        }

        objMessage = objSmppSession.ReceiveSubmitSms;
    }
    ...
    objSmppSession = objSmppServer.GetNextSession;
}
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:

$objMessage = New-Object -ComObject AxSms.Message
...
$objMessage.Clear()
$objMessage.ToAddress = "+31122334455"
$objMessage.Body = "Short SMS message"
...
var objMessage = new AxSms.Message();
...
objMessage.Clear();
objMessage.ToAddress = "+31122334455";
objMessage.Body = "Short SMS message";
...
Set objMessage = CreateObject("AxSms.Message")
...
objMessage.Clear
objMessage.ToAddress = "+31122334455"
objMessage.Body = "Short SMS message"
...

GetErrorDescription method

Returns a readable description for a given error code.

Parameters:

  • Error code

Return value:

The error description string.

Example:

$objMessage = New-Object -ComObject AxSms.Message
...
$objTlv = $objMessage.SmppGetFirstTlv()
While ($objMessage.LastError -eq 0) {
    Write-Host "Tag: $($objTlv.Tag); Value: $($objTlv.ValueAsHexString)"
    $objTlv = $objMessage.SmppGetNextTlv()
}
...
Write-Host $objMessage.GetErrorDescription($objMessage.LastError)
var objMessage = new AxSms.Message();
...
var objTlv = objMessage.SmppGetFirstTlv();
while (objMessage.LastError == 0)
{
    Console.WriteLine("Tag: " + objTlv.Tag + "; Value: " + objTlv.ValueAsHexString);
    objTlv = objMessage.SmppGetNextTlv();
}
...
Console.WriteLine(objMessage.GetErrorDescription(objMessage.LastError));
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
...
WScript.Echo objMessage.GetErrorDescription(objMessage.LastError)

ToJSon method

Serializes the message to a JSON string. Restore it later with FromJSon.

Parameters:

  • none

Return value:

JSON formatted string of this message.

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objOtherMessage = New-Object -ComObject AxSms.Message
...
$sJSonDump = $objMessage.ToJSon()
Write-Host $sJSonDump
$objOtherMessage.FromJSon($sJSonDump)
...
var objMessage = new AxSms.Message();
var objOtherMessage = new AxSms.Message();
...
string sJSonDump = objMessage.ToJSon();
Console.WriteLine(sJSonDump);
objOtherMessage.FromJSon(sJSonDump);
...
Set objMessage = CreateObject("AxSms.Message")
Set objOtherMessage = CreateObject("AxSms.Message")
...
sJSonDump = objMessage.ToJSon()
WScript.Echo sJSonDump
objOtherMessage.FromJSon(sJSonDump)
...

FromJSon method

Deserializes a JSON string into this message object. Create the JSON with ToJSon.

Parameters:

  • JSON formatted string

Return value:

None

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objOtherMessage = New-Object -ComObject AxSms.Message
...
$sJSonDump = $objMessage.ToJSon()
Write-Host $sJSonDump
$objOtherMessage.FromJSon($sJSonDump)
...
var objMessage = new AxSms.Message();
var objOtherMessage = new AxSms.Message();
...
string sJSonDump = objMessage.ToJSon();
Console.WriteLine(sJSonDump);
objOtherMessage.FromJSon(sJSonDump);
...
Set objMessage = CreateObject("AxSms.Message")
Set objOtherMessage = CreateObject("AxSms.Message")
...
sJSonDump = objMessage.ToJSon()
WScript.Echo sJSonDump
objOtherMessage.FromJSon(sJSonDump)
...

SmppAddTlv method

Adds a TLV (Tag, Length, Value) object to this message.

Parameters:

Return value:

None

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objTlv = New-Object -ComObject AxSms.Tlv
...
$objTlv.Tag = 100
$objTlv.ValueAsString = "Hello"
$objMessage.SmppAddTlv($objTlv)
...
var objMessage = new AxSms.Message();
var objTlv = new AxSms.Tlv();
...
objTlv.Tag = 100;
objTlv.ValueAsString = "Hello";
objMessage.SmppAddTlv(objTlv);
...
Set objMessage = CreateObject("AxSms.Message")
Set objTlv = CreateObject("AxSms.Tlv")
...
objTlv.Tag = 100
objTlv.ValueAsString = "Hello"
objMessage.SmppAddTlv objTlv
...

SmppGetTlv method

Returns the TLV object that matches the given tag. See common TLV tags.

Parameters:

  • Tag value

Return value:

Tlv object

Example:

$objMessage = New-Object -ComObject AxSms.Message
...
$objTlv = $objMessage.SmppGetTlv(100)
Write-Host $objTlv.ValueAsHexString
...
var objMessage = new AxSms.Message();
...
var objTlv = objMessage.SmppGetTlv(100);
Console.WriteLine(objTlv.ValueAsHexString);
...
Set objMessage = CreateObject("AxSms.Message")
...
Set objTlv = objMessage.SmppGetTlv(100)
WScript.Echo objTlv.ValueAsHexString
...

SmppGetFirstTlv method

Returns the first TLV attached to this message.

Parameters:

  • None

Return value:

Tlv object

Example:

$objMessage = New-Object -ComObject AxSms.Message
...
$objTlv = $objMessage.SmppGetFirstTlv()
While ($objMessage.LastError -eq 0) {
    Write-Host "Tag: $($objTlv.Tag); Value: $($objTlv.ValueAsHexString)"
    $objTlv = $objMessage.SmppGetNextTlv()
}
var objMessage = new AxSms.Message();
...
var objTlv = objMessage.SmppGetFirstTlv();
while (objMessage.LastError == 0)
{
    Console.WriteLine("Tag: " + objTlv.Tag + "; Value: " + objTlv.ValueAsHexString);
    objTlv = objMessage.SmppGetNextTlv();
}
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

Returns the next TLV attached to this message.

Parameters:

  • None

Return value:

Tlv object

Example:

$objMessage = New-Object -ComObject AxSms.Message
...
$objTlv = $objMessage.SmppGetFirstTlv()
While ($objMessage.LastError -eq 0) {
    Write-Host "Tag: $($objTlv.Tag); Value: $($objTlv.ValueAsHexString)"
    $objTlv = $objMessage.SmppGetNextTlv()
}
var objMessage = new AxSms.Message();
...
var objTlv = objMessage.SmppGetFirstTlv();
while (objMessage.LastError == 0)
{
    Console.WriteLine("Tag: " + objTlv.Tag + "; Value: " + objTlv.ValueAsHexString);
    objTlv = objMessage.SmppGetNextTlv();
}
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

Removes a TLV (Tag, Length, Value) object from this message.

Parameters:

  • Tag value

Return value:

None

Example:

$objMessage = New-Object -ComObject AxSms.Message
$objTlv = New-Object -ComObject AxSms.Tlv
...
$objTlv.Tag = 100
$objTlv.ValueAsString = "Hello"
$objMessage.SmppAddTlv($objTlv)
...
$objMessage.SmppDeleteTlv(100)
...
var objMessage = new AxSms.Message();
var objTlv = new AxSms.Tlv();
...
objTlv.Tag = 100;
objTlv.ValueAsString = "Hello";
objMessage.SmppAddTlv(objTlv);
...
objMessage.SmppDeleteTlv(100);
...
Set objMessage = CreateObject("AxSms.Message")
Set objTlv = CreateObject("AxSms.Tlv")
...
objTlv.Tag = 100
objTlv.ValueAsString = "Hello"
objMessage.SmppAddTlv objTlv
...
objMessage.SmppDeleteTlv 100
...