[asterisk-commits] rmudgett: branch group/issue14068 r199093 - in /team/group/issue14068: ./ cha...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 4 11:46:01 CDT 2009


Author: rmudgett
Date: Thu Jun  4 11:45:57 2009
New Revision: 199093

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=199093
Log:
Q.SIG COLP feature completed.

*  Enhanced the libpri party id structure with more information.  (valid flag,
separate name and number presentation, name character set)
*  Eliminated the libpri connected-line source parameter as it did not do anything.
*  Eliminated several added API fields in libpri events.  The connected-line and
redirecting subcommands pass the information instead.
*  The PRI lock needs to be grabbed when the AST_CONTROL_CONNECTED_LINE and
AST_CONTROL_REDIRECTING are received.

Modified:
    team/group/issue14068/CHANGES
    team/group/issue14068/channels/chan_dahdi.c

Modified: team/group/issue14068/CHANGES
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/issue14068/CHANGES?view=diff&rev=199093&r1=199092&r2=199093
==============================================================================
--- team/group/issue14068/CHANGES (original)
+++ team/group/issue14068/CHANGES Thu Jun  4 11:45:57 2009
@@ -132,6 +132,17 @@
 -------------------------------------------
   * The channel variable PRIREDIRECTREASON is now just a status variable.
     Use the REDIRECTING(reason) dialplan function to alter the reason.
+  * For Q.SIG and ETSI PRI/BRI-PTP, you should manually send the COLR of the
+    redirected-to party for an incomming redirected call if the incoming call
+    could experience further redirects.  Just set the
+    REDIRECTING(to-num,i) = CALLERID(dnid) and set the REDIRECTING(to-pres)
+    to the COLR.  A call has been redirected if the REDIRECTING(count) is not
+    zero.
+  * For outgoing Q.SIG and ETSI PRI/BRI-PTP redirected calls, you need to
+    use the inhibit(i) option on all of the REDIRECTING statements before
+    dialing the redirected-to party.  You still have to set the
+    REDIRECTING(to-xxx,i) and the REDIRECTING(from-xxx,i) values.  The call
+    will update the redirecting-to presentation (COLR) when it becomes available.
 
 Asterisk Manager Interface
 --------------------------

Modified: team/group/issue14068/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/issue14068/channels/chan_dahdi.c?view=diff&rev=199093&r1=199092&r2=199093
==============================================================================
--- team/group/issue14068/channels/chan_dahdi.c (original)
+++ team/group/issue14068/channels/chan_dahdi.c Thu Jun  4 11:45:57 2009
@@ -3345,52 +3345,146 @@
 #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_ANSWER:
-		ast_source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
-		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;
-	}
-
-	return ast_source;
+/*!
+ * \internal
+ * \brief Determine the overall presentation value for the given party.
+ * \since 1.6.3
+ *
+ * \param id Party to determine the overall presentation value.
+ *
+ * \return Overall presentation value for the given party converted to ast values.
+ */
+static int overall_ast_presentation(const struct pri_party_id *id)
+{
+	int number_priority;
+	int number_value;
+	int number_screening;
+	int name_priority;
+	int name_value;
+
+	/* Determine name presentation priority. */
+	if (!id->name.valid) {
+		name_value = PRI_PRES_UNAVAILABLE;
+		name_priority = 3;
+	} else {
+		name_value = id->name.presentation & PRI_PRES_RESTRICTION;
+		switch (name_value) {
+		case PRI_PRES_RESTRICTED:
+			name_priority = 0;
+			break;
+		case PRI_PRES_ALLOWED:
+			name_priority = 1;
+			break;
+		case PRI_PRES_UNAVAILABLE:
+			name_priority = 2;
+			break;
+		default:
+			name_value = PRI_PRES_UNAVAILABLE;
+			name_priority = 3;
+			break;
+		}
+	}
+
+	/* Determine number presentation priority. */
+	if (!id->number.valid) {
+		number_screening = PRI_PRES_USER_NUMBER_UNSCREENED;
+		number_value = PRI_PRES_UNAVAILABLE;
+		number_priority = 3;
+	} else {
+		number_screening = id->number.presentation & PRI_PRES_NUMBER_TYPE;
+		number_value = id->number.presentation & PRI_PRES_RESTRICTION;
+		switch (number_value) {
+		case PRI_PRES_RESTRICTED:
+			number_priority = 0;
+			break;
+		case PRI_PRES_ALLOWED:
+			number_priority = 1;
+			break;
+		case PRI_PRES_UNAVAILABLE:
+			number_priority = 2;
+			break;
+		default:
+			number_screening = PRI_PRES_USER_NUMBER_UNSCREENED;
+			number_value = PRI_PRES_UNAVAILABLE;
+			number_priority = 3;
+			break;
+		}
+	}
+
+	/* Select the wining presentation value. */
+	if (name_priority < number_priority) {
+		number_value = name_value;
+	}
+
+	return pri_to_ast_presentation(number_value | number_screening);
 }
 #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_ANSWER:
-		pri_source = PRI_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
-		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;
-	}
-
-	return pri_source;
+/*!
+ * \internal
+ * \brief Fill in the PRI party id from the given asterisk party id.
+ * \since 1.6.3
+ *
+ * \param pri_id PRI party id structure.
+ * \param ast_id Asterisk party id structure.
+ *
+ * \return Nothing
+ *
+ * \note Assumes that pri_id has been previously memset to zero.
+ */
+static void dahdi_pri_party_id_from_ast(struct pri_party_id *pri_id, const struct ast_party_id *ast_id)
+{
+	int presentation;
+
+	presentation = ast_to_pri_presentation(ast_id->number_presentation);
+	if (!ast_strlen_zero(ast_id->name)) {
+		pri_id->name.valid = 1;
+		pri_id->name.presentation = presentation;
+		pri_id->name.char_set = PRI_CHAR_SET_ISO8859_1;
+		ast_copy_string(pri_id->name.str, ast_id->name, sizeof(pri_id->name.str));
+	}
+	if (!ast_strlen_zero(ast_id->number)) {
+		pri_id->number.valid = 1;
+		pri_id->number.presentation = presentation;
+		pri_id->number.plan = ast_id->number_type;
+		ast_copy_string(pri_id->number.str, ast_id->number, sizeof(pri_id->number.str));
+	}
+}
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
+/*!
+ * \internal
+ * \brief Update the PRI redirecting information for the current call.
+ * \since 1.6.3
+ *
+ * \param ast Asterisk channel
+ *
+ * \return Nothing
+ *
+ * \note Assumes that the PRI lock is already obtained.
+ */
+static void dahdi_pri_redirecting_update(struct ast_channel *ast)
+{
+	struct dahdi_pvt *pvt;
+	struct pri_party_redirecting pri_redirecting;
+	struct ast_party_redirecting ast_redirecting;
+
+	/* Gather asterisk redirecting data */
+	ast_redirecting = ast->redirecting;
+	ast_redirecting.from.number = ast->cid.cid_rdnis;
+
+/*! \todo XXX Original called data can be put in a channel data store that is inherited. */
+
+	memset(&pri_redirecting, 0, sizeof(pri_redirecting));
+	dahdi_pri_party_id_from_ast(&pri_redirecting.from, &ast_redirecting.from);
+	dahdi_pri_party_id_from_ast(&pri_redirecting.to, &ast_redirecting.to);
+	pri_redirecting.count = ast_redirecting.count;
+	pri_redirecting.reason = ast_to_pri_reason(ast_redirecting.reason);
+
+	pvt = ast->tech_pvt;
+	pri_redirecting_update(pvt->pri->pri, pvt->call, &pri_redirecting);
 }
 #endif	/* defined(HAVE_PRI) */
 
@@ -4103,10 +4197,7 @@
 		}
 		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));
-		pri_sr_set_redirecting(sr, ast->cid.cid_rdnis, ast->redirecting.from.number_type,
-			ast->redirecting.from.number_presentation,
-			ast_to_pri_reason(ast->redirecting.reason));
-		pri_sr_set_redirecting_name(sr, ast->redirecting.from.name);
+		dahdi_pri_redirecting_update(ast);
 
 #ifdef SUPPORT_USERUSER
 		/* User-user info */
@@ -7770,59 +7861,23 @@
 		case AST_CONTROL_CONNECTED_LINE:
 			ast_debug(1, "Received AST_CONTROL_CONNECTED_LINE on %s\n", chan->name);
 #if defined(HAVE_PRI)
-			if (p->pri) {
+			if (p->pri && p->pri->pri && !pri_grab(p, 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);
+				memset(&connected, 0, sizeof(connected));
+				dahdi_pri_party_id_from_ast(&connected.id, &chan->connected.id);
+
 				pri_connected_line_update(p->pri->pri, p->call, &connected);
+				pri_rel(p->pri);
 			}
 #endif	/* defined(HAVE_PRI) */
 			break;
 		case AST_CONTROL_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);
+			if (p->pri && p->pri->pri && !pri_grab(p, p->pri)) {
+				dahdi_pri_redirecting_update(chan);
+				pri_rel(p->pri);
 			}
 #endif	/* defined(HAVE_PRI) */
 			break;
@@ -12878,7 +12933,8 @@
  *
  * \return Nothing
  */
-static void dahdi_pri_handle_subcmds(struct dahdi_pri *pri, int chanpos, int event_id, int channel, const struct pri_subcommands *subcmds)
+static void dahdi_pri_handle_subcmds(struct dahdi_pri *pri, int chanpos, int event_id,
+	int channel, const struct pri_subcommands *subcmds)
 {
 	int index;
 	struct ast_channel *owner;
@@ -12898,25 +12954,42 @@
 				struct ast_party_connected_line connected;
 				const struct pri_subcmd_connected_line *cmdcl;
 
+				/* Extract the connected line information */
+				ast_party_connected_line_init(&connected);
+				cmdcl = &subcmd->u.connected_line;
+				if (cmdcl->party.id.name.valid) {
+					connected.id.name = (char *) cmdcl->party.id.name.str;
+
+					/* Save for Caller-ID update */
+					ast_copy_string(pri->pvts[chanpos]->lastcid_name,
+						cmdcl->party.id.name.str,
+						sizeof(pri->pvts[chanpos]->lastcid_name));
+					pri->pvts[chanpos]->subs[SUB_REAL].needcallerid = 1;
+				}
+				if (cmdcl->party.id.number.valid) {
+					connected.id.number = (char *) cmdcl->party.id.number.str;
+					connected.id.number_type = cmdcl->party.id.number.plan;
+
+					/* Save for Caller-ID update */
+					ast_copy_string(pri->pvts[chanpos]->lastcid_num,
+						cmdcl->party.id.number.str,
+						sizeof(pri->pvts[chanpos]->lastcid_num));
+					pri->pvts[chanpos]->subs[SUB_REAL].needcallerid = 1;
+				} else {
+					connected.id.number = "";
+				}
+				if (cmdcl->party.id.name.valid
+					|| cmdcl->party.id.number.valid) {
+					connected.id.number_presentation =
+						overall_ast_presentation(&cmdcl->party.id);
+				}
+				connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
+
 				/* Update the connected line information on the other channel */
-				ast_party_connected_line_init(&connected);
-				cmdcl = &subcmd->connected_line;
-				connected.id.number = (char *) cmdcl->party.id.number;
-				connected.id.name = (char *) cmdcl->party.id.name;
-				connected.id.number_type = cmdcl->party.id.number_type;
-				connected.id.number_presentation =
-					pri_to_ast_presentation(cmdcl->party.id.number_presentation);
-				connected.source =
-					pri_to_ast_connected_line_update_source(cmdcl->party.source);
-				ast_channel_queue_connected_line_update(owner, &connected);
-
-				ast_copy_string(pri->pvts[chanpos]->lastcid_num, cmdcl->party.id.number,
-					sizeof(pri->pvts[chanpos]->lastcid_num));
-				ast_copy_string(pri->pvts[chanpos]->lastcid_name, cmdcl->party.id.name,
-					sizeof(pri->pvts[chanpos]->lastcid_name));
-
-				pri->pvts[chanpos]->subs[SUB_REAL].needcallerid = 1;
-				//dahdi_enable_ec(pri->pvts[chanpos]);
+				if (event_id != PRI_EVENT_RING) {
+					/* This connected_line update was not from a SETUP message. */
+					ast_channel_queue_connected_line_update(owner, &connected);
+				}
 
 				ast_channel_unlock(owner);
 			}
@@ -12930,22 +13003,46 @@
 
 				ast_party_redirecting_set_init(&redirecting, &owner->redirecting);
 
-				cmdr = &subcmd->redirecting;
-				redirecting.from.number = (char *) cmdr->party.from.number;
-				redirecting.from.name = (char *) cmdr->party.from.name;
-				redirecting.from.number_type = cmdr->party.from.number_type;
-				redirecting.from.number_presentation =
-					pri_to_ast_presentation(cmdr->party.from.number_presentation);
-				redirecting.to.number = (char *) cmdr->party.to.number;
-				redirecting.to.name = (char *) cmdr->party.to.name;
-				redirecting.to.number_type = cmdr->party.to.number_type;
-				redirecting.to.number_presentation =
-					pri_to_ast_presentation(cmdr->party.to.number_presentation);
+				cmdr = &subcmd->u.redirecting;
+
+				/* redirecting.from */
+				if (cmdr->party.from.name.valid) {
+					redirecting.from.name = (char *) cmdr->party.from.name.str;
+				}
+				if (cmdr->party.from.number.valid) {
+					redirecting.from.number = (char *) cmdr->party.from.number.str;
+					redirecting.from.number_type = cmdr->party.from.number.plan;
+				}
+				if (cmdr->party.from.name.valid
+					|| cmdr->party.from.number.valid) {
+					redirecting.from.number_presentation =
+						overall_ast_presentation(&cmdr->party.from);
+				}
+
+				/* redirecting.to */
+				if (cmdr->party.to.name.valid) {
+					redirecting.to.name = (char *) cmdr->party.to.name.str;
+				}
+				if (cmdr->party.to.number.valid) {
+					redirecting.to.number = (char *) cmdr->party.to.number.str;
+					redirecting.to.number_type = cmdr->party.to.number.plan;
+				}
+				if (cmdr->party.to.name.valid
+					|| cmdr->party.to.number.valid) {
+					redirecting.to.number_presentation =
+						overall_ast_presentation(&cmdr->party.from);
+				}
+
 				redirecting.count = cmdr->party.count;
 				redirecting.reason = pri_to_ast_reason(cmdr->party.reason);
 
+/*! \todo XXX Original called data can be put in a channel data store that is inherited. */
+
 				ast_channel_set_redirecting(owner, &redirecting);
-				ast_channel_queue_redirecting_update(owner, &redirecting);
+				if (event_id != PRI_EVENT_RING) {
+					/* This redirection was not from a SETUP message. */
+					ast_channel_queue_redirecting_update(owner, &redirecting);
+				}
 
 				ast_channel_unlock(owner);
 			}
@@ -13480,12 +13577,7 @@
 				if ((chanpos < 0) && (e->ring.flexible))
 					chanpos = pri_find_empty_chan(pri, 1);
 				if (chanpos > -1) {
-					struct ast_party_redirecting redirecting = {{0,},};
-
 					ast_mutex_lock(&pri->pvts[chanpos]->lock);
-/* XXX BUGBUG handling subcommands may be done too soon here.! */
-					dahdi_pri_handle_subcmds(pri, chanpos, e->e, e->ring.channel,
-						e->ring.subcmds);
 					if (pri->switchtype == PRI_SWITCH_GR303_TMC) {
 						/* Should be safe to lock CRV AFAIK while bearer is still locked */
 						crv = pri_find_crv(pri, pri_get_crv(pri->pri, e->ring.call, NULL));
@@ -13506,17 +13598,6 @@
 							break;
 						}
 					}
-					if (e->ring.redirectingnum[0] || e->ring.redirectingname[0]) {
-						redirecting.to.number = e->ring.callednum;
-						redirecting.to.number_type = e->ring.calledplan;
-						redirecting.to.number_presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
-						redirecting.from.name = e->ring.redirectingname;
-						redirecting.from.number = e->ring.redirectingnum;
-						redirecting.from.number_presentation = e->ring.redirectingpres;
-						redirecting.from.number_type = e->ring.callingplanrdnis;
-						redirecting.reason = pri_to_ast_reason(e->ring.redirectingreason);
-						redirecting.count = e->ring.redirectingcount;
-					}
 					pri->pvts[chanpos]->call = e->ring.call;
 					apply_plan_to_number(plancallingnum, sizeof(plancallingnum), pri, e->ring.callingnum, e->ring.callingplan);
 					if (pri->pvts[chanpos]->use_callerid) {
@@ -13550,7 +13631,6 @@
 					/* Get called number */
 					else if (!ast_strlen_zero(e->ring.callednum)) {
 						ast_copy_string(pri->pvts[chanpos]->exten, e->ring.callednum, sizeof(pri->pvts[chanpos]->exten));
-						ast_copy_string(pri->pvts[chanpos]->dnid, e->ring.callednum, sizeof(pri->pvts[chanpos]->dnid));
 					} else if (pri->overlapdial)
 						pri->pvts[chanpos]->exten[0] = '\0';
 					else {
@@ -13559,8 +13639,7 @@
 						pri->pvts[chanpos]->exten[1] = '\0';
 					}
 					/* Set DNID on all incoming calls -- even immediate */
-					if (!ast_strlen_zero(e->ring.callednum))
-						ast_copy_string(pri->pvts[chanpos]->dnid, e->ring.callednum, sizeof(pri->pvts[chanpos]->dnid));
+					ast_copy_string(pri->pvts[chanpos]->dnid, e->ring.callednum, sizeof(pri->pvts[chanpos]->dnid));
 					/* No number yet, but received "sending complete"? */
 					if (e->ring.complete && (ast_strlen_zero(e->ring.callednum))) {
 						ast_verb(3, "Going to extension s|1 because of Complete received\n");
@@ -13619,9 +13698,6 @@
 
 							ast_mutex_unlock(&pri->pvts[chanpos]->lock);
 
-							if (c && (redirecting.from.number || redirecting.from.name)) {
-								ast_channel_set_redirecting(c, &redirecting);
-							}
 							if (!ast_strlen_zero(e->ring.callingsubaddr)) {
 								pbx_builtin_setvar_helper(c, "CALLINGSUBADDR", e->ring.callingsubaddr);
 							}
@@ -13646,6 +13722,10 @@
 
 							ast_mutex_lock(&pri->pvts[chanpos]->lock);
 							ast_mutex_lock(&pri->lock);
+
+							dahdi_pri_handle_subcmds(pri, chanpos, e->e, e->ring.channel,
+								e->ring.subcmds);
+
 							if (c && !ast_pthread_create_detached(&threadid, NULL, ss_thread, c)) {
 								ast_verb(3, "Accepting overlap call from '%s' to '%s' on channel %d/%d, span %d\n",
 										plancallingnum, S_OR(pri->pvts[chanpos]->exten, "<unspecified>"),
@@ -13669,9 +13749,6 @@
 
 								ast_mutex_unlock(&pri->pvts[chanpos]->lock);
 
-								if (redirecting.from.number || redirecting.from.name) {
-									ast_channel_set_redirecting(c, &redirecting);
-								}
 								if (e->ring.ani2 >= 0) {
 									snprintf(ani2str, 5, "%d", e->ring.ani2);
 									pbx_builtin_setvar_helper(c, "ANI2", ani2str);
@@ -13694,6 +13771,9 @@
 
 								ast_mutex_lock(&pri->pvts[chanpos]->lock);
 								ast_mutex_lock(&pri->lock);
+
+								dahdi_pri_handle_subcmds(pri, chanpos, e->e, e->ring.channel,
+									e->ring.subcmds);
 
 								ast_verb(3, "Accepting call from '%s' to '%s' on channel %d/%d, span %d\n",
 										plancallingnum, pri->pvts[chanpos]->exten,
@@ -13739,28 +13819,8 @@
 						ast_log(LOG_WARNING, "Ringing requested on channel %d/%d not in use on span %d\n",
 							PRI_SPAN(e->ringing.channel), PRI_CHANNEL(e->ringing.channel), pri->span);
 					} else {
-						struct ast_channel *owner;
-
 						ast_mutex_lock(&pri->pvts[chanpos]->lock);
 
-						if (e->ringing.calledname[0] || e->ringing.callednum[0]) {
-							struct ast_party_connected_line connected;
-							
-							dahdi_pri_lock_owner(pri, chanpos);
-							owner = pri->pvts[chanpos]->owner;
-							if (owner) {
-								/* Update the connected line information on the other channel */
-								ast_party_connected_line_init(&connected);
-								connected.id.name = e->ringing.calledname;
-								connected.id.number = e->ringing.callednum;
-								connected.id.number_type = e->ringing.calledplan;
-								connected.id.number_presentation =
-									pri_to_ast_presentation(e->ringing.calledpres);
-								connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
-								ast_channel_queue_connected_line_update(owner, &connected);
-								ast_channel_unlock(owner);
-							}
-						}
 						dahdi_pri_handle_subcmds(pri, chanpos, e->e, e->ringing.channel,
 							e->ringing.subcmds);
 						if (ast_strlen_zero(pri->pvts[chanpos]->dop.dialstr)) {
@@ -13787,6 +13847,8 @@
 
 #ifdef SUPPORT_USERUSER
 						if (!ast_strlen_zero(e->ringing.useruserinfo)) {
+							struct ast_channel *owner;
+
 							dahdi_pri_lock_owner(pri, chanpos);
 							owner = pri->pvts[chanpos]->owner;
 							if (owner) {
@@ -13922,26 +13984,8 @@
 						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);
 
-						dahdi_pri_lock_owner(pri, chanpos);
-						owner = pri->pvts[chanpos]->owner;
-						if (owner) {
-							/* Update the connected line information on the other channel */
-							ast_party_connected_line_init(&connected);
-							connected.id.name = e->answer.connectedname;
-							connected.id.number = e->answer.connectednum;
-							connected.id.number_type = e->answer.connectedplan;
-							connected.id.number_presentation =
-								pri_to_ast_presentation(e->answer.connectedpres);
-							connected.source =
-								pri_to_ast_connected_line_update_source(e->answer.source);
-							ast_channel_queue_connected_line_update(owner, &connected);
-							ast_channel_unlock(owner);
-						}
 						dahdi_pri_handle_subcmds(pri, chanpos, e->e, e->answer.channel,
 							e->answer.subcmds);
 						/* Now we can do call progress detection */
@@ -13983,6 +14027,8 @@
 
 #ifdef SUPPORT_USERUSER
 						if (!ast_strlen_zero(e->answer.useruserinfo)) {
+							struct ast_channel *owner;
+
 							dahdi_pri_lock_owner(pri, chanpos);
 							owner = pri->pvts[chanpos]->owner;
 							if (owner) {




More information about the asterisk-commits mailing list