home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: OtherApp / OtherApp.zip / phoneb.zip / DIALER.VRX next >
Text File  |  1995-03-13  |  3KB  |  104 lines

  1. /*:VRX         Main
  2. */
  3. Main:
  4.     debug = 0
  5.     phoneNumber = arg(1)
  6.     ok = VRMethod( "Application", "GetVar", "COMPort")  /* COM1: or COM2: */
  7.     ok = VRMethod( "Application", "GetVar", "BaudRate") /* 300 ... 19200 */
  8.     ok = VRMethod( "Application", "GetVar", "DialString")  /* ATDT usually */
  9.     ok = VRMethod( "Application", "GetVar", "HangupString") /* ATH usually */
  10.  
  11.     signal on halt
  12.  
  13.     if debug=1 then
  14.      do    
  15.         msg.0 = 3
  16.         msg.1 = "Dialing ..."
  17.         msg.2 = phoneNumber
  18.         msg.3 = "Port:" COMPort "Baudrate:" baudRate
  19.         button.0 = 1
  20.         button.1 = "Continue"
  21.         call VRMessageStem VRWindow(), "msg.","Dialer. Dialing in progress","N","button.",1,1
  22.      end
  23.  
  24.  
  25.     /* Set comport using the OS/2 MODE command */
  26.     "@MODE" COMPort":"baudRate",,,,TO=OFF,XON=ON 1>NUL 2>NUL"
  27.  
  28.     if RC \= 0 then
  29.      do
  30.         msg.0 = 3
  31.         msg.1 = "Dialing ..."
  32.         msg.2 = "MODE command returned code:" RC
  33.         msg.3 = ""
  34.         button.0 = 1
  35.         button.1 = "Continue"
  36.         call VRMessageStem VRWindow(), "msg.","Dialer. Dialing in progress","N","button.",1,1
  37.      end
  38.  
  39.     RC = stream(COMPort,"C", "OPEN")
  40.     if RC \= "READY:" then 
  41.      do
  42.         msg.0 = 3
  43.         msg.1 = "Dialing ..."
  44.         msg.2 = "Open for stream" COMPort "returned code:" RC
  45.         msg.3 = ""
  46.         button.0 = 1
  47.         button.1 = "Continue"
  48.         call VRMessageStem VRWindow(), "msg.","Dialer. Dialing in progress","N","button.",1,1
  49.      end
  50.  
  51.  
  52.     RC = lineout(COMPort, "ATDT"phoneNumber";")
  53.     if RC \= 0 then
  54.      do
  55.         msg.0 = 3
  56.         msg.1 = "Dialing ..."
  57.         msg.2 = "lineout("COMPort",DialString"phoneNumber";') returned code:" RC
  58.         msg.3 = ""
  59.         button.0 = 1
  60.         button.1 = "Continue"
  61.         call VRMessageStem VRWindow(), "msg.","Dialer. Dialing in progress","N","button.",1,1
  62.       end
  63.  
  64.         msg.0 = 3
  65.         msg.1 = "Phone number has been dialed."
  66.         msg.2 = "Pick up the phone."
  67.         msg.3 = "Press Hangup when done."
  68.         button.0 = 1
  69.         button.1 = "Hangup"
  70.         call VRMessageStem VRWindow(), "msg.","Dialer","N","button.",1,1
  71.  
  72.     /* Issue hangup command to modem */
  73.     RC = lineout(COMPort, HangupString)
  74.     if RC \= 0 then
  75.      do
  76.         msg.0 = 3
  77.         msg.1 = "Hanging up ..."
  78.         msg.2 = "lineout("COMPort",'"HangupString"') returned code:" RC
  79.         msg.3 = ""
  80.         button.0 = 1
  81.         button.1 = "Continue"
  82.         call VRMessageStem VRWindow(), "msg.","Dialer. Error","N","button.",1,1
  83.       end
  84.  
  85.  
  86.     RC = stream(COMPort, "C", "CLOSE")
  87.         
  88.     call postSender "done"
  89.         
  90. exit
  91.  
  92. /*:VRX         Halt
  93. */
  94. Halt:
  95.     call postSender "halted"
  96. exit
  97.  
  98. /*:VRX         postSender
  99. */
  100. postSender: 
  101.     call VRMethod "Application", "PostQueue", 0,1, "call dialerDone", "status", arg(1)
  102. return
  103.  
  104.