[Asterisk-cvs]
libpri-matt pri_facility.c, 1.17, 1.18 pri_facility.h,
1.10, 1.11 q931.c, 1.18, 1.19
mattf at lists.digium.com
mattf at lists.digium.com
Fri Jan 21 11:38:16 CST 2005
- Previous message: [Asterisk-cvs]
asterisk/res res_agi.c, 1.24, 1.25 res_config_odbc.c,
1.19, 1.20 res_crypto.c, 1.18, 1.19 res_features.c, 1.35,
1.36 res_musiconhold.c, 1.50, 1.51 res_odbc.c, 1.9,
1.10 res_osp.c, 1.10, 1.11
- Next message: [Asterisk-cvs] libpri-matt q931.c,1.19,1.20
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /usr/cvsroot/libpri-matt
In directory mongoose.digium.com:/tmp/cvs-serv24413
Modified Files:
pri_facility.c pri_facility.h q931.c
Log Message:
Rewrite of callername sending code.
Index: pri_facility.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_facility.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- pri_facility.c 19 Jan 2005 16:19:22 -0000 1.17
+++ pri_facility.c 21 Jan 2005 17:41:07 -0000 1.18
@@ -45,6 +45,77 @@
}
}
+
+/* Sending callername information functions */
+extern int add_callername_facility_ies(q931_call *c)
+{
+ int res = 0;
+ int i = 0;
+ unsigned char buffer[256];
+ unsigned char namelen = 0;
+
+ /* Start building the component with the Invoke section */
+ buffer[i++] = ASN1_INTEGER; /* Invoke ID -- TODO: universal method for assigning these */
+ buffer[i++] = 0x01;
+ buffer[i++] = get_invokeid(); /* Id of 16 */
+
+ /* Operation ID */
+ buffer[i++] = ASN1_INTEGER;
+ buffer[i++] = 0x01;
+ buffer[i++] = ASN1_OBJECTIDENTIFIER;
+
+ buffer[i++] = 0x07; /* Length */
+ buffer[i++] = 0x2a; /* informationFollowing 42 */
+ buffer[i++] = 0x86;
+ buffer[i++] = 0x48;
+ buffer[i++] = 0xce;
+ buffer[i++] = 0x15;
+ buffer[i++] = 0x00;
+ buffer[i++] = 0x04;
+
+ buffer[i++] = 0x0a;
+ buffer[i++] = 0x01;
+ buffer[i++] = 0x00;
+
+ if (pri_call_adpu_queue(c, Q931_SETUP, buffer, i, NULL, NULL))
+ return -1;
+
+
+ /* Now the ADPu that contains the information that needs sent.
+ * We can reuse the buffer since the queue function doesn't
+ * need it. */
+
+ i = 0;
+ namelen = strlen(c->callername);
+ if (namelen > 50) {
+ namelen = 50; /* truncate the name */
+ }
+
+ /* Invoke ID */
+ buffer[i++] = ASN1_INTEGER;
+ buffer[i++] = 0x01;
+ buffer[i++] = get_invokeid();
+
+ /* Operation ID: Calling name */
+ buffer[i++] = ASN1_INTEGER;
+ buffer[i++] = 0x01;
+ buffer[i++] = SS_CNID_CALLINGNAME;
+
+ buffer[i++] = 0x80;
+ buffer[i++] = namelen;
+ memcpy(&buffer[i], c->callername, namelen);
+ i += namelen;
+
+ if (pri_call_adpu_queue(c, Q931_FACILITY, buffer, i, NULL, NULL))
+ return -1;
+
+ return res;
+}
+
+/* End Callername */
+
+/* MWI related encode and decode functions */
+
void mwi_activate_encode_cb(void *data)
{
return;
@@ -94,6 +165,8 @@
return pri_call_adpu_queue(call, Q931_SETUP, buffer, i, mwi_activate_encode_cb, NULL);
}
+/* End MWI */
+
static int rose_return_result_decode(q931_call *call, unsigned char *data, int len)
{
/* TODO:3 */
@@ -219,7 +292,7 @@
case SS_MWI_DEACTIVATE:
default:
- pri_message("Found unrecognzied operation of type 0x%X\n", operationid->data[0]);
+ pri_message("Unable to handle operation of type 0x%X\n", operationid->data[0]);
break;
}
} while (0);
Index: pri_facility.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_facility.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- pri_facility.h 14 Jan 2005 16:15:29 -0000 1.10
+++ pri_facility.h 21 Jan 2005 17:41:07 -0000 1.11
@@ -111,9 +111,16 @@
#define FUNC_DUMP(name) void ((name))(int full_ie, q931_ie *ie, int len, char prefix)
#define FUNC_RECV(name) int ((name))(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
#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_message_send(q931_call *call, struct pri_sr *req, int activate);
-void mwi_activate_encode_cb(void *data);
+
+extern int mwi_message_send(q931_call *call, struct pri_sr *req, int activate);
+
+extern void mwi_activate_encode_cb(void *data);
+
+extern int add_callername_facility_ies(q931_call *c);
#endif /* _PRI_FACILITY_H */
Index: q931.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/q931.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- q931.c 19 Jan 2005 16:19:22 -0000 1.18
+++ q931.c 21 Jan 2005 17:41:07 -0000 1.19
@@ -2163,6 +2163,13 @@
return 0;
}
+static int facility_ies[] = { Q931_IE_FACILITY, -1};
+
+static int q931_facility(struct pri *pri, q931_call *c)
+{
+ return send_message(pri, c, Q931_FACILITY, facility_ies);
+}
+
static int status_ies[] = { Q931_CAUSE, Q931_CALL_STATE, -1 };
static int q931_status(struct pri *pri, q931_call *c, int cause)
@@ -2538,6 +2545,10 @@
} else
return -1;
+ if (pri->switchtype == PRI_SWITCH_NI2) {
+ add_callername_facility_ies(c);
+ }
+
if (req->nonisdn && (pri->switchtype == PRI_SWITCH_NI2))
c->progress = Q931_PROG_CALLER_NOT_ISDN;
else
@@ -2695,6 +2706,7 @@
int missingmand;
int codeset, cur_codeset;
int last_ie[8];
+ struct adpu_event *cur = NULL;
memset(last_ie, 0, sizeof(last_ie));
if (pri->debug & PRI_DEBUG_Q931_DUMP)
q931_dump(h, len, 0);
@@ -3216,6 +3228,16 @@
c->peercallstate = Q931_CALL_STATE_OVERLAP_RECEIVING;
pri->ev.e = PRI_EVENT_SETUP_ACK;
pri->ev.setup_ack.channel = c->channelno;
+
+ /* Send the callername FACILITY message */
+ cur = c->adpus;
+ while (cur) {
+ if (!cur->sent && cur->message == Q931_FACILITY) {
+ q931_facility(pri, c);
+ }
+ cur = cur->next;
+ }
+
return Q931_RES_HAVEEVENT;
case Q931_NOTIFY:
pri->ev.e = PRI_EVENT_NOTIFY;
- Previous message: [Asterisk-cvs]
asterisk/res res_agi.c, 1.24, 1.25 res_config_odbc.c,
1.19, 1.20 res_crypto.c, 1.18, 1.19 res_features.c, 1.35,
1.36 res_musiconhold.c, 1.50, 1.51 res_odbc.c, 1.9,
1.10 res_osp.c, 1.10, 1.11
- Next message: [Asterisk-cvs] libpri-matt q931.c,1.19,1.20
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the svn-commits
mailing list