AxSms.SmppSession
Introduction
Skip to properties and methods
The SmppSession object represents an SMPP client in the SmppServer object. The client can be either Connected, Binding, Bound or Disconnected. The only way to obtain a valid, ‘Connected’, SmppSession object is through the SmppServer object.
Use SmppSession instances to send SMS messages to and receive SMS messages from SMPP clients that are connected to your SMPP server.
To connect to an existing SMPP server use the Smpp object.
Properties and Methods
Property | Type | Read/Write | Description |
LastError | Number | Read | Result of the last called method |
LogFile | String | Read/Write | The path to a logfile which can be used for troubleshooting |
LogPduDetails | Boolean | Read/Write | Enable detailed PDU logging |
LogLevel | Integer | Read/Write | Set how much information will be logged |
Id | Number | Read | The ID for this session |
Ip | String | Read | The IP address of the remote client |
Port | Number | Read | The port number of the remote client |
Version | Number | Read | The SMPP client version of the remote client |
SystemId | String | Read | The system id of the remote client |
Password | String | Read | The password of the remote client |
SystemType | String | Read | The system type of the remote client |
AddressRange | String | Read | The address range of the remote client |
AddressRangeNpi | Number | Read | The address range NPI of the remote client |
AddressRangeTon | Number | Read | The address range TON for the remote client |
ConnectionState | Number | Read | The connection state for this session |
IsConnected | Boolean | Read | Whether the SMPP session is connected |
IsBound | Boolean | Read | Whether the SMPP session is bound |
RequestedBind | Number | Read | The bind type this client requested |
PduTimeout | Number | Read/Write | Number of milliseconds before an outstanding PDU will timeout |
EnquireInterval | Number | Read/Write | Number of milliseconds between ‘Enquire’ commands |
MultipartTimeout | Number | Read/Write | Number of seconds before an incomplete multipart message is returned |
UseGsmEncoding | Number | Read/Write | User GSM encoding for text messages |
MultipartMode | Number | Read/Write | Specify how multipart messages should be sent |
ExtractApplicationPort | Boolean | Read/Write | Whether the application port is extracted from the message |
ExtractLanguageShift | Boolean | Read/Write | Whether language shift should be applied |
DeliverMode | Number | Read/Write | Specify how SMS messages should be submitted to the client |
SmsSentPerSecond | Number | Read | Number of SMS messages sent per second |
SmsReceivedPerSecond | Number | Read | Number of SMS messages received per second |
MaxSmsDeliveries | Number | Read/Write | Maximum length or the SMS deliver queue |
MaxSmsSubmission | Number | Read/Write | Maximum length of the SMS submit queue |
MaxSmsQueries | Number | Read/Write | Maximum length of the SMS query queue |
MaxOutPendingPdus | Number | Read/Write | Maximum number of outstanding PDU’s |
Method | Description |
GetErrorDescription | Get the description of the given error |
RespondToBind | Respond to a bind request |
GetFirstBindTlv | Get the first TLV object from the last bind request |
GetNextBindTlv | Get the next TLV object from the last bind request |
GetBindTlv | Get the a TLV object from the last bind request |
RespondToSubmitSms | Respond to an SMS submission |
ReceiveSubmitSms | Receive an SMS submission |
RespondToQuerySms | Respond to an SMS query |
ReceiveQuerySms | Receive an SMS Query request |
DeliverSms | Deliver an SMS message to the remote client |
DeliverReport | Deliver a delivery report to the remote client |
ReceiveDeliverResponse | Receive a response on an SMS delivery or delivery report |
Disconnect | Disconnect this session |
CountSmsSubmissions | Count the number of received SMS messages in the submission queue |
CountSmsQueries | Count the number of received SMS queries in the query queue |
CountSmsDeliverySpace | Count the space available in the delivery queue |
FetchNotResponded | Fetch message that was delivered but without response |
FetchNotDelivered | Fetch message that was submitted but not sent to the client |
GetFirstPart | Split up a multipart message, get the first part. |
GetNextPart | Split up a multipart message, get the next part. |
CountParts | Count the number of parts required for a message. |
AssembleSms | Assemble a multipart SMS from its parts. |
GetAssembledSms | Get the first available assembled SMS. |
LastError property
Completion code of the last called method. To find the error description of a given error code, go to the online error codes codes page.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31122334455"
objMessage.FromAddress = "+35544332211"
objMessage.Body = "Hello from the Auron Gateway !"
objMessage.UserTag = 1 ' To identify this message when the client responds
objSmppSession.DeliverSms objMessage
If objSmppSession.LastError <> 0 Then
WScript.Echo "Error while delivering: " & _
objSmppSession.GetErrorDescription(objSmppSession.LastError)
WScript.Quit 1
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
LogFile property
By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the SMS Component will write debug information to this file. Output data is written at the end of the file, the file is not cleared.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
LogPduDetails property
The SMPP protocol primitives are called ‘Protocol Data Units’ (PDU’s). Set this property to true to add a detailed description of every PDU that’s send or received including a HEX dump.
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
objSmppSession.LogPduDetails = True
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
LogLevel property
The log level determines how much information is logged to file when logging is enabled. Use one of these constants.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
objSmppSession.LogLevel = objConstants.SMPP_LOGLEVEL_VERBOSE
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
Id property
The ID for this session. When a new session is connect an ID is automatically assigned. This ID can be used to uniquely identify the session in the SmppServer object.
Id’s for sessions that have been disconnected will not be re-used until the session ID wraps around the size of an unsigned 32 bit integer (4.294.967.295).
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Session Id: " & objSmppSession.Id
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
Ip property
The IP address of the remote client.
This can either be an IPv4 or an IPv6 address. This depends on how the SMPP server was started.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
Port property
The port number of the remote client.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
Version property
The SMPP client version of the remote client. Should be on of these constants.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SMPP Version: " & objSmppSession.Version
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
SystemId property
The system id of the remote client.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
Password property
The password of the remote client.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
If objSmppSession.Password = "Secret" Then
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
Else
objSmppSession.RespondToBind objConstants.SMPP_ESME_RINVPASWD
End If
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
SystemType property
The system type of the remote client.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
AddressRange property
The address range of the remote client.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
AddressRangeNpi property
The addres range NPI (Numbering Plan Indicator) of the remote host.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
WScript.Echo "AddressRange NPI: " & objSmppSession.AddressRangeNpi
WScript.Echo "AddressRange TON: " & objSmppSession.AddressRangeTon
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
AddressRangeTon property
The address range TON (Type of Number) for the remote client.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
WScript.Echo "AddressRange NPI: " & objSmppSession.AddressRangeNpi
WScript.Echo "AddressRange TON: " & objSmppSession.AddressRangeTon
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
ConnectionState property
The connection state for this session. This is one of these constants.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
IsConnected property
This property reflects whether the SMPP session is connected to the SMPP client.
The property becomes false when the connection is interrupted or the Disconnect method is called.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If Not objSmppSession.IsConnected Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
IsBound property
This property reflects whether the SMPP session is bound to the SMPP client.
This property becomes false when the client unbinds, disconnects or when the connection is interrupted.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If Not objSmppSession.IsBound Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
RequestedBind property
If the client requested a bind, this property will contain the type of bind this client requested. This is one of these constants.
The value of this property is only meaningful when the ConnectionState property is set to SMPP_SESSIONSTATE_BINDING.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
PduTimeout property
Set this property to the number of milliseconds the remote client has to react to a given PDU before it times out. When a client fails to react to an outstanding PDU in a timely matter the connection will be closed.
Default is set to 5000 milliseconds
Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objConstants = CreateObject("AxSms.Constants")
...
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.PduTimeout = 10000
objSmppSession.EnquireInterval = 30000
objSmppSession.MultipartTimeout = 300000
objSmppSession.UseGsmEncoding = objConstants.SMPP_USEGSMENCODING_INANDOUT
objSmppSession.MultipartMode = objConstants.SMPP_MULTIPARTMODE_UDH
objSmppSession.DeliverMode = objConstants.SMPP_DELIVERMODE_DELIVERSM
objSmppSession.ExtractApplicationPort = True
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
WEnd
EnquireInterval property
Set this property to the number of milliseconds between enquire commands. An enquire command is send to the client at regular intervals to keep the connection alive.
Default is set to 30000 milliseconds
Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objConstants = CreateObject("AxSms.Constants")
...
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.PduTimeout = 10000
objSmppSession.EnquireInterval = 30000
objSmppSession.MultipartTimeout = 300000
objSmppSession.UseGsmEncoding = objConstants.SMPP_USEGSMENCODING_INANDOUT
objSmppSession.MultipartMode = objConstants.SMPP_MULTIPARTMODE_UDH
objSmppSession.DeliverMode = objConstants.SMPP_DELIVERMODE_DELIVERSM
objSmppSession.ExtractApplicationPort = True
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
WEnd
MultipartTimeout property
Set this property to the number of seconds that the session should wait for a multipart message to complete. If a multipart message is received but it could not be assembled from all of its parts within this time the message will be returned anyway.
Parts that are missing will be marked with the text ‘**Missing Part!**’. The ‘Incomplete’ property of the SMS Message will be set to true.
This property applies to the AssembleSms and GetAssembledSms
methods.
Default is set to 300 seconds.
Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objConstants = CreateObject("AxSms.Constants")
...
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.PduTimeout = 10000
objSmppSession.EnquireInterval = 30000
objSmppSession.MultipartTimeout = 300000
objSmppSession.UseGsmEncoding = objConstants.SMPP_USEGSMENCODING_INANDOUT
objSmppSession.MultipartMode = objConstants.SMPP_MULTIPARTMODE_UDH
objSmppSession.DeliverMode = objConstants.SMPP_DELIVERMODE_DELIVERSM
objSmppSession.ExtractApplicationPort = True
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
WEnd
UseGsmEncoding property
Set this property to indicate whether GSM encoding should be used for incoming or outgoing text messages. Use one of these constants.
This only applies when the
datacoding
property is set to
DATACODING_DEFAULT
.
By default this is set to SMPP_USEGSMENCODING_DISABLED
Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objConstants = CreateObject("AxSms.Constants")
...
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.PduTimeout = 10000
objSmppSession.EnquireInterval = 30000
objSmppSession.MultipartTimeout = 300000
objSmppSession.UseGsmEncoding = objConstants.SMPP_USEGSMENCODING_INANDOUT
objSmppSession.MultipartMode = objConstants.SMPP_MULTIPARTMODE_UDH
objSmppSession.DeliverMode = objConstants.SMPP_DELIVERMODE_DELIVERSM
objSmppSession.ExtractApplicationPort = True
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
WEnd
MultipartMode property
In combination with the Multipart flag this property specifies how multipart messages should be sent if they should be automatically formatted as multipart.
This property does not affect how multipart messages are received. Incoming multipart messages will be correctly recognized if they use 8bit or 16 bit UDH’s, SAR TLV’s or Payload TLV’s.
By default this property is set to SMPP_MULTIPARTMODE_UDH
Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objConstants = CreateObject("AxSms.Constants")
...
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.PduTimeout = 10000
objSmppSession.EnquireInterval = 30000
objSmppSession.MultipartTimeout = 300000
objSmppSession.UseGsmEncoding = objConstants.SMPP_USEGSMENCODING_INANDOUT
objSmppSession.MultipartMode = objConstants.SMPP_MULTIPARTMODE_UDH
objSmppSession.DeliverMode = objConstants.SMPP_DELIVERMODE_DELIVERSM
objSmppSession.ExtractApplicationPort = True
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
WEnd
ExtractApplicationPort property
This property will only affect incoming SMS messages that contain an application port specifier. An SMS can contain an application port if it is meant to target a specific application. For example a WAP Push message will always have destination port 2948 to target the WAP Push application specifically.
If this property is set to ‘True’ the SMS Component will interpret the application port by appending the source port to the ‘FromAddress’ property and the destination port to the ‘ToAddress’ property separated by a colon character (‘:’). The SMS Component will remove the application port header from the SMS.
If this property is set to ‘False’ the SMS Component will not interpret the application port and leave the application port header in place. The application ports will not be added to the ‘FromAddress’ and ‘ToAddress’ properties.
By default this property is set to true.
Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objConstants = CreateObject("AxSms.Constants")
...
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.PduTimeout = 10000
objSmppSession.EnquireInterval = 30000
objSmppSession.MultipartTimeout = 300000
objSmppSession.UseGsmEncoding = objConstants.SMPP_USEGSMENCODING_INANDOUT
objSmppSession.MultipartMode = objConstants.SMPP_MULTIPARTMODE_UDH
objSmppSession.DeliverMode = objConstants.SMPP_DELIVERMODE_DELIVERSM
objSmppSession.ExtractApplicationPort = True
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
WEnd
ExtractLanguageShift property
This property controls if the language shift tables should be applied. This only applies when receiving SMS messages that include a national language shift user data header (UDH).
With this property set to True the UDH is extracted and the appropriate national language tables are used automatically.
If this property is set to False the message the UDH is left in place and the message will be HEX formatted.
To send SMS messages using one of the language shift tables use the LanguageLockingShift and the LanguageSingleShift properties.
Make sure that the UseGsmEncoding property is set to either 7 bit or 8 bit on incoming messages for national language shift tables to work.
By default this property is set to true.
Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objConstants = CreateObject("AxSms.Constants")
...
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.PduTimeout = 10000
objSmppSession.EnquireInterval = 30000
objSmppSession.MultipartTimeout = 300000
objSmppSession.UseGsmEncoding = objConstants.SMPP_USEGSMENCODING_INANDOUT
objSmppSession.MultipartMode = objConstants.SMPP_MULTIPARTMODE_UDH
objSmppSession.DeliverMode = objConstants.SMPP_DELIVERMODE_DELIVERSM
objSmppSession.ExtractApplicationPort = True
objSmppSession.ExtractLanguageShift = True
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
WEnd
DeliverMode property
This property indicates how SMS messages should be submitted to the client.
If SMPP_DELIVERMODE_DATASM is selected the multipart mode should be set to SMPP_MULTIPARTMODE_PAYLOADTLV.
Incoming messages, whether ‘data_sm’ or ‘submit_sm’, will always be received, regardless of this setting.
By default this property is set to SMPP_DELIVERMODE_SUBMITSM
Example:
Set objSmpp = CreateObject("AxSms.Smpp")
Set objConstants = CreateObject("AxSms.Constants")
...
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.PduTimeout = 10000
objSmppSession.EnquireInterval = 30000
objSmppSession.MultipartTimeout = 300000
objSmppSession.UseGsmEncoding = objConstants.SMPP_USEGSMENCODING_INANDOUT
objSmppSession.MultipartMode = objConstants.SMPP_MULTIPARTMODE_UDH
objSmppSession.DeliverMode = objConstants.SMPP_DELIVERMODE_DELIVERSM
objSmppSession.ExtractApplicationPort = True
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
WEnd
SmsSentPerSecond property
The number of SMS messages sent per second. This includes messages that will be rejected by the client.
This is informative. It can be used for performance measurements.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
WScript.Echo "Sent: " & objSmppSession.SmsSentPerSecond
WScript.Echo "Received: " & objSmppSession.SmsReceivedPerSecond
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
SmsReceivedPerSecond property
The number of SMS messages received per second.
This is informative. It can be used for performance measurements.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
WScript.Echo "Sent: " & objSmppSession.SmsSentPerSecond
WScript.Echo "Received: " & objSmppSession.SmsReceivedPerSecond
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
MaxSmsDeliveries property
SMS Messages that are to be delivered by this session using the DeliverSms method are queued in the delivery queue and sent out of the earliest convenience through the SMPP session.
The number of message in the deliver queue will increase if the remote client is too busy to accept any new messages. This property sets the maximum number of SMS messages that can be kept in the delivery queue.
By default this is set to 100 messages.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
objSmppSession.MaxSmsDeliveries = 50
objSmppSession.MaxSmsSubmission = 100
objSmppSession.MaxSmsQueries = 100
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
MaxSmsSubmission property
Incoming SMS submissions are queued until they are read using ReceiveSubmitSms. This method sets the maximum size of the incoming SMS submission queue. If the queue is full new messages will be rejected using the ‘SMPP_ESME_RMSGQFUL’ status.
The default value is set to 15 messages
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
objSmppSession.MaxSmsDeliveries = 50
objSmppSession.MaxSmsSubmission = 100
objSmppSession.MaxSmsQueries = 100
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
MaxSmsQueries property
Incoming SMS queries are queued until they are read using ReceiveQuerySms. This method sets the maximum size of the incoming SMS queries queue. If the queue is full new queries will be rejected using the ‘SMPP_ESME_RMSGQFUL’ status.
The default value is set to 15 messages
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
objSmppSession.MaxSmsDeliveries = 50
objSmppSession.MaxSmsSubmission = 100
objSmppSession.MaxSmsQueries = 100
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
MaxOutPendingPdus property
This property sets the maximum number of PDU’s that can be pending for a reply from the client.
Default is set to 10 PDU’s
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
objSmppSession.MaxOutPendingPdus = 10
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
GetErrorDescription method
GetErrorDescription provides the error description of a given error code.
Parameters:
- The error code
Return value:
The error string.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31122334455"
objMessage.FromAddress = "+35544332211"
objMessage.Body = "Hello from the Auron Gateway !"
objMessage.UserTag = 1 ' To identify this message when the client responds
objSmppSession.DeliverSms objMessage
If objSmppSession.LastError <> 0 Then
WScript.Echo "Error while delivering: " & _
objSmppSession.GetErrorDescription(objSmppSession.LastError)
WScript.Quit 1
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
RespondToBind method
This method responds to an incoming bind request with the given SMPP status code. One of these constants can be used.
Use this method when the ConnectionState property is set to SMPP_SESSIONSTATE_BINDING.
If the response status is not ‘0’ then the connection to this client will automatically be dropped and the sessions connections state set to SMPP_SESSIONSTATE_DISCONNECTED.
Parameters:
- The status code
Return value:
Always 0
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
WScript.Echo "SystemId: " & objSmppSession.SystemId
WScript.Echo "AddressRange: " & objSmppSession.AddressRange
objSmppSession.LogFile = objSmppSession.SystemId & ".log"
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
GetFirstBindTlv method
Clients can use Tlv‘s to send optional parameters while binding to your server.
Use this method together with GetNextBindTlv to iterate over all TLV’s from the last bind request.
Parameters:
- None
Return value:
Tlv object
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState =
objConstants.SMPP_SESSIONSTATE_BINDING Then
' iterate over all bind TLV values
Set objTlv = objSmppSession.GetFirstBindTlv()
While objSmppSession.LastError = 0
...
Set objTlv = objSmppSession.GetNextBindTlv()
WEnd
...
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
GetNextBindTlv method
Clients can use Tlv‘s to send optional parameters while binding to your server.
Use this method together with GetFirstBindTlv to iterate over all TLV’s from the last bind request.
Parameters:
- None
Return value:
Tlv object
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState =
objConstants.SMPP_SESSIONSTATE_BINDING Then
' iterate over all bind TLV values
Set objTlv = objSmppSession.GetFirstBindTlv()
While objSmppSession.LastError = 0
...
Set objTlv = objSmppSession.GetNextBindTlv()
WEnd
...
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
GetBindTlv method
Clients can use Tlv‘s to send optional parameters while binding to your server.
Use this method to get a specific TLV object by tag number.
Parameters:
- None
Return value:
Tlv object
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
If objSmppSession.ConnectionState =
objConstants.SMPP_SESSIONSTATE_BINDING Then
' Get TLV with tag number 101
Set objTlv = objSmppSession.GetBindTlv(101)
If objSmppSession.LastError = 0 Then
' Found TLV object
...
EndIf
...
objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
End If
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
RespondToSubmitSms method
Respond to an SMS submission. Use ReceiveSubmitSms to receive SMS submissions and use this method to respond to the submissions with a status code.
Every received SMS message requires a response, either ‘0’ to confirm the SMS or one of these status codes to reject an SMS.
Parameters:
- Message object
Return value:
Always 0
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
Set objMessage = objSmppSession.ReceiveSubmitSms
While objSmppSession.LastError = 0
WScript.Echo "Receive SMS from: " & objSmppSession.SystemId & "; to: " & _
objMessage.ToAddress & "; suggested reference: " & objMessage.Reference
' Accept the incoming message with the suggested message reference
objSmppSession.RespondToSubmitSms objMessage
If objSmppSession.LastError <> 0 Then
WScript.Echo "Error while responding: " & _
objSmppSession.GetErrorDescription(objSmppSession.LastError)
WScript.Quit 1
End If
' Send a successful delivery report for the incoming message
objMessage.SmppStatus = objConstants.SMPP_MESSAGESTATE_DELIVERED
objSmppSession.DeliverReport objMessage
If objSmppSession.LastError <> 0 Then
WScript.Echo "Error while sending delivery report: " & _
objSmppSession.GetErrorDescription(objSmppSession.LastError)
WScript.Quit 1
End If
Set objMessage = objSmppSession.ReceiveSubmitSms
WEnd
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
ReceiveSubmitSms method
Receive an SMS submission from the connected client. Every SMS needs to be responded to using the
RespondToSubmitSms method.
If there are no more SMS submission pending nothing will be returned and LastError will be set.
Parameters:
- None
Return value:
An Message object
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
Set objMessage = objSmppSession.ReceiveSubmitSms
While objSmppSession.LastError = 0
WScript.Echo "Receive SMS from: " & objSmppSession.SystemId & "; to: " & _
objMessage.ToAddress & "; suggested reference: " & objMessage.Reference
' Accept the incoming message with the suggested message reference
objSmppSession.RespondToSubmitSms objMessage
If objSmppSession.LastError <> 0 Then
WScript.Echo "Error while responding: " & _
objSmppSession.GetErrorDescription(objSmppSession.LastError)
WScript.Quit 1
End If
' Send a successful delivery report for the incoming message
objMessage.SmppStatus = objConstants.SMPP_MESSAGESTATE_DELIVERED
objSmppSession.DeliverReport objMessage
If objSmppSession.LastError <> 0 Then
WScript.Echo "Error while sending delivery report: " & _
objSmppSession.GetErrorDescription(objSmppSession.LastError)
WScript.Quit 1
End If
Set objMessage = objSmppSession.ReceiveSubmitSms
WEnd
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
RespondToQuerySms method
Respond to an SMS Query request. Use ReceiveQuerySms to receive SMS queries and use this method to respond to the query with a status code.
This method requires the original SMS that way queried. Make sure the status is set to reflect the current status.
Every received SMS Query requires a response.
Parameters:
- The Message object that was queried
Return value:
Always 0.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
'Don't support query_sm
Set objMessage = objSmppSession.ReceiveQuerySms
While objSmppSession.LastError = 0
objMessage.SmppCommandStatus = objConstants.SMPP_ESME_RINVCMDID
objSmppSession.RespondToQuerySms objMessage
Set objMessage = objSmppSession.ReceiveQuerySms
WEnd
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
ReceiveQuerySms method
Receive an SMS query from the connected client. The client will send an SMS message reference to query. Every SMS Query requires a response using the RespondToQuerySms method.
If there are no more SMS queries pending nothing will be returned and LastError will be set.
Parameters:
- None
Return value:
An Message object
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
'Don't support query_sm
Set objMessage = objSmppSession.ReceiveQuerySms
While objSmppSession.LastError = 0
objMessage.SmppCommandStatus = objConstants.SMPP_ESME_RINVCMDID
objSmppSession.RespondToQuerySms objMessage
Set objMessage = objSmppSession.ReceiveQuerySms
WEnd
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
DeliverSms method
Deliver an SMS message to the remote client. For every SMS that’s deliverd the client should send a response which needs to be received using the ReceiveDeliverResponse method.
Parameters:
Return value:
Always 0.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
' Deliver a new message to the client
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31122334455"
objMessage.FromAddress = "+35544332211"
objMessage.Body = "Hello from the Auron Gateway !"
objMessage.UserTag = 1 ' To identify this message when the client responds
objSmppSession.DeliverSms objMessage
If objSmppSession.LastError <> 0 Then
WScript.Echo "Error while delivering: " & _
objSmppSession.GetErrorDescription(objSmppSession.LastError)
WScript.Quit 1
End If
' Check if the client accepted any messages
Set objMessage = objSmppSession.ReceiveDeliverResponse
While objSmppSession.LastError = 0
WScript.Echo "Response: " & objMessage.SmppCommandStatus & _
" for UserTag: " & objMessage.UserTag
Set objMessage = objSmppSession.ReceiveDeliverResponse
WEnd
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
DeliverReport method
Deliver a delivery report to the remote client. A delivery report is a special kind of SMS message that is formatted in a specific way. This method generates a delivery reports out of the original SMS that needs to be reported. Make sure that the final delivery status is set in this SMS message before passing to this method.
For every delivery report the client should send a response which needs to be received using the ReceiveDeliverResponse method.
Parameters:
- The Message object that will be reported about
Return value:
Always 0.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
Set objMessage = objSmppSession.ReceiveSubmitSms
While objSmppSession.LastError = 0
WScript.Echo "Receive SMS from: " & objSmppSession.SystemId & "; to: " & _
objMessage.ToAddress & "; suggested reference: " & objMessage.Reference
' Accept the incoming message with the suggested message reference
objSmppSession.RespondToSubmitSms objMessage
If objSmppSession.LastError <> 0 Then
WScript.Echo "Error while responding: " & _
objSmppSession.GetErrorDescription(objSmppSession.LastError)
WScript.Quit 1
End If
' Send a successful delivery report for the incoming message
objMessage.SmppStatus = objConstants.SMPP_MESSAGESTATE_DELIVERED
objSmppSession.DeliverReport objMessage
If objSmppSession.LastError <> 0 Then
WScript.Echo "Error while sending delivery report: " & _
objSmppSession.GetErrorDescription(objSmppSession.LastError)
WScript.Quit 1
End If
Set objMessage = objSmppSession.ReceiveSubmitSms
WEnd
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
ReceiveDeliverResponse method
This method received the client’s response on an SMS delivery or delivery report. The response will always be related to an earlier sent delivery report or SMS message. The response will contain the same UserTag value that was used in originally submitting the SMS message.
Parameters:
- None
Return value:
The orginal Message object that was responed to.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
' Deliver a new message to the client
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31122334455"
objMessage.FromAddress = "+35544332211"
objMessage.Body = "Hello from the Auron Gateway !"
objMessage.UserTag = 1 ' To identify this message when the client responds
objSmppSession.DeliverSms objMessage
If objSmppSession.LastError <> 0 Then
WScript.Echo "Error while delivering: " & _
objSmppSession.GetErrorDescription(objSmppSession.LastError)
WScript.Quit 1
End If
' Check if the client accepted any messages
Set objMessage = objSmppSession.ReceiveDeliverResponse
While objSmppSession.LastError = 0
WScript.Echo "Response: " & objMessage.SmppCommandStatus & _
" for UserTag: " & objMessage.UserTag
Set objMessage = objSmppSession.ReceiveDeliverResponse
WEnd
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
Disconnect method
Disconnect this session. The connection on the client side will be dropped immediately.
Parameters:
- None
Return value:
Always 0.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
objSmppSession.Disconnect
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
CountSmsSubmissions method
This is the number of messages that have been received by the session but still need to be collected through the ReceiveSubmitSms method.
Parameters:
- None
Return value:
The number of received SMS submissions.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
WScript.Echo "In submit queue: " & objSmppSession.CountSmsSubmissions
WScript.Echo "In query queue: " & objSmppSession.CountSmsQueries
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
CountSmsQueries method
This is the number of message queries that have been received by the session but still need to be collected through the ReceiveQuerySms method.
Parameters:
- None
Return value:
The number of received SMS queries.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
WScript.Echo "In submit queue: " & objSmppSession.CountSmsSubmissions
WScript.Echo "In query queue: " & objSmppSession.CountSmsQueries
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
CountSmsDeliverySpace method
This method returns the minimum number of SMS messages that can be added to the ‘delivery queue’ using DeliverSms.
Use to set the maximum number of messages in this queue.
Parameters:
- None
Return value:
The number of SMS messages that can be added using DeliverSms.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
iMax = objSmppSession.CountSmsDeliverySpace
strQ = "SELECT TOP(" & iMax & ") FROM Messages"
Set objRs = objCon.Execute(strQ)
...
While Not objRs.EOF
objMessage.ToAddress = objRs("ToAddress")
objSmppSession.DeliverSms objMessage
...
objRs.MoveNext
WEnd
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
FetchNotResponded method
Returns the next SMS Message that was submitted to the remote SMPP client but not acknowledged. This message will have a sequence number but the command status is undefined. Use the UserTag property to identify this message.
This method can only be called on a disconnected instance.
When no more messages are available LastError will be set.
Parameters:
- None
Return value:
The next Message object that was not updated
Example:
Set objSmppSession = objSmppServer.GetClosedSession
While objSmppServer.LastError = 0
WScript.Echo "Session closed: " & objSmppSession.SystemId
WScript.Echo "Not responded: "
Set objMessage = objSmppSession.FetchNotResponded
While objSmppSession.LastError = 0
WScript.Echo "Usertag: " & objMessage.Usertag & "; SequenceNumber: " & _
objMessage.SmppSequenceNumber
Set objMessage = objSmppSession.FetchNotResponded
WEnd
WScript.Echo "Not delivered (seq is 0): "
Set objMessage = objSmppSession.FetchNotDelivered
While objSmppSession.LastError = 0
WScript.Echo "Usertag: " & objMessage.Usertag & "; SequenceNumber: " & _
objMessage.SmppSequenceNumber
Set objMessage = objSmppSession.FetchNotDelivered
WEnd
Set objSmppSession = objSmppServer.GetClosedSession
WEnd
FetchNotDelivered method
Returns the next SMS Message that was submitted to the submit queue but not sent to the remote SMPP server. This message will not have a sequence number and the command status is undefined. Use the UserTag property to identify this message.
This method can only be called on a disconnected instance.
When no more messages are available LastError will be set.
Parameters:
- None
Return value:
The next Message object that was not submitted
Example:
Set objSmppSession = objSmppServer.GetClosedSession
While objSmppServer.LastError = 0
WScript.Echo "Session closed: " & objSmppSession.SystemId
WScript.Echo "Not responded: "
Set objMessage = objSmppSession.FetchNotResponded
While objSmppSession.LastError = 0
WScript.Echo "Usertag: " & objMessage.Usertag & "; SequenceNumber: " & _
objMessage.SmppSequenceNumber
Set objMessage = objSmppSession.FetchNotResponded
WEnd
WScript.Echo "Not delivered (seq is 0): "
Set objMessage = objSmppSession.FetchNotDelivered
While objSmppSession.LastError = 0
WScript.Echo "Usertag: " & objMessage.Usertag & "; SequenceNumber: " & _
objMessage.SmppSequenceNumber
Set objMessage = objSmppSession.FetchNotDelivered
WEnd
Set objSmppSession = objSmppServer.GetClosedSession
WEnd
GetFirstPart method
This methods splits up a multipart message and returns the first part. If a message is not multipart it will return the original message formatted as HEX. Call GetNextPart to get the next part.
The returned message will be assigned a new multipart reference id that is kept and increased in this session.
The message will be formatted according to the current multipart mode.
Parameters:
- Message object to be split
Return value:
The first part of the multipart message.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
iCredits = objSmpp.CountParts(objSms)
Set objPart = objSmpp.GetFirstPart(objSms)
While objSmpp.LastError = 0
objSmppSession.DeliverSms objPart
Set objPart = objSmpp.GetNextPart()
WEnd
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
GetNextPart method
This method returns the next part of a split up message. If no further parts are available the LastError code will be set. Call GetFirstPart before calling this method.
The message will be formatted according to the current multipart mode.
Parameters:
- None
Return value:
The first part of the multipart message.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
iCredits = objSmpp.CountParts(objSms)
Set objPart = objSmpp.GetFirstPart(objSms)
While objSmpp.LastError = 0
objSmppSession.DeliverSms objPart
Set objPart = objSmpp.GetNextPart()
WEnd
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
CountParts method
This method returns the number of parts required to send the given Message object. This number will be calculated according to the current multipart mode.
Parameters:
- None
Return value:
The first part of the multipart message.
Example:
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
...
iCredits = objSmpp.CountParts(objSms)
Set objPart = objSmpp.GetFirstPart(objSms)
While objSmpp.LastError = 0
objSmppSession.DeliverSms objPart
Set objPart = objSmpp.GetNextPart()
WEnd
...
Set objSmppSession = objSmppServer.GetNextSession
WEnd
AssembleSms method
This method assembles a multipart SMS message from its parts. Add parts through this function and check if assembled messages are ready through GetAssembledSms.
It’s possible to assemble multiple multipart messages at the same time.
Parameters:
- A multipart Message object
Return value:
None
Example:
Set objSmppServer = CreateObject("AxSms.SmppServer")
...
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
' Receive incoming messages
Set objMessage = objSmppSession.ReceiveSubmitSms
While objSmppSession.LastError = 0
objSmppSession.AssembleSms objMessage
objSmppSession.RespondToSubmitSms objMessage
...
Set objMessage = objSmppSession.ReceiveSubmitSms
WEnd
' Get assembled messages
Set objMessage = objSmppSession.GetAssembledSms(false)
While objSmppSession.LastError = 0
WScript.Echo "Received: " & objMessage.Body
Set objMessage = objSmppSession.GetAssembledSms(false)
WEnd
...
WEnd
GetAssembledSms method
This method returns the first available assembled multipart SMS message. The message would be assembled from the parts inserted through the AssembleSms method.
Use ResetSmsAssembler to clear the internal list of incomplete multipart messages.
Use the ‘Force’ parameter to force assembly of the first stored (incomplete) multipart message. This may result in an incomplete message. An incomplete message will have Incomplete set to true.
If no multipart messages are available the LastError property will be set.
Parameters:
- Force assemble to first available message
Return value:
None
Example:
Set objSmppServer = CreateObject("AxSms.SmppServer")
...
Set objSmppSession = objSmppServer.GetFirstSession
While objSmppServer.LastError = 0
' Receive incoming messages
Set objMessage = objSmppSession.ReceiveSubmitSms
While objSmppSession.LastError = 0
objSmppSession.AssembleSms objMessage
objSmppSession.RespondToSubmitSms objMessage
...
Set objMessage = objSmppSession.ReceiveSubmitSms
WEnd
' Get assembled messages
Set objMessage = objSmppSession.GetAssembledSms(false)
While objSmppSession.LastError = 0
WScript.Echo "Received: " & objMessage.Body
Set objMessage = objSmppSession.GetAssembledSms(false)
WEnd
...
WEnd