123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- MAX_ATTEMPTS=10
- SLEEP_DELAY=15s
- PHONE1=555-1212
- PHONE2=411
- ACCOUNT=my_account_name
- PASSWORD=my_password
- function initialize
- {
- chat -v TIMEOUT 3 '' AT 'OK-+++\c-OK'
- return
- }
- function callnumber
- {
- chat -v \
- ABORT '\nBUSY\r' \
- ABORT '\nNO ANSWER\r' \
- ABORT '\nRINGING\r\n\r\nRINGING\r' \
- '' ATDT$1 \
- CONNECT '' \
- ogin:--ogin: $ACCOUNT \
- assword: $PASSWORD
- if [ "$?" = "0" ]; then
- exit 0
- fi
- return
- }
- function callall
- {
- callnumber $PHONE1
- }
- initialize
- if [ ! "$?" = "0" ]; then
- exit 1
- fi
- attempt=0
- while : ; do
- attempt=`expr $attempt + 1`
- callall $attempt
- if [ "$attempt" = "$MAX_ATTEMPTS" ]; then
- exit 1
- fi
- sleep "$SLEEP_DELAY"
- done
|