> 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.
> 

Here is one I have used in the past. (This is the dialer script
to pass to diald).


------------------------------ dial.sh -------------------------

CHAT=/usr/bin/chat
USERNAME=guest
PASSWORD=guest
PRIMARY_PHONE=555-1212    # Information in the us, don't use!
BACKUP_PHONE=555-2323

function chat_connect () {
     /usr/sbin/chat -v                                  \
        TIMEOUT         3                               \
        ABORT           '\nBUSY\r'                      \
        ABORT           '\nNO ANSWER\r'                 \
        ABORT           '\nRINGING\r\n\r\nRINGING\r'    \
        ''              \rAT                            \
        'OK-+++\c-OK'   ATL0H0                          \
        TIMEOUT         30                              \
        OK              ATDT$PHONE                      \
        CONNECT         ''                              \
        name:--name:    $USERNAME                       \
        assword:        $PASSWORD                       \
        PPP             ''

      return $?
}


#
# Try the first number
#
PHONE=$PRIMARY_PHONE
echo `date` Dial Primary >> /tmp/dial.log
chat_connect
rc=$?
if [ $rc -eq 0 ] ; then
        #
        # we connected.  
        #
        echo `date` Connected to primary >> /tmp/dial.log
        exit 0
else
        echo `date` Primary Failed Code $rc >> /tmp/dial.log    
fi

#
# Try the backup number
#
PHONE=$BACKUP_PHONE
echo `date` Dial Backup >> /tmp/dial.log
chat_connect
rc=$?
if [ $rc -eq 0 ] ; then
        #
        # we connected.  
        #
        echo `date` Connected to backup >> /tmp/dial.log
        exit 0
else
        echo `date` Primary Failed Code $rc >> /tmp/dial.log    
fi
return $rc

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

-- cary
Cary O'Brien
[EMAIL PROTECTED]

-
To unsubscribe from this list: send the line "unsubscribe linux-diald" in
the body of a message to [EMAIL PROTECTED]

Reply via email to