[Asterisk-cvs] libpri-matt libpri.h, 1.2, 1.3 pri.c, 1.1.1.1,
1.2 pri_internal.h, 1.3, 1.4 q931.c, 1.2, 1.3
mattf at lists.digium.com
mattf at lists.digium.com
Tue Dec 7 12:48:21 CST 2004
Update of /usr/cvsroot/libpri-matt
In directory mongoose.digium.com:/tmp/cvs-serv28967
Modified Files:
libpri.h pri.c pri_internal.h q931.c
Log Message:
Adding functionality for Call Independent Signalling connections (no bchan) :-)
Index: libpri.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/libpri.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- libpri.h 12 Nov 2004 17:51:09 -0000 1.2
+++ libpri.h 7 Dec 2004 17:46:05 -0000 1.3
@@ -170,6 +170,7 @@
#define PRI_CAUSE_INTERWORKING 127
/* Transmit capabilities */
+#define PRI_TRANS_CAP_UNRESTRICTED_DIGITAL_INFO 0x00
#define PRI_TRANS_CAP_SPEECH 0x0
#define PRI_TRANS_CAP_DIGITAL 0x08
#define PRI_TRANS_CAP_RESTRICTED_DIGITAL 0x09
@@ -293,7 +294,7 @@
int complete; /* Have we seen "Complete" i.e. no more number? */
q931_call *call; /* Opaque call pointer */
char callingsubaddr[256]; /* Calling parties subaddress */
-
+ /* New fields for additional data in facility IEs */
char origcallername[256];
char origcallernum[256];
int redirectingreason;
@@ -463,7 +464,14 @@
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);
+/* Set a call has a call indpendent signalling connection (i.e. no bchan) */
+extern int pri_sr_set_connection_call_independent(struct pri_sr *req);
+
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);
/* 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.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- pri.c 5 Nov 2004 19:23:18 -0000 1.1.1.1
+++ pri.c 7 Dec 2004 17:46:05 -0000 1.2
@@ -452,7 +452,6 @@
static void pri_sr_init(struct pri_sr *req)
{
memset(req, 0, sizeof(struct pri_sr));
-
}
int pri_setup(struct pri *pri, q931_call *c, struct pri_sr *req)
@@ -462,6 +461,37 @@
return q931_setup(pri, c, req);
}
+int pri_sr_set_connection_call_independent(struct pri_sr *req)
+{
+ if (!req)
+ return -1;
+
+ req->justsignalling = 1; /* have to set justsignalling for all those pesky IEs we need to setup */
+ 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)
+{
+ 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;
+
+ /* Do more stuff when we figure out that the CISC stuff works */
+ 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_internal.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_internal.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pri_internal.h 12 Nov 2004 17:46:57 -0000 1.3
+++ pri_internal.h 7 Dec 2004 17:46:05 -0000 1.4
@@ -107,6 +107,7 @@
struct pri_sr {
int transmode;
+ int transmoderate;
int channel;
int exclusive;
int nonisdn;
@@ -122,6 +123,7 @@
int redirectingplan;
int redirectingpres;
int redirectingreason;
+ int justsignalling; /* See similar field in struct q931_call and ECMA-165 7.3 */
};
/* Internal switch types */
@@ -203,6 +205,8 @@
int useruserprotocoldisc;
char useruserinfo[256];
char callingsubaddr[256]; /* Calling parties sub address */
+
+ int justsignalling; /* For establishment of Call Independent Signalling Connections */
};
extern int pri_schedule_event(struct pri *pri, int ms, void (*function)(void *data), void *data);
Index: q931.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/q931.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- q931.c 12 Nov 2004 17:46:57 -0000 1.2
+++ q931.c 7 Dec 2004 17:46:05 -0000 1.3
@@ -316,6 +316,13 @@
static FUNC_SEND(transmit_channel_id)
{
int pos=0;
+ /* For call indpendent signalling connections */
+ if (call->justsignalling) {
+ ie->data[pos++] = 0xac; /* Read the standards docs to figure this out
+ ECMA-165 section 7.3 */
+ return pos + 2;
+ }
+
/* Start with standard stuff */
if (pri->switchtype == PRI_SWITCH_GR303_TMC)
ie->data[pos] = 0x69;
@@ -596,6 +603,13 @@
ie->data[1] = 0x90;
return 4;
}
+
+ if (call->justsignalling) {
+ ie->data[0] = 0xa8;
+ ie->data[1] = 0x80;
+ return 4;
+ }
+
if (pri->switchtype == PRI_SWITCH_ATT4ESS) {
/* 4ESS uses a different trans capability for 3.1khz audio */
if (tc == PRI_TRANS_CAP_3_1K_AUDIO)
@@ -2467,13 +2481,17 @@
static int gr303_setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, -1 };
+static int cis_setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, Q931_CALLED_PARTY_NUMBER, Q931_FACILITY, -1 };
+
int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req)
{
int res;
c->transcapability = req->transmode;
+
c->transmoderate = TRANS_MODE_64_CIRCUIT;
+
if (!req->userl1)
req->userl1 = PRI_LAYER_1_ULAW;
c->userl1 = req->userl1;
@@ -2488,6 +2506,7 @@
c->slotmap = -1;
c->nonisdn = req->nonisdn;
c->newcall = 0;
+ c->justsignalling = req->justsignalling;
c->complete = req->numcomplete;
if (req->exclusive)
c->chanflags = FLAG_EXCLUSIVE;
@@ -2542,6 +2561,8 @@
c->progress = -1;
if (pri->subchannel)
res = send_message(pri, c, Q931_SETUP, gr303_setup_ies);
+ else if (c->justsignalling)
+ res = send_message(pri, c, Q931_SETUP, cis_setup_ies);
else
res = send_message(pri, c, Q931_SETUP, setup_ies);
if (!res) {
More information about the svn-commits
mailing list