Subject: Re: How to use DTMF in TCL! - DN [1]


dhagberg@my-dejanews.com - 20 May 1999 - comp.lang.tcl

 In article <7hrrnb$t5h$1@holly.prod.itd.earthlink.net>,
   "Vincent Bandille" <vinband@earthlink.net> wrote:
 > HELP!
 >
 > I need to write a script in TCL that will send a page via DTMF. Being
 > completely brand new to TCL, I'm having a hard time determining just
 how I
 > should go about this.

 Assuming you are using a modem on a serial port, say /dev/term/a
 (Solaris) or com1: (Win32), something like the following should
 work, :

     set devname   "/dev/term/a"
     set phonenum  "888-8888"
     set commas1    ",,,,"     ;# most modems delay 2 secs per ,
     set message   "999"
     set commas2    ","
     set end       "#"        ;# most paging svcs expect # to end msg
     set pauseSecs 30

     set port [open $devname RDWR]
     fconfigure $port -mode 9600,n,8,1
     puts -nonewline $port "ATDT$phonenum$commas1$message$commas2$end;\r"
     after [expr {$pauseSecs*1000}]
     close $port

 The ";" at the end of the dial string should return an OK
 immediately, though this code does nothing to read.

 You could do more interesting stuff with fileevent if your modem
 could detect tones and hangups on the remote end, rather than just
 waiting a fixed amount of time.  That's a *much* harder problem,
 though.

 --== Sent via Deja.com http://www.deja.com/ ==--
 ---Share what you know. Learn what you don't.---

Last modified
1999-09-27

(195.108.246.50)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated