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 sent 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 | Delete 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 IDs 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 formatted according to the BodyFormat property.
Reference property
The provider specific message reference. The message reference is used by the provider to connect a sent message 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
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 one of these constants.
HasUdh property
True if this SMS has a User Data Header (UDH). Special SMS messages such as multipart SMS messages and SMS messages directed to a specific application port will have a UDH. By default Auron Omni filters out the UDH data and interprets it. If the UDH data is not recognized as something Omni can interpret, it is 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 Omni 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 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 constants.
This works if the datacoding of the SMS is set to 0 (default). On SMPP channels the default character set should be set to 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 constants.
This works if the datacoding of the SMS is set to 0 (default). On SMPP channels the default character set should be set to any one of the GSM encodings.
GsmSmscAddress property
This property is only applicable for use with GSM modems. It contains the SMSC address of the SMS that routed this incoming SMS.
GsmSmscAddressTon property
The Type of Number (TON) of the SMSC address. Use one of these constants.
GsmSmscAddressNpi property
The Number Plan Indicator (NPI) of the SMSC address. Use 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 providers also provide USSD services over SMPP where this field is set to ‘USSD’.
SmppTlvs property
The raw, binary encoded TLV values that were received or need to be sent with this message. Do not 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 is 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
Gets 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 = objMessage.GetTlv(SENDER_NAME)
WScript.Echo "Message ID: " & objMessage.ID & " has Sender name: " & objTlv.ValueAsString
Set objMessage = objMessageDB.FindNextMessage
Wend
objMessageDB.Close
var objMessageDB = new ActiveXObject("AxMmServer.MessageDB");
var objConstants = new ActiveXObject("AxMmServer.Constants");
const SENDER_NAME = 12345;
var objMessage = objMessageDB.FindFirstMessage(objConstants.MESSAGETYPE_SMS, "");
while (objMessageDB.LastError === 0) {
var objTlv = objMessage.GetTlv(SENDER_NAME);
WScript.Echo("Message ID: " + objMessage.ID + " has Sender name: " + objTlv.ValueAsString);
objMessage = objMessageDB.FindNextMessage();
}
objMessageDB.Close();
AddTlv method
Adds a TLV to this message.
Parameters:
Tlv object
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
const SENDER_NAME = 12345;
var objMessageDB = new ActiveXObject("AxMmServer.MessageDB");
var objConstants = new ActiveXObject("AxMmServer.Constants");
var objMessage = objMessageDB.Create(objConstants.MESSAGETYPE_SMS);
WScript.Echo("Create, result: " + objMessageDB.LastError);
if (objMessageDB.LastError !== 0) {
WScript.Quit();
}
objMessage.DirectionID = objConstants.MESSAGEDIRECTION_OUT;
objMessage.StatusID = objConstants.MESSAGESTATUS_PENDING;
objMessage.ToAddress = "+31000000000";
objMessage.Body = "Test message";
var objTlv = new ActiveXObject("AxMmServer.TLV");
objTlv.Tag = SENDER_NAME;
objTlv.ValueAsString = "John";
objMessage.AddTlv(objTlv);
objMessageDB.Save(objMessage);
WScript.Echo("Save, result " + objMessageDB.LastError);
DeleteTlv method
Deletes 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
var objMessageDB = new ActiveXObject("AxMmServer.MessageDB");
var objConstants = new ActiveXObject("AxMmServer.Constants");
var objMessage = objMessageDB.Load(100);
WScript.Echo("Load, result: " + objMessageDB.LastError);
if (objMessageDB.LastError !== 0) {
WScript.Quit();
}
WScript.Echo("Message successfully Loaded, recordID: " + objMessage.ID);
objMessage.DeleteTlv(1025);
objMessageDB.Save(objMessage);
WScript.Echo("Save, result " + objMessageDB.LastError);
GetFirstTlv method
Gets 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
var objMessageDB = new ActiveXObject("AxMmServer.MessageDB");
var objConstants = new ActiveXObject("AxMmServer.Constants");
var objMessage = objMessageDB.FindFirstMessage(objConstants.MESSAGETYPE_SMS, "");
while (objMessageDB.LastError === 0) {
var objTlv = objMessage.GetFirstTlv();
while (objMessage.LastError === 0) {
WScript.Echo("Message ID: " + objMessage.ID + " has TLV: " + objTlv.Tag +
" Value: " + objTlv.ValueAsHexString);
objTlv = objMessage.GetNextTlv();
}
objMessage = objMessageDB.FindNextMessage();
}
GetNextTlv method
Gets 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
var objMessageDB = new ActiveXObject("AxMmServer.MessageDB");
var objConstants = new ActiveXObject("AxMmServer.Constants");
var objMessage = objMessageDB.FindFirstMessage(objConstants.MESSAGETYPE_SMS, "");
while (objMessageDB.LastError === 0) {
var objTlv = objMessage.GetFirstTlv();
while (objMessage.LastError === 0) {
WScript.Echo("Message ID: " + objMessage.ID + " has TLV: " + objTlv.Tag +
" Value: " + objTlv.ValueAsHexString);
objTlv = objMessage.GetNextTlv();
}
objMessage = objMessageDB.FindNextMessage();
}
objMessageDB.Close();