[asterisk-commits] rmudgett: branch group/issue14292 r173348 - in /team/group/issue14292: ./ cha...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 3 19:30:14 CST 2009


Author: rmudgett
Date: Tue Feb  3 19:30:14 2009
New Revision: 173348

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=173348
Log:
Resolved conflicts and restarted automerge.

Merged revisions 173242,173245 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/team/group/issue14068

................
  r173242 | rmudgett | 2009-02-03 16:26:39 -0600 (Tue, 03 Feb 2009) | 7 lines
  
  *  Fixed some redirecting.from.number usage errors.
  *  Fixed compilation if lippri not present.
  *  Fixed handling of AST_CONTROL_CONNECTED_LINE and
  AST_CONTROL_REDIRECTING if the channel is not PRI.
  *  Removed unused AST_CONNECTED_LINE_UPDATE_SOURCE_DIVERSION.
  *  Added new AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER_ALERTING.
................
  r173245 | root | 2009-02-03 17:17:25 -0600 (Tue, 03 Feb 2009) | 14 lines
  
  Merged revisions 173244 via svnmerge from 
  file:///srv/subversion/repos/asterisk/team/group/issue8824
  
  ........
    r173244 | rmudgett | 2009-02-03 17:05:48 -0600 (Tue, 03 Feb 2009) | 7 lines
    
    *  Made build_connected_line_data() and build_redirecting_data()
    include an empty string in the built control frame.
    
    The change makes the CONNECTEDLINE() and REDIRECTING() dialplan
    functions behave the same way whether the inhibit(i) option is used
    or not on the datatypes: name, number, and all.
  ........
................

Modified:
    team/group/issue14292/   (props changed)
    team/group/issue14292/CHANGES
    team/group/issue14292/channels/chan_dahdi.c
    team/group/issue14292/main/channel.c

Propchange: team/group/issue14292/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/issue14292/
------------------------------------------------------------------------------
--- issue14068-integrated (original)
+++ issue14068-integrated Tue Feb  3 19:30:14 2009
@@ -1,1 +1,1 @@
-/team/group/issue8824:1-173201
+/team/group/issue8824:1-173244

Propchange: team/group/issue14292/
------------------------------------------------------------------------------
--- issue14292-integrated (original)
+++ issue14292-integrated Tue Feb  3 19:30:14 2009
@@ -1,1 +1,1 @@
-/team/group/issue14068:1-173207
+/team/group/issue14068:1-173250

Modified: team/group/issue14292/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/CHANGES?view=diff&rev=173348&r1=173347&r2=173348
==============================================================================
--- team/group/issue14292/CHANGES (original)
+++ team/group/issue14292/CHANGES Tue Feb  3 19:30:14 2009
@@ -44,6 +44,10 @@
     received number from the ISDN link if that number has the corresponding
     Type-Of-Number.
 
+libpri channel driver (chan_dahdi) changes
+-------------------------------------------
+  * The channel variable PRIREDIRECTREASON is now just a status variable.
+    Use the REDIRECTING(reason) dialplan function to alter the reason.
 
 SIP channel driver (chan_sip) changes
 -------------------------------------------

Modified: team/group/issue14292/channels/chan_dahdi.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/channels/chan_dahdi.c?view=diff&rev=173348&r1=173347&r2=173348
==============================================================================
--- team/group/issue14292/channels/chan_dahdi.c (original)
+++ team/group/issue14292/channels/chan_dahdi.c Tue Feb  3 19:30:14 2009
@@ -336,7 +336,7 @@
 	 * event cache instead of checking the mailbox directly. */
 }
 
-#ifdef HAVE_PRI
+#if defined(HAVE_PRI)
 #define CC_TIMEOUT_PEERLINKCHANNELS  60
 #define CC_MAX_PEERLINKCHANNELS  20*CC_TIMEOUT_PEERLINKCHANNELS
 AST_MUTEX_DEFINE_STATIC(peerlink_lock);
@@ -372,7 +372,9 @@
 
 static struct ccbsnr_link *ccbsnr_list = NULL;
 AST_MUTEX_DEFINE_STATIC(ccbsnr_lock);
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 /*
  * remove too old CCBS/CCNR entries
  * (must be called with ccbsnr_lock held)
@@ -398,8 +400,9 @@
 		ccbsnr = ccbsnr->next;
 	}
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 /*
  * return the pointer to ccbsnr structure by handle
  */
@@ -431,8 +434,9 @@
 
 	return ret;
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static struct ccbsnr_link *ccbsnr_get_link_by_number(const char *callingnum, const char *callernum, unsigned int *state)
 {
 	struct ccbsnr_link *ret;
@@ -467,8 +471,9 @@
 
 	return ret;
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 /*
  * select CCBS/CCNR id
  */
@@ -504,8 +509,9 @@
 
 	return ret;
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 /*
  * a CCBS/CCNR link was removed
  */
@@ -550,8 +556,9 @@
 	}
 	ast_mutex_unlock(&ccbsnr_lock);
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 /*
  * return the counter of ccbsnrlinks to callingnumber
  */
@@ -572,8 +579,9 @@
 
 	return count;
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 /*
  * Add a new peer link id
  */
@@ -601,7 +609,9 @@
 	}
 	return i;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 /*
  * Get and remove peer link id
  */
@@ -624,7 +634,9 @@
 	ast_mutex_unlock(&peerlink_lock);
 	return ast;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static void cc_destroy_all_peer_link_id(void)
 {
 	int i;
@@ -636,7 +648,7 @@
 	}
 	ast_mutex_unlock(&peerlink_lock);
 }
-#endif
+#endif	/* defined(HAVE_PRI) */
 
 
 /*! \brief Avoid the silly dahdi_getevent which ignores a bunch of events */
@@ -878,9 +890,9 @@
 	ast_mutex_t lock;
 	struct ast_channel *owner;			/*!< Our current active owner (if applicable) */
 							/*!< Up to three channels can be associated with this call */
-#ifdef HAVE_PRI
+#if defined(HAVE_PRI)
 	int dummychannel;				/*!< Flag for dummy Channel. used for ccbsnr (shellscript) */
-#endif
+#endif	/* defined(HAVE_PRI) */
 
 	struct dahdi_subchannel sub_unused;		/*!< Just a safety precaution */
 	struct dahdi_subchannel subs[3];			/*!< Sub-channels */
@@ -1173,9 +1185,9 @@
 	 */
 	unsigned int setup_ack:1;
 #endif
-#ifdef HAVE_PRI
+#if defined(HAVE_PRI)
 	unsigned int ccringout:1;		/*!< Append CC-Ringout facility */
-#endif
+#endif	/* defined(HAVE_PRI) */
 	/*!
 	 * \brief TRUE if SMDI (Simplified Message Desk Interface) is enabled
 	 * \note Set from the "usesmdi" value read in from chan_dahdi.conf
@@ -1606,7 +1618,7 @@
 #define GET_CHANNEL(p) ((p)->channel)
 #endif
 
-#ifdef HAVE_PRI
+#if defined(HAVE_PRI)
 static inline int pri_nochannel_grab(struct dahdi_pri *pri)
 {
 	int res;
@@ -1622,8 +1634,9 @@
 	pthread_kill(pri->master, SIGURG);
 	return 0;
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 /*
  * a new CCBS/CCNR id was received
  */
@@ -1659,8 +1672,9 @@
 
 	return ccbsnr;
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 /*
  * Clear CCBS/CCNR links
  */
@@ -1685,8 +1699,9 @@
 	ccbsnr_list = NULL;
 	ast_mutex_unlock(&ccbsnr_lock);
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static void ccbsnr_destroy_all_of_span(struct dahdi_pri *pri)
 {
 	int span = pri->span;
@@ -1736,8 +1751,9 @@
 
 	ast_mutex_unlock(&ccbsnr_lock);
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 /*
  * Destroy CCBS/CCNR links
  */
@@ -1787,8 +1803,9 @@
 	ccbsnr_list = NULL;
 	ast_mutex_unlock(&ccbsnr_lock);
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 /*
  * on an activated CCBS, the remote party is now free
  */
@@ -1890,7 +1907,7 @@
 
 	ast_module_ref(ast_module_info->self);
 }
-#endif
+#endif	/* defined(HAVE_PRI) */
 
 struct dahdi_pvt *round_robin[32];
 
@@ -3117,14 +3134,40 @@
 }
 #endif	/* defined(HAVE_SS7) */
 
+#if defined(HAVE_PRI)
+static enum AST_REDIRECTING_REASON pri_to_ast_reason(int pri_reason)
+{
+	enum AST_REDIRECTING_REASON ast_reason;
+
+	switch (pri_reason) {
+	case PRI_REDIR_FORWARD_ON_BUSY:
+		ast_reason = AST_REDIRECTING_REASON_USER_BUSY;
+		break;
+	case PRI_REDIR_FORWARD_ON_NO_REPLY:
+		ast_reason = AST_REDIRECTING_REASON_NO_ANSWER;
+		break;
+	case PRI_REDIR_DEFLECTION:
+		ast_reason = AST_REDIRECTING_REASON_DEFLECTION;
+		break;
+	case PRI_REDIR_UNCONDITIONAL:
+		ast_reason = AST_REDIRECTING_REASON_UNCONDITIONAL;
+		break;
+	case PRI_REDIR_UNKNOWN:
+	default:
+		ast_reason = AST_REDIRECTING_REASON_UNKNOWN;
+		break;
+	}	/* end switch */
+
+	return ast_reason;
+}
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static int ast_to_pri_reason(enum AST_REDIRECTING_REASON ast_reason)
 {
 	int pri_reason;
 
 	switch (ast_reason) {
-	case AST_REDIRECTING_REASON_UNKNOWN:
-		pri_reason = PRI_REDIR_UNKNOWN;
-		break;
 	case AST_REDIRECTING_REASON_USER_BUSY:
 		pri_reason = PRI_REDIR_FORWARD_ON_BUSY;
 		break;
@@ -3137,6 +3180,7 @@
 	case AST_REDIRECTING_REASON_DEFLECTION:
 		pri_reason = PRI_REDIR_DEFLECTION;
 		break;
+	case AST_REDIRECTING_REASON_UNKNOWN:
 	default:
 		pri_reason = PRI_REDIR_UNKNOWN;
 		break;
@@ -3144,7 +3188,9 @@
 
 	return pri_reason;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static int pri_to_ast_presentation(int pri_presentation)
 {
 	int ast_presentation;
@@ -3184,7 +3230,9 @@
 
 	return ast_presentation;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static int ast_to_pri_presentation(int ast_presentation)
 {
 	int pri_presentation;
@@ -3224,24 +3272,24 @@
 
 	return pri_presentation;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static enum AST_CONNECTED_LINE_UPDATE_SOURCE pri_to_ast_connected_line_update_source(enum PRI_CONNECTED_LINE_UPDATE_SOURCE pri_source)
 {
 	enum AST_CONNECTED_LINE_UPDATE_SOURCE ast_source;
 
 	switch (pri_source) {
-	case PRI_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN:
-		ast_source = AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN;
-		break;
 	case PRI_CONNECTED_LINE_UPDATE_SOURCE_ANSWER:
 		ast_source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
-		break;
-	case PRI_CONNECTED_LINE_UPDATE_SOURCE_DIVERSION:
-		ast_source = AST_CONNECTED_LINE_UPDATE_SOURCE_DIVERSION;
 		break;
 	case PRI_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER:
 		ast_source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
 		break;
+	case PRI_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER_ALERTING:
+		ast_source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER_ALERTING;
+		break;
+	case PRI_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN:
 	default:
 		ast_source = AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN;
 		break;
@@ -3249,24 +3297,24 @@
 
 	return ast_source;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static enum PRI_CONNECTED_LINE_UPDATE_SOURCE ast_to_pri_connected_line_update_source(enum AST_CONNECTED_LINE_UPDATE_SOURCE ast_source)
 {
 	enum PRI_CONNECTED_LINE_UPDATE_SOURCE pri_source;
 
 	switch (ast_source) {
-	case AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN:
-		pri_source = PRI_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN;
-		break;
 	case AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER:
 		pri_source = PRI_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
-		break;
-	case AST_CONNECTED_LINE_UPDATE_SOURCE_DIVERSION:
-		pri_source = PRI_CONNECTED_LINE_UPDATE_SOURCE_DIVERSION;
 		break;
 	case AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER:
 		pri_source = PRI_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
 		break;
+	case AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER_ALERTING:
+		pri_source = PRI_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER_ALERTING;
+		break;
+	case AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN:
 	default:
 		pri_source = PRI_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN;
 		break;
@@ -3274,6 +3322,7 @@
 
 	return pri_source;
 }
+#endif	/* defined(HAVE_PRI) */
 
 static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout)
 {
@@ -3568,7 +3617,8 @@
 		ast_mutex_unlock(&p->lock);
 		return -1;
 	}
-#ifdef HAVE_SS7
+
+#if defined(HAVE_SS7)
 	if (p->ss7) {
 		char ss7_called_nai;
 		int called_nai_strip;
@@ -3705,8 +3755,9 @@
 		ast_setstate(ast, AST_STATE_DIALING);
 		ss7_rel(p->ss7);
 	}
-#endif /* HAVE_SS7 */
-#ifdef HAVE_PRI
+#endif	/* defined(HAVE_SS7) */
+
+#if defined(HAVE_PRI)
 	if (p->pri) {
 		struct pri_sr *sr;
 		struct ast_channel *peer;
@@ -3722,8 +3773,6 @@
 		int prilocaldialplan;
 		int ldp_strip;
 		int exclusive;
-		const char *rr_str;
-		int redirect_reason;
 
 		c = strchr(dest, '/');
 		if (c) {
@@ -3952,21 +4001,9 @@
 		}
 		pri_sr_set_caller(sr, l ? (l + ldp_strip) : NULL, n, prilocaldialplan,
 			p->use_callingpres ? ast->connected.id.number_presentation : (l ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_NUMBER_NOT_AVAILABLE));
-		if ((rr_str = pbx_builtin_getvar_helper(ast, "PRIREDIRECTREASON"))) {
-			if (!strcasecmp(rr_str, "UNKNOWN"))
-				redirect_reason = 0;
-			else if (!strcasecmp(rr_str, "BUSY"))
-				redirect_reason = 1;
-			else if (!strcasecmp(rr_str, "NO_REPLY"))
-				redirect_reason = 2;
-			else if (!strcasecmp(rr_str, "UNCONDITIONAL"))
-				redirect_reason = 15;
-			else
-				redirect_reason = PRI_REDIR_UNCONDITIONAL;
-		} else
-			redirect_reason = PRI_REDIR_UNCONDITIONAL;
-		pri_sr_set_redirecting(sr, ast->redirecting.from.name, ast->redirecting.from.number, ast->redirecting.from.number_type,
-		                       ast->redirecting.from.number_presentation, ast_to_pri_reason(ast->redirecting.reason));
+		pri_sr_set_redirecting(sr, ast->redirecting.from.name,
+			ast->cid.cid_rdnis, ast->redirecting.from.number_type,
+			ast->redirecting.from.number_presentation, ast_to_pri_reason(ast->redirecting.reason));
 
 #ifdef SUPPORT_USERUSER
 		/* User-user info */
@@ -4053,7 +4090,8 @@
 			pbx_builtin_setvar_helper(peer, "CCBSNRONPRISPAN", tmp);
 		}
 	}
-#endif
+#endif	/* defined(HAVE_PRI) */
+
 	ast_mutex_unlock(&p->lock);
 	return 0;
 }
@@ -4152,7 +4190,7 @@
 		/* Free associated memory */
 		if (pl)
 			destroy_dahdi_pvt(&pl);
-		if (option_verbose > 2) 
+		if (option_verbose > 2)
 			ast_verbose(VERBOSE_PREFIX_2 "Unregistered channel %d\n", x);
 	}
 	iflist = NULL;
@@ -4184,14 +4222,14 @@
 
 	return 0;
 }
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
+static char *dahdi_qsic_check_ccbsnr_app = "DAHDIQsigCheckCcbsnr";
+
+static int dahdi_qsig_check_ccbsnr_exec(struct ast_channel *ast, void *param)
+{
 #define CC_MAX_NOCHANNELS 256
-
-static char *dahdi_qsic_check_ccbsnr_app = "DAHDIQsigCheckCcbsnr";
-
-static int dahdi_qsig_check_ccbsnr_exec(struct ast_channel *ast, void *param)
-{
-
 #define MAX_DISSALOWED 4
 
 	char *data = (char *) param;
@@ -4308,8 +4346,9 @@
 
 	return 0;
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static char *dahdi_qsic_clear_nochannel_app = "DAHDIQsigClearNoChannel";
 
 static int dahdi_qsig_clear_nochannel_exec(struct ast_channel *ast, void *param)
@@ -4387,8 +4426,9 @@
 	return 0;
 
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static char *dahdi_qsic_ccbsnr_request_app = "DAHDIQsigCcbsnrRequest";
 
 static int dahdi_qsig_ccbsnr_request_exec(struct ast_channel *ast, void *param)
@@ -4669,8 +4709,9 @@
 
 	return 0;
 }
-
-
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
 static char *dahdi_send_keypad_facility_app = "DAHDISendKeypadFacility";
 
 static int dahdi_send_keypad_facility_exec(struct ast_channel *chan, void *data)
@@ -7593,42 +7634,13 @@
 	return 0;
 }
 
-static enum AST_REDIRECTING_REASON pri_to_ast_reason(int pri_reason)
-{
-	enum AST_REDIRECTING_REASON ast_reason;
-
-	switch (pri_reason) {
-	case PRI_REDIR_UNKNOWN:
-		ast_reason = AST_REDIRECTING_REASON_UNKNOWN;
-		break;
-	case PRI_REDIR_FORWARD_ON_BUSY:
-		ast_reason = AST_REDIRECTING_REASON_USER_BUSY;
-		break;
-	case PRI_REDIR_FORWARD_ON_NO_REPLY:
-		ast_reason = AST_REDIRECTING_REASON_NO_ANSWER;
-		break;
-	case PRI_REDIR_DEFLECTION:
-		ast_reason = AST_REDIRECTING_REASON_DEFLECTION;
-		break;
-	case PRI_REDIR_UNCONDITIONAL:
-		ast_reason = AST_REDIRECTING_REASON_UNCONDITIONAL;
-		break;
-	default:
-		ast_reason = AST_REDIRECTING_REASON_UNKNOWN;
-		break;
-	}	/* end switch */
-
-	return ast_reason;
-}
-
 static int dahdi_indicate(struct ast_channel *chan, int condition, const void *data, size_t datalen)
 {
 	struct dahdi_pvt *p = chan->tech_pvt;
 	int res=-1;
 	int idx;
 	int func = DAHDI_FLASH;
-	struct pri_party_connected_line connected;
-	struct pri_party_redirecting redirecting;
+
 	ast_mutex_lock(&p->lock);
 	idx = dahdi_get_index(chan, p, 0);
 	ast_debug(1, "Requested indication %d on channel %s\n", condition, chan->name);
@@ -7855,45 +7867,63 @@
 			res = tone_zone_play_tone(p->subs[idx].dfd, -1);
 			break;
 		case AST_CONTROL_CONNECTED_LINE:
-			ast_debug(1,"Received AST_CONTROL_CONNECTED_LINE on %s\n",chan->name);
-			if (chan->connected.id.number)
-				ast_copy_string(connected.id.number, chan->connected.id.number, sizeof(connected.id.number));
-			else
-				connected.id.number[0] = '\0';
-			if (chan->connected.id.name)
-				ast_copy_string(connected.id.name, chan->connected.id.name, sizeof(connected.id.name));
-			else
-				connected.id.name[0] = '\0';
-			connected.id.number_type = chan->connected.id.number_type;
-			connected.id.number_presentation = ast_to_pri_presentation(chan->connected.id.number_presentation);
-			connected.source = ast_to_pri_connected_line_update_source(chan->connected.source);
-			pri_connected_line_update(p->pri->pri, p->call, &connected);
+			ast_debug(1, "Received AST_CONTROL_CONNECTED_LINE on %s\n", chan->name);
+#if defined(HAVE_PRI)
+			if (p->pri) {
+				struct pri_party_connected_line connected;
+
+				if (chan->connected.id.number) {
+					ast_copy_string(connected.id.number, chan->connected.id.number, sizeof(connected.id.number));
+				} else {
+					connected.id.number[0] = '\0';
+				}
+				if (chan->connected.id.name) {
+					ast_copy_string(connected.id.name, chan->connected.id.name, sizeof(connected.id.name));
+				} else {
+					connected.id.name[0] = '\0';
+				}
+				connected.id.number_type = chan->connected.id.number_type;
+				connected.id.number_presentation = ast_to_pri_presentation(chan->connected.id.number_presentation);
+				connected.source = ast_to_pri_connected_line_update_source(chan->connected.source);
+				pri_connected_line_update(p->pri->pri, p->call, &connected);
+			}
+#endif	/* defined(HAVE_PRI) */
 			break;
 		case AST_CONTROL_REDIRECTING:
-			ast_debug(1,"Received AST_CONTROL_REDIRECTING on %s\n",chan->name);
-			if (chan->redirecting.from.number)
-				ast_copy_string(redirecting.from.number, chan->redirecting.from.number, sizeof(redirecting.from.number));
-			else
-				redirecting.from.number[0] = '\0';
-			if (chan->redirecting.from.name)
-				ast_copy_string(redirecting.from.name, chan->redirecting.from.name, sizeof(redirecting.from.name));
-			else
-				redirecting.from.name[0] = '\0';
-			redirecting.from.number_type = chan->redirecting.from.number_type;
-			redirecting.from.number_presentation = ast_to_pri_presentation(chan->redirecting.from.number_presentation);
-			if (chan->redirecting.to.number)
-				ast_copy_string(redirecting.to.number, chan->redirecting.to.number, sizeof(redirecting.to.number));
-			else
-				redirecting.to.number[0] = '\0';
-			if (chan->redirecting.to.name)
-				ast_copy_string(redirecting.to.name, chan->redirecting.to.name, sizeof(redirecting.to.name));
-			else
-				redirecting.to.name[0] = '\0';
-			redirecting.to.number_type = chan->redirecting.to.number_type;
-			redirecting.to.number_presentation = ast_to_pri_presentation(chan->redirecting.to.number_presentation);
-			redirecting.count = chan->redirecting.count;
-			redirecting.reason = ast_to_pri_reason(chan->redirecting.reason);
-			pri_redirecting_update(p->pri->pri, p->call, &redirecting);
+			ast_debug(1, "Received AST_CONTROL_REDIRECTING on %s\n", chan->name);
+#if defined(HAVE_PRI)
+			if (p->pri) {
+				struct pri_party_redirecting redirecting;
+
+				if (chan->cid.cid_rdnis) {
+					ast_copy_string(redirecting.from.number, chan->cid.cid_rdnis, sizeof(redirecting.from.number));
+				} else {
+					redirecting.from.number[0] = '\0';
+				}
+				if (chan->redirecting.from.name) {
+					ast_copy_string(redirecting.from.name, chan->redirecting.from.name, sizeof(redirecting.from.name));
+				} else {
+					redirecting.from.name[0] = '\0';
+				}
+				redirecting.from.number_type = chan->redirecting.from.number_type;
+				redirecting.from.number_presentation = ast_to_pri_presentation(chan->redirecting.from.number_presentation);
+				if (chan->redirecting.to.number) {
+					ast_copy_string(redirecting.to.number, chan->redirecting.to.number, sizeof(redirecting.to.number));
+				} else {
+					redirecting.to.number[0] = '\0';
+				}
+				if (chan->redirecting.to.name) {
+					ast_copy_string(redirecting.to.name, chan->redirecting.to.name, sizeof(redirecting.to.name));
+				} else {
+					redirecting.to.name[0] = '\0';
+				}
+				redirecting.to.number_type = chan->redirecting.to.number_type;
+				redirecting.to.number_presentation = ast_to_pri_presentation(chan->redirecting.to.number_presentation);
+				redirecting.count = chan->redirecting.count;
+				redirecting.reason = ast_to_pri_reason(chan->redirecting.reason);
+				pri_redirecting_update(p->pri->pri, p->call, &redirecting);
+			}
+#endif	/* defined(HAVE_PRI) */
 			break;
 		}
 	} else
@@ -11313,11 +11343,11 @@
 					p->digital = 1;
 					if (tmp)
 						tmp->transfercapability = AST_TRANS_CAP_DIGITAL;
-#ifdef HAVE_PRI
+#if defined(HAVE_PRI)
 				} else if (opt == 'q') {
 					/* Append CC-Ringout facility */
 					p->ccringout = 1;
-#endif
+#endif	/* defined(HAVE_PRI) */
 				} else {
 					ast_log(LOG_WARNING, "Unknown option '%c' in '%s'\n", opt, (char *)data);
 				}
@@ -12907,17 +12937,17 @@
 					if (chanpos > -1) {
 						ast_mutex_lock(&pri->pvts[chanpos]->lock);
 						/* queue DTMF frame if the PBX for this call was already started (we're forwarding KEYPAD_DIGITs further on */
-						if ((pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING) && pri->pvts[chanpos]->call==e->digit.call && pri->pvts[chanpos]->owner) {
+						if ((pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING)
+							&& pri->pvts[chanpos]->call == e->digit.call
+							&& pri->pvts[chanpos]->owner) {
 							/* how to do that */
 							int digitlen = strlen(e->digit.digits);
-							char digit;
 							int i;
+
 							for (i = 0; i < digitlen; i++) {
-								digit = e->digit.digits[i];
-								{
-									struct ast_frame f = { AST_FRAME_DTMF, digit, };
-									dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
-								}
+								struct ast_frame f = { AST_FRAME_DTMF, e->digit.digits[i], };
+
+								dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
 							}
 						}
 						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
@@ -12935,38 +12965,40 @@
 					if (chanpos > -1) {
 						ast_mutex_lock(&pri->pvts[chanpos]->lock);
 						/* queue DTMF frame if the PBX for this call was already started (we're forwarding INFORMATION further on */
-						if ((pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING) && pri->pvts[chanpos]->call==e->ring.call && pri->pvts[chanpos]->owner) {
+						if ((pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING)
+							&& pri->pvts[chanpos]->call == e->ring.call
+							&& pri->pvts[chanpos]->owner) {
 							/* how to do that */
 							int digitlen = strlen(e->ring.callednum);
-							char digit;
 							int i;
+
 							for (i = 0; i < digitlen; i++) {
-								digit = e->ring.callednum[i];
-								{
-									struct ast_frame f = { AST_FRAME_DTMF, digit, };
-									dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
-								}
+								struct ast_frame f = { AST_FRAME_DTMF, e->ring.callednum[i], };
+
+								dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
 							}
 							if (pri->pvts[chanpos]->owner) {
 								char dnid[AST_MAX_EXTENSION];
-								char rdnis[AST_MAX_EXTENSION];
-								if (pri->pvts[chanpos]->owner->exten) {
-									int pos = strlen(pri->pvts[chanpos]->owner->exten);
-									if (pos < sizeof(pri->pvts[chanpos]->owner->exten) - 2)
-										ast_copy_string(&pri->pvts[chanpos]->owner->exten[pos], e->ring.callednum, sizeof(pri->pvts[chanpos]->owner->exten) - strlen(e->ring.callednum));
+
+								/*
+								 * Append the received info digits to the end of
+								 * the exten and dnid strings
+								 */
+								strncat(pri->pvts[chanpos]->owner->exten,
+									e->ring.callednum,
+									sizeof(pri->pvts[chanpos]->owner->exten) - 1
+									- strlen(pri->pvts[chanpos]->owner->exten));
+								if (pri->pvts[chanpos]->owner->cid.cid_dnid) {
+									ast_copy_string(dnid,
+										pri->pvts[chanpos]->owner->cid.cid_dnid,
+										sizeof(dnid));
+									ast_free(pri->pvts[chanpos]->owner->cid.cid_dnid);
+								} else {
+									dnid[0] = 0;
 								}
-								if (pri->pvts[chanpos]->owner->cid.cid_dnid) {
-									ast_copy_string(dnid, pri->pvts[chanpos]->owner->cid.cid_dnid, sizeof(dnid));
-									strncat (dnid, e->ring.callednum, sizeof(dnid) - strlen(dnid) - 1);
-									ast_free(pri->pvts[chanpos]->owner->cid.cid_dnid);
-									pri->pvts[chanpos]->owner->cid.cid_dnid = ast_strdup(dnid);
-								}
-								if (pri->pvts[chanpos]->owner->cid.cid_rdnis) {
-									ast_copy_string(rdnis, pri->pvts[chanpos]->owner->cid.cid_rdnis, sizeof(rdnis));
-									strncat (rdnis, e->ring.callednum, sizeof(rdnis) - strlen(rdnis) - 1);
-									ast_free(pri->pvts[chanpos]->owner->cid.cid_rdnis);
-									pri->pvts[chanpos]->owner->cid.cid_rdnis = ast_strdup(rdnis);
-								}
+								strncat(dnid, e->ring.callednum,
+									sizeof(dnid) - 1 - strlen(dnid));
+								pri->pvts[chanpos]->owner->cid.cid_dnid = ast_strdup(dnid);
 							}
 						}
 						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
@@ -13122,7 +13154,9 @@
 						pri->pvts[chanpos]->callingpres = e->ring.callingpres;
 
 						/* Start PBX */
-						if (!e->ring.complete && (pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING) && ast_matchmore_extension(NULL, pri->pvts[chanpos]->context, pri->pvts[chanpos]->exten, 1, pri->pvts[chanpos]->cid_num)) {
+						if (!e->ring.complete
+							&& (pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING)
+							&& ast_matchmore_extension(NULL, pri->pvts[chanpos]->context, pri->pvts[chanpos]->exten, 1, pri->pvts[chanpos]->cid_num)) {
 							/* Release the PRI lock while we create the channel */
 							ast_mutex_unlock(&pri->lock);
 							if (crv) {
@@ -13137,8 +13171,8 @@
 
 							ast_mutex_unlock(&pri->pvts[chanpos]->lock);
 
-							if (c  && (redirecting.from.number || redirecting.from.name)) {
-								ast_party_redirecting_copy(&c->redirecting, &redirecting);
+							if (c && (redirecting.from.number || redirecting.from.name)) {
+								ast_set_redirecting(c, &redirecting);
 							}
 							if (!ast_strlen_zero(e->ring.callingsubaddr)) {
 								pbx_builtin_setvar_helper(c, "CALLINGSUBADDR", e->ring.callingsubaddr);
@@ -13157,8 +13191,10 @@
 
 							snprintf(calledtonstr, sizeof(calledtonstr), "%d", e->ring.calledplan);
 							pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr);
-							if (e->ring.redirectingreason >= 0)
+							if (e->ring.redirectingreason >= 0) {
+								/* This is now just a status variable.  Use REDIRECTING() dialplan function. */
 								pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason));
+							}
 
 							ast_mutex_lock(&pri->pvts[chanpos]->lock);
 							ast_mutex_lock(&pri->lock);
@@ -13186,7 +13222,7 @@
 								ast_mutex_unlock(&pri->pvts[chanpos]->lock);
 
 								if (redirecting.from.number || redirecting.from.name) {
-									ast_party_redirecting_copy(&c->redirecting, &redirecting);
+									ast_set_redirecting(c, &redirecting);
 								}
 								if (e->ring.ani2 >= 0) {
 									snprintf(ani2str, 5, "%d", e->ring.ani2);
@@ -13200,8 +13236,10 @@
 								}
 #endif
 
-								if (e->ring.redirectingreason >= 0)
+								if (e->ring.redirectingreason >= 0) {
+									/* This is now just a status variable.  Use REDIRECTING() dialplan function. */
 									pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason));
+								}
 
 								snprintf(calledtonstr, sizeof(calledtonstr), "%d", e->ring.calledplan);
 								pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr);
@@ -13397,473 +13435,474 @@
 						ast_mutex_lock(&pri->pvts[chanpos]->lock);
 						ast_copy_string(pri->pvts[chanpos]->lastcid_num, e->facname.callingnum, sizeof(pri->pvts[chanpos]->lastcid_num));
 						ast_copy_string(pri->pvts[chanpos]->lastcid_name, e->facname.callingname, sizeof(pri->pvts[chanpos]->lastcid_name));
-						pri->pvts[chanpos]->subs[SUB_REAL].needcallerid =1;
+						pri->pvts[chanpos]->subs[SUB_REAL].needcallerid = 1;
 						dahdi_enable_ec(pri->pvts[chanpos]);
 						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
 					}
 				}
 				break;
 			case PRI_EVENT_FACILITY:
-				{
-					unsigned int handle;
-					int channel = e->facility.channel;
-					int ccbsnronprispan = PRI_SPAN(channel);
-					int explicit = PRI_EXPLICIT(channel);
-					int i;
-
-					channel = PRI_CHANNEL(channel);
-
-					ast_verb(4,
-						"PRI_EVENT_CC_FACILITY e->facility.channel(0x%x) span(%d) explicit(%d) channel(%d)\n",
-						e->facility.channel, ccbsnronprispan, explicit, channel);
-					if (channel == 0) {
-						for (i = 0; i < e->facility.subcmds.counter_subcmd; i++) {
-							subcommand *subcmd = &e->facility.subcmds.subcmd[i];
-							switch (subcmd->cmd) {
-							case CMD_CC_EXECPOSIBLE_INV:
-								{
-									int cr = e->facility.cref;
-									unsigned int state;
-
+			{
+				unsigned int handle;
+				int channel = e->facility.channel;
+				int ccbsnronprispan = PRI_SPAN(channel);
+				int explicit = PRI_EXPLICIT(channel);
+				int i;
+
+				channel = PRI_CHANNEL(channel);
+
+				ast_verb(4,
+					"PRI_EVENT_CC_FACILITY e->facility.channel(0x%x) span(%d) explicit(%d) channel(%d)\n",
+					e->facility.channel, ccbsnronprispan, explicit, channel);
+				if (channel == 0) {
+					for (i = 0; i < e->facility.subcmds.counter_subcmd; i++) {
+						struct subcommand *subcmd = &e->facility.subcmds.subcmd[i];
+
+						switch (subcmd->cmd) {
+						case CMD_CC_EXECPOSIBLE_INV:
+						{
+							int cr = e->facility.cref;
+							unsigned int state;
+
+							ast_verb(4,
+								"Facility cc-execposible INV cr %d channel %d/%d, span %d\n",
+								cr, ccbsnronprispan, channel, pri->span);
+
+							handle = CCBS_HANDLE(ccbsnronprispan, cr);
+							state = 0;
+							ast_verb(4,
+								"Facility cc-execposible: handle=%x\n", handle);
+							if (ccbsnr_get_link(handle, &state) != NULL) {
+								if (state == CC_INVOKED_A_RET) {
 									ast_verb(4,
-										"Facility cc-execposible INV cr %d channel %d/%d, span %d\n",
-										cr, ccbsnronprispan, channel, pri->span);
-
-									handle = CCBS_HANDLE(ccbsnronprispan, cr);
-									state = 0;
+										"DAHDI ccbsnr_remote_user_free: state '%d'\n",
+										state);
+									ccbsnr_remote_user_free(handle);
+								}
+							} else {
+								ast_verb(3,
+									"Facility cc-execposible: List-obj not found - handle=%x state=%d\n",
+									handle, state);
+							}
+							break;
+						}
+						default:
+							ast_log(LOG_WARNING,
+								"Illegal subcommand %d in facility request  on channel %d/%d span %d\n",
+								subcmd->cmd, ccbsnronprispan, channel, pri->span);
+							break;
+						}
+					}
+				} else {
+					chanpos = pri_find_principle(pri, e->facility.channel);
+					if (chanpos < 0) {
+						ast_log(LOG_WARNING, "Facility requested on unconfigured channel %d/%d span %d\n",
+							PRI_SPAN(e->facility.channel), PRI_CHANNEL(e->facility.channel), pri->span);
+					} else {
+						chanpos = pri_fixup_principle(pri, chanpos, e->facility.call);
+						if (chanpos < 0) {
+							ast_log(LOG_WARNING, "Facility requested on channel %d/%d not in use on span %d\n",
+								PRI_SPAN(e->facility.channel), PRI_CHANNEL(e->facility.channel), pri->span);
+						} else {
+							ast_mutex_lock(&pri->pvts[chanpos]->lock);
+							for (i = 0; i < e->facility.subcmds.counter_subcmd; i++) {
+								struct subcommand *subcmd = &e->facility.subcmds.subcmd[i];
+								struct ast_channel *owner;
+
+								switch (subcmd->cmd) {
+								case CMD_CONNECTEDLINE:
+									owner = pri->pvts[chanpos]->owner;
+									if (owner) {
+										struct ast_party_connected_line connected;
+										struct cmd_connectedline *cmdcl;
+
+										/* Update the connected line information on the other channel */
+										ast_party_connected_line_init(&connected);
+										cmdcl = &subcmd->connectedline;
+										connected.id.number = cmdcl->connected.id.number;
+										connected.id.name = cmdcl->connected.id.name;
+										connected.id.number_type = cmdcl->connected.id.number_type;
+										connected.id.number_presentation = pri_to_ast_presentation(cmdcl->connected.id.number_presentation);
+										connected.source = pri_to_ast_connected_line_update_source(cmdcl->connected.source);
+										ast_queue_connected_line_update(owner, &connected);
+
+										ast_copy_string(pri->pvts[chanpos]->lastcid_num, cmdcl->connected.id.number, sizeof(pri->pvts[chanpos]->lastcid_num));
+										ast_copy_string(pri->pvts[chanpos]->lastcid_name, cmdcl->connected.id.name, sizeof(pri->pvts[chanpos]->lastcid_name));
+
+										pri->pvts[chanpos]->subs[SUB_REAL].needcallerid = 1;
+										//dahdi_enable_ec(pri->pvts[chanpos]);
+									}
+									break;
+								case CMD_REDIRECTING:
+									owner = pri->pvts[chanpos]->owner;
+									if (owner) {
+										struct ast_party_redirecting redirecting = {{0,},};
+										struct cmd_redirecting *cmdr;
+
+										cmdr = &subcmd->redirecting;
+										redirecting.from.number = cmdr->redirecting.from.number;
+										redirecting.from.name = cmdr->redirecting.from.name;
+										redirecting.from.number_type = cmdr->redirecting.from.number_type;
+										redirecting.from.number_presentation = pri_to_ast_presentation(cmdr->redirecting.from.number_presentation);
+										redirecting.to.number = cmdr->redirecting.to.number;
+										redirecting.to.name = cmdr->redirecting.to.name;
+										redirecting.to.number_type = cmdr->redirecting.to.number_type;
+										redirecting.to.number_presentation = pri_to_ast_presentation(cmdr->redirecting.to.number_presentation);
+										redirecting.count = 0;
+										redirecting.reason = pri_to_ast_reason(cmdr->redirecting.reason);
+										ast_queue_redirecting_update(owner, &redirecting);
+									}
+									break;
+								default:
+									ast_log(LOG_WARNING,
+										"Illegal subcommand %d in facility request on channel %d/%d not in use on span %d\n",
+										subcmd->cmd, PRI_SPAN(e->facility.channel), PRI_CHANNEL(e->facility.channel), pri->span);
+									break;
+								}
+							}
+							ast_mutex_unlock(&pri->pvts[chanpos]->lock);
+						}
+					}
+				}
+				break;
+			}
+			case PRI_EVENT_ANSWER:
+			{
+				int channel = e->answer.channel;
+				int ccbsnronprispan = PRI_SPAN(channel);
+				int explicit = PRI_EXPLICIT(channel);
+				int i;
+
+				channel = PRI_CHANNEL(channel);
+
+				ast_verb(4,
+					"PRI_EVENT_ANSWER e->answer.channel(0x%x) span(%d) explicit(%d) channel(%d)\n",
+					e->answer.channel, ccbsnronprispan, explicit, channel);
+
+				if (channel == 0) {	/* No channel Connection */
+					for (i = 0; i < e->answer.subcmds.counter_subcmd; i++) {
+						struct subcommand *subcmd = &e->answer.subcmds.subcmd[i];
+
+						switch (subcmd->cmd) {
+						case CMD_CC_CCBSREQUEST_RR:
+						{
+							struct ccbsnr_link *cclink;
+							unsigned int handle;
+							int cr = e->answer.cref;
+							int no_path_reservation = subcmd->cc_ccbs_rr.cc_request_res.no_path_reservation;
+							int retain_service      = subcmd->cc_ccbs_rr.cc_request_res.retain_service;
+
+							ast_verb(4,
+								"Answer ccbs-request RR no-path-reservation '%d' retain-service '%d' on channel %d/%d on span %d\n",
+								no_path_reservation, retain_service,
+								PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), pri->span);
+							handle = CCBS_HANDLE(ccbsnronprispan,cr);
+							cclink = ccbsnr_select_link(handle);
+							if (cclink) {
+								struct ast_channel *peer;
+
+								peer = cclink->peer;
+								cclink->peer = NULL;
+								ast_verb(4,
+									"PRI_EVENT_ANSWER: peer on CCBS-List-Obj (%p))\n",
+									peer);
+
+								if (peer) {
 									ast_verb(4,
-										"Facility cc-execposible: handle=%x\n", handle);
-									if (ccbsnr_get_link(handle, &state) != NULL) {
-										if (state == CC_INVOKED_A_RET) {
-											ast_verb(4,
-												"DAHDI ccbsnr_remote_user_free: state '%d'\n",
-												state);
-											ccbsnr_remote_user_free(handle);
-										}
-									} else {
-										ast_verb(3,
-											"Facility cc-execposible: List-obj not found - handle=%x state=%d\n",
-											handle, state);
+										"fac-ev:PRI_CC_CCBSREQUEST:set per peer %p state ACTIVATED\n",
+										peer);
+									pbx_builtin_setvar_helper(peer, "CCBSNRREQSTATE", "ACTIVATED");
+								} else {
+									ast_verb(4,
+										"PRI_EVENT_ANSWER: No peer on CCBS-List-Obj found\n");
+								}
+							} else {
+								ast_verb(3,
+									"PRI_EVENT_ANSWER: CCBS-List-Obj not found: e->answer.channel(0x%x) span(%d) explicit(%d) channel(%d)\n",
+									e->answer.channel, ccbsnronprispan, explicit, channel);
+							}
+							break;
+						}
+
+						case CMD_CC_CCNRREQUEST_RR:
+						{
+							struct ccbsnr_link *cclink;
+							unsigned int handle;
+							int cr = e->answer.cref;
+							int no_path_reservation = subcmd->cc_ccnr_rr.cc_request_res.no_path_reservation;
+							int retain_service      = subcmd->cc_ccnr_rr.cc_request_res.retain_service;
+
+							ast_verb(3,
+								"Answer ccnr-request RR no-path-reservation '%d' retain-service '%d' on channel %d/%d on span %d\n",
+								no_path_reservation, retain_service,
+								PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), pri->span);
+							handle = CCBS_HANDLE(ccbsnronprispan,cr);
+							cclink = ccbsnr_select_link(handle);
+							if (cclink) {
+								struct ast_channel *peer;
+								peer = cclink->peer;
+								cclink->peer = NULL;
+								ast_verb(4,
+									"PRI_EVENT_ANSWER: peer on CCBS-List-Obj (%p))\n", peer);
+
+								if (peer) {
+									ast_verb(4,
+										"fac-ev:PRI_CC_CCBSREQUEST:set per peer %p state ACTIVATED\n",
+										peer);
+									pbx_builtin_setvar_helper(peer, "CCBSNRREQSTATE", "ACTIVATED");
+								} else {
+									ast_verb(3, "PRI_EVENT_ANSWER: No peer on CCBS-List-Obj found\n");
+								}
+							} else {
+								ast_verb(3,
+									"PRI_EVENT_ANSWER: CCBS-List-Obj not found: e->answer.channel(0x%x) span(%d) explicit(%d) channel(%d)\n",
+									e->answer.channel, ccbsnronprispan, explicit, channel);
+							}
+							break;
+						}
+
+						default:
+							ast_log(LOG_WARNING, "Illegal subcommand %d in answer on channel %d/%d span %d\n",
+								subcmd->cmd, PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), pri->span);
+							break;
+						}
+					}
+				} else {
+					chanpos = pri_find_principle(pri, e->answer.channel);
+					if (chanpos < 0) {
+						ast_log(LOG_WARNING, "Answer on unconfigured channel %d/%d span %d\n",
+							PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), pri->span);
+					} else {
+						chanpos = pri_fixup_principle(pri, chanpos, e->answer.call);
+						if (chanpos < 0) {
+							ast_log(LOG_WARNING, "Answer requested on channel %d/%d not in use on span %d\n",
+								PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), pri->span);
+						} else {
+							struct ast_party_connected_line connected;
+							struct ast_channel *owner;
+
+							ast_mutex_lock(&pri->pvts[chanpos]->lock);
+							/* Now we can do call progress detection */
+
+							/* We changed this so it turns on the DSP no matter what... progress or no progress.
+							 * By this time, we need DTMF detection and other features that were previously disabled
+							 * -- Matt F */
+							if (pri->pvts[chanpos]->dsp && pri->pvts[chanpos]->dsp_features) {

[... 912 lines stripped ...]



More information about the asterisk-commits mailing list