Headwind SMS software products

About | Contact us

 
 

Command-line SMS source

The type "Command-Line" of the SMS source runs a DOS command and uses its output to send SMS. The output of the command must have the following XML format:

    <messages>
      <message msisdn="..." [flash="true"] [url="..."] [report="true"]>Message text</message>
      <message msisdn="..." [flash="true"] [url="..."] [report="true"]>Message text</message>
      ...
    </messages>

Adding a command-line SMS source

  • Click "Add" in the "Sources" tab and select "Command".
  • Choose the name, the command (or use the "Browse" button), the directory where the command will be executed, and the period of polling in seconds.
  • Demo VBScript source

    VBScript language is very convenient to build SMS sources.

    This demo source gets the messages from a MySQL database. The script requires MySQL Connector/ODBC.

    
    OPTION EXPLICIT
    Dim objDB, oRS
    Dim sqlHost, sqlBase, sqlUser, sqlPassword, sqlGetQuery, sqlFlushQuery
    
    sqlHost = "vmcuekz.apollomysql.com"
    sqlBase = "test"
    sqlUser = ""
    sqlPassword = ""
    sqlGetQuery = "SELECT addr, body FROM outbox"
    sqlFlushQuery = "DELETE FROM outbox"
    
    'Main Processing section
    'Database connection & select all from Table
    Set objDB = DBConnect()
    Set oRS = objDB.Execute(sqlGetQuery)
    
    ' Our XML format
    WScript.Echo ""
    Do While Not oRS.EOF
      WScript.Echo "  " &_
                   oRS.Fields.Item("body") & ""
      oRS.MoveNext
    Loop
    WScript.Echo ""
    
    objDB.Execute(sqlFlushQuery)
    
    'Procedures section
    'This function sets up DB Connection using specified DSN
    Function DBConnect
      Set objDB = CreateObject("ADODB.Connection")
      Dim ConnString
      ConnString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=" & sqlHost &_
                   "; DATABASE=" & sqlBase & "; UID=" & sqlUser &_
                   "; PASSWORD=" & sqlPassword & "; OPTION=3"
      objDB.Open ConnString
      Set DBConnect = objDB
    End Function
    	
    • Create the MySQL table "outbox";
    • Save the above code in the "source.vbs" file;
    • Use the following command for the MySQL source:
    • cscript.exe //Nologo source.vbs

      Use //Nologo to suppress VBScript logo output.