SMS Component - Smpp object

Overview

The Short Message Peer to Peer protocol (SMPP) is used for sending and receiving SMS messages. It's a TCP/IP based binary application protocol which was specifically developed for high volume, low latency sending of SMS messages. The protocol supports all SMS features like delivery reports / binary SMS messages etc..

An SMPP client, such as the SMS Component, will connect directly to an SMPP based SMSC interface. It will connect either directly through the internet or through VPN software. Most SMPP providers support connecting directly through the internet.

Some advantages for using SMPP instead of a GSM modem:

The Smpp object features the following:

The Smpp object is part of the ActiveXperts SMS Component. Overview of all SMS Component objects:

Sample code

VBScript sample: Send a simple SMS message via SMPP

Option Explicit

' Declare objects
Dim objSmpp, objMessage, objSmsConstants

' Create objects
Set objSmpp                   = CreateObject ( "AxSms.Smpp" )
Set objMessage                = CreateObject ( "AxSms.Message" )
Set objSmsConstants           = CreateObject ( "AxSms.Constants" )

' Connect to smpp provider
objSmpp.Connect "smpp.activexperts-labs.com", 2775, 10000
WScript.Echo "Connect, result: " & objSmpp.LastError
If ( objSmpp.LastError <> 0 ) Then 
  WScript.Sleep 3000
  WScript.Quit
End If 

objSmpp.Bind objSmsConstants.SMPP_BIND_TRANSCEIVER, "myaccount", "topsecret", 
             "", objSmsConstants.SMPP_VERSION_34, 0, 0, "", 10000
WScript.Echo "Bind, result: " & objSmpp.LastError 
If ( objSmpp.LastError <> 0 ) Then
  objSmpp.Disconnect
  WScript.Quit
End If

' Message: set all properties
objMessage.Clear
objMessage.FromAddress        = "+31612134567"
objMessage.ToAddress          = "+31612345678"
objMessage.Body               = "Hello, world!"
objMessage.RequestDeliveryReport = False

' Submit the message to the SMSC
objSmpp.SubmitSms( objMessage )
Wscript.Echo "SubmitSms, result: " & objSmpp.LastError

' Wait for the SMSC response to acknowledge the message
objSmpp.WaitForSmsUpdate(1000)
Set objMessage = objsmpp.FetchSmsUpdate
Wscript.Echo "FetchSmsUpdate, result: " & objSmpp.LastError

' If this is '0' the message is accepted by the SMSC
Wscript.Echo "Command status: " & objMessage.SmppCommandStatus

objSmpp.Unbind
objSmpp.Disconnect

WScript.Echo "Disconnected."

VB .NET sample: Send a simple SMS message via SMPP

Imports Microsoft.Win32
Imports System.IO
Imports AxSms
Imports System.Threading

Module SmppProgram

Sub Main()
  Dim objSmpp As Smpp = New Smpp() ' Create instance of COM Object
  Dim objSmsMessage As SmsMessage = New SmsMessage() ' Create instance of COM Object
  Dim objSmsConstants As SmsConstants = New SmsConstants() ' Create instance of COM Object

  ' Connect to the SMPP server using host/IP-addess, a specific TCP port and a timeout
  objSmpp.Connect("smpp.activexperts-labs.com", 2775, 10000)
  Console.WriteLine(String.Format("Connect, result: {0})", objSmpp.LastError.ToString() ))
  If (objSmpp.LastError <> 0) Then
    GoTo _EndMain
  End If

  objSmpp.Bind( objSmsConstants.SMPP_BIND_TRANSCEIVER, "myaccount", "topsecret", 
                "", objSmsConstants.SMPP_VERSION_34, 0, 0, String.Empty, 10000 )
  Console.WriteLine(String.Format("Bind, result: {0})", objSmpp.LastError.ToString))
  If (objSmpp.LastError <> 0) Then
      GoTo _EndMain
  End If

  objSmsMessage.Clear()
  objSmsMessage.ToAddress = "+31612345678"
  objSmsMessage.Body = ReadInput("Type SMS text", False)
  objSmsMessage.RequestDeliveryReport = False

  objSmpp.SubmitSms(objSmsMessage, objSmsConstants.MULTIPART_OK)
  Console.WriteLine("SubmitSms, result: " & objSmpp.LastError.ToString)
  If (objSmpp.LastError <> 0) Then
    GoTo _EndMain
  End If

  ' Wait for the SMSC response to acknowledge the message
  objSmpp.WaitForSmsUpdate(1000)
  Set objMessage = objsmpp.FetchSmsUpdate
  Console.WriteLine("FetchSmsUpdate, result: " & objSmpp.LastError.ToString)

  ' If this is '0' the message is accepted by the SMSC
  Console.WriteLine("Command status, result: " & objMessage.SmppCommandStatus.ToString)
  
_EndMain:
  ' Unbind and Disconnect
  objSmpp.Unbind()
  objSmpp.Disconnect()

  Console.WriteLine("Disconnected.")
  Console.WriteLine("Ready.")
  Console.WriteLine("Press  to continue.")
  Console.ReadLine()
End Sub

End Module

More samples

Samples are available for: C# .NET, Visual Basic .NET, Visual C/C++, VBA, ASP, ASP .NET, Java, Javascript, PHP, HTML, ColdFusion, Delphi and more.

On ftp.activexperts-labs.com, you can find many SMS Component samples. Samples are also part of the SMS Component installation.