[Asterisk-cvs] libpri-matt pri.c, 1.5, 1.6 pri_facility.c, 1.14, 1.15 pri_facility.h, 1.9, 1.10

mattf at lists.digium.com mattf at lists.digium.com
Fri Jan 14 10:11:40 CST 2005


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

Modified Files:
	pri.c pri_facility.c pri_facility.h 
Log Message:
DeActivate message support


Index: pri.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pri.c	13 Jan 2005 20:49:04 -0000	1.5
+++ pri.c	14 Jan 2005 16:15:29 -0000	1.6
@@ -491,8 +491,8 @@
 
 	c->mwi_state = MWI_STATE_ACT_SEND;
 
-	if (mwi_activate_encode_and_queue(c, &req) < 0) {
-		pri_message("Could not send mwi message\n");
+	if (mwi_message_send(c, &req, 1) < 0) {
+		pri_message("Unable to send MWI activate message\n");
 		return -1;
 	}
 	/* Do more stuff when we figure out that the CISC stuff works */
@@ -518,6 +518,11 @@
 
 	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;
+	}
+
 	return q931_setup(pri, c, &req);
 }
 	

Index: pri_facility.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_facility.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- pri_facility.c	14 Jan 2005 00:01:26 -0000	1.14
+++ pri_facility.c	14 Jan 2005 16:15:29 -0000	1.15
@@ -33,23 +33,14 @@
 	}
 }
 
-#if 0
-int mwi_deactivate_encode(q931_call *call, unsigned char *data)
-{
-	int i = 0;
-	/* TODO:2 */
-	return i;
-}
-#endif
-
 void mwi_activate_encode_cb(void *data)
 {
 	return;
 }
 
-int mwi_activate_encode_and_queue(q931_call *call, struct pri_sr *req)
+int mwi_message_send(q931_call *call, struct pri_sr *req, int activate)
 {
-	int res = 0, i = 0;
+	int i = 0;
 	unsigned char buffer[255];
 	int destlen = strlen(req->called);
 	int istr = 0;
@@ -62,7 +53,14 @@
 
 	buffer[i++] = ASN1_INTEGER; /* Invoke ID -- TODO: universal method for assigning these */
 	buffer[i++] = 0x01;
-	buffer[i++] = 0x10; /* Id of 1 */
+	buffer[i++] = 0x10; /* Id of 16 */
+
+	buffer[i++] = ASN1_INTEGER;
+	buffer[i++] = 0x01;
+	if (activate)
+		buffer[i++] = SS_MWI_ACTIVATE;
+	else
+		buffer[i++] = SS_MWI_DEACTIVATE;
 
 	buffer[i++] = 0x30; /* Sequence */
 	buffer[i++] = 5 /* All fixed length necessary parts */
@@ -81,9 +79,7 @@
 	buffer[i++] = 0x1; /* contents: Voice */
 	
 	
-	res = pri_call_adpu_queue(call, Q931_SETUP, buffer, i, mwi_activate_encode_cb, NULL);
-
-	return res;
+	return pri_call_adpu_queue(call, Q931_SETUP, buffer, i, mwi_activate_encode_cb, NULL);
 }
 
 static int rose_return_result_decode(q931_call *call, unsigned char *data, int len)

Index: pri_facility.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_facility.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- pri_facility.h	13 Jan 2005 01:58:05 -0000	1.9
+++ pri_facility.h	14 Jan 2005 16:15:29 -0000	1.10
@@ -113,7 +113,7 @@
 #define FUNC_SEND(name) int ((name))(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
 extern FUNC_SEND(transmit_facility);
 extern FUNC_RECV(receive_facility);
-int mwi_activate_encode_and_queue(q931_call *call, struct pri_sr *req);
+int mwi_message_send(q931_call *call, struct pri_sr *req, int activate);
 void mwi_activate_encode_cb(void *data);
 
 #endif /* _PRI_FACILITY_H */




More information about the svn-commits mailing list