ppp-on-dialer-org 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 "AT+CFUN=1" \
  38. OK "AT+CGDATA=\"ppp\",1" \
  39. TIMEOUT 22 \
  40. OK \\d\\d\\d \
  41. "" ATD$TELEPHONE \
  42. TIMEOUT 22 \
  43. SAY "\nwaiting for connect...\n" \
  44. CONNECT "" \
  45. SAY "\nConnected." \
  46. SAY "\nIf the following ppp negotiations fail,\n" \
  47. SAY "try restarting the phone.\n"
  48. else
  49. exec /root/ppp/chat -v \
  50. SAY "BEGIN\n" \
  51. TIMEOUT 22 \
  52. ECHO ON \
  53. ABORT '\nBUSY\r' \
  54. ABORT '\nERROR\r' \
  55. ABORT '\nNO ANSWER\r' \
  56. ABORT '\nNO CARRIER\r' \
  57. ABORT '\nNO DIALTONE\r' \
  58. ABORT '\nRINGING\r\n\r\nRINGING\r' \
  59. SAY "Press CTRL-C to close the connection at any stage!" \
  60. SAY "\ndefining PDP context...\n" \
  61. "" \\d \
  62. "" "AT+CPIN?" \
  63. TIMEOUT 5 \
  64. READY-AT+CPIN=\"$PIN\"-OK "AT" \
  65. OK \\d\\d\\d \
  66. "" "ATZ" \
  67. OK "ATE1" \
  68. OK "AT+CGDCONT=1,\"IP\",\"$APN\" " \
  69. OK "AT+CFUN=1" \
  70. OK "AT+CGDATA=\"ppp\",1" \
  71. TIMEOUT 22 \
  72. OK \\d\\d\\d \
  73. "" ATD$TELEPHONE \
  74. TIMEOUT 22 \
  75. SAY "\nwaiting for connect...\n" \
  76. CONNECT "" \
  77. #ogin:--ogin: $ACCOUNT \
  78. #assword: $PASSWORD
  79. fi