Hi,
I don't know if you have already solved your problem. So here is a script
written with expect which give you more control on your script than chat. I
know some people don't like tcl but Expect is so powerful.
----------------- ispdialer.exp ----------------------
#!/usr/bin/expect --
#send logging and debugging messages to /var/log/messages
proc syslog {msg} {
global verbose
if {$verbose} {system "logger $msg"}
}
# turn on verbose
set verbose 1
# Set phones list numbers (replace phoneX with your differents isp numbers)
set phones {phone1 phone2 phone3}
set lmax [llength $phones]
#Set Stty to modem line (already open by pppd or diald for us)
stty < /dev/modem
# turn off expect logging
log_user 0
#Check the modem and do some initialisations (for me ATZ is enough )
set timeout 15
send_user "ATZ\r"
expect_user {
"ERROR" {
syslog "modem error"
exit(1)
}
"OK"
}
for {set count 0} {$count < $lmax} {incr $count} {
set p [lindex $phones $count]
syslog "Dialing...$p"
set timeout 30
send_user "AT M0 DT$p\r"
expect_user {
"ERROR" {
syslog "ERROR on dialing $p"
exit(1)
}
-re "BUSY" {
syslog "BUSY"
}
timeout {
syslog "timeout on dialing $p"
exit(1)
}
"CONNECT" break
}
}
# assuming that everything is fine
# log in procedure
syslog "Connected"
set timeout 30
#you can send a carriage return if your isp is messing around for login
#send_user "\r"
expect_user {
timeout exit(1)
"ogin"
}
syslog "logging in"
send_user "yourusername\r"
expect_user {
timeout exit(1)
"sword"
}
send_user "your_password\r"
expect_user {
timeout exit(1)
-re "(Invalid|Bad|Incorrect) login" exit(1)
-re "(>|:) " {
send_user "ppp\r"
exp_continue
}
"\}"
}
#that's all, go surfing
syslog "logger loggin succeeded"
exit
------------------ End of ispdialer.exp ---------------------------
I hope this will help you.
Regards
Georges Djonga
Nicholas Waltham a �crit :
> Hello,
> Could anyone tell me if there exists a more sofisticated chat
> program which I could use to get diald to try different phone numbers.
> The scenario is this. Our service provider has several numbers, some
> connect at a faster speed than others, while the slower ones are less
> frequently occupied. I would like diald to try and connect first using the
> faster phone lines, but if that fails, either due to line conditions or
> the number is busy, I would like it to try some of the other numbers. This
> was quite easy to do with Windows NT, but under Linux - I don't know what
> else I need.
>
> Thanks in advance,
> Nicholas Waltham
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-diald" in
> the body of a message to [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line "unsubscribe linux-diald" in
the body of a message to [EMAIL PROTECTED]