res_agi: Prevent run_agi from eating frames it shouldn't
authorGeorge Joseph <gjoseph@digium.com>
Fri, 22 Apr 2016 22:53:23 +0000 (16:53 -0600)
committerGeorge Joseph <gjoseph@digium.com>
Mon, 25 Apr 2016 14:56:00 +0000 (09:56 -0500)
commit99fcf2a791c2c78ae0ffffce2ac3e8db18ca5be0
treee98d1c4cd924d93d3271061791cc35d0003aa319
parent7f8d83fef42f4b1d2240ea543f61a5a70754e862
res_agi:  Prevent run_agi from eating frames it shouldn't

The run_agi function is eating control frames when it shouldn't be. This is
causing issues when an AGI is run from CONNECTED_LINE_SEND_SUB in a blond
transfer.

Alice calls Bob. Bob attended transfers to Charlie but hangs up before Charlie
answers.

Alice gets the COLP UPDATE indicating Charlie but Charlie never gets an UPDATE
and is left thinking he's connected to Bob.

In this case, when CONNECTED_LINE_SEND_SUB runs on Alice's channel and it calls
an AGI, the extra eaten frames prevent CONNECTED_LINE_SEND_SUB from running on
Charlie's channel.

The fix was to accumulate deferrable frames in the "forever" loop instead of
dropping them, and re-queue them just before running the actual agi command
or exiting.

ASTERISK-25951 #close

Change-Id: I0f4bbfd72fc1126c2aaba41da3233a33d0433645
res/res_agi.c