[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

phone dialer



I already lost a day searching for a free phone dialer and since simple
scripting is not enough (i.e. echo "ATDT3483545" >> /dev/modem)
I build a simple awk script that utilizes cu (apt-get install cu)
and it works with kaddressbook :-).

The script requires cu and kdialog but it is simple enough to change it
to use gdialog if you are GNOME fun or even simple dialog or just
getchar() (getline in awk) if need be.

The script skips local codes from the same area. Just change the
0030 to your country code if you are not from Greece. I don't know
how to get the current area code from Linux/Debian/KDE but probably
is not correctly setup anyway. Similarly you can change your modem's
init script.

The usage is
prompt$>dial 784678465
and you press ok when the connection is established

From the kaddressbook you have to go
Settings/Configure KaddressBook/AddressBook/General/Script-Hooks
and type in
            dial %N

Future TODOs:
-guess area code
-guess terminal type (X, KDE, GNOME, noX)
-specify modem device, init string, area, dialog type in the command line
-use bidirectional input in order to avoid sleep(1) maybe to small may be
to big. This looks next to impossible. The manual of cu says under BUGS:
"This program does not work very well" and I couldn't agree more.

And here is the script. Have fun with instant dialings from kaddressbook

#!/usr/bin/awk -f

BEGIN {
    telephone = ARGV[1];
    gsub("[ \t]", "", telephone);
    sub("^0030", "", telephone);
    cu = "cu -l modem";
    print "AT S7=45 S0=0 L3 V1 X0 &c1 E1 Q0\r" | cu;
    system("sleep 1");
    printf("ATDT %s\r", telephone) | cu;
    dialog = sprintf("kdialog --msgbox \"Dialing %s. Press OK on connection\"", telephone);
    system(dialog);
}

PS:
Please for any replies CC me since I am not in the debian-user nor in debian-KDE.



Reply to: