AxSms.Dialup
Introduction
Skip to properties and methods
The Dialup object enables you to send SMS messages using a normal Hayes compatible modem (1200 bps or higher). The modem connects to an SMSC dial-in service provider to deliver the SMS message.
You can use the Dialup object to send SMS messages; receiving messages is not supported. The Dialup object can only send messages one-by-one.
The Dialup object communicates with a normal modem using either a direct COM port, or using a Windows telephony device. It is recommended to use Windows telephony devices, for instance ‘Standard 9600 bps Modem’.
If a Windows telephony device is used, settings are controlled by the Windows telephony driver, and can be configured through the ‘Phone and Modem’ settings:
- Open the Windows Control Panel from the Start menu;
- Double-click on ‘Phone and Modem Options’ and select the ‘Modems’ tab;
- Select the preferred modem and click on ‘Properties’; from here, you can change the settings.
You can only send plain text messages. To send advanced SMS messages (like: flash, multi-part messages, data, ringtones, Unicode, etc.) try the Gsm or Smpp object.
There are two types of SMSC dial-in providers:
- TAP/XIO providers;
- UCP providers.
The Dialup object supports them both. Our list of supported SMSC providers shows the type of provider (TAP/XIO or UCP) for each provider.
Send SMS using Dialup
Send an SMS through the Dialup (UCP/TAP-XIO) protocol object.
Set objDialup = CreateObject("AxSms.Dialup") ' Create Dialup protocol object
Set objConstants = CreateObject("AxSms.Constants") ' Create global constants object
Set objMessage = CreateObject("AxSms.Message") ' Create SMS message object
WScript.Echo "SMS Component Version " & objDialup.Version & "; Build " & _
objDialup.Build & "; Module " & objDialup.Module
WScript.Echo "License Status: " & objDialup.LicenseStatus & vbCrLf
objDialup.LogFile = "log.txt"
objDialup.Device = "COM2"
objDialup.DeviceSpeed = 56000
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410" ' Dialup provider
objMessage.ToAddress = "31122334455"
objMessage.Body = "Hello, World!"
objDialup.Send objMessage ' Send SMS message
If objDialup.LastError <> 0 Then
WScript.Echo "Error: " & objDialup.GetErrorDescription(objDialup.LastError)
WScript.Quit 1
End If
How to run this example
Properties and Methods
Property | Type | Read/Write | Description |
Version | String | Read | Version number of the SMS Component |
Build | String | Read | Build number of the SMS Component |
Module | String | Read | Module name of the SMS Component |
LicenseStatus | String | Read | License Status |
LicenseKey | String | Read/Write | License Key |
LastError | Number | Read | Result of the last called method |
LogFile | String | Read/Write | The path to a logfile which can be used for troubleshooting |
Device | String | Read/Write | Name of the device you want to use for sending the SMS messages |
DeviceSpeed | Number | Read/Write | The baudrate of the communication session |
DeviceSettings | Number | Read/Write | Identifier indicating databits, parity and stopbits |
DeviceInitString | String | Read/Write | Initialization string for the device |
Dialmode | Number | Read/Write | Tone or Pulse. Default: Tone |
ProviderDialString | String | Read/Write | Dial-string to dial-up to the provider |
ProviderPassword | String | Read/Write | Optional password to log on to the provider (UCP only) |
ProviderType | Number | Read/Write | Type of provider; can be UCP or TAP |
ProviderResponse | String | Read | Last response from provider |
Method | Description |
Clear | Reset all properties to their default values |
GetErrorDescription | Get the description of the given error |
Sleep | Sleep for the specified number of milliseconds |
GetDeviceCount | Return the number of Windows telephony devices installed on the local computer |
GetDevice | Retrieve a Windows telephony device name |
Send | Deliver the message to the SMSC provider. The SMSC provider will send the SMS message to the recipient |
ProviderLoadConfig | Load SMSC specific parameters from a configuration file |
ProviderSaveConfig | Save SMSC specific parameters to a configuration file |
SaveLicenseKey | Save the License Key in the registry |
Version property
Return the version number of the SMS Component
Example:
Set objDialup = CreateObject("AxSms.Dialup")
WScript.Echo "SMS Component Version " & objDialup.Version & "; Build " & _
objDialup.Build & "; Module " & objDialup.Module
WScript.Echo "License Status: " & objDialup.LicenseStatus & vbCrLf
...
Build property
Return the build number of the SMS Component.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
WScript.Echo "SMS Component Version " & objDialup.Version & "; Build " & _
objDialup.Build & "; Module " & objDialup.Module
WScript.Echo "License Status: " & objDialup.LicenseStatus & vbCrLf
...
Module property
Return the module name of the SMS Component.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
WScript.Echo "SMS Component Version " & objDialup.Version & "; Build " & _
objDialup.Build & "; Module " & objDialup.Module
WScript.Echo "License Status: " & objDialup.LicenseStatus & vbCrLf
...
LicenseStatus property
The status of your license. In case you have not licensed the product, the property holds the trial expiration date. For details, see Product Activation.
Example:
Set objDialup = CreateObject("AxSms.Dialup") ' Create new instance
WScript.Echo "License Status: " & objDialup.LicenseStatus
WScript.Echo "License Key: " & objDialup.LicenseKey
LicenseKey property
A license key is required to unlock this component after the trial period has expired. Assign the LicenseKey property every time a new instance of this component is created (see code below). Alternatively, the LicenseKey property can be set automatically. This requires the license key to be stored in the registry. For details, see Product Activation.
Example:
Set objDialup = CreateObject("AxSms.Dialup") ' Create new instance
objDialup.LicenseKey = "XXXXX-XXXXX-XXXXX" ' Assign your license key
WScript.Echo "LicenseKey: " & objDialup.LicenseKey
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 objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
...
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..
objDialup.Send objMessage
WScript.Echo "Send result: " & objDialup.LastError ' Is our message sent ?
...
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 objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
...
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..
objDialup.Send objMessage
...
Device property
The preferred device for sending SMS messages. You can either use a Windows telephony device (recommended) or a physical COM port (directly).
Assign one of the following strings to the ‘Device’ property:
- A valid Windows telephony device name – this must be the exact name as it appears in Modems tab of the Phone and Modems Options applet in the Control Panel. For instance: “Standard 9600 bps Modem”;
- A valid COM port string, formatted as COMx, where x is a valid COM port number. When you assign the ‘Device’ property with a COM port string, you bypass all Windows telephony intelligence, like dialing rules, port sharing and so on.
Use the GetDevice method to retrieve Windows telephony device names;
Windows telephony devices are highly recommended.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
...
objDialup.Device = "COM1"
objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..
objDialup.Send objMessage
...
DeviceSpeed property
By default, the speed settings are inherited from the Windows telephony device, or (in case a direct COM port is used) the default COM settings are used.
Use one of these values.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
...
objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..
objDialup.Send objMessage
...
DeviceSettings property
By default, the databits/parity/stopbits settings are inherited from the Windows telephony device, or (in case a direct COM port is used) the default COM settings are used (8 databits, no parity, 1 stopbit).
Use one of these values.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
...
objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
objDialup.DeviceSettings = objConstants.DIALUP_DEVICESETTINGS_8N1
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..
objDialup.Send objMessage
...
DeviceInitString property
Initialization string for the modem. Following string is used to initialize a modem:
- If a Windows telephony device is used, the Windows telephony initialization string is used (the ‘DeviceInitString’ property is ignored);
- If a direct COM port is used, the ‘DeviceInitString’ property is used to initialize the device.
As said, the ‘DeviceInitString’ property is ignored if a Windows telephony device is used. If you are using a direct port device, and you assign a string to the ‘DeviceInitString’ property, the string will be used to initialize the modem.
Important: commands can be separated by the ‘;’ character, and will issued separately. So, if ‘DeviceInitString’ property holds the “ATZ” string, the toolkit first issues ATZ, waits for the OK response, then issues the AT&C1&K0 command and again waits for the OK response.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
...
objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
objDialup.DeviceInitString = "AT&F;AT&C1&K0"
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..
objDialup.Send objMessage
...
Dialmode property
Set the ‘DialMode’ property to specify ‘Tone’ or ‘Pulse’ dialing. Click here for the values.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
...
objDialup.Dialmode = objConstants.DIALUP_DIALMODE_TONE
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..
objDialup.Send objMessage
...
ProviderDialString property
Dial string to dial-up to the provider.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
...
objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..
objDialup.Send objMessage
...
ProviderPassword property
Password used to logon to the provider. The majority of the TAP/UCP providers do not require a password; however, if a password is required, you can set it here.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
...
objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
objDialup.ProviderPassword = "Passw0rd"
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..
objDialup.Send objMessage
...
ProviderType property
Type of provider; click here for a list of values.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
...
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..
objDialup.Send objMessage
...
ProviderResponse property
ProviderResponse holds the last response from the Dial-Up provider. Use it for troubleshooting.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
Set objMessage = CreateObject("AxSms.Message")
Set objConstants = CreateObject("AxSms.Constants")
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
...
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
..
objDialup.Send objMessage
WScript.Echo objDialup.ProviderResponse
...
Clear method
This method resets all properties to their default values.
Parameters:
- None
Return value:
Always 0.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
....
objDialup.Clear
...
GetErrorDescription method
GetErrorDescription provides the error description of a given error code.
Parameters:
- The error code
Return value:
The error string.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
objDialup.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
objDialup.Send objMessage
WScript.Echo "SendSms result: " & objDialup.LastError & ", " & _
objDialup.GetErrorDescription(objDialup.LastError)
Sleep method
This method suspends the current thread for the specified number of milliseconds.
Parameters:
- Milliseconds to sleep
Return value:
Always 0.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
....
objDialup.Sleep 1000
...
GetDeviceCount method
This method suspends the current thread for the specified number of milliseconds.
Parameters:
- Milliseconds to sleep
Return value:
Always 0.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
....
n = objDialupProtocol.GetDeviceCount()
For i = 0 to n-1
WScript.Echo "Device " & i & ": " & objDialupProtocol.GetDevice( i )
Next
...
GetDevice method
This method suspends the current thread for the specified number of milliseconds.
Parameters:
- Milliseconds to sleep
Return value:
Always 0.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
....
n = objDialupProtocol.GetDeviceCount()
For i = 0 to n-1
WScript.Echo "Device " & i & ": " & objDialupProtocol.GetDevice( i )
Next
...
Send method
This method suspends the current thread for the specified number of milliseconds.
Parameters:
- Milliseconds to sleep
Return value:
Always 0.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
Set objConstants = CreateObject("AxSms.Constants")
...
objMessage.ToAddress = "31623350218"
objMessage.Body = "Hello world!"
...
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
...
objDialup.Send objMessage
ProviderLoadConfig method
This method suspends the current thread for the specified number of milliseconds.
Parameters:
- Milliseconds to sleep
Return value:
Always 0.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
Set objConstants = CreateObject("AxSms.Constants")
...
objDialup.ProviderLoadConfig "D:\Auron\SMS Component\MyProvider.dial"
ProviderSaveConfig method
Save provider specific information to a SmsProtocolDialup configuration file.
Parameters:
- A SmsProtocolDialup file. A previous SmsProtocolDialup file will be overwritten automatically.
Return value:
Always 0.
Example:
Set objDialup = CreateObject("AxSms.Dialup")
Set objConstants = CreateObject("AxSms.Constants")
...
objDialup.Dialmode = objConstants.DIALUP_DIALMODE_TONE
objDialup.ProviderPassword = "Passw0rd"
objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
objDialup.ProviderDialString = "0653141410"
...
objDialup.ProviderSaveConfig "D:\Auron\SMS Component\MyProvider.dial"
SaveLicenseKey method
Description:
Use SaveLicenseKey to store the license key permanently in the registry. When a license key is saved, it is restored automatically every time a new instance of the object (‘Dialup’) is created. It is not recommended to save the license key if you distribute the component with your own software, because the key can be easily used by others.
Parameters:
- None.
Return value:
Always 0. Check LastError property to see if the method was completed successfully.
Example:
Set objDialup = CreateObject("AxSms.Dialup") ' Create new instance
objDialup.LicenseKey = "XXXXX-XXXXX-XXXXX"
objDialup.SaveLicenseKey ' Save license key to registry
For more information, see Product Activation.