[Asterisk-cvs] libpri libpri.h, 1.35, 1.36 pri.c, 1.27, 1.28 pri_internal.h, 1.13, 1.14 q931.c, 1.92, 1.93

markster at lists.digium.com markster at lists.digium.com
Sat Oct 30 16:10:33 CDT 2004


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

Modified Files:
	libpri.h pri.c pri_internal.h q931.c 
Log Message:
Add ability to send redirecting number (bug #2760)


Index: libpri.h
===================================================================
RCS file: /usr/cvsroot/libpri/libpri.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- libpri.h	27 Oct 2004 20:43:23 -0000	1.35
+++ libpri.h	30 Oct 2004 20:13:19 -0000	1.36
@@ -449,6 +449,7 @@
 extern int pri_sr_set_bearer(struct pri_sr *sr, int transmode, int userl1);
 extern int pri_sr_set_called(struct pri_sr *sr, char *called, int calledplan, int complete);
 extern int pri_sr_set_caller(struct pri_sr *sr, char *caller, char *callername, int callerplan, int callerpres);
+extern int pri_sr_set_redirecting(struct pri_sr *sr, char *num, int plan, int pres, int reason);
 
 extern int pri_setup(struct pri *pri, q931_call *call, struct pri_sr *req);
 	 

Index: pri.c
===================================================================
RCS file: /usr/cvsroot/libpri/pri.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- pri.c	27 Oct 2004 20:43:23 -0000	1.27
+++ pri.c	30 Oct 2004 20:13:19 -0000	1.28
@@ -639,3 +639,11 @@
 	return 0;
 }
 
+int pri_sr_set_redirecting(struct pri_sr *sr, char *num, int plan, int pres, int reason)
+{
+	sr->redirectingnum = num;
+	sr->redirectingplan = plan;
+	sr->redirectingpres = pres;
+	sr->redirectingreason = reason;
+	return 0;
+}

Index: pri_internal.h
===================================================================
RCS file: /usr/cvsroot/libpri/pri_internal.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- pri_internal.h	27 Oct 2004 20:43:23 -0000	1.13
+++ pri_internal.h	30 Oct 2004 20:13:19 -0000	1.14
@@ -118,6 +118,10 @@
 	int calledplan;
 	int userl1;
 	int numcomplete;
+	char *redirectingnum;
+	int redirectingplan;
+	int redirectingpres;
+	int redirectingreason;
 };
 
 /* Internal switch types */

Index: q931.c
===================================================================
RCS file: /usr/cvsroot/libpri/q931.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- q931.c	29 Oct 2004 15:41:59 -0000	1.92
+++ q931.c	30 Oct 2004 20:13:20 -0000	1.93
@@ -818,6 +818,17 @@
 	return 0;
 }
 
+static FUNC_SEND(transmit_redirecting_number)
+{
+	if (call->redirectingnum && strlen(call->redirectingnum)) {
+		ie->data[0] = call->redirectingplan;
+		ie->data[1] = call->redirectingpres;
+		ie->data[2] = (call->redirectingreason & 0x0f) | 0x80;
+		memcpy(ie->data + 3, call->redirectingnum, strlen(call->redirectingnum));
+		return strlen(call->redirectingnum) + 3 + 2;
+	}
+	return 0;
+}
 
 static FUNC_DUMP(dump_redirecting_subaddr)
 {
@@ -1458,7 +1469,7 @@
 	{ Q931_CALLING_PARTY_SUBADDR, "Calling Party Subaddress", dump_calling_party_subaddr, receive_calling_party_subaddr },
 	{ Q931_CALLED_PARTY_NUMBER, "Called Party Number", dump_called_party_number, receive_called_party_number, transmit_called_party_number },
 	{ Q931_CALLED_PARTY_SUBADDR, "Called Party Subaddress", dump_called_party_subaddr },
-	{ Q931_REDIRECTING_NUMBER, "Redirecting Number", dump_redirecting_number, receive_redirecting_number },
+	{ Q931_REDIRECTING_NUMBER, "Redirecting Number", dump_redirecting_number, receive_redirecting_number, transmit_redirecting_number },
 	{ Q931_REDIRECTING_SUBADDR, "Redirecting Subaddress", dump_redirecting_subaddr },
 	{ Q931_TRANSIT_NET_SELECT, "Transit Network Selection" },
 	{ Q931_RESTART_INDICATOR, "Restart Indicator", dump_restart_indicator, receive_restart_indicator, transmit_restart_indicator },
@@ -2191,7 +2202,7 @@
 }
 
 static int setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, Q931_IE_FACILITY, Q931_PROGRESS_INDICATOR, Q931_NETWORK_SPEC_FAC, Q931_DISPLAY,
-	Q931_CALLING_PARTY_NUMBER, Q931_CALLED_PARTY_NUMBER, Q931_SENDING_COMPLETE, Q931_IE_ORIGINATING_LINE_INFO, -1 };
+	Q931_CALLING_PARTY_NUMBER, Q931_CALLED_PARTY_NUMBER, Q931_REDIRECTING_NUMBER, Q931_SENDING_COMPLETE, Q931_IE_ORIGINATING_LINE_INFO, -1 };
 
 static int gr303_setup_ies[] =  { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, -1 };
 
@@ -2241,6 +2252,23 @@
 		c->callerplan = PRI_UNKNOWN;
 		c->callerpres = PRES_NUMBER_NOT_AVAILABLE;
 	}
+	if (req->redirectingnum) {
+		strncpy(c->redirectingnum, req->redirectingnum, sizeof(c->redirectingnum) - 1);
+		c->redirectingplan = req->redirectingplan;
+		if ((pri->switchtype == PRI_SWITCH_DMS100) ||
+		    (pri->switchtype == PRI_SWITCH_ATT4ESS)) {
+			/* Doesn't like certain presentation types */
+			if (!(req->redirectingpres & 0x7c))
+				req->redirectingpres = PRES_ALLOWED_NETWORK_NUMBER;
+		}
+		c->redirectingpres = req->redirectingpres;
+		c->redirectingreason = req->redirectingreason;
+	} else {
+		strcpy(c->redirectingnum, "");
+		c->redirectingplan = PRI_UNKNOWN;
+		c->redirectingpres = PRES_NUMBER_NOT_AVAILABLE;
+		c->redirectingreason = PRI_REDIR_UNKNOWN;
+	}
 	if (req->called) {
 		strncpy(c->callednum, req->called, sizeof(c->callednum) - 1);
 		c->calledplan = req->calledplan;




More information about the svn-commits mailing list