[Asterisk-cvs] libpri libpri.h, 1.56, 1.57 pri_internal.h, 1.25, 1.26 q931.c, 1.134, 1.135

kpfleming at lists.digium.com kpfleming at lists.digium.com
Mon Jul 11 22:25:12 CDT 2005


Update of /usr/cvsroot/libpri
In directory mongoose.digium.com:/tmp/cvs-serv13047

Modified Files:
	libpri.h pri_internal.h q931.c 
Log Message:
forward more ANI information to users of libpri (bug #4571)


Index: libpri.h
===================================================================
RCS file: /usr/cvsroot/libpri/libpri.h,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- libpri.h	29 Jun 2005 21:28:23 -0000	1.56
+++ libpri.h	12 Jul 2005 02:33:25 -0000	1.57
@@ -294,10 +294,12 @@
 	q931_call *call;
 } pri_event_facname;
 
+#define PRI_CALLINGPLANANI
 typedef struct pri_event_ring {
 	int e;
 	int channel;				/* Channel requested */
 	int callingpres;			/* Presentation of Calling CallerID */
+	int callingplanani;			/* Dialing plan of Calling entity ANI */
 	int callingplan;			/* Dialing plan of Calling entity */
 	char callingani[256];		/* Calling ANI */
 	char callingnum[256];		/* Calling number */
@@ -305,17 +307,17 @@
 	int calledplan;				/* Dialing plan of Called number */
 	int ani2;                   /* ANI II */
 	char callednum[256];		/* Called number */
-	char redirectingnum[256];		/* Redirecting number */
-	char redirectingname[256];		/* Redirecting name */
-	int redirectingreason;			/* Reason for redirect */
-	char useruserinfo[256];			/* User->User info */
+	char redirectingnum[256];	/* Redirecting number */
+	char redirectingname[256];	/* Redirecting name */
+	int redirectingreason;		/* Reason for redirect */
+	char useruserinfo[256];		/* User->User info */
 	int flexible;				/* Are we flexible with our channel selection? */
 	int cref;					/* Call Reference Number */
 	int ctype;					/* Call type (see PRI_TRANS_CAP_* */
-	int layer1;				/* User layer 1 */
+	int layer1;					/* User layer 1 */
 	int complete;				/* Have we seen "Complete" i.e. no more number? */
 	q931_call *call;			/* Opaque call pointer */
-	char callingsubaddr[256];		/* Calling parties subaddress */
+	char callingsubaddr[256];	/* Calling parties subaddress */
 	int progress;
 	int progressmask;
 	char origcalledname[256];

Index: pri_internal.h
===================================================================
RCS file: /usr/cvsroot/libpri/pri_internal.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- pri_internal.h	21 Jun 2005 22:47:39 -0000	1.25
+++ pri_internal.h	12 Jul 2005 02:33:25 -0000	1.26
@@ -199,16 +199,17 @@
 	int sugcallstate;		/* Status call state */
 	
 	int callerplan;
+	int callerplanani;
 	int callerpres;			/* Caller presentation */
 	char callerani[256];	/* Caller */
 	char callernum[256];
 	char callername[256];
 
-	char digitbuf[64];	/* Buffer for digits that come in KEYPAD_FACILITY */
+	char digitbuf[64];		/* Buffer for digits that come in KEYPAD_FACILITY */
 
 	int ani2;               /* ANI II */
 	
-	int  calledplan;
+	int calledplan;
 	int nonisdn;
 	char callednum[256];	/* Called Number */
 	int complete;			/* no more digits coming */
@@ -226,11 +227,11 @@
 	/* Filled in cases of multiple diversions */
 	int origcalledplan;
 	int origcalledpres;
-	int origredirectingreason;      /* Original reason for redirect (in cases of multiple redirects) */
+	int origredirectingreason;	/* Original reason for redirect (in cases of multiple redirects) */
 	char origcalledname[256];	/* Original name of person being called */
-	char origcallednum[256];		/* Orignal number of person being called */
+	char origcallednum[256];	/* Orignal number of person being called */
 
-        int useruserprotocoldisc;
+	int useruserprotocoldisc;
 	char useruserinfo[256];
 	char callingsubaddr[256];	/* Calling parties sub address */
 	

Index: q931.c
===================================================================
RCS file: /usr/cvsroot/libpri/q931.c,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -d -r1.134 -r1.135
--- q931.c	11 Jul 2005 17:48:30 -0000	1.134
+++ q931.c	12 Jul 2005 02:33:25 -0000	1.135
@@ -913,18 +913,12 @@
 {
 	u_int8_t *data;
 	size_t length;
-	int extbit;
         
-	call->callerplan = ie->data[0] & 0x7f;
-	extbit = (ie->data[0] >> 7) & 0x01;
-
-	if (extbit) {
+	if (ie->data[0] & 0x80) {
 		data = ie->data + 1;
 		length = len - 3;
-		call->callerpres = 0; /* PI presentation allowed
-								 SI user-provided, not screened */        
-	}
-	else {
+		call->callerpres = 0; /* PI presentation allowed SI user-provided, not screened */        
+	} else {
 		data = ie->data + 2;
 		length = len - 4;
 		call->callerpres = ie->data[1] & 0x7f;
@@ -933,15 +927,17 @@
 	if (call->callerpres == PRES_ALLOWED_NETWORK_NUMBER ||
 		call->callerpres == PRES_PROHIB_NETWORK_NUMBER) {
 		q931_get_number((u_int8_t *)call->callerani, sizeof(call->callerani), data, length);
+		call->callerplanani = ie->data[0] & 0x7f;
 
-		/*
-		 * Copy ANI to Caller*ID if Caller*ID is not already set
-		 */
-		if (!*call->callernum)
+		if (!*call->callernum) { /*Copy ANI to CallerID if CallerID is not already set */
 			libpri_copy_string(call->callernum, call->callerani, sizeof(call->callernum));
-	}
-	else
+			call->callerplan = call->callerplanani;
+		}
+		
+	} else {
 		q931_get_number((u_int8_t *)call->callernum, sizeof(call->callernum), data, length);
+		call->callerplan = ie->data[0] & 0x7f;
+	}
 
 	return 0;
 }
@@ -3000,20 +2996,23 @@
 		c->callernum[0] = '\0';
 		c->callednum[0] = '\0';
 		c->callername[0] = '\0';
-                c->redirectingplan = -1;
-                c->redirectingpres = -1;
-                c->redirectingreason = -1;
-                c->origcalledplan = -1;
-                c->origcalledpres = -1;
-                c->origredirectingreason = -1;
+		c->callerani[0] = '\0';
+		c->callerplanani = -1;
+		c->redirectingplan = -1;
+		c->redirectingpres = -1;
+		c->redirectingreason = -1;
+		c->origcalledplan = -1;
+		c->origcalledpres = -1;
+		c->origredirectingreason = -1;
 		c->redirectingnum[0] = '\0';
 		c->origcallednum[0] = '\0';
 		c->redirectingname[0] = '\0';
 		c->origcalledname[0] = '\0';
-                c->useruserprotocoldisc = -1; 
+		c->useruserprotocoldisc = -1; 
 		c->useruserinfo[0] = '\0';
 		c->complete = 0;
 		c->nonisdn = 0;
+		c->aoc_units = -1;
 		/* Fall through */
 	case Q931_CONNECT:
 	case Q931_ALERTING:
@@ -3210,6 +3209,7 @@
 		pri->ev.ring.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
 		pri->ev.ring.callingpres = c->callerpres;
 		pri->ev.ring.callingplan = c->callerplan;
+		pri->ev.ring.callingplanani = c->callerplanani;
 		pri->ev.ring.ani2 = c->ani2;
 		libpri_copy_string(pri->ev.ring.callingani, c->callerani, sizeof(pri->ev.ring.callingani));
 		libpri_copy_string(pri->ev.ring.callingnum, c->callernum, sizeof(pri->ev.ring.callingnum));




More information about the svn-commits mailing list