# -------------------------------------------------------------------- # Using the GENERIC driver. # It is possible build simple client interfaces to dialin networks # for delivering SMS messages. # # A Simple generic script consists of three sections: # # login # send # disconnect # # # Each sections is made up of a list of Actions. # Where each action is a dictionary consisting of # a number of entries, these include: # # message # send # expect # success # failure # # # The basic sequence of events is: # # 1. If 'message' is present output to console. # 2. If 'send' is present output to server. # 3. If 'expect' is present, check the input from # the server against the expect string. # 4. If the expect string matches output 'success' to console. # proceed to next entry and goto step 1. # 5. If the expect string does NOT match, output 'failure' to # console. do NOT proceed any further. # # -------------------------------------------------------------------- # # Example. # The script below sends an email by connecting # to an SMTP server. # # -------------------------------------------------------------------- { login = ( { message = "Connecting to server...\n" }, { expect = "220 " success = "Welcome prompt found\n" failure = "Welcome Failed - Welcome prompt expected\n" }, { expect = "\n" success = "Welcome prompt found\n" failure = "Welcome Failed - Welcome prompt expected\n" } ) send = ( { send = "MAIL FROM: bill.gates@microsoft.com\n" expect = "250 " success = "Successfully set Mail from\n" failure = "failed to set Mail from\n" }, { expect = "\n" success = "" failure = "" }, { send = ( "RCPT TO: ", '$ID$', "\n" ) expect = "250 " success = "Successfully set Mail to\n" failure = "failed to set Mail to\n" }, { expect = "\n" success = "" failure = "" }, { send = "DATA\n" expect = "354 " success = "Successfully initiating data transfer\n" failure = "failed initiating data transfer\n" }, { expect = "\n" success = "" failure = "" }, { send = ( '$MSG$', "\n", ".\n" ) expect = "250 " success = "Successfully set data\n" failure = "failed to set data\n" }, { expect = "\n" success = "" failure = "" } ) disconnect = ( { send = "QUIT\n" expect = "221" success = "Disconnect successful\n" failure = "Disconnect Failed\n" }, { expect = "\n" success = "" failure = "" } ) }