From d9ace5c9fe32083542e7c98ac6265100275e9c0c Mon Sep 17 00:00:00 2001 From: moy Date: Thu, 23 Dec 2010 01:46:16 +0000 Subject: [PATCH] Enqueue AST_CONTROL_PROGRESS after AST_CONTROL_RINGING when MFC-R2 calls are accepted (closes issue #18438) Reported by: mariner7 Tested by: moy git-svn-id: http://svn.digium.com/svn/asterisk/trunk@299493 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_dahdi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 1167a3633..0b8261c8c 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -1189,6 +1189,7 @@ struct dahdi_pvt { int mfcr2_dnis_matched:1; int mfcr2_call_accepted:1; int mfcr2_accept_on_offer:1; + int mfcr2_progress_sent:1; #endif /*! \brief DTMF digit in progress. 0 when no digit in progress. */ char begindigit; @@ -5331,6 +5332,8 @@ static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout) ast_log(LOG_ERROR, "unable to make new MFC/R2 call!\n"); return -1; } + p->mfcr2_call_accepted = 0; + p->mfcr2_progress_sent = 0; ast_setstate(ast, AST_STATE_DIALING); } #endif /* HAVE_OPENR2 */ @@ -8708,6 +8711,18 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast) #ifdef HAVE_OPENR2 if (p->mfcr2) { openr2_chan_process_event(p->r2chan); + if (OR2_DIR_FORWARD == openr2_chan_get_direction(p->r2chan)) { + struct ast_frame fr = { AST_FRAME_CONTROL, { AST_CONTROL_PROGRESS } }; + /* if the call is already accepted and we already delivered AST_CONTROL_RINGING + * now enqueue a progress frame to bridge the media up */ + if (p->mfcr2_call_accepted && + !p->mfcr2_progress_sent && + ast->_state == AST_STATE_RINGING) { + ast_log(LOG_DEBUG, "Enqueuing progress frame after R2 accept in chan %d\n", p->channel); + ast_queue_frame(p->owner, &fr); + p->mfcr2_progress_sent = 1; + } + } } #endif