Hello all -
I've looked through the postings and didn't find anything that answered my question, so I'll put it out to you...
I am writing a phone forwarding system for a hotline. The hotline number is forwarded to different volunteer's home telephones based on the time of day. I have an Access Database that holds the schedule and generates a text file that defines the telephone number that it should be forwarded to. Procomm looks at that textfile during the script.
This system picks up the hotline phone line at certain times of the days and:
1. Cancels call forwarding.
2. Dials the new person's number.
3. Dials it again if they are on the line.
My problem is that the line won't dial the number. Am I using the ATDT command correctly? I don't need to wait for confirmation that the call is picked up, I just need to wait for 5 seconds after the dialed digits are finished. My script just blows through quickly without actually dialing the numbers.
Thanks so much in advance.
-Kim
-----------------------------------------
string DialIt, TimeStmp ;Global Variable
;---------------------------------------------------------------------------------------------
; Main Procedure looks through the extracted file for the specific number to dial based
; on Day and AM or PM schedule. This file is generated from the Access Form by clicking
; the Activate Changes Button. Created file: c:\fcdtc\sched.txt
;---------------------------------------------------------------------------------------------
proc main
string sLine, sDay1, sNumber1
DialIt = "EMPTY" ;Initialize DialIt variable
call SetDate ;Set Date Variables for Log File
fopen 0 "c:\fcdtc\sched.txt" READ TEXT ;Open our data file
if strfind DialIt "EMPTY" ;While no match has been made
while not feof 0 ;While the file still has data
fgets 0 sLine ;Read a line of data
strtok sDay1 sLine "," 1 ;Get the first field - Day & Time
strtok sNumber1 sLine "," 1 ;Get the second field - Telephone Number
if strfind sDay1 S0 ;Look for MON_AM
DialIt = sNumber1 ;This is the number to dial
call MakeCall ;Send the number to MakeCall Procedure
endif
endwhile
endif
fclose 0
if strfind DialIt "EMPTY"
usermsg "Can't Find Phone Number in File - Reactivate From Access"
fopen 1 "c:\fcdtc\log.txt" APPEND ;Write Failure Line in Log File
fputs 1 "FAILURE "
fputs 1 "When: "
fputs 1 TimeStmp
fputs 1 " Variable Sent: "
fputs 1 S0
fclose 1
fopen 1 "c:\fcdtc\log.txt" APPEND TEXT
fputs 1 " No Data From Access File"
fclose 1
endif
endproc
proc SetDate
integer iDay, iMonth, iYear, iHour, iMin, iSec
ltimeints $LTIME iYear iMonth iDay iHour iMin iSec
strfmt TimeStmp "%02d %02d %d %02d:%02d" iMonth iDay iYear iHour iMin
endproc
;-------------------------------------------------------------------------------------------
; MakeCall Procedure clears the line from previous forward, dials the new number
; pauses for 10 seconds, redials it (incase the line is busy, then hangs up the line.
;-------------------------------------------------------------------------------------------
proc MakeCall
commandmode on ;Take control of the modem
if success
transmit "ATDT#72,," ;Clear the forward
transmit "^M"
transmit "ATH" ;Hangup
transmit "^M"
transmit "ATDT,#73,," ;Forward to the new number
transmit DialIt
transmit "^M"
pause 3
transmit "ATH" ;Hangup
transmit "^M"
transmit "ATDT#73,," ;Do it again in case line is busy
transmit DialIt
transmit "^M"
pause 5
transmit "ATH" ;Hangup
transmit "^M"
commandmode off
fopen 1 "c:\fcdtc\log.txt" APPEND ;Write Success Line in Log File
fputs 1 "SUCCESS "
fputs 1 "When: "
fputs 1 TimeStmp
fputs 1 " Variable Sent: "
fputs 1 S0
fputs 1 " Number Dialed: "
fclose 1
fopen 1 "c:\fcdtc\log.txt" APPEND TEXT
fputs 1 DialIt
fclose 1
else
usermsg "MODEM NOT RESPONDING" ;Modem is inaccessible, display error message
fopen 1 "c:\fcdtc\log.txt" APPEND ;Write Failure Line in Log File
fputs 1 "FAILURE "
fputs 1 "When: "
fputs 1 TimeStmp
fclose 1
fopen 1 "c:\fcdtc\log.txt" APPEND TEXT
fputs 1 " Modem Not Responding"
fclose 1
endif
endproc
I've looked through the postings and didn't find anything that answered my question, so I'll put it out to you...
I am writing a phone forwarding system for a hotline. The hotline number is forwarded to different volunteer's home telephones based on the time of day. I have an Access Database that holds the schedule and generates a text file that defines the telephone number that it should be forwarded to. Procomm looks at that textfile during the script.
This system picks up the hotline phone line at certain times of the days and:
1. Cancels call forwarding.
2. Dials the new person's number.
3. Dials it again if they are on the line.
My problem is that the line won't dial the number. Am I using the ATDT command correctly? I don't need to wait for confirmation that the call is picked up, I just need to wait for 5 seconds after the dialed digits are finished. My script just blows through quickly without actually dialing the numbers.
Thanks so much in advance.
-Kim
-----------------------------------------
string DialIt, TimeStmp ;Global Variable
;---------------------------------------------------------------------------------------------
; Main Procedure looks through the extracted file for the specific number to dial based
; on Day and AM or PM schedule. This file is generated from the Access Form by clicking
; the Activate Changes Button. Created file: c:\fcdtc\sched.txt
;---------------------------------------------------------------------------------------------
proc main
string sLine, sDay1, sNumber1
DialIt = "EMPTY" ;Initialize DialIt variable
call SetDate ;Set Date Variables for Log File
fopen 0 "c:\fcdtc\sched.txt" READ TEXT ;Open our data file
if strfind DialIt "EMPTY" ;While no match has been made
while not feof 0 ;While the file still has data
fgets 0 sLine ;Read a line of data
strtok sDay1 sLine "," 1 ;Get the first field - Day & Time
strtok sNumber1 sLine "," 1 ;Get the second field - Telephone Number
if strfind sDay1 S0 ;Look for MON_AM
DialIt = sNumber1 ;This is the number to dial
call MakeCall ;Send the number to MakeCall Procedure
endif
endwhile
endif
fclose 0
if strfind DialIt "EMPTY"
usermsg "Can't Find Phone Number in File - Reactivate From Access"
fopen 1 "c:\fcdtc\log.txt" APPEND ;Write Failure Line in Log File
fputs 1 "FAILURE "
fputs 1 "When: "
fputs 1 TimeStmp
fputs 1 " Variable Sent: "
fputs 1 S0
fclose 1
fopen 1 "c:\fcdtc\log.txt" APPEND TEXT
fputs 1 " No Data From Access File"
fclose 1
endif
endproc
proc SetDate
integer iDay, iMonth, iYear, iHour, iMin, iSec
ltimeints $LTIME iYear iMonth iDay iHour iMin iSec
strfmt TimeStmp "%02d %02d %d %02d:%02d" iMonth iDay iYear iHour iMin
endproc
;-------------------------------------------------------------------------------------------
; MakeCall Procedure clears the line from previous forward, dials the new number
; pauses for 10 seconds, redials it (incase the line is busy, then hangs up the line.
;-------------------------------------------------------------------------------------------
proc MakeCall
commandmode on ;Take control of the modem
if success
transmit "ATDT#72,," ;Clear the forward
transmit "^M"
transmit "ATH" ;Hangup
transmit "^M"
transmit "ATDT,#73,," ;Forward to the new number
transmit DialIt
transmit "^M"
pause 3
transmit "ATH" ;Hangup
transmit "^M"
transmit "ATDT#73,," ;Do it again in case line is busy
transmit DialIt
transmit "^M"
pause 5
transmit "ATH" ;Hangup
transmit "^M"
commandmode off
fopen 1 "c:\fcdtc\log.txt" APPEND ;Write Success Line in Log File
fputs 1 "SUCCESS "
fputs 1 "When: "
fputs 1 TimeStmp
fputs 1 " Variable Sent: "
fputs 1 S0
fputs 1 " Number Dialed: "
fclose 1
fopen 1 "c:\fcdtc\log.txt" APPEND TEXT
fputs 1 DialIt
fclose 1
else
usermsg "MODEM NOT RESPONDING" ;Modem is inaccessible, display error message
fopen 1 "c:\fcdtc\log.txt" APPEND ;Write Failure Line in Log File
fputs 1 "FAILURE "
fputs 1 "When: "
fputs 1 TimeStmp
fclose 1
fopen 1 "c:\fcdtc\log.txt" APPEND TEXT
fputs 1 " Modem Not Responding"
fclose 1
endif
endproc