ppp-on-dialer-org 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/sh
  2. auto_apn_conf="/root/ppp/auto-apn.conf"
  3. c3g_gprs_conf="/root/ppp/3g-gprs.conf"
  4. sim-auth -f "$c3g_gprs_conf" &>/dev/null
  5. auto-apn &>/dev/null
  6. if [ -f "$auto_apn_conf" ]; then
  7. source "$auto_apn_conf"
  8. fi
  9. if [ -f "$c3g_gprs_conf" ]; then
  10. source "$c3g_gprs_conf"
  11. fi
  12. #
  13. # This is part 2 of the ppp-on script. It will perform the connection
  14. # protocol for the desired connection.
  15. #
  16. if [ "$ACCOUNT" == "" ] || [ "$PASSWORD" == "" ]; then
  17. exec /root/ppp/chat -v \
  18. SAY "BEGIN\n" \
  19. TIMEOUT 22 \
  20. ECHO ON \
  21. ABORT '\nBUSY\r' \
  22. ABORT '\nERROR\r' \
  23. ABORT '\nNO ANSWER\r' \
  24. ABORT '\nNO CARRIER\r' \
  25. ABORT '\nNO DIALTONE\r' \
  26. ABORT '\nRINGING\r\n\r\nRINGING\r' \
  27. SAY "Press CTRL-C to close the connection at any stage!" \
  28. SAY "\ndefining PDP context...\n" \
  29. "" \\d \
  30. "" "AT+CPIN?" \
  31. TIMEOUT 5 \
  32. READY-AT+CPIN=\"$PIN\"-OK "AT" \
  33. OK \\d\\d\\d \
  34. "" "ATZ" \
  35. OK "ATE1" \
  36. OK "AT+CGDCONT=1,\"IP\",\"$APN\" " \
  37. OK \\d\\d\\d \
  38. "" "AT+CFUN=1" \
  39. OK "AT+CGDATA=\"ppp\",1" \
  40. TIMEOUT 22 \
  41. OK \\d\\d\\d \
  42. "" ATD$TELEPHONE \
  43. TIMEOUT 22 \
  44. SAY "\nwaiting for connect...\n" \
  45. CONNECT "" \
  46. SAY "\nConnected." \
  47. SAY "\nIf the following ppp negotiations fail,\n" \
  48. SAY "try restarting the phone.\n"
  49. else
  50. exec /root/ppp/chat -v \
  51. SAY "BEGIN\n" \
  52. TIMEOUT 22 \
  53. ECHO ON \
  54. ABORT '\nBUSY\r' \
  55. ABORT '\nERROR\r' \
  56. ABORT '\nNO ANSWER\r' \
  57. ABORT '\nNO CARRIER\r' \
  58. ABORT '\nNO DIALTONE\r' \
  59. ABORT '\nRINGING\r\n\r\nRINGING\r' \
  60. SAY "Press CTRL-C to close the connection at any stage!" \
  61. SAY "\ndefining PDP context...\n" \
  62. "" \\d \
  63. "" "AT+CPIN?" \
  64. TIMEOUT 5 \
  65. READY-AT+CPIN=\"$PIN\"-OK "AT" \
  66. OK \\d\\d\\d \
  67. "" "ATZ" \
  68. OK "ATE1" \
  69. OK "AT+CGDCONT=1,\"IP\",\"$APN\" " \
  70. OK \\d\\d\\d \
  71. "" "AT+CFUN=1" \
  72. OK "AT+CGDATA=\"ppp\",1" \
  73. TIMEOUT 22 \
  74. OK \\d\\d\\d \
  75. "" ATD$TELEPHONE \
  76. TIMEOUT 22 \
  77. SAY "\nwaiting for connect...\n" \
  78. CONNECT "" \
  79. #ogin:--ogin: $ACCOUNT \
  80. #assword: $PASSWORD
  81. fi