Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Answer Incoming Call through Script

Status
Not open for further replies.

CBIN

Programmer
Sep 17, 2003
21
0
0
US
Hello Knob & Everyone,

Hope I'm not repeating this question.
My requirement is to transfer files when a caller dials in.

I have set Procomm in auto-answer mode. After it is connected, the following script does the work for me.

Instead, I would like to automate by having a script running and waiting for call.
Can someone help me with this script.

*****************************
string InFile
string OutFile

proc main
integer XferProgress

Initialize()
pause 2
getfile XMODEM InFile
XferProgress=$XFERSTATUS
while XferProgress==1
yield
XferProgress=$XFERSTATUS
endwhile
pause 2
if XferProgress==2
usermsg "File downloaded successfully"
Cleanup()
else
usermsg "Failed to download file, try again..."
Cleanup()
endif
endproc

proc Initialize
strfmt InFile "E:\ProComm\Download\Mail_In.New"
strfmt OutFile "E:\ProComm\Download\Mail_Out.New"
if isfile InFile
delfile InFile
endif
endproc

proc Cleanup
exit
endproc
****************************

Thanks in advance for your help.
 
If Procomm is already in auto-answer mode, all you will need to do is add these lines to the beginning of the script:

while ($CARRIER == 0)
yield
endwhile

This will have your script loop until $CARRIER = 1, indicating a connection is established. The while loop will then be exited and the rest of your script can proceed.


 
Appreciate your help, Thanks Knob.

 
Knob,

In the settings, Options | Answer Options | Procomm plus Answers Calls is set.
The call is answered by procomm automatically. But the script does not execute unless I manually start the script for the second call.

After the cleanup() in the above script, should I add something else to keep it running all the time even after hanging up the call(from my side or the other side).

 
Okay got it, I put an execute command after the clean up. Its working now.
This is like a circular reference. Is this correct or is there anyother way to keep this script running.

Thanks.
 
Knob,

This is how my script looks now.

------------------------------

string InFile
string OutFile
string OutEFile

proc main
integer XferProgress
integer SndProgress
integer ErdSndProgress
while ($CARRIER == 0)
yield
endwhile

Initialize()
pause 2
getfile XMODEM InFile
XferProgress=$XFERSTATUS
while XferProgress==1
yield
XferProgress=$XFERSTATUS
endwhile
pause 2
if XferProgress==2
usermsg "File downloaded successfully"
pause 2
sendfile XMODEM OutFile
SndProgress=$XFERSTATUS
while SndProgress==1
yield
SndProgress=$XFERSTATUS
endwhile
pause 2
if SndProgress==2
usermsg "Message File uploaded successfully"
Cleanup()
execute "download.wax"
endif
else
usermsg "Failed to download file, try again..."
sendfile XMODEM OutEFile
ErdSndProgress=$XFERSTATUS
while ErdSndProgress==1
yield
ErdSndProgress=$XFERSTATUS
endwhile
pause 2
if ErdSndProgress==2
usermsg "Error File uploaded successfully"
Cleanup()
execute "download.wax"
endif
endif

endproc

proc Initialize

strfmt InFile "E:\ProComm\Download\Mail_In.New"
strfmt OutFile "E:\ProComm\Download\Mail_Out.New"
strfmt OutEFile "E:\ProComm\Download\EMail_Out.New"
if isfile InFile
delfile InFile
endif
endproc

proc Cleanup
hangup
endproc

-------------------------

Thanks
 
OK, so I take it that the script you posted is download.was, so the script is calling itself since you want it to continually be able to answer phone calls? If so, add while 1 just before your while ($CARRIER == 0) command and an endwhile just before the endproc of the main procedure (you can also get rid of the execute command). This will cause your script to loop back to the beginning of the main procedure after each call.

 
It does, Thanks Knob. I appreciate all the help that you provided me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top