1#!/bin/sh
2#
3# description: dial and try to connect to internet
4
5# parameters of dial. Change as needed.
6DEVICE=$1
7TELEPHONE=$2           # The telephone number for the connection ex:*99***1#
8ACCOUNT=$3              # The account name for logon	
9PASSWORD=$4     				# The password for this account
10AUTHENTICATION=$5				# The authentication protocal
11export COLUMNS=256
12
13#added by qiao for wcdma only to same as windows
14#evdo #777
15if [ "$2" = "" ]; then
16        TELEPHONE="*99***1#"
17fi
18
19if [ "$5" = "" ]; then
20        LOCAL_IP=0.0.0.0
21else
22        LOCAL_IP=$5
23fi
24
25if [ "$6" = "" ]; then
26        REMOTE_IP=0.0.0.0
27else
28        REMOTE_IP=$6
29fi
30
31if [ ! "$7" = "" ]; then
32	USEPEERDNS=''
33	for NAMESERVER in `echo $7 | awk -F: '{for (i=1;i<=NF;i++) print $i}'`
34	do
35        	echo "nameserver $NAMESERVER" >> /etc/ppp/resolv.conf
36	done
37else
38	USEPEERDNS='usepeerdns'
39fi
40
41NETMASK=255.255.255.0	# The proper netmask if needed
42#
43# Export them so that they will be available at 'con-script' time.
44export TELEPHONE APN ACCOUNT PASSWORD 
45# 
46# This is the location of the script which dials the phone and logs
47# in.  Please use the absolute file name as the $PATH variable is not
48# used on the connect option.  (To do so on a 'root' account would be
49# a security hole so don't ask.)
50#
51DIALER_SCRIPT=/usr/local/lcDial/etc/ppp/con-script
52CLOSE_SCRIPT=/usr/local/lcDial/etc/ppp/discon-script
53# Initiate the connection
54# 
55# I put most of the common options on this command. Please, don't
56# forget the 'lock' option or some programs such as mgetty will not
57# work. The asyncmap and escape will permit the PPP link to work with
58# a telnet or rlogin connection. You are welcome to make any changes
59# as desired. Don't use the 'defaultroute' option if you currently
60# have a default route to an ethernet gateway.
61#
62/sbin/route del default
63
64/usr/local/lcDial/sbin/pppd linkname LcPhone $AUTHENTICATION lock crtscts modem $DEVICE 115200 $USEPEERDNS noauth noipdefault defaultroute name "$ACCOUNT" password "$PASSWORD" connect $DIALER_SCRIPT disconnect $CLOSE_SCRIPT 
65