[asterisk-dev] res_agi background work in network waiting loop

Anton Fedorov datacompboy at call2ru.com
Mon Jul 14 10:33:12 CDT 2014


Hello!

Right now res_agi application in run_agi() execution loop does run
ast_waitfor_nandfds forever, without checking for any scheduled events runned on
channel.

That includes playback of any sound (so you can't run playback of sound, that
would be interrupted a bit later, once your application gen finish required info
calculation); it should also affect playtones, and possible another places.

There no much work to get loop correct -- we should instead
  ms = -1;
do something like
  struct ast_sched_context *sched = ast_channel_sched(chan);
  ms = sched ? ast_sched_wait(chan->sched) : -1;

and right before
  if (c) {

need to analyse result of wait:
  if (sched) ast_sched_runq(sched);
  if (ms==0) retry = AGI_NANDFS_RETRY;


that's the only changes reqired to get correct background work with FastAGI().


-- 
Regards,
Anton Fedorov
Call2ru service
E-Mail: datacompboy at call2ru.com
Jabber: datacompboy at call2ru.com
Skype: datacompboy
ICQ: 272-35-262
Mobile: +7-913-925-7974 [SMS 24h, Call 05:00-19:00 MSKT (GMT+3)]




More information about the asterisk-dev mailing list