[Asterisk-cvs] libpri-matt pri_facility.c, 1.2, 1.3 pri_facility.h, 1.2, 1.3

mattf at lists.digium.com mattf at lists.digium.com
Wed Dec 15 11:24:14 CST 2004


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

Modified Files:
	pri_facility.c pri_facility.h 
Log Message:
Convert Q.SIG redirect reason codes to Q.931 redirect codes...
Also read the redirecting number correctly


Index: pri_facility.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_facility.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pri_facility.c	10 Nov 2004 16:57:39 -0000	1.2
+++ pri_facility.c	15 Dec 2004 16:20:56 -0000	1.3
@@ -15,6 +15,24 @@
 #include <stdlib.h>
 #include <string.h>
 
+
+static unsigned char redirectingreason_qsig2q931(unsigned char qsigreason)
+{
+	switch (qsigreason) {
+		case DIVERT_REASON_UNKNOWN:
+			return PRI_REDIR_UNKNOWN;
+		case DIVERT_REASON_CFU:
+			return PRI_REDIR_UNCONDITIONAL;
+		case DIVERT_REASON_CFB:
+			return PRI_REDIR_FORWARD_ON_BUSY;
+		case DIVERT_REASON_CFNR:
+			return PRI_REDIR_FORWARD_ON_NO_REPLY;
+		default:
+			pri_message("Unknown Redirect reason %d\n", qsigreason);
+			return DIVERT_REASON_UNKNOWN;
+	}
+}
+
 int rose_invoke_decode(q931_call *call, unsigned char *data, int len)
 {
 	int i = 0;
@@ -86,6 +104,7 @@
 					if (i+1 >= seq_end) return -1;
 					comp = (struct rose_component*)&vdata[i];
 					if (((comp->type&0x1f) == ASN1_ENUMERATED) && comp->len == 1) {
+						call->redirectingreason = redirectingreason_qsig2q931(comp->data[0]);
 						call->redirectingreason = comp->data[0];
 						pri_message("Diversion Reason: %d\n", call->redirectingreason);
 					} else {
@@ -107,6 +126,7 @@
 								break;
 							case 0x01: /* diverting number */
 								pri_message("Found diverting number\n");
+								strncpy(call->redirectingnum, comp->data, strlen(comp->data));
 								break;
 							case 0x02: /* TODO: Originally called number */
 								pri_message("Found originally called number\n");

Index: pri_facility.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_facility.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pri_facility.h	10 Nov 2004 16:57:39 -0000	1.2
+++ pri_facility.h	15 Dec 2004 16:20:56 -0000	1.3
@@ -3,6 +3,10 @@
    with facility message usage and the ROSE components included
    within those messages.
 
+   It is distributed under the terms and conditions of the GNU General
+   Public License Version 2.  Please see http://www.gnu.org/ for license
+   details.
+
    by Matthew Fredrickson <creslin at digium.com>
    Copyright (C) Digium, Inc. 2004
 */
@@ -18,6 +22,8 @@
 #define ROSE_NETWORK_EXTENSION	31
 
 /* Argument values */
+/* TODO: Look at spec at clean this up... 0x80 should not be
+   included in basic types */
 #define ROSE_NAME_PRESENTATION_ALLOWED_SIMPLE 0x80
 #define ROSE_NAME_PRESENTATION_RESTRICTED_NULL 0x87
 #define ROSE_NAME_NOT_AVAIL 0x84
@@ -66,11 +72,11 @@
 #define ASN1_UTCTIME 0x17
 #define ASN1_GENERALIZEDTIME 0x18
 
-/* Divert cause */
-#define DIVERT_REASON_UNKNOWN 0x00
-#define DIVERT_REASON_CFU 0x01
-#define DIVERT_REASON_CFB 0x02
-#define DIVERT_REASON_CFNR 0x03
+/* Q.SIG Divert cause */
+#define DIVERT_REASON_UNKNOWN 0x00 /* Call forward Unknown reason */
+#define DIVERT_REASON_CFU 0x01 /* Call forward Unconditional (Other reason) */
+#define DIVERT_REASON_CFB 0x02 /* Call Forward Busy */
+#define DIVERT_REASON_CFNR 0x03 /* Call forward No Reply */
 
 struct rose_component {
         u_int8_t type;




More information about the svn-commits mailing list