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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modem Dialling

Status
Not open for further replies.

treeshark

Programmer
Jan 8, 2003
3
CA
Hi folks,

I've only just found this forum and it seems excellent although i've looked thro it and cannot find any references to my problem. This is going to sound like an awfully dumb question. I would like to read in a file of phone numbers and 'test call' them i.e. see if they connect or are answered (cannot guarantee type of number PSTN/FAX etc). I wanted to use the Dialling Directory as its already got a nice user interface. I came up with the below code, but it doesn't seem to use the GUI and it also uses the default 'Direct Connect-Telnet' and doesn't dial. I can't find any references to 'Set Dialentry Connection'. Am I going about this the hard way?

Heres what I have so far..


'-----------------------
#include "funcproc.inc"

string sFname, sPath, sGroup


Proc Main

; GetInputs()
sPath="D:\"
sFname="in.txt"
ReadFileToGroup()
DialGroup()
DeleteGroup()

Endproc
'-----------------------


Proc GetInputs
String sFileSpec
sFileSpec="D:\"

dir sFileSpec sFname
if SUCCESS
statmsg sFname
getpathname sPath sFname
getfilename sFname sFname
else
exit
endif
Endproc
'-----------------------


Proc ReadFileToGroup
String sStat, sLine, sEntry
Integer iFnum, iGrpNm, iLen


iFnum=1
iGrpNm=1
sGroup="Test"

sStat=OpenFile(sFname, sPath, "read", iFnum)
if stricmp sStat "OK"
dialadd DATA GROUP sGroup ;Add New groupname

while not feof(iFnum)
sLine=ReadFile(iFnum)
strlen sLine iLen
if iLen > 2

strfmt sEntry "%d" iGrpNm ;Create a name for the entry
dialadd DATA sEntry
set dialentry access sEntry ;Allows access to entry
set dialentry phonenumber DATA sLine ;set the number for the entry
set dialentry calltype LOCAL ;defines connection

; set dialentry connection "Sportster 28.8-Auto-Com"
;would be noce but command doesnt exist

dialinsert DATA sGroup sEntry ;Insert new entry into group sGroup

endif
iGrpNm++
endwhile
fclose 1
dialsave ;save this new group to the existing dial directory
endif
Endproc
'-----------------------

Proc DialGroup

dial DATA GROUP sGroup CONNECTALL

Endproc
'-----------------------



Proc DeleteGroup

dialdelete DATA GROUP sGroup
dialsave

EndProc



 
To make Procomm use a specified modem, use the set modem connection command. For your particular modem, then command would be:

set modem connection "Sportster 28.8-Auto-Com"

assuming that is how the modem appears in the Quick Select Line at the bottom of the Procomm window (I assume there is a com port number that is not included in the string in your script). aspect@aspectscripting.com
 
Thanks very much, it works a treat.

However as this script may be copied to another P.C. (which may use a different modem) is there any way that I can identify what Modem is available, before I set the Modem Connection property.

I would like to include a log to show whether the call was successful or not but I dont know what type of number the test-call is. Can you give me any hints on how to achieve this? Do you somehow compare the recieved tone to saved .wav files? Or check for a Carrier?

Any help would be gratefully recieved.
Thanks again for the help already given.
 
Instead of specifying a name you can choose an index instead. Here is some text copied from the help file that explains the set modem connection command more fully:

set modem connection index | string | CURRENT | FIRST

Specifies the active data modem connection. Either a zero-based index, or the name of a data modem connection in the Current Modem/Connection list in Setup, System, Modem Connection may be used. This command will fail if an attempt is made to set a Connection Directory entry to "direct connect-none", "direct connect-Telnet", or a modem/connection that has incnctlist set to OFF. This command will also fail if you specify a modem/connection that has incnctlist set to OFF. fetch returns the contents of the Current Modem/Connection field in a string.

Please note that the index value for TAPI connections begins at 10, even though TAPI connections may be displayed at the top of the Current Modem/Connection list. Other connections have zero-based indexes. For example, "direct connect-none" is always index 0, followed in order by the other connections in the list.
The CURRENT and FIRST keywords are valid only for a specified Connection Directory entry. The FIRST keyword is valid only when accessing a Fax entry.

As for determining if a particular number answered, I don't believe ASPECT has the ability to do that well. You could check the value of $CARRIER after you have dialed the number. If $CARRIER was one, then you know you connected to a data modem. However, there would be no way to differentiate between a voice, fax, or no answer connection. This is mostly due to Procomm being dependent on TAPI (the method Windows uses to communicate to modems) instead of talking directly to the modem. Some of this would also be dependent on your modem supporting the required functionality. I would recommend using another piece of software that is able to differentiate between the different types of connections you wish to check for. Unfortunately, I am not familiar with any products off the top of my head.
aspect@aspectscripting.com
 
Thanks again,
Your comments have been very helpful, I'll go away and scratch my head for a bit now.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top