bash script to connect with Indian mobile networks.
Reference & Credit - http://forums.debian.net/viewtopic.php?f=5&t=74246
#!/bin/bash
#
# A bash script to connect with Indian mobile networks.
#
# This script is tested with Teracom device (Model no. LW273) only, and might
# not work with other devices because of the differences in AT commands.
#
usage() {
echo "Usage: wv-connect.sh <APN> [TECH]"
echo
echo "Where, APN should be:"
echo
echo " bsnlnet = BSNL"
echo " www = Vodafone India"
echo " internet = Idea Cellular"
echo " TATA.DOCOMO.INTERNET = Tata Docomo"
echo
echo "check with your mobile provider for the valid APN"
echo
echo "and, opetionally TECH can be:"
echo
echo " umts = UMTS mode (3G)"
echo " edge = EDGE mode (2G)"
echo " auto = Automatic"
echo
echo "For example, to connect to BSNL 3G network"
echo
echo " wv-connect.sh bsnlnet umts"
echo
echo "This script is tested with Teracom (LW273/LW272) devices only."
exit
}
nodev() {
echo "ERROR: No device."
exit
}
nowvdial() {
echo "ERROR: wvdial is not installed."
exit
}
test "$1" && APN="$1" || usage
test "$2" && TECH="$2" || TECH="auto"
WVDIAL=`which wvdial`
DEVICE="/dev/ttyACM0"
case "$TECH" in
umts) FUN=6;;
edge) FUN=5;;
auto) FUN=1;;
*) usage;;
esac
test -c $DEVICE || nodev
test -f $WVDIAL || nowvdial
cat <<EOT > /tmp/wvdial-gsm.conf
[Dialer Defaults]
Modem Type = USB Modem
Modem = $DEVICE
Baud = 460800
Stupid Mode = 1
Phone = *99#
Username = " "
Password = " "
Init1 = AT
Init2 = AT&F
Init3 = AT+CFUN=$FUN
Init4 = AT+CGDCONT=1,"IP","$APN"
EOT
$WVDIAL -C /tmp/wvdial-gsm.conf
|