[Asterisk-cvs] libpri-matt libpri.h, 1.5, 1.6 pri.c, 1.2,
1.3 pri_facility.c, 1.6, 1.7 pri_facility.h, 1.5,
1.6 pri_internal.h, 1.6, 1.7
mattf at lists.digium.com
mattf at lists.digium.com
Mon Dec 27 16:48:09 CST 2004
Update of /usr/cvsroot/libpri-matt
In directory mongoose.digium.com:/tmp/cvs-serv7134
Modified Files:
libpri.h pri.c pri_facility.c pri_facility.h pri_internal.h
Log Message:
More changes moving MWI along
Index: libpri.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/libpri.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- libpri.h 27 Dec 2004 14:31:18 -0000 1.5
+++ libpri.h 27 Dec 2004 21:43:08 -0000 1.6
@@ -470,8 +470,12 @@
extern int pri_setup(struct pri *pri, q931_call *call, struct pri_sr *req);
/* Send an MWI indication to a remote location. If activate is non zero, activates, if zero, decativates */
-extern int pri_mwi_send(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres,
- char *called, int calledplan, int activate);
+extern int pri_mwi_activate(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres,
+ char *called, int calledplan);
+
+/* Send an MWI deactivate request to a remote location */
+extern int pri_mwi_deactivate(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres,
+ char *called, int calledplan);
/* Override message and error stuff */
extern void pri_set_message(void (*__pri_error)(char *));
Index: pri.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pri.c 7 Dec 2004 17:46:05 -0000 1.2
+++ pri.c 27 Dec 2004 21:43:08 -0000 1.3
@@ -470,9 +470,9 @@
return 0;
}
-
-int pri_mwi_send(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres, char *called,
- int calledplan, int activate)
+/* Don't call any other pri functions on this */
+int pri_mwi_activate(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres, char *called,
+ int calledplan)
{
struct pri_sr req;
if (!pri || !c)
@@ -487,11 +487,36 @@
req.callerpres = callerpres;
req.called = called;
req.calledplan = calledplan;
+
+ c->mwi_state = MWI_STATE_ACT_SEND;
/* Do more stuff when we figure out that the CISC stuff works */
return q931_setup(pri, c, &req);
}
+int pri_mwi_deactivate(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres, char *called,
+ int calledplan)
+{
+ struct pri_sr req;
+ if (!pri || !c)
+ return -1;
+
+ pri_sr_init(&req);
+ pri_sr_set_connection_call_independent(&req);
+
+ req.caller = caller;
+ req.callerplan = callerplan;
+ req.callername = callername;
+ req.callerpres = callerpres;
+ req.called = called;
+ req.calledplan = calledplan;
+
+ c->mwi_state = MWI_STATE_DEACT_SEND;
+
+ return q931_setup(pri, c, &req);
+}
+
+
int pri_call(struct pri *pri, q931_call *c, int transmode, int channel, int exclusive,
int nonisdn, char *caller, int callerplan, char *callername, int callerpres, char *called,
int calledplan,int ulayer1)
Index: pri_facility.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_facility.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pri_facility.c 23 Dec 2004 18:02:00 -0000 1.6
+++ pri_facility.c 27 Dec 2004 21:43:08 -0000 1.7
@@ -33,7 +33,30 @@
}
}
-int rose_invoke_decode(q931_call *call, unsigned char *data, int len)
+static int mwi_deactivate_encode(q931_call *call, unsigned char *data)
+{
+ int i = 0;
+ /* TODO:2 */
+ return i;
+}
+
+static int mwi_activate_encode(q931_call *call, unsigned char *data)
+{
+ int i = 0;
+ /* TODO:1 */
+
+
+
+ return i;
+}
+
+static int rose_return_result_decode(q931_call *call, unsigned char *data, int len)
+{
+ /* TODO:3 */
+ return 0;
+}
+
+static int rose_invoke_decode(q931_call *call, unsigned char *data, int len)
{
int i = 0;
unsigned char *vdata = data;
@@ -147,6 +170,9 @@
}
}
return 0;
+ case SS_MWI_ACTIVATE:
+
+ case SS_MWI_DEACTIVATE:
default:
pri_message("Found unrecognzied operation of type 0x%X\n", operationid->data[0]);
break;
@@ -162,6 +188,47 @@
struct rose_component *comp;
unsigned char namelen = strlen(call->callername);
+ switch (call->mwi_state) {
+ case MWI_STATE_UNINITIALIZED:
+ break;
+ case MWI_STATE_ACT_SEND:
+ ie->data[i++] = ROSE_NETWORK_EXTENSION | 0x80;
+
+ comp = (struct rose_component*)&ie->data[i];
+ comp->type = COMP_TYPE_INTERPRETATION;
+ comp->len = 0x01;
+ comp->data[0] = 0x00;
+ i+=3;
+
+ comp = (struct rose_component*)&ie->data[i];
+ comp->type = COMP_TYPE_INVOKE;
+ comp->len = mwi_activate_encode(call, comp->data);
+ i+= comp->len;
+ call->mwi_state = MWI_STATE_ACT_SEND_RESULT;
+ return i+2;
+ case MWI_STATE_ACT_SEND_RESULT:
+ break;
+ case MWI_STATE_DEACT_SEND:
+ ie->data[i++] = ROSE_NETWORK_EXTENSION | 0x80;
+
+ comp = (struct rose_component*)&ie->data[i];
+ comp->type = COMP_TYPE_INTERPRETATION;
+ comp->len = 0x01;
+ comp->data[0] = 0x00;
+ i+=3;
+
+ comp = (struct rose_component*)&ie->data[i];
+ comp->type = COMP_TYPE_INVOKE;
+ comp->len = mwi_deactivate_encode(call, comp->data);
+ i+= comp->len;
+ call->mwi_state = MWI_STATE_DEACT_SEND_RESULT;
+ return i+2;
+ case MWI_STATE_DEACT_SEND_RESULT:
+ break;
+ default:
+ pri_message("Huhh...? Got MWI state of %d\n", call->mwi_state);
+ }
+
if ((namelen > 0) && (pri->switchtype == PRI_SWITCH_QSIG)) {
ie->data[i] = ROSE_NETWORK_EXTENSION | 0x80 /* No extra octets */;
i++;
@@ -234,6 +301,9 @@
case COMP_TYPE_INVOKE:
rose_invoke_decode(call, comp->data, comp->len);
break;
+ case COMP_TYPE_RETURN_RESULT:
+ rose_return_result_decode(call, comp->data, comp->len);
+ break;
case COMP_TYPE_NFE:
if (pri->debug) pri_message("Handle NFE component\n");
break;
Index: pri_facility.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_facility.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pri_facility.h 23 Dec 2004 18:02:00 -0000 1.5
+++ pri_facility.h 27 Dec 2004 21:43:08 -0000 1.6
@@ -45,8 +45,11 @@
#define COMP_TYPE_NFE 0xAA
/* Operation ID values */
-#define SS_CNID_CALLINGNAME 0x00
-#define SS_DIV_DIVERTINGLEGINFORMATION2 0x15
+#define SS_CNID_CALLINGNAME 0
+#define SS_DIV_DIVERTINGLEGINFORMATION2 21
+#define SS_MWI_ACTIVATE 80
+#define SS_MWI_DEACTIVATE 81
+#define SS_MWI_INTERROGATE 82
/* ROSE definitions and data structures */
#define INVOKE_IDENTIFIER 0x02
@@ -107,10 +110,7 @@
break; \
}
-/* Decoder for the invoke part of a ROSE request
- It currently only support calling name decode */
extern FUNC_SEND(transmit_facility);
extern FUNC_RECV(receive_facility);
-extern int rose_invoke_decode(struct q931_call *call, unsigned char *data, int len);
#endif /* _PRI_FACILITY_H */
Index: pri_internal.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_internal.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pri_internal.h 15 Dec 2004 21:09:03 -0000 1.6
+++ pri_internal.h 27 Dec 2004 21:43:08 -0000 1.7
@@ -130,8 +130,17 @@
#define PRI_SWITCH_GR303_EOC_PATH 11
#define PRI_SWITCH_GR303_TMC_SWITCHING 12
-/* q931_call datastructure */
+/* 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
+/* q931_call datastructure */
struct q931_call {
struct pri *pri; /* PRI */
int cr; /* Call Reference */
@@ -207,6 +216,7 @@
char callingsubaddr[256]; /* Calling parties sub address */
int justsignalling; /* For establishment of Call Independent Signalling Connections */
+ int mwi_state; /* More MWI related stuff */
};
extern int pri_schedule_event(struct pri *pri, int ms, void (*function)(void *data), void *data);
More information about the svn-commits
mailing list