[asterisk-commits] kpfleming: trunk r50538 - /trunk/main/channel.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jan 11 16:42:15 MST 2007


Author: kpfleming
Date: Thu Jan 11 17:42:14 2007
New Revision: 50538

URL: http://svn.digium.com/view/asterisk?view=rev&rev=50538
Log:
when a channel gets automatically answered by an application, sleep a bit to give the audio path (for VOIP channels) time to be setup

Modified:
    trunk/main/channel.c

Modified: trunk/main/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/main/channel.c?view=diff&rev=50538&r1=50537&r2=50538
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Thu Jan 11 17:42:14 2007
@@ -1615,17 +1615,21 @@
 int ast_answer(struct ast_channel *chan)
 {
 	int res = 0;
+
 	ast_channel_lock(chan);
+
 	/* You can't answer an outbound call */
 	if (ast_test_flag(chan, AST_FLAG_OUTGOING)) {
 		ast_channel_unlock(chan);
 		return 0;
 	}
+
 	/* Stop if we're a zombie or need a soft hangup */
 	if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
 		ast_channel_unlock(chan);
 		return -1;
 	}
+
 	switch(chan->_state) {
 	case AST_STATE_RINGING:
 	case AST_STATE_RING:
@@ -1633,6 +1637,7 @@
 			res = chan->tech->answer(chan);
 		ast_setstate(chan, AST_STATE_UP);
 		ast_cdr_answer(chan->cdr);
+		ast_safe_sleep(chan, 500);
 		break;
 	case AST_STATE_UP:
 		ast_cdr_answer(chan->cdr);
@@ -1640,7 +1645,9 @@
 	default:
 		break;
 	}
+
 	ast_channel_unlock(chan);
+
 	return res;
 }
 



More information about the asterisk-commits mailing list