Changed handling of multiple "calling party number" information elements.

The network provided number is now preferred in any case.  The other
number (typical set by originating user) can be ignored using the
ignoreCOLP or -U setting, which allows different values for COLP and CLIP
now.  (The old behaviour was to use the first number if ignoreCOLP was set
and the network provided number regardless of order otherwise.)
This commit is contained in:
Tobias Becker 2004-09-29 21:02:02 +00:00
parent 6d863a95ba
commit 3d9d9fdd65
6 changed files with 101 additions and 21 deletions

View File

@ -1,3 +1,23 @@
2004-09-29 Tobias Becker <tobiasb@isdn4linux.de>
* isdnlog.c (init_variables): Set ignoreCLIP to 0.
* isdnlog.c (set_options): Set ignoreCLIP from -Ux[:y] option.
* isdnlog.c (read_param_file): Set ignoreCLIP from "ignoreCOLP=x[:y]",
use y value if present, x otherwise.
* processor.c (decode): Use ignoreCLIP instead of ignoreCOLP for
control of IE 0x6c (calling party number) handling.
* processor.c (decode): Changes for IE 0x6c when IE is given twice,
e.g. source number from user and from network on an incoming call
(ETS 300 092-1 Annex B). Use network provided number as source
number (index [CALLING] for .onum and other in call[chan]) regardless
ignoreCLIP setting. ignoreCLIP now only controls the storage of the
user provided number to [CLIP]. The old effect of ignoreCLIP was to
look at the first IE only. Changed the calls of buildnumber and vnum
in case of number order network/user, so that [CLIP] is set right.
If there is an alias for the CLIP number, show alias and number in
parentheses (new) in "CLIP ..." notice.
2004-09-05 Tobias Becker <tobiasb@isdn4linux.de>
* isdnlog.h (ignore_unknown_PD): New global variable.

View File

@ -110,14 +110,17 @@ Ignore "housekeeping" frames.
may be 1 (ignore RR=Receiver ready) or 2 (ignore EMP=Euracom Management Protokoll) frames.
.TP
.B \-U\fIx\fB ignoreCOLP="value"
.B \-U\fIx[:y]\fB ignoreCOLP="value[:value]"
Ignore COLP/CLIP frames when value is 1 or greater.
Value 0 is default, and tells isdnlog to not ignore COLP/CLIP frames.
With value 2 the ignored COLP/CLIP number is displayed.
.br
The first value applies to COLP the second to CLIP. If only one value is given,
it applies to COLP and CLIP.
.br
Sometimes the COLP number is a number in a different areacode to the
number that was dialled, and then the cost calculation would be wrong.
.br
With value 2 the ignored COLP number is displayed.
.TP
.B ignoreUPD={yes|no}

View File

@ -19,6 +19,11 @@
* along with this program; if not, write to the Free Software
*
* $Log$
* Revision 1.73 2004/09/05 22:04:55 tobiasb
* New parameter file entry "ignoreUPD" for suppressing "Unexpected
* discrimator (...)" messages, demanded by Günther J. Niederwimmer
* on the suse-isdn mailing list.
*
* Revision 1.72 2004/01/28 14:27:46 tobiasb
* Second step in restricting fds at isdnlog restart and script starting.
* The fd limit is now taken from getrlimit() instead of NR_OPEN.
@ -810,7 +815,7 @@ static void init_variables(int argc, char* argv[])
watchdog = 0;
use_new_config = 1;
ignoreRR = ignoreCOLP = 0;
ignoreRR = ignoreCOLP = ignoreCLIP = 0;
#ifdef Q931
q931dmp = 0;
@ -1018,8 +1023,15 @@ int set_options(int argc, char* argv[])
case 'u' : ignoreRR = atoi(optarg);
break;
case 'U' : ignoreCOLP = atoi(optarg);
break;
case 'U' :
if ((p = strchr(optarg, ':'))) {
*p = 0;
ignoreCOLP = atoi(optarg);
ignoreCLIP = atoi(p + 1);
}
else
ignoreCOLP = ignoreCLIP = atoi(optarg);
break;
case 'B' : free(vbn);
vbn = strdup(optarg);
@ -1262,8 +1274,15 @@ static int read_param_file(char *FileName)
if (!strcmp(Ptr->name,CONF_ENT_IGNORERR))
ignoreRR = (int)strtol(Ptr->value, NIL, 0);
else
if (!strcmp(Ptr->name,CONF_ENT_IGNORECOLP))
ignoreCOLP = (int)strtol(Ptr->value, NIL, 0);
if (!strcmp(Ptr->name,CONF_ENT_IGNORECOLP)) {
if ((p = strchr(Ptr->value, ':'))) {
*p = 0;
ignoreCOLP = atoi(Ptr->value);
ignoreCLIP = atoi(p + 1);
}
else
ignoreCOLP = ignoreCLIP = (int)strtol(Ptr->value, NIL, 0);
}
else
if (!strcmp(Ptr->name,CONF_ENT_VBN)) {
free(vbn);

View File

@ -19,6 +19,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
* Revision 1.129 2004/09/05 22:04:56 tobiasb
* New parameter file entry "ignoreUPD" for suppressing "Unexpected
* discrimator (...)" messages, demanded by Günther J. Niederwimmer
* on the suse-isdn mailing list.
*
* Revision 1.128 2004/08/25 21:22:06 tobiasb
* Minor fixes, required by gcc-3.4: Label at end of block, double function
* declaration. Revealed by Andreas Jochens as Debian bug #266523.
@ -1430,7 +1435,7 @@ void buildnumber(char *num, int oc3, int oc3a, char *result, int version,
sprintf(s, "\"%s\"", num);
Q931dump(TYPE_STRING, -2, s, version);
} /* if */
} /* if -q */
strcpy(n, num);
strcpy(result, "");
@ -1607,7 +1612,7 @@ void buildnumber(char *num, int oc3, int oc3a, char *result, int version,
case 0x70 : break; /* 111 Reserved for extension */
} /* switch */
} /* if */
} /* if neither special number nor internal */
if (*num)
strcat(result, num);
@ -2611,13 +2616,13 @@ static void decode(int chan, register char *p, int type, int version, int tei)
if (*call[chan].onum[CALLING]) { /* another Calling-party? */
if (strcmp(call[chan].onum[CALLING], s)) { /* different! */
if (ignoreCOLP && !Q931dmp) /* FIXME */
break;
if ((call[chan].screening == 3) && ((oc3a & 3) < 3)) { /* we believe the first one! */
strcpy(call[chan].onum[CLIP], s);
buildnumber(s, oc3, oc3a, call[chan].num[CLIP], version, &call[chan].provider, &call[chan].sondernummer[CLIP], &call[chan].intern[CLIP], &call[chan].local[CLIP], 0, 0);
strcpy(call[chan].vnum[CLIP], vnum(6, CLIP));
/* first number was network provided, this is not */
if (!ignoreCLIP || Q931dmp) {
strcpy(call[chan].onum[CLIP], s);
buildnumber(s, oc3, oc3a, call[chan].num[CLIP], version, &call[chan].provider, &call[chan].sondernummer[CLIP], &call[chan].intern[CLIP], &call[chan].local[CLIP], call[chan].dialin, CALLING);
strcpy(call[chan].vnum[CLIP], vnum(chan, CLIP));
}
if (Q931dmp && (*call[chan].vnum[CLIP] != '?') && *call[chan].vorwahl[CLIP]
&& oc3 && ((oc3 & 0x70) != 0x40)) {
auto char s[BUFSIZ];
@ -2629,14 +2634,34 @@ static void decode(int chan, register char *p, int type, int version, int tei)
call[chan].area[CLIP]);
Q931dump(TYPE_STRING, -2, s, version);
} /* if */
} /* if -q */
sprintf(s1, "CLIP %s", call[chan].vnum[CLIP]);
info(chan, PRT_SHOWNUMBERS, STATE_RING, s1);
if (!ignoreCLIP) {
if (call[chan].confentry[CLIP] != UNKNOWN)
snprintf(s1, BUFSIZ, "CLIP: %s (%s)", call[chan].vnum[CLIP], call[chan].num[CLIP]);
else
snprintf(s1, BUFSIZ, "CLIP: %s", call[chan].vnum[CLIP]);
info(chan, PRT_SHOWNUMBERS, STATE_RING, s1);
}
else if (ignoreCLIP & 0x2) {
snprintf(s1, BUFSIZ, "CLIP %s -- ignored", s);
info(chan, PRT_SHOWNUMBERS, STATE_RING, s1);
}
break;
break; /* [CALLING] remain unchanged */
}
else if (ignoreCLIP && !Q931dmp) {
/* same as below, but first number gets ignored */
if (ignoreCLIP & 0x2) {
snprintf(s1, BUFSIZ, "CLIP %s -- ignored", call[chan].onum[CALLING]);
info(chan, PRT_SHOWNUMBERS, STATE_RING, s1);
}
}
else {
/* first number was not network provided, this may be
* first number was network provided, this is too
* --> consider first number as CLIP, this number
as the default source number */
warn = 1;
strcpy(call[chan].onum[CLIP], call[chan].onum[CALLING]);
@ -2671,7 +2696,7 @@ static void decode(int chan, register char *p, int type, int version, int tei)
call[chan].area[CALLING]);
Q931dump(TYPE_STRING, -2, s, version);
} /* if */
} /* if -q */
if (callfile && call[chan].dialin) {
FILE *cl = fopen(callfile, "a");
@ -2688,7 +2713,10 @@ static void decode(int chan, register char *p, int type, int version, int tei)
} /* if */
if (warn) {
sprintf(s1, "CLIP %s", call[chan].vnum[CLIP]);
if (call[chan].confentry[CLIP] != UNKNOWN)
snprintf(s1, BUFSIZ, "CLIP: %s (%s)", call[chan].vnum[CLIP], call[chan].num[CLIP]);
else
snprintf(s1, BUFSIZ, "CLIP: %s", call[chan].vnum[CLIP]);
info(chan, PRT_SHOWNUMBERS, STATE_RING, s1);
} /* if */

View File

@ -1,3 +1,7 @@
2004-09-29 Tobias Becker <tobiasb@isdn4linux.de>
* tools.h (ignoreCLIP): New global variable, similiar ignoreCOLP.
2004-09-27 Tobias Becker <tobiasb@isdn4linux.de>
* isdnrate.c (printTable): Check provider and price (new) when

View File

@ -20,6 +20,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
* Revision 1.62 2004/09/05 22:04:57 tobiasb
* New parameter file entry "ignoreUPD" for suppressing "Unexpected
* discrimator (...)" messages, demanded by Günther J. Niederwimmer
* on the suse-isdn mailing list.
*
* Revision 1.61 2004/07/24 16:16:56 tobiasb
* New entry `REPOPTIONS' in section [ISDNLOG] of the isdn configuration
* file. This will be used for commandline options defaults of isdnrep.
@ -1177,6 +1182,7 @@ _EXTERN char mlabel[BUFSIZ];
_EXTERN char *amtsholung;
_EXTERN int ignoreRR;
_EXTERN int ignoreCOLP;
_EXTERN int ignoreCLIP;
_EXTERN int interns0;
_EXTERN char *vbn;
_EXTERN char *vbnlen;