Download ActiveXperts SMS and MMS Toolkit 5.1  (6826 KB - .exe file)
Download Manual  (623 KB - .htm file)
Multipart SMS messaging
By design, SMS is developed to send up to 140 bytes of user data. All user data is send in the 'User Data' part of the SMS packet.
Because SMS text messages are encoded using 7-bit characters you can send up to 160 characters in a single SMS message.
When sending Unicode text, you can only send 70 characters per single SMS message.
It is however possible to split up text and data messages and send them using multiple SMS messages.
The receiving party will be able to combine the messages to the original message. This is called Segmentation and Reassembly (SAR).
When sending multipart SMS messages you will be charged for every single SMS message sent.
Sending Multipart Messages through a GSM phone or modem
To send enhanced content, a so called user data header (UDH) is added add the beginning of the user data block of the SMS.
When using an UDH, there is less data left for user data in the User Data field (140 - length of UDH).
An UDH can be used to send multipart messages, smart messaging (ringtones, WAP push, pictures etc), voicemail indications and other services.
In this article we will only discuss the use of UDH to send multipart text messages.
The UDH for message concatenation will only take 5 bytes, so there are 135 bytes left for the user data.
When sending concatenated text messages, you can send 153 characters when using 7-bit text, when using Unicode 67 characters per part.
| Byte |
Value |
Description |
01 |
00 |
Information Element Identifier: Concatenated short message, 8bit reference number |
02 |
03 |
Information Element Data Length (always 03 for this UDH) |
03 |
A4 |
Information Element Data: Concatenated short message reference, should be same for all parts of a message |
04 |
03 |
Information Element Data: Total number of parts |
05 |
01 |
Information Element Data: Number of this part (1/3) |
Example of a multipart message consisting of 3 parts containing 300 bytes:
SMS 1 User Data: 00 03 A4 03 01 [ 135 bytes of message data ]
SMS 2 User Data: 00 03 A4 03 02 [ 135 bytes of message data ]
SMS 3 User Data: 00 03 A4 03 03 [ 30 bytes of message data ]
The UDH present flag in the SMS header has to be set when an UDH block is used.
When using the SMS and MMS Toolkit, the user data header is added automatically when the data is too long
and the 'MessageType' property is set to 'asMESSAGEFORMAT_TEXT_MULTIPART', 'asMESSAGEFORMAT_DATA', 'asMESSAGEFORMAT_DATA_UDH' or 'asMESSAGEFORMAT_UNICODE_MULTIPART'.
When receiving SMS messages using the SMS and MMS Toolkit, messages are also reassembled to a single part automatically. The UDH data is stripped.
The following sample shows how to send a multipart messages in just a few lines of code:
Option Explicit
Dim objSmsProtocol
Dim objSmsMessage
Dim objConstants
Dim strReference
Set objSmsMessage = CreateObject ( "ActiveXperts.SmsMessage" )
Set objSmsProtocol = CreateObject ( "ActiveXperts.SmsProtocolGsm" )
Set objConstants = CreateObject ( "ActiveXperts.SmsConstants" )
Wscript.Echo "ActiveXperts SMS and MMS Toolkit " & objSmsProtocol.Version & " demo."
Wscript.Echo "Expiration date: " & objSmsProtocol.ExpirationDate & vbCrLf
' Set Logfile
objSmsProtocol.LogFile = "c:\SmsLog.txt"
' Set the device the GSM modem is connected to
objSmsProtocol.Device = "COM1"
' Set the long messagetext
objSmsMessage.Data = "Internet Explorer Enhanced Security Configuration is an option that is provided in Windows Server 2003 operating systems." &_
+ "You can use it to quickly enhance Internet Explorer security settings for all users."
' Set Messagetype to multipart
objSmsMessage.Format = objConstants.asMESSAGEFORMAT_TEXT_MULTIPART
' Set the recipient
objSmsMessage.Recipient = "+31647134225"
' Send the message
strReference = objSmsProtocol.Send ( objSmsMessage )
' Show the result
If( objSmsProtocol.LastError <> 0 ) Then
WScript.Echo "Failed to send message, error: " & objSmsProtocol.LastError & " (" &_
& objSmsProtocol.GetErrorDescription( objSmsProtocol.LastError ) & ")"
WScript.Echo "To view the trace file, open " & objSmsProtocol.LogFile & "."
Else
WScript.Echo "Message successfully submitted ( MessageReference = " & strReference & " )"
End If
Sending Multipart Messages through a SMPP Server
To send a multipart message through a SMPP server, you have to add the same UDH as in the previous chapter.
Some providers allows you to send multipart messages without the need to encode this header.
This is done using the so called TLV paramaters which are extra options which can be used from version 3.4 of the SMPP protocol.
sar_msg_ref_num, sar_gegment_seqnum and sar_total_segments
These parameters are sent together with the submit_sm packet. You have to set this values, but you do not have to add the UDH to the
messagedata field. You only have to split the message into parts and reserve 5 bytes per messagedata field, because the SMPP provider will
add the UDH header for you.
| 0x020C |
sar_msg_ref_num |
Unique reference ID for this multipart message ( 0x0000-0xFFFF ) |
0x020F |
sar_gegment_seqnum |
Part number of this message |
0x020E |
sar_total_segments |
Total number of parts used for this message |
The following code demonstrates how to use these TLV's with the SMS and MMS Toolkit:
Option Explicit
Dim objSmpp
Dim objMessage
Dim objConstants
Set objSmpp = CreateObject ( "ActiveXperts.SmsProtocolSmpp" )
Set objConstants = CreateObject ( "ActiveXperts.SmsConstants" )
Set objMessage = CreateObject ( "ActiveXperts.SmsMessage" )
objSmpp.Server = "192.168.31.98"
objSmpp.ServerPort = 2775
objSmpp.SystemVersion = objConstants.asSMPPVERSION_34 ' Required, you need version 3.4 or higher
objSmpp.Connect
If ( objSmpp.LastError <> 0 ) Then
WScript.Echo "Connect ERROR# " & objSmpp.LastError & " (" & objSmpp.GetErrorDescription ( objSmpp.LastError ) & ")"
WScript.Quit
End If
objMessage.Recipient = "+3161234578"
objMessage.Format = objConstants.asMESSAGEFORMAT_TEXT
objMessage.Data = "This is part 1 of 2 "
objSmpp.SetTLVValue objConstants.asSMPP_TLV_2BYTE, &H020C, 123 ' Multipart ref
objSmpp.SetTLVValue objConstants.asSMPP_TLV_1BYTE, &H020F, 1 ' Part 1
objSmpp.SetTLVValue objConstants.asSMPP_TLV_1BYTE, &H020E, 2 ' Of 2
objSmpp.Send ( objSmsMessage )
objSmpp.MessageData = "This is part 2 of 2 "
objSmpp.SetTLVValue objConstants.asSMPP_TLV_2BYTE, &H020C, 123 ' Multipart ref
objSmpp.SetTLVValue objConstants.asSMPP_TLV_1BYTE, &H020F, 2 ' Part 2
objSmpp.SetTLVValue objConstants.asSMPP_TLV_1BYTE, &H020E, 2 ' Of 2
objSmpp.Send ( objSmsMessage )
objSmpp.Disconnect
message_payload
When the message_payload TLV is supported, just leave the message_data field blank, and copy the whole message data (up to 65536 bytes) to this
field. All segmentation is handled by the network.
Option Explicit
Dim objSmpp
Dim objMessage
Dim objConstants
Set objSmpp = CreateObject ( "ActiveXperts.SmsProtocolSmpp" )
Set objConstants = CreateObject ( "ActiveXperts.SmsConstants" )
Set objMessage = CreateObject ( "ActiveXperts.SmsMessage" )
objSmpp.Server = "192.168.31.98"
objSmpp.ServerPort = 2775
objSmpp.SystemVersion = objConstants.asSMPPVERSION_34 ' Required, you need version 3.4 or higher
objSmpp.Connect
If ( objSmpp.LastError <> 0 ) Then
WScript.Echo "Connect ERROR# " & objSmpp.LastError & " (" & objSmpp.GetErrorDescription ( objSmpp.LastError ) & ")"
WScript.Quit
End If
objMessage.Clear ()
objMessage.Recipient = "+3161234578"
objMessage.Data = ""
objMessage.Format = objConstants.asMESSAGEFORMAT_TEXT
objSmpp.SetTLVValue objConstants.asSMPP_TLV_OCTET, &H0424, "<Your long text message goes here>" ' message_payload TLV
objSmpp.Send ( objMessage )
objSmpp.Disconnect
There are many working samples included with the product.
You can also find them on the ActiveXperts FTP site: ftp.activexperts-labs.com/samples/xmstoolkit.
The ActiveXperts SMS and MMS Toolkit is a SMS development component (SDK). This control can be used by any Windows development platform,
including Visual Basic .NET, Visual CSharp .NET,
ASP .NET (VB,CS),
ASP,
Visual Basic,
Visual Basic for Applications (VBA),
Visual Studio/Visual C++,
Borland Delphi and
C++ Builder,
PHP,
ColdFusion,
HTML,
VBScript and any other ActiveX/COM compliant platform. The SMS and MMS Toolkit is an ActiveXperts Software B.V. Product.
|