#!/bin/bash # Version 0.04 # modem-dial # (C)Tue Jun 3 2008 Transtronics, Inc. # Karl Schmidt # http://www.xtronics.com # GNU General Public License (GPL) Version 3, June 1991 # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . # device is your modem DEVICE="/dev/modem" #Your areacode AREA="785" #AT dial string - most will want just "AT DT" LINE="AT DT9," HANGUP="atho" RESET="atz" # Put your special ointment here - runt it twice to test - s11 can speeds up the dialing CONFIG="at S11=45 S8=1" #in jpilot set your 'Dial Command' to "~/bin/modem-dial %n" #,.,.,.,.,.,.,.,.,. DSTRING=$1 # strip anything that isn't a digit DSTRING="${DSTRING//[![:digit:]]/}" #Strip off the 1 before area code DSTRING="${DSTRING##1}" #The next line was grabbed after minicom started and then exited. For some reason, this script won't work after boot until minicom has run once? # If you know why please email karl@xtronics.com Not yet sure this line will work - not going to reboot right now. stty -F $DEVICE 2102:5:800018b1:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0 # is this in your area code? if [ "$DSTRING" != "${DSTRING#$AREA}" ] then # strip Area code DSTRING="${DSTRING##$AREA}" #dial local number echo -n -e $LINE$DSTRING"\r" > $DEVICE else echo -n -e $LINE"1"$DSTRING"\r" > $DEVICE fi sleep 9 echo -n -e $HANGUP"\r" > $DEVICE echo -n -e $RESET"\r" > $DEVICE #Yes the config is at the end - so most of the time it will be quicker to dial echo -n -e $CONFIG"\r" > $DEVICE #echo $DSTRING exit = 0