[Asterisk-cvs] libpri-matt libpri.h, 1.6, 1.7 pri.c, 1.6, 1.7 pri_facility.c, 1.18, 1.19 pri_facility.h, 1.11, 1.12 pri_internal.h, 1.11, 1.12 pri_q931.h, 1.1.1.1, 1.2 q931.c, 1.21, 1.22

mattf at lists.digium.com mattf at lists.digium.com
Wed Feb 2 20:28:05 CST 2005


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

Modified Files:
	libpri.h pri.c pri_facility.c pri_facility.h pri_internal.h 
	pri_q931.h q931.c 
Log Message:
Here it is all of you, have at it.  Finally, 2 B-channel transfer.  I'd like to
especially thank all of you (..) that committed to contribute and came through.
(The thanks is meant to be sarcastic.  Nobody actually came through that committed to)


Index: libpri.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/libpri.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- libpri.h	27 Dec 2004 21:43:08 -0000	1.6
+++ libpri.h	3 Feb 2005 02:29:14 -0000	1.7
@@ -52,7 +52,8 @@
 #define PRI_SWITCH_GR303_EOC		8	/* GR-303 Embedded Operations Channel */
 #define PRI_SWITCH_GR303_TMC		9	/* GR-303 Timeslot Management Channel */
 #define PRI_SWITCH_QSIG			10	/* QSIG Switch */
-/* Switchtypes 10 - 20 are reserved for internal use */
+#define PRI_SWITCH_5ESS			11	/* 5ESS AT&T switch */
+/* Switchtypes 12 - 20 are reserved for internal use */
 
 
 /* PRI D-Channel Events */
@@ -477,6 +478,11 @@
 extern int pri_mwi_deactivate(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres,
 						char *called, int calledplan);
 	 
+#define PRI_2BCT
+/* Attempt to pass the channels back to the NET side if compatable and
+ * suscribed.  Sometimes called 2 bchannel transfer (2BCT) */
+int pri_channel_bridge(q931_call *call1, q931_call *call2);
+
 /* Override message and error stuff */
 extern void pri_set_message(void (*__pri_error)(char *));
 extern void pri_set_error(void (*__pri_error)(char *));

Index: pri.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pri.c	14 Jan 2005 16:15:29 -0000	1.6
+++ pri.c	3 Feb 2005 02:29:14 -0000	1.7
@@ -399,6 +399,28 @@
 }
 #endif
 
+int pri_channel_bridge(q931_call *call1, q931_call *call2)
+{
+	if (!call1 || !call2)
+		return -1;
+
+	/* Check switchtype compatibility */
+	if (call1->pri->switchtype != PRI_SWITCH_5ESS ||
+			call2->pri->switchtype != PRI_SWITCH_5ESS)
+		return -1;
+
+	/* Check to see if calls are on the same PRI dchannel
+	 * Currently only support calls on the same dchannel
+	 */
+	if (call1->pri != call2->pri)
+		return -1;
+	
+	if (eect_initiate_transfer(call1, call2))
+		return -1;
+
+	return 0;
+}
+
 int pri_hangup(struct pri *pri, q931_call *call, int cause)
 {
 	if (!pri || !call)
@@ -489,8 +511,6 @@
 	req.called = called;
 	req.calledplan = calledplan;
 
-	c->mwi_state = MWI_STATE_ACT_SEND;
-
 	if (mwi_message_send(c, &req, 1) < 0) {
 		pri_message("Unable to send MWI activate message\n");
 		return -1;
@@ -516,8 +536,6 @@
 	req.called = called;
 	req.calledplan = calledplan;
 
-	c->mwi_state = MWI_STATE_DEACT_SEND;
-
 	if(mwi_message_send(c, &req, 0) < 0) {
 		pri_message("Unable to send MWI deactivate message\n");
 		return -1;

Index: pri_facility.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_facility.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- pri_facility.c	21 Jan 2005 17:41:07 -0000	1.18
+++ pri_facility.c	3 Feb 2005 02:29:14 -0000	1.19
@@ -31,17 +31,17 @@
 static unsigned char redirectingreason_qsig2q931(unsigned char qsigreason)
 {
 	switch (qsigreason) {
-		case DIVERT_REASON_UNKNOWN:
+		case QSIG_DIVERT_REASON_UNKNOWN:
 			return PRI_REDIR_UNKNOWN;
-		case DIVERT_REASON_CFU:
+		case QSIG_DIVERT_REASON_CFU:
 			return PRI_REDIR_UNCONDITIONAL;
-		case DIVERT_REASON_CFB:
+		case QSIG_DIVERT_REASON_CFB:
 			return PRI_REDIR_FORWARD_ON_BUSY;
-		case DIVERT_REASON_CFNR:
+		case QSIG_DIVERT_REASON_CFNR:
 			return PRI_REDIR_FORWARD_ON_NO_REPLY;
 		default:
 			pri_message("Unknown Redirect reason %d\n", qsigreason);
-			return DIVERT_REASON_UNKNOWN;
+			return PRI_REDIR_UNKNOWN;
 	}
 }
 
@@ -124,7 +124,7 @@
 int mwi_message_send(q931_call *call, struct pri_sr *req, int activate)
 {
 	int i = 0;
-	unsigned char buffer[255];
+	unsigned char buffer[255] = "";
 	int destlen = strlen(req->called);
 	int istr = 0;
 	/* TODO:1 */
@@ -167,9 +167,60 @@
 
 /* End MWI */
 
+/* EECT functions */
+extern int eect_initiate_transfer(q931_call *c1, q931_call *c2)
+{
+	/* Did all the tests to see if we're on the same PRI and
+	 * are on a compatible switchtype */
+	/* TODO */
+	int i = 0;
+	int res = 0;
+	unsigned char buffer[255] = "";
+	unsigned short call_reference = c2->cr;
+
+	buffer[i++] = ASN1_INTEGER;
+	buffer[i++] = 0x01;
+	buffer[i++] = get_invokeid();
+
+	buffer[i++] = ASN1_OBJECTIDENTIFIER;
+	buffer[i++] = 0x07;
+	buffer[i++] = 0x2A;
+	buffer[i++] = 0x86;
+	buffer[i++] = 0x48;
+	buffer[i++] = 0xCE;
+	buffer[i++] = 0x15;
+	buffer[i++] = 0x00;
+	buffer[i++] = 0x08;
+
+	buffer[i++] = ASN1_SEQUENCE;
+	buffer[i++] = 0x04;
+	buffer[i++] = 0x02;
+	buffer[i++] = ((call_reference>>8)&0xFF);
+	buffer[i++] = (call_reference&0xFF);
+
+	res = pri_call_adpu_queue(c1, Q931_FACILITY, buffer, i, NULL, NULL);
+	if (res) {
+		pri_message("Could not queue ADPU in facility message\n");
+		return -1;
+	}
+
+	/* Remember that if we queue a facility IE for a facility message we
+	 * have to explicitly send the facility message ourselves */
+
+	res = q931_facility(c1->pri, c1);
+	if (res) {
+		pri_message("Could not schedule facility message for call %d\n", c1->cr);
+		return -1;
+	}
+
+	return 0;
+}
+
+/* End EECT */
+
+
 static int rose_return_result_decode(q931_call *call, unsigned char *data, int len)
 {
-	/* TODO:3 */
 	pri_message("-- Got return result!\n");
 	return 0;
 }

Index: pri_facility.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_facility.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- pri_facility.h	21 Jan 2005 17:41:07 -0000	1.11
+++ pri_facility.h	3 Feb 2005 02:29:14 -0000	1.12
@@ -14,7 +14,6 @@
 #ifndef _PRI_FACILITY_H
 #define _PRI_FACILITY_H
 
-
 /* ROSE stuff */
 /* Protocol Profile field */
 #define ROSE_OPERATIONS		17	/* X.219 & X.229 */
@@ -30,9 +29,6 @@
 #define ROSE_NAME_PRESENTATION_RESTRICTED_NULL 0x87
 #define ROSE_NAME_NOT_AVAIL 0x84
 
-/* Divert arguments */
-#define ROSE_DIVERTING_LEG_INFORMATION2 0x15
-
 /* Component types */
 #define COMP_TYPE_INTERPRETATION 0x8B
 #define COMP_TYPE_NETWORK_PROTOCOL_PROFILE 0x92
@@ -48,6 +44,7 @@
 #define SS_MWI_ACTIVATE 		80
 #define SS_MWI_DEACTIVATE 		81
 #define SS_MWI_INTERROGATE		82
+#define ROSE_DIVERTING_LEG_INFORMATION2 0x15
 
 /* ROSE definitions and data structures */
 #define INVOKE_IDENTIFIER 0x02
@@ -78,10 +75,10 @@
 #define ASN1_GENERALIZEDTIME 0x18
 
 /* Q.SIG Divert cause.. listed in ECMA-174 */
-#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 */
+#define QSIG_DIVERT_REASON_UNKNOWN 0x00 /* Call forward Unknown reason */
+#define QSIG_DIVERT_REASON_CFU 0x01 /* Call forward Unconditional (Other reason) */
+#define QSIG_DIVERT_REASON_CFB 0x02 /* Call Forward Busy */
+#define QSIG_DIVERT_REASON_CFNR 0x03 /* Call forward No Reply */
 
 struct rose_component {
         u_int8_t type;
@@ -123,4 +120,6 @@
 
 extern int add_callername_facility_ies(q931_call *c);
 
+extern int eect_initiate_transfer(q931_call *c1, q931_call *c2);
+
 #endif /* _PRI_FACILITY_H */

Index: pri_internal.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_internal.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- pri_internal.h	14 Jan 2005 17:04:12 -0000	1.11
+++ pri_internal.h	3 Feb 2005 02:29:14 -0000	1.12
@@ -127,18 +127,8 @@
 };
 
 /* Internal switch types */
-#define PRI_SWITCH_GR303_EOC_PATH	11
-#define PRI_SWITCH_GR303_TMC_SWITCHING	12
-
-/* MWI data structures and definitions */
-
-#define MWI_STATE_UNINITIALIZED		0
-#define MWI_STATE_ACT_SEND		1
-#define MWI_STATE_ACT_SEND_RESULT 	2
-#define MWI_STATE_DEACT_SEND		3
-#define MWI_STATE_DEACT_SEND_RESULT	4
-#define MWI_STATE_INTER_SEND		5
-#define MWI_STATE_INTER_SEND_RESULT	6
+#define PRI_SWITCH_GR303_EOC_PATH	19
+#define PRI_SWITCH_GR303_TMC_SWITCHING	20
 
 /* For scheduling the sending and receiving of invokes, etc */
 struct adpu_event {

Index: pri_q931.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_q931.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- pri_q931.h	5 Nov 2004 19:23:15 -0000	1.1.1.1
+++ pri_q931.h	3 Feb 2005 02:29:14 -0000	1.2
@@ -266,6 +266,8 @@
 
 extern int q931_restart(struct pri *pri, int channel);
 
+extern int q931_facility(struct pri *pri, q931_call *call);
+
 extern int q931_call_getcrv(struct pri *pri, q931_call *call, int *callmode);
 
 extern int q931_call_setcrv(struct pri *pri, q931_call *call, int crv, int callmode);

Index: q931.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/q931.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- q931.c	3 Feb 2005 02:04:28 -0000	1.21
+++ q931.c	3 Feb 2005 02:29:14 -0000	1.22
@@ -2165,7 +2165,7 @@
 
 static int facility_ies[] = { Q931_IE_FACILITY, -1};
 
-static int q931_facility(struct pri *pri, q931_call *c)
+int q931_facility(struct pri *pri, q931_call *c)
 {
 	return send_message(pri, c, Q931_FACILITY, facility_ies);
 }




More information about the svn-commits mailing list