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

John Todd jtodd at loligo.com
Thu Jan 11 23:39:47 MST 2007


While I understand the sentiment here, I'm not sure this is a good 
idea.  This builds in a 500ms post-dial delay issue into every call. 
I've been building systems for three years now, and everywhere there 
is an "Answer" (which, I believe, should be the only method that 
picks up a line and sets up a media channel locally, but that's a 
discussion for another thread) there is a "Wait(.5)" or even a 
"Wait(1)".

Building this in as a non-optional default seems a bit on the drastic 
side to deal with people who don't know about how to manage their 
dialplans.  Perhaps making this a selectable option, or removing it 
and better educating folks how to write a dialplan that has better 
audio performance?

There are instances where instant audio path access is useful.  If 
I'm using DTMF to page through ChanSpy sessions, as an example, is 
this called?  How about during large test jig configurations where 
thousands of audio channels are being set up/torn down in short 
order?  (which, BTW, will be happening next week on a grand scale 
hopefully.)

It just seems "wrong" to me to insert a mandatory delay.  I know the 
intentions are good, but hard-coded things like this make me 
uncomfortable.  Discussion?

JT



>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-dev mailing list