How can we help?

AxMmServer.SmsMessage


In C#, VB.Net, C++ and other compiled languages the namespace for most classes is AXMMCFGLib instead of AxMmServer. For interpreted languages like VBScript, JavaScript or Powershell it is AxMmServer.

This is an SMS message. This message is send or received by GSM, SMPP, SMPP Server and HTTP channels.

This message inherits all the properties of the Message object as well.

Property Type Read/Write Description
ToAddress String Read/Write To address or SMS recipient
ToAddressTon Number Read/Write To address TON (Type of Number)
ToAddressNpi Number Read/Write To address NPI (Number Plan Indicator)
FromAddress String Read/Write From address or SMS originator
FromAddressTon Number Read/Write From address TON (Type of Number)
FromAddressNpi Number Read/Write From address NPI (Number Plan Indicator)
Body String Read/Write The body of the SMS message
Reference String Read/Write The provider specific message reference
RequestDeliveryReport Boolean Read/Write Whether to request a delivery report
IsDeliveryReport Boolean Read/Write Whether this SMS is a delivery report
DeliveryStatus String Read/Write Delivery status of an SMS
ValidityPeriod Number Read/Write Validity period in minutes
DataCoding Number Read/Write The encoding of the message
BodyFormat Number Read/Write The format of the SMS body.
HasUdh Boolean Read/Write True if this SMS has a User Data Header (UDH)
TotalParts Number Read/Write Total number of parts of this SMS
PartNumber Number Read/Write Part number of this SMS
MultipartReference Number Read/Write Multipart Reference
LanguageLockingShift Number Read/Write Language Locking Shift
LanguageSingleShift Number Read/Write Language Single Shift
GsmSmscAddress Number Read/Write GSM SMSC address
GsmSmscAddressTon Number Read/Write GSM TON of SMSC address
GsmSmscAddressNpi Number Read/Write GSM NPI of SMSC address
SmppPriority Number Read/Write SMPP Priority
SmppServiceType String Read/Write SMPP Service type
SmppTlvs Number Read/Write SMPP TLV values
SmppStatusCode Number Read/Write SMPP status code
SmppClient String Read/Write SMPP Client ID
SmppSequenceNumber Number Read/Write Sequence number of the SMS message

Method Description
GetTlv Returns a TLV object for a specific Tag value
AddTlv Add a TLV object to this message
DeleteTlv Delet a TLV object from this message
GetFirstTlv Get the first TLV attached to this message
GetNextTlv Get the next TLV attached to this message

ToAddress property

The ‘to address’ of the SMS message. This should be internationally formatted (e.g.: +31612345678).

ToAddressTon property

The recipient TON (Type of Number). Use one of these constants.

ToAddressNpi property

The recipient NPI (Number Plan Indicator). Use one of these constants.

FromAddress property

The ‘from address’ of the SMS message. This can either be an internationally formatted phone number or an alphanumeric sender ID (e.g. name of a company). Alphanumeric sender ID’s only work with SMPP or HTTP providers.

FromAddressTon property

The originator TON (Type of Number). Use one of these constants.

FromAddressNpi property

The originator NPI (Number Plan Indicator). Use one of these constants.

Body property

The body of the SMS message. This is formatter according to the BodyFormat property.

Reference property

The provider specific message reference. The message reference is used by the provider to connect a message that was sent to a delivery report.

RequestDeliveryReport property

If this property is set a delivery report will be requested when sending this message. If the property is not set the channel default value for ‘RequestDeliveryReport’ will be used.

IsDeliveryReport property

In the SMS Server a delivery report is an SMS message that has this property set to ‘True’.

DeliveryStatus property

If this SMS is a delivery report this property contains the text status of the delivery report. The actual text is specific to the provider. Generally ‘DELIVERED’ or ‘DELIVRD’ will mean that the message is successfully delivered. Any other text will indicate a type of failure.

ValidityPeriod property

The number of minutes this message will remain ‘Valid’. The SMS provider will no longer attempt to deliver a message if the validity period has expired.

DataCoding property

Contains more information about the encoding of the message. Use one of these constants.

BodyFormat property

The format of the SMS body. Use of one these constants.

HasUdh property

True if this SMS has a User Data Header (UDH). Special SMS messages such as multipart SMS message and SMS messages directed to a specific application port will have a UDH. By default the SMS Server filter out the UDH data and interprets it. If the UDH data is not recognized as something the SMS Server can interpret it will be left intact and the message will be formatted as binary.

TotalParts property

The total number of parts this SMS (originally) had. By default, for SMPP channels the SMS Server will try to assemble multipart SMS messages automatically.

PartNumber property

If the SMS is a multipart SMS message that was not already assembled this property will contain the part number of this SMS.

MultipartReference property

All parts of a multipart message share the same multipart reference. A multipart reference normally is a short (8 or max 16 bit number) so the same multipart reference may occur multiple times. This value is only set if the SMS is (was originally) a multipart message.

LanguageLockingShift property

Controls which locking shift table should be used. This way you can use any of the extended GSM national language character sets from these contants.
This works if the datacoding of the SMS is set to 0 (default). On SMPP channels the default character set should be set any one of the GSM encodings.

LanguageSingleShift property

Controls which single shift table should be used. This way you can use any of the extended GSM national language character sets from these contants.
This works if the datacoding of the SMS is set to 0 (default). On SMPP channels the default character set should be set any one of the GSM encodings.

GsmSmscAddress property

This property is only applicable for use with GSM modems. Contains the SMSC address of the SMS that routed this incoming SMS.

GsmSmscAddressTon property

The Type of Number (TON) of the SMSC address. One of these constants.

GsmSmscAddressNpi property

The Number Plan Indicator (NPI) of the SMSC address. One of these constants.

SmppPriority property

The SMPP related priority of this SMS. 0 is non-priority (default), 1 is priority.

SmppServiceType property

The type of service this SMS is a part of. This is provider dependent. For example: Some SMPP provider also provide USSD services of SMPP where this field is set to ‘USSD’.

SmppTlvs property

The raw, binary encoded TLV values that where received or need to be sent with this message. Don’t use this property. Instead use the TLV methods in this class.

SmppStatusCode property

The SMPP status code field value. Should only be set on SMPP Server channels when acknowledging a message. Use one of these constants.

SmppClient property

This is not the SystemID, that’s in the BillingID property. This is an IP/port number combination of the SMPP client that sent this message.

SmppSequenceNumber property

This is used internally to correctly handle the SMPP protocol.

GetTlv method

Get a specific TLV from this message

Parameters:

Tlv Tag value

Return value:

Tlv object

Example:

Set objMessageDB = CreateObject( "AxMmServer.MessageDB" ) 
Set objConstants = CreateObject( "AxMmServer.Constants" ) 

Const SENDER_NAME = 12345

Set objMessage   = objMessageDB.FindFirstMessage( objConstants.MESSAGETYPE_SMS, "" )     ' Find first message
While objMessageDB.LastError = 0   
   ' Print billing information ..
   Set objTlv = objMessageDB.GetTLV(SENDER_NAME)
   Script.Echo "Message ID: " & objMessage.ID & " has Sender name: " & objTlv.ValueAsString
   Set objMessage = objMessageDB.FindNextMessage
Wend
 
objMessageDB.Close  

AddTlv method

Add a TLV to this message.

Parameters:

Tlv

Return value:

None

Example:

Const SENDER_NAME = 12345
  
Set objMessageDB = CreateObject( "AxMmServer.MessageDB" ) 
Set objConstants = CreateObject( "AxMmServer.Constants" ) 
 
Set objMessage   = objMessageDB.Create(objConstants.MESSAGETYPE_SMS)
WScript.Echo "Create, result: " & objMessageDB.LastError
If( objMessageDB.LastError <> 0 ) Then
  WScript.Quit
End If  
    
objMessage.DirectionID  = objConstants.MESSAGEDIRECTION_OUT
objMessage.StatusID     = objConstants.MESSAGESTATUS_PENDING                               
objMessage.ToAddress    = "+31000000000"
objMessage.Body         = "Test message"

Set objTlv = CreateObject( "AxMmServer.TLV" ) 
objTlv.Tag = SENDER_NAME
objTlv.ValueAsString = "John"
objMessage.AddTlv objTlv

objMessageDB.Save( objMessage )
WScript.Echo "Save, result " & objMessageDB.LastError

DeleteTlv method

Delete a TLV from this message.

Parameters:

Tag

Return value:

None

Example:

Set objMessageDB = CreateObject( "AxMmServer.MessageDB" ) 
Set objConstants = CreateObject( "AxMmServer.Constants" ) 

Set objMessage   = objMessageDB.Load(100)
WScript.Echo "Load, result: " & objMessageDB.LastError
If( objMessageDB.LastError <> 0 ) Then
  WScript.Quit
End If  
    
WScript.Echo "Message successfully Loaded, recordID: " & objMessage.ID

objMessage.DeleteTlv 1025

objMessageDB.Save( objMessage )
WScript.Echo "Save, result " & objMessageDB.LastError

GetFirstTlv method

Get the first TLV that was attached to this message.

Parameters:

None

Return value:

Tlv object

Example:

Set objMessageDB = CreateObject( "AxMmServer.MessageDB" ) 
Set objConstants = CreateObject( "AxMmServer.Constants" ) 

Set objMessage   = objMessageDB.FindFirstMessage( objConstants.MESSAGETYPE_SMS, "" )     ' Find first SMS message
While objMessageDB.LastError = 0         
   Set objTlv = objMessage.GetFirstTlv
   While objMessage.LastError = 0
     WScript.Echo "Message ID: " & objMessage.ID & " has TLV: " & objTlv.Tag & _
       " Value: " & objTlv.ValueAsHexString
     Set objTlv = objMessage.GetNextTlv
   Wend
   Set objMessage = objMessageDB.FindNextMessage
Wend

GetNextTlv method

Get the next TLV that was attached to this message.

Parameters:

None

Return value:

Tlv object

Example:

Set objMessageDB = CreateObject( "AxMmServer.MessageDB" )
Set objConstants = CreateObject( "AxMmServer.Constants" )

Set objMessage   = objMessageDB.FindFirstMessage( objConstants.MESSAGETYPE_SMS "" )     ' Find first message
While objMessageDB.LastError = 0
   Set objTlv = objMessage.GetFirstTlv
   While objMessage.LastError = 0
     WScript.Echo "Message ID: " & objMessage.ID & " has TLV: " & objTlv.Tag & _
       " Value: " & objTlv.ValueAsHexString
     Set objTlv = objMessage.GetNextTlv
   Wend
   Set objMessage = objMessageDB.FindNextMessage
Wend

objMessageDB.Close