Three years ago on our discussion board we posted a simple Windows JScript that could be used to send an SMS message via NowSMS using a command-line interface. If you’re not famliar with the script, then you can find more details at http://www.nowsms.com/support/bulletins/tb-nowsms-008.htm.
In the three years that have passed, I’ve referenced that script many times. After all, while the HTTP interface into NowSMS offers a great deal of flexibility, it is not always easy to add an HTTP interface on to an existing application. Sometimes a simple command line interface is easier to get started with … it’s easier to understand, and provides immediate feedback.
In a recent posting on the NowSMS discussion board, I was asked if there was a similar command line interface that could be used to send an OMA Client Provisioning (XML Settings) document.
I thought about all of the times that people had asked me for different variations of that script for sending different types of messages beyond the simple SMS text message … and I thought about the wasted hours that I had spent trying to write different scripts … frustrated by the fact that I simply was not very well versed in JScript.
Still, it sounded like a challenge worth revisiting … and modifying the script for this purpose was actually easier than I thought it would be.
The result is sendota.js. You can right-click on the file name to download and save this file.
Assuming that the script file is saved as a file named smsota.js, you would issue the following command:
cscript sms.js PhoneNumber1[,PhoneNumber2,...] OTAFilename.xml [PINValue] [USERPIN NETWPIN]
(cscript.exe is the Windows Script Host, which is a component of Windows which should be located in the \Windows\System32 directory.)
cscript smsota.js +44777777777 settings.xml
cscript smsota.js +44777777777,+44777777778 settings.xml
cscript smsota.js +44777777777 settings.xml 1234
cscript smsota.js +44777777777 settings.xml 1234 USERPIN
This script can be used to send XML Settings documents for any of the document types currently supported by NowSMS, including:
1.) OMA (Open Mobile Alliance) Provisioning Content (root XML element “wap-provisioningdoc”
2.) OMA (Open Mobile Alliance) DRM Rights Objects (root XML element “o-ex:rights”
3.) WAP Push Service Indication, Service Load and Cache Operation (root XML element “si”, “sl”
4.) OMA (Open Mobile Alliance) E-Mail Notification (EMN) (root XML element “emn”
5.) Nokia/Ericsson Over The Air Settings (OTA) Specification (root XML element
6.) Nokia/Ericssson SyncML OTA or Wireless Village Settings (root XML element “SyncSettings”
A “PINValue” can be associated with many of the XML settings types to provide a layer of authentication to the message. Many devices will allow you to send XML settings without a PIN, but some will require a PIN to be present before the settings will be accepted.
There are three different types of PINs, depending on the “PINType” setting.
The simplest “OTA PIN Type” is “USERPIN” (User PIN). This setting indicates that a short PIN code (often 4 digits) is supplied as the “OTA PIN”. When the user receives the OTA settings message, they will need to supply this PIN code in order to be able to open the message and apply the settings. If a “PINValue” is specified, but a “PINType” is not, then USERPIN will be assumed.
“NETWPIN” (Network PIN) indicates the PIN is a network PIN code. In the GSM environment, this is the IMSI number associated with the SIM card in the device. (Hint, if you want to experiment with determining the PIN card associated with a SIM, you can put the SIM into a GSM modem and the AT+CIMI command to return the IMSI. However, not all GSM modems support the AT+CIMI command.) When the device receives the settings, if the NETWPIN does not match the IMSI, the settings will be discarded.
An additional type of PIN, known as “USERNETWPIN” also exists, which indicates a combination of the USERPIN and NETWPIN types. To use this OTA PIN type, specify the OTA PIN as the IMSI number associated with the SIM card in the device, followed by a “:” character, followed by a USERPIN (e.g., 1234567889012345:1234). When the device receives the settings, the user will be prompted for a PIN. This user supplied PIN, and the SIM card IMSI, must match in order for the settings to be accepted.
P.S. – Now the real challenge … can I hack this script further to create a script that can easily send MMS messages from the command line, uploading local content objects from the script? Stay tuned ….
For comments and further discussion, please click here to visit the NowSMS Technical Forums (Discussion Board)...