I think I see the solution. In aculab/trunk.cpp, starting at line 238:
case TRUNK_TIMER_EXPIRED:
trunkSignal(TRUNK_SIGNAL_TIMEOUT);
event->id = TRUNK_STOP_STATE;
goto retry;
This should be changed to:
case TRUNK_TIMER_EXPIRED:
if(!trunkSignal(TRUNK_SIGNAL_TIMEOUT))
trunkSignal(TRUNK_SIGNAL_STEP);
event->id = TRUNK_STOP_STATE;
goto retry;
It will then stop and step to the next statement when record times out.
This looks consistent with other drivers also.
address@hidden wrote:
>
>
>
> This is what we get on our system
>
> aculab(4,1): starting play of file
> '/usr/local/share/bayonne/sys/test/beep.au', bufsize=2048,format=7
> aculab(4,1): event 500 received aculab(4,1): playHandler - got event
> 500 aculab(4,1): stepHandler event 100 aculab(4,1): step 3
> record(=prefix,%rdir,%g,=maxtime,8) aculab(4,1): stepHandler event 303
> aculab(4,1): record aculab(4,1): starting record of file
> '/home/data/testmbox/pegasus-129-1114867667v2.au',
> bufsize=2048,format=7 aculab(4,1): event 401 received aculab(4,1):
> stepHandler event 100 aculab(4,1): step 3
> record(=prefix,%rdir,%g,=maxtime,8) aculab(4,1): stepHandler event 303
> aculab(4,1): record aculab(4,1): starting record of file
> '/home/data/testmbox/pegasus-129-1114867667v2.au',
> bufsize=2048,format=7 aculab(4,1): event 401 received aculab(4,1):
> stepHandler event 100 aculab(4,1): step 3
> record(=prefix,%rdir,%g,=maxtime,8) aculab(4,1): stepHandler event 303
> aculab(4,1): record aculab(4,1): starting record of file
> '/home/data/testmbox/pegasus-129-1114867667v2.au',
> bufsize=2048,format=7
>
>
> Mo
>
> On Apr 28 2005, David Sugar wrote:
>
>> Hmm...it looks to me the actual problem is actually simple. There is
>> only a dtmf handler and a stop state for exiting. If the stop state
>> is triggered, then the engine does not step but immediately falls back
>> to step state, and hence re-executes the record command all over
>> again. This sounds to me like what is happening based on what was
>> described.
>>
>> I would need to know exactly which event->id's are received in the
>> record state as it runs, but whichever one it is, it should do a
>> signal step to advance the interpreter. I would expect audio idle to
>> eventually come out, and it may make more sense to eliminate changing
>> to the step state on stop and dtmf handlers entirely, and then
>> fallback to the interpreter only on a AUDIO_IDLE, but it would be much
>> better to see the event sequence you do receive to be certain.
>>
>> address@hidden wrote:
>> > On Apr 27 2005, David Sugar wrote:
>> > >> Hmm...so you can build against 141?
>> >>
>> >> Perhaps tracing the record state in the aculab driver would help.
>> You >> can have it report each event->id it receives. Are you using a
>> >> timeout to set a maximum record duration? Does the timer go off?
>> >> What happens in the TRUNK_TIMER_EXPIRED handler in
>> >> aculab/record.cpp?
>> >>
>> >> Luca Bariani wrote:
>> >> > have you already posted this to bayonne-aculab mailing list?
>> >> > > Luca
>> >> > > >> First, we do not use DTK111 we use DTK141 with patch from >>
>> DTK140 that >> gives options of building drivers as Prosody2 (TiNG) or
>> >> Prosody 1, >> since we could not get dtk111 to load firmware onto
>> our >> boards.
>> >> >>
>> >> >> You only need to create sysmbolic link of ln -s >> >>
>> /usr/src/aculab/dtk141 dtk111 and bayonne will build >> >>
>> straightforward.
>> >> >>
>> >> >> In bayonne.conf we set firmware=/root/ets_supu.upr and it >>
>> downloaded >> the firmware ok, it will look for dtk111 this time under
>> >> >> /home/aculab/dtk111 , which is another symbolic link from dtk141.
>> >> >>
>> >> >>We made thousands of calls, most of them in bulk and everthing is
>> ok.
>> >> >>
>> >> >> We do have problem though of recording, it keep looping and >>
>> >> overwriting the audio and the script will not advance unless you
>> press >> >> #, however if we replace record with sleep the script will
>> complete.
>> >> >>
>> >> >> There has been similar problem with other drivers, I believe and
>> I >> was >> wondering those who have been running aculab resolved this
>> >> aculab >> recording issue we use bayonne-1.2.14
>> >> >>
>> >> >>We are getting similar problem with bayonne-1.2.8 which we have
>> run >> with
>> >> >>dialogic with great sucess.
>> >> >>
>> >> >>Your help will be very appriciated.
>> >> >>
>> >> >>Thanks,
>> >> >>
>> >> >>Mo
>> >> >>
>> >> >>
>> >> >>
>> >> >>_______________________________________________
>> >> >>Bayonne-devel mailing list
>> >> >>address@hidden
>> >> >>http://lists.gnu.org/mailman/listinfo/bayonne-devel
>> >> > > > > > > > _______________________________________________
>> >> > Bayonne-devel mailing list
>> >> > address@hidden
>> >> > http://lists.gnu.org/mailman/listinfo/bayonne-devel
>> > > > > > Source code of record.cpp in bayonne-1.2.14
>> > > > #include "driver.h"
>> > > #ifdef CCXX_NAMESPACES
>> > using namespace std;
>> > namespace ost {
>> > #endif
>> > > bool AculabTrunk::recordHandler(TrunkEvent *event)
>> > {
>> > struct tm *dt, tbuf;
>> > struct stat ino;
>> > char buffer[32];
>> > const char *ext;
>> > Audio::Info info;
>> > unsigned mask;
>> > > switch(event->id)
>> > {
>> > case TRUNK_STOP_STATE:
>> > endTimer();
>> > handler = &AculabTrunk::stepHandler;
>> > StopRecordFile();
>> > Trunk::flags.dsp=DSP_MODE_INACTIVE;
>> > return true;
>> > case TRUNK_DTMF_KEYUP:
>> > mask = (1 << event->parm.dtmf.digit);
>> > if(!(mask & data.record.term)) {
>> > return false;
>> > }
>> > endTimer();
>> > StopRecordFile();
>> > Trunk::flags.dsp=DSP_MODE_INACTIVE;
>> > trunkSignal(TRUNK_SIGNAL_STEP);
>> > handler = &AculabTrunk::stepHandler;
>> > return true;
>> > case TRUNK_ENTER_STATE:
>> > enterState("record");
>> > status[id] = 'r';
>> > > setTimer(data.record.timeout);
>> > if(data.record.term) {
>> > setDTMFDetect(true);
>> > }
>> > else {
>> > Trunk::setDTMFDetect();
>> > }
>> > > ext = strrchr(data.record.name, '/');
>> > if(!ext)
>> > ext = data.record.name;
>> > > ext = strrchr(ext, '.');
>> > > info.format = raw;
>> > info.encoding = mulawAudio;
>> > info.order = 0;
>> > info.annotation = (char *)data.record.annotation;
>> > info.rate = 8000;
>> > > if(!ext) {
>> > ext = data.record.extension;
>> > strcat(data.record.name, ext);
>> > }
>> > > if(!stricmp(ext, ".al")) {
>> > info.encoding = alawAudio;
>> > }
>> > else if(!stricmp(ext, ".au"))
>> > {
>> > info.format = sun;
>> > info.order = __BIG_ENDIAN;
>> > }
>> > else if(!stricmp(ext, ".wav"))
>> > {
>> > info.format = riff;
>> > info.order = __LITTLE_ENDIAN;
>> > }
>> > > close();
>> > > filename=data.record.name;
>> > > if(data.record.offset != (unsigned long)-1)
>> > {
>> > open(data.record.name);
>> > setPosition(data.record.offset);
>> > }
>> > else if(data.record.append)
>> > open(data.record.name);
>> > else
>> > create(data.record.name, &info);
>> > > setSymbol(SYM_OFFSET, "0");
>> > setSymbol(SYM_RECORDED, "0");
>> > > if(!isOpen())
>> > {
>> > slog(Slog::levelError) << name<<": >
>> "<<data.record.name << ": cannot open" << endl;
>> > setSymbol(SYM_ERROR, "record-failed");
>> > trunkSignal(TRUNK_SIGNAL_ERROR);
>> > handler = &AculabTrunk::stepHandler;
>> > return true;
>> > }
>> > if(data.record.append) {
>> > setPosition();
>> > }
>> > > dt = localtime_r(&ino.st_ctime, &tbuf);
>> > sprintf(buffer, "%04d%02d%02d,%02d%02d%02d",
>> > dt->tm_year + 1900, dt->tm_mon + 1,
>> > dt->tm_mday,
>> > dt->tm_hour, dt->tm_min, dt->tm_sec);
>> > setSymbol(SYM_CREATED, buffer);
>> > if(data.record.info)
>> > {
>> > sprintf(buffer, "%ld", getPosition());
>> > setSymbol(SYM_OFFSET, buffer);
>> > }
>> > else
>> > StartRecordFile();
>> > Trunk::flags.dsp=DSP_MODE_VOICE;
>> > return true;
>> > }
>> > return false;
>> > }
>> > > #ifdef CCXX_NAMESPACES
>> > };
>> > #endif
>> > > > > > > > _______________________________________________
>> > Bayonne-devel mailing list
>> > address@hidden
>> > http://lists.gnu.org/mailman/listinfo/bayonne-devel
>>