[asterisk-commits] trunk r35554 - /trunk/channels/chan_iax2.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jun 22 10:10:17 MST 2006


Author: russell
Date: Thu Jun 22 12:10:16 2006
New Revision: 35554

URL: http://svn.digium.com/view/asterisk?rev=35554&view=rev
Log:
- move the increase of the use count to be after the possible failures
- if the pbx fails to start, set the owner channel of the pvt strucutre
  to be NULL
- return immediately if the pbx fails to start so the loop to set all of
  the variables from the "setvar" options aren't set as a bunch of global
  variables instead

Modified:
    trunk/channels/chan_iax2.c

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?rev=35554&r1=35553&r2=35554&view=diff
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Thu Jun 22 12:10:16 2006
@@ -3307,20 +3307,20 @@
 		i->owner = tmp;
 		i->capability = capability;
 		ast_setstate(tmp, state);
+		if (state != AST_STATE_DOWN) {
+			if (ast_pbx_start(tmp)) {
+				ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
+				ast_hangup(tmp);
+				i->owner = NULL;
+				return NULL;
+			}
+		}
+		for (v = i->vars ; v ; v = v->next)
+			pbx_builtin_setvar_helper(tmp,v->name,v->value);
 		ast_mutex_lock(&usecnt_lock);
 		usecnt++;
 		ast_mutex_unlock(&usecnt_lock);
 		ast_update_use_count();
-		if (state != AST_STATE_DOWN) {
-			if (ast_pbx_start(tmp)) {
-				ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
-				ast_hangup(tmp);
-				tmp = NULL;
-			}
-		}
-		for (v = i->vars ; v ; v = v->next)
-			pbx_builtin_setvar_helper(tmp,v->name,v->value);
-		
 	}
 	return tmp;
 }



More information about the asterisk-commits mailing list