[svn-commits] kpfleming: trunk r65688 - in /trunk: ./ channels/chan_iax2.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed May 23 14:01:19 MST 2007


Author: kpfleming
Date: Wed May 23 16:01:18 2007
New Revision: 65688

URL: http://svn.digium.com/view/asterisk?view=rev&rev=65688
Log:
Merged revisions 65685 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r65685 | kpfleming | 2007-05-23 16:59:19 -0400 (Wed, 23 May 2007) | 2 lines

start the delayed PBX when receive voice or video full frames as well, and comment this delayed-PBX activity

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_iax2.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=65688&r1=65687&r2=65688
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Wed May 23 16:01:18 2007
@@ -6927,6 +6927,25 @@
 				f.data = empty;
 			memset(&ies, 0, sizeof(ies));
 		}
+
+		/* when we receive the first full frame for a new incoming channel,
+		   it is safe to start the PBX on the channel because we have now
+		   completed a 3-way handshake with the peer */
+		if ((f.frametype == AST_FRAME_VOICE) ||
+		    (f.frametype == AST_FRAME_VIDEO) ||
+		    (f.frametype == AST_FRAME_IAX)) {
+			if (ast_test_flag(iaxs[fr->callno], IAX_DELAYPBXSTART)) {
+				ast_clear_flag(iaxs[fr->callno], IAX_DELAYPBXSTART);
+				if (ast_pbx_start(iaxs[fr->callno]->owner)) {
+					ast_log(LOG_WARNING, "Unable to start PBX on %s\n", iaxs[fr->callno]->owner->name);
+					ast_hangup(iaxs[fr->callno]->owner);
+					iaxs[fr->callno]->owner = NULL;
+					ast_mutex_unlock(&iaxsl[fr->callno]);
+					return 1;
+				}
+			}
+		}
+
 		if (f.frametype == AST_FRAME_VOICE) {
 			if (f.subclass != iaxs[fr->callno]->voiceformat) {
 					iaxs[fr->callno]->voiceformat = f.subclass;
@@ -6987,17 +7006,6 @@
 				iaxs[fr->callno]->last = fr->ts;
 				if (option_debug && iaxdebug)
 					ast_log(LOG_DEBUG, "For call=%d, set last=%d\n", fr->callno, fr->ts);
-			}
-
-			if (ast_test_flag(iaxs[fr->callno], IAX_DELAYPBXSTART)) {
-				ast_clear_flag(iaxs[fr->callno], IAX_DELAYPBXSTART);
-				if (ast_pbx_start(iaxs[fr->callno]->owner)) {
-					ast_log(LOG_WARNING, "Unable to start PBX on %s\n", iaxs[fr->callno]->owner->name);
-					ast_hangup(iaxs[fr->callno]->owner);
-					iaxs[fr->callno]->owner = NULL;
-					ast_mutex_unlock(&iaxsl[fr->callno]);
-					return 1;
-				}
 			}
 
 			switch(f.subclass) {
@@ -7210,7 +7218,9 @@
 												VERBOSE_PREFIX_4,
 												using_prefs);
 								
-								if(!(c = ast_iax2_new(fr->callno, AST_STATE_RING, format, 1)))
+								/* create an Asterisk channel for this call, but don't start
+								   a PBX on it until we have received a full frame from the peer */
+								if (!(c = ast_iax2_new(fr->callno, AST_STATE_RING, format, 1)))
 									iax2_destroy(fr->callno);
 								else if (ies.vars) {
 									struct ast_variable *var, *prev = NULL;



More information about the svn-commits mailing list