Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Nov 2001 01:48:31 +0000 (GMT)
From:      Andrew Gordon <arg-bsd@arg1.demon.co.uk>
To:        Leif Neland <leifn@neland.dk>
Cc:        <freebsd-isdn@FreeBSD.ORG>
Subject:   Re: bidirectional /dev/i4btel0 ?
Message-ID:  <20011126011737.K43742-100000@server.arg.sj.co.uk>
In-Reply-To: <20011125182631.U50532-100000@arnold.neland.dk>

next in thread | previous in thread | raw e-mail | index | archive | help


On Sun, 25 Nov 2001, Leif Neland wrote:
> On Sun, 25 Nov 2001, Andrew Gordon wrote:
> > > On Friday 23 November 2001 13:04, Leif Neland wrote:
> > > > Is it somehow possible to both be sending and recieving from
> > > > /dev/i4btel0?
> > > >
> > > > I would like to send voice to the caller, while also recieving
> > > > data, eventually decoding with dtmfdecode to make a
> > > > voice-response system.
> > > >
> > > > dd of=${DEVICE} if=${LIBDIR}/leifans.al bs=2k  >/tmp/out.log
> > > > 2>&1 & sleep 2
> > > > dd if=${DEVICE} of=/tmp/answers.al bs=2k count=100
> > > > >/tmp/in.log 2>&1
> >
> > Doing this with two independent processes is never going to work usefully,
> > due to the need to synchronize the transmit with the receive (eg. you want
> > the outgoing message to stop and switch to the next action immediately on
> > decoding a DTMF key, not some seconds later).
>
> My idea was sampling the input in say 0.5 secs, then run dtfmdecode to see
> if a key was pressed. If so, then kill the backgrounded process. If not,
> loop back and sample again.
>
> But as the simple test above didn't work, there was no reason to develop
> further.


You can fix your original problem by opening the device once and passing
the file descriptor to the child processes.  From a shell script, this
will work:


{ dd if=${LIBDIR}/msg.al bs=2k &
  dd of=/tmp/record bs=2k ; } <>${DEVICE} 1>&0 2>>${LOGFILE}


Or even:

{ dd if=${LIBDIR}/longmsg.al bs=2k &
  /usr/sbin/dtmfdecode -1 1>/tmp/digit
  kill $!
  DIGIT=`cat /tmp/digit`
  dd if=${LIBDIR}/${DIGIT}.al ; } <>${DEVICE} 1>&0 2>>${LOGFILE}


These both work (I slapped them into the middle of /etc/isdn/tell.sh for
test purposes), but suffer from the fact that the output dd process will
fill up the driver's output buffer with the outgoing message, and it will
take a while for the output to drain when you go to kill the 'dd' process.



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-isdn" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011126011737.K43742-100000>