[svn-commits] rmudgett: branch rmudgett/bkp_issue14068 r209667 - /team/rmudgett/bkp_issue14...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jul 31 10:26:01 CDT 2009


Author: rmudgett
Date: Fri Jul 31 10:25:50 2009
New Revision: 209667

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=209667
Log:
Simplified PRI PBX start that is also more compatible with the new sig_pri restructuring.

Modified:
    team/rmudgett/bkp_issue14068/channels/chan_dahdi.c

Modified: team/rmudgett/bkp_issue14068/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/rmudgett/bkp_issue14068/channels/chan_dahdi.c?view=diff&rev=209667&r1=209666&r2=209667
==============================================================================
--- team/rmudgett/bkp_issue14068/channels/chan_dahdi.c (original)
+++ team/rmudgett/bkp_issue14068/channels/chan_dahdi.c Fri Jul 31 10:25:50 2009
@@ -8928,38 +8928,6 @@
 	return res;
 }
 
-/*!
- * \internal
- * \brief Start a PBX on the given channel in a new thread.
- * \since 1.6.3
- *
- * \param pvt DAHDI private structure.
- * \param chan Asterisk channel to start the PBX.
- *
- * \retval AST_PBX_SUCCESS on success.
- * \retval Other on error.
- */
-static enum ast_pbx_result dahdi_pbx_start(struct dahdi_pvt *pvt, struct ast_channel *chan)
-{
-	enum ast_pbx_result result;
-
-#if defined(HAVE_OPENR2)
-	if (pvt->mfcr2call) {
-		pbx_builtin_setvar_helper(chan, "MFCR2_CATEGORY",
-			openr2_proto_get_category_string(pvt->mfcr2_recvd_category));
-	}
-#endif	/* defined(HAVE_OPENR2) */
-
-	result = ast_pbx_start(chan);
-	if (result != AST_PBX_SUCCESS) {
-		ast_log(LOG_WARNING, "Unable to start PBX on %s\n", chan->name);
-		ast_hangup(chan);
-		pvt->owner = NULL;
-	}
-
-	return result;
-}
-
 static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpbx, int idx, int law, int transfercapability)
 {
 	struct ast_channel *tmp;
@@ -9140,8 +9108,18 @@
 	for (v = i->vars ; v ; v = v->next)
 		pbx_builtin_setvar_helper(tmp, v->name, v->value);
 
-	if (startpbx && dahdi_pbx_start(i, tmp) != AST_PBX_SUCCESS) {
-		return NULL;
+	if (startpbx) {
+#ifdef HAVE_OPENR2
+		if (i->mfcr2call) {
+			pbx_builtin_setvar_helper(tmp, "MFCR2_CATEGORY", openr2_proto_get_category_string(i->mfcr2_recvd_category));
+		}
+#endif
+		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;
+		}
 	}
 
 	ast_module_ref(ast_module_info->self);
@@ -14933,7 +14911,7 @@
 								dahdi_pri_handle_subcmds(pri, chanpos, e->e, e->ring.channel,
 									e->ring.subcmds);
 							}
-							if (c && !dahdi_pbx_start(pri->pvts[chanpos], c)) {
+							if (c && !ast_pbx_start(c)) {
 								ast_verb(3, "Accepting call from '%s' to '%s' on channel %d/%d, span %d\n",
 										plancallingnum, pri->pvts[chanpos]->exten,
 										pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span);
@@ -14942,7 +14920,9 @@
 							} else {
 								ast_log(LOG_WARNING, "Unable to start PBX on channel %d/%d, span %d\n",
 									pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span);
-								if (!c) {
+								if (c) {
+									ast_hangup(c);
+								} else {
 									pri_hangup(pri->pri, e->ring.call, PRI_CAUSE_SWITCH_CONGESTION);
 									pri->pvts[chanpos]->call = NULL;
 								}




More information about the svn-commits mailing list