> 
> Hi,
> 
> Does anyone know how you setup diald to use multiple phone numbers. We're
> based in a 4th world country where phone services are hardly bearable at the
> best of times....and need to setup extra numbers for when problems occur.
> 

The trick is to have the chat script try multiple phone numbers till
it gets one that works.  Something like this...


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

------------------------------------------------- snip -----------------------------

Good luck,

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