[Asterisk-cvs] libpri q931.c,1.133,1.134
mattf at lists.digium.com
mattf at lists.digium.com
Mon Jul 11 13:40:13 CDT 2005
Update of /usr/cvsroot/libpri
In directory mongoose.digium.com:/tmp/cvs-serv10126
Modified Files:
q931.c
Log Message:
Don't allow notification codes outside of the Q.931 spec for switches other
than EuroISDN. Also take out some old facility IE code.
Index: q931.c
===================================================================
RCS file: /usr/cvsroot/libpri/q931.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -d -r1.133 -r1.134
--- q931.c 29 Jun 2005 17:27:03 -0000 1.133
+++ q931.c 11 Jul 2005 17:48:30 -0000 1.134
@@ -1120,182 +1120,6 @@
return i + 2;
}
-#if 0
-static FUNC_SEND(transmit_facility)
-{
- int i = 0, j, first_i, compsp = 0;
- struct rose_component *comp, *compstk[10];
- unsigned char namelen = strlen(call->callername);
-
- if ((pri->switchtype == PRI_SWITCH_NI2) && (namelen > 15))
- namelen = 15; /* According to GR-1367, for NI2 switches it can't be > 15 characters */
- if ((namelen > 0) && ((pri->switchtype == PRI_SWITCH_QSIG) ||
- ((pri->switchtype == PRI_SWITCH_NI2) && (pri->localtype == PRI_NETWORK)))) {
- do {
- first_i = i;
- ie->data[i] = 0x80 | Q932_PROTOCOL_EXTENSIONS;
- i++;
- /* Interpretation component */
- ASN1_ADD_BYTECOMP(comp, COMP_TYPE_INTERPRETATION, ie->data, i, 0x00 /* Discard unrecognized invokes */);
-
- /* Invoke ID */
- ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, ie->data, i);
- ASN1_PUSH(compstk, compsp, comp);
-
- /* Invoke component contents */
- /* Invoke ID */
- ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, ie->data, i, ++pri->last_invoke);
-
- /* Operation Tag */
- ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, ie->data, i, SS_CNID_CALLINGNAME);
-
- /* Arugement Tag */
- j = asn1_string_encode(ROSE_NAME_PRESENTATION_ALLOWED_SIMPLE, &ie->data[i], len - i, 15, call->callername, namelen);
- if (j < 0) {
- i = first_i;
- break;
- }
- i += j;
-
- /* Fix length of stacked components */
- while(compsp > 0) {
- ASN1_FIXUP(compstk, compsp, ie->data, i);
- }
- } while (0);
- }
- if (/*(pri->switchtype == PRI_SWITCH_EUROISDN_E1) &&*/ call->redirectingnum && *call->redirectingnum) {
- if (!(first_i = i)) {
- /* Add protocol information header */
- ie->data[i++] = 0x80 | Q932_PROTOCOL_ROSE;
- }
-
- /* ROSE invoke component */
- ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, ie->data, i);
- ASN1_PUSH(compstk, compsp, comp);
-
- /* ROSE invokeId component */
- ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, ie->data, i, ++pri->last_invoke);
-
- /* ROSE operationId component */
- ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, ie->data, i, ROSE_DIVERTING_LEG_INFORMATION2);
-
- /* ROSE ARGUMENT component */
- ASN1_ADD_SIMPLE(comp, 0x30, ie->data, i);
- ASN1_PUSH(compstk, compsp, comp);
-
- /* ROSE DivertingLegInformation2.diversionCounter component */
- /* Always is 1 because other isn't available in the current design */
- ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, ie->data, i, 1);
-
- /* ROSE DivertingLegInformation2.diversionReason component */
- ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, ie->data, i, redirectingreason_from_q931(pri, call->redirectingreason));
-
- /* ROSE DivertingLegInformation2.divertingNr component */
- ASN1_ADD_SIMPLE(comp, 0xA1, ie->data, i);
- ASN1_PUSH(compstk, compsp, comp);
-
- /* Redirecting information always not screened */
- switch(call->redirectingpres) {
- case PRES_ALLOWED_USER_NUMBER_NOT_SCREENED:
- case PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN:
- if (call->redirectingnum && *call->redirectingnum) {
- ASN1_ADD_SIMPLE(comp, 0xA0, ie->data, i);
- ASN1_PUSH(compstk, compsp, comp);
-
- /* NPI of redirected number is not supported in the current design */
- ASN1_ADD_SIMPLE(comp, 0xA1, ie->data, i);
- ASN1_PUSH(compstk, compsp, comp);
-
- ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, ie->data, i, typeofnumber_from_q931(pri, call->redirectingplan >> 4));
-
- j = asn1_string_encode(ASN1_NUMERICSTRING, &ie->data[i], len - i, 20, call->redirectingnum, strlen(call->redirectingnum));
- if (j < 0) {
- i = first_i;
- goto finish2;
- }
- i += j;
- ASN1_FIXUP(compstk, compsp, ie->data, i);
- ASN1_FIXUP(compstk, compsp, ie->data, i);
- break;
- }
- /* fall through */
- case PRES_PROHIB_USER_NUMBER_PASSED_SCREEN:
- case PRES_PROHIB_USER_NUMBER_NOT_SCREENED:
- ASN1_ADD_SIMPLE(comp, 0x81, ie->data, i);
- break;
- /* Don't know how to handle this */
- case PRES_ALLOWED_NETWORK_NUMBER:
- case PRES_PROHIB_NETWORK_NUMBER:
- case PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN:
- case PRES_PROHIB_USER_NUMBER_FAILED_SCREEN:
- ASN1_ADD_SIMPLE(comp, 0x81, ie->data, i);
- break;
- default:
- pri_message(pri, "!! Undefined presentation value for redirecting number: %d\n", call->redirectingpres);
- case PRES_NUMBER_NOT_AVAILABLE:
- ASN1_ADD_SIMPLE(comp, 0x82, ie->data, i);
- break;
- }
- ASN1_FIXUP(compstk, compsp, ie->data, i);
-
- /* ROSE DivertingLegInformation2.originalCalledNr component */
- /* This information isn't supported by current design - duplicate divertingNr */
- ASN1_ADD_SIMPLE(comp, 0xA2, ie->data, i);
- ASN1_PUSH(compstk, compsp, comp);
-
- /* Redirecting information always not screened */
- switch(call->redirectingpres) {
- case PRES_ALLOWED_USER_NUMBER_NOT_SCREENED:
- case PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN:
- if (call->redirectingnum && *call->redirectingnum) {
- ASN1_ADD_SIMPLE(comp, 0xA0, ie->data, i);
- ASN1_PUSH(compstk, compsp, comp);
-
- ASN1_ADD_SIMPLE(comp, 0xA1, ie->data, i);
- ASN1_PUSH(compstk, compsp, comp);
-
- ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, ie->data, i, typeofnumber_from_q931(pri, call->redirectingplan >> 4));
-
- j = asn1_string_encode(ASN1_NUMERICSTRING, &ie->data[i], len - i, 20, call->redirectingnum, strlen(call->redirectingnum));
- if (j < 0) {
- i = first_i;
- goto finish2;
- }
- i += j;
- ASN1_FIXUP(compstk, compsp, ie->data, i);
- ASN1_FIXUP(compstk, compsp, ie->data, i);
- break;
- }
- /* fall through */
- case PRES_PROHIB_USER_NUMBER_PASSED_SCREEN:
- case PRES_PROHIB_USER_NUMBER_NOT_SCREENED:
- ASN1_ADD_SIMPLE(comp, 0x81, ie->data, i);
- break;
- /* Don't know how to handle this */
- case PRES_ALLOWED_NETWORK_NUMBER:
- case PRES_PROHIB_NETWORK_NUMBER:
- case PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN:
- case PRES_PROHIB_USER_NUMBER_FAILED_SCREEN:
- ASN1_ADD_SIMPLE(comp, 0x81, ie->data, i);
- break;
- default:
- pri_message(pri, "!! Undefined presentation value for redirecting number: %d\n", call->redirectingpres);
- case PRES_NUMBER_NOT_AVAILABLE:
- ASN1_ADD_SIMPLE(comp, 0x82, ie->data, i);
- break;
- }
- ASN1_FIXUP(compstk, compsp, ie->data, i);
-
- /* Fix length of stacked components */
- while(compsp > 0) {
- ASN1_FIXUP(compstk, compsp, ie->data, i);
- }
- }
-finish2:
- return (i ? i+2 : 0);
-}
-#endif
-
static FUNC_RECV(receive_facility)
{
int i = 0;
@@ -2615,6 +2439,11 @@
int q931_notify(struct pri *pri, q931_call *c, int channel, int info)
{
+ if ((pri->switchtype == PRI_SWITCH_EUROISDN_T1) || (pri->switchtype != PRI_SWITCH_EUROISDN_E1)) {
+ if ((info > 0x2) || (info < 0x00))
+ return 0;
+ }
+
if (info >= 0)
c->notify = info & 0x7F;
else
More information about the svn-commits
mailing list