[libpri-commits] rmudgett: branch group/issue14068 r965 - /team/group/issue14068/

SVN commits to the libpri project libpri-commits at lists.digium.com
Tue Jul 28 14:17:43 CDT 2009


Author: rmudgett
Date: Tue Jul 28 14:17:39 2009
New Revision: 965

URL: http://svn.asterisk.org/svn-view/libpri?view=rev&rev=965
Log:
Added more called party address support for possible future subaddress.

*  Added needed q931_party_address support like q931_party_id support.
*  Collected the called party information in pri_sr into a q931_party_address.
This simplified the code that uses the called party information.
*  Simplified the Q.SIG and ETSI PRI/BRI-PTP REDIRECTING(to-) setup for
DivertingLegInformation3 control.

Modified:
    team/group/issue14068/pri.c
    team/group/issue14068/pri_facility.c
    team/group/issue14068/pri_internal.h
    team/group/issue14068/q931.c

Modified: team/group/issue14068/pri.c
URL: http://svn.asterisk.org/svn-view/libpri/team/group/issue14068/pri.c?view=diff&rev=965&r1=964&r2=965
==============================================================================
--- team/group/issue14068/pri.c (original)
+++ team/group/issue14068/pri.c Tue Jul 28 14:17:39 2009
@@ -902,6 +902,7 @@
 	memset(req, 0, sizeof(struct pri_sr));
 	q931_party_redirecting_init(&req->redirecting);
 	q931_party_id_init(&req->caller);
+	q931_party_address_init(&req->called);
 	req->reversecharge = PRI_REVERSECHARGE_NONE;
 }
 
@@ -1187,8 +1188,12 @@
 
 int pri_sr_set_called(struct pri_sr *sr, char *called, int calledplan, int numcomplete)
 {
-	sr->called = called;
-	sr->calledplan = calledplan;
+	q931_party_address_init(&sr->called);
+	if (called) {
+		sr->called.number.valid = 1;
+		sr->called.number.plan = calledplan;
+		libpri_copy_string(sr->called.number.str, called, sizeof(sr->called.number.str));
+	}
 	sr->numcomplete = numcomplete;
 	return 0;
 }

Modified: team/group/issue14068/pri_facility.c
URL: http://svn.asterisk.org/svn-view/libpri/team/group/issue14068/pri_facility.c?view=diff&rev=965&r1=964&r2=965
==============================================================================
--- team/group/issue14068/pri_facility.c (original)
+++ team/group/issue14068/pri_facility.c Tue Jul 28 14:17:39 2009
@@ -1464,11 +1464,14 @@
 	msg.operation = ROSE_QSIG_MWIActivate;
 	msg.invoke_id = get_invokeid(ctrl);
 
+	/* The called.number is the served user */
+	q931_copy_number_to_rose(ctrl, &msg.args.qsig.MWIActivate.served_user_number,
+		&req->called.number);
+	/*
+	 * For now, we will just force the numbering plan to unknown to preserve
+	 * the original behaviour.
+	 */
 	msg.args.qsig.MWIActivate.served_user_number.plan = 0;	/* unknown */
-	libpri_copy_string((char *) msg.args.qsig.MWIActivate.served_user_number.str,
-		req->called, sizeof(msg.args.qsig.MWIActivate.served_user_number.str));
-	msg.args.qsig.MWIActivate.served_user_number.length = strlen((char *)
-		msg.args.qsig.MWIActivate.served_user_number.str);
 
 	msg.args.qsig.MWIActivate.basic_service = 1;	/* speech */
 
@@ -1510,11 +1513,14 @@
 	msg.operation = ROSE_QSIG_MWIDeactivate;
 	msg.invoke_id = get_invokeid(ctrl);
 
+	/* The called.number is the served user */
+	q931_copy_number_to_rose(ctrl, &msg.args.qsig.MWIDeactivate.served_user_number,
+		&req->called.number);
+	/*
+	 * For now, we will just force the numbering plan to unknown to preserve
+	 * the original behaviour.
+	 */
 	msg.args.qsig.MWIDeactivate.served_user_number.plan = 0;	/* unknown */
-	libpri_copy_string((char *) msg.args.qsig.MWIDeactivate.served_user_number.str,
-		req->called, sizeof(msg.args.qsig.MWIDeactivate.served_user_number.str));
-	msg.args.qsig.MWIDeactivate.served_user_number.length = strlen((char *)
-		msg.args.qsig.MWIDeactivate.served_user_number.str);
 
 	msg.args.qsig.MWIDeactivate.basic_service = 1;	/* speech */
 
@@ -1539,7 +1545,7 @@
 	unsigned char buffer[255];
 	unsigned char *end;
 
-	if (!req->called || !req->called[0]) {
+	if (!req->called.number.valid || !req->called.number.str[0]) {
 		return -1;
 	}
 

Modified: team/group/issue14068/pri_internal.h
URL: http://svn.asterisk.org/svn-view/libpri/team/group/issue14068/pri_internal.h?view=diff&rev=965&r1=964&r2=965
==============================================================================
--- team/group/issue14068/pri_internal.h (original)
+++ team/group/issue14068/pri_internal.h Tue Jul 28 14:17:39 2009
@@ -289,8 +289,7 @@
 	int nonisdn;
 	struct q931_party_redirecting redirecting;
 	struct q931_party_id caller;
-	char *called;
-	int calledplan;
+	struct q931_party_address called;
 	int userl1;
 	int numcomplete;
 	int justsignalling;
@@ -485,6 +484,7 @@
 
 void q931_party_name_init(struct q931_party_name *name);
 void q931_party_number_init(struct q931_party_number *number);
+void q931_party_address_init(struct q931_party_address *address);
 void q931_party_id_init(struct q931_party_id *id);
 void q931_party_redirecting_init(struct q931_party_redirecting *redirecting);
 

Modified: team/group/issue14068/q931.c
URL: http://svn.asterisk.org/svn-view/libpri/team/group/issue14068/q931.c?view=diff&rev=965&r1=964&r2=965
==============================================================================
--- team/group/issue14068/q931.c (original)
+++ team/group/issue14068/q931.c Tue Jul 28 14:17:39 2009
@@ -294,6 +294,18 @@
 	number->presentation = PRI_PRES_UNAVAILABLE | PRI_PRES_USER_NUMBER_UNSCREENED;
 	number->plan = (PRI_TON_UNKNOWN << 4) | PRI_NPI_E163_E164;
 	number->str[0] = '\0';
+}
+
+/*!
+ * \brief Initialize the given struct q931_party_address
+ *
+ * \param address Structure to initialize
+ *
+ * \return Nothing
+ */
+void q931_party_address_init(struct q931_party_address *address)
+{
+	q931_party_number_init(&address->number);
 }
 
 /*!
@@ -2940,7 +2952,7 @@
 	cur->aoc_units = -1;
 	cur->changestatus = -1;
 	q931_party_number_init(&cur->redirection_number);
-	q931_party_number_init(&cur->called.number);
+	q931_party_address_init(&cur->called);
 	q931_party_id_init(&cur->local_id);
 	q931_party_id_init(&cur->remote_id);
 	q931_party_redirecting_init(&cur->redirecting);
@@ -3782,12 +3794,9 @@
 		q931_party_id_fixup(ctrl, &c->redirecting.orig_called);
 	}
 
-	if (req->called) {
-		c->called.number.valid = 1;
-		c->called.number.plan = req->calledplan;
-		libpri_copy_string(c->called.number.str, req->called,
-			sizeof(c->called.number.str));
-		libpri_copy_string(c->overlap_digits, req->called, sizeof(c->overlap_digits));
+	if (req->called.number.valid) {
+		c->called = req->called;
+		libpri_copy_string(c->overlap_digits, req->called.number.str, sizeof(c->overlap_digits));
 	} else
 		return -1;
 
@@ -4033,7 +4042,7 @@
 		c->userl3 = -1;
 		c->rateadaption = -1;
 
-		q931_party_number_init(&c->called.number);
+		q931_party_address_init(&c->called);
 		q931_party_id_init(&c->local_id);
 		q931_party_id_init(&c->remote_id);
 		q931_party_redirecting_init(&c->redirecting);
@@ -4431,13 +4440,9 @@
 			 * incoming call was redirected by checking if the
 			 * REDIRECTING(count) is nonzero.
 			 */
-			q931_party_number_init(&c->redirecting.to.number);
-			c->redirecting.to.number.valid = 1;
+			c->redirecting.to.number = c->called.number;
 			c->redirecting.to.number.presentation =
 				PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED;
-			c->redirecting.to.number.plan = c->called.number.plan;
-			libpri_copy_string(c->redirecting.to.number.str, c->called.number.str,
-				sizeof(c->redirecting.to.number.str));
 		}
 
 		ctrl->ev.e = PRI_EVENT_RING;




More information about the libpri-commits mailing list