1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #!/bin/sh
- auto_apn_conf="/root/ppp/auto-apn.conf"
- c3g_gprs_conf="/root/ppp/3g-gprs.conf"
- sim-auth -f "$c3g_gprs_conf" &>/dev/null
- auto-apn &>/dev/null
- if [ -f "$auto_apn_conf" ]; then
- source "$auto_apn_conf"
- fi
- if [ -f "$c3g_gprs_conf" ]; then
- source "$c3g_gprs_conf"
- fi
- #
- # This is part 2 of the ppp-on script. It will perform the connection
- # protocol for the desired connection.
- #
- if [ "$ACCOUNT" == "" ] || [ "$PASSWORD" == "" ]; then
- exec /root/ppp/chat -v \
- SAY "BEGIN\n" \
- TIMEOUT 22 \
- ECHO ON \
- ABORT '\nBUSY\r' \
- ABORT '\nERROR\r' \
- ABORT '\nNO ANSWER\r' \
- ABORT '\nNO CARRIER\r' \
- ABORT '\nNO DIALTONE\r' \
- ABORT '\nRINGING\r\n\r\nRINGING\r' \
- SAY "Press CTRL-C to close the connection at any stage!" \
- SAY "\ndefining PDP context...\n" \
- "" \\d \
- "" "AT+CPIN?" \
- TIMEOUT 5 \
- READY-AT+CPIN=\"$PIN\"-OK "AT" \
- OK \\d\\d\\d \
- "" "ATZ" \
- OK "ATE1" \
- OK "AT+CGDCONT=1,\"IP\",\"$APN\" " \
- OK \\d\\d\\d \
- "" "AT+CFUN=1" \
- OK "AT+CGDATA=\"ppp\",1" \
- TIMEOUT 22 \
- OK \\d\\d\\d \
- "" ATD$TELEPHONE \
- TIMEOUT 22 \
- SAY "\nwaiting for connect...\n" \
- CONNECT "" \
- SAY "\nConnected." \
- SAY "\nIf the following ppp negotiations fail,\n" \
- SAY "try restarting the phone.\n"
- else
- exec /root/ppp/chat -v \
- SAY "BEGIN\n" \
- TIMEOUT 22 \
- ECHO ON \
- ABORT '\nBUSY\r' \
- ABORT '\nERROR\r' \
- ABORT '\nNO ANSWER\r' \
- ABORT '\nNO CARRIER\r' \
- ABORT '\nNO DIALTONE\r' \
- ABORT '\nRINGING\r\n\r\nRINGING\r' \
- SAY "Press CTRL-C to close the connection at any stage!" \
- SAY "\ndefining PDP context...\n" \
- "" \\d \
- "" "AT+CPIN?" \
- TIMEOUT 5 \
- READY-AT+CPIN=\"$PIN\"-OK "AT" \
- OK \\d\\d\\d \
- "" "ATZ" \
- OK "ATE1" \
- OK "AT+CGDCONT=1,\"IP\",\"$APN\" " \
- OK \\d\\d\\d \
- "" "AT+CFUN=1" \
- OK "AT+CGDATA=\"ppp\",1" \
- TIMEOUT 22 \
- OK \\d\\d\\d \
- "" ATD$TELEPHONE \
- TIMEOUT 22 \
- SAY "\nwaiting for connect...\n" \
- CONNECT "" \
- #ogin:--ogin: $ACCOUNT \
- #assword: $PASSWORD
- fi
|