Refactoring validity check and prefix processing of dialed number
Command line help shows how many digits and what prefixes can be dialed. Giving a station ID via command line will be checked for being valid. The number to call the mobile statione will be checked for being valid. Prefixes that are defined for a nework will be removed from station ID automatically. Multiple station ID lengths are supported: * C-Netz: 7 or 8 digits, depending on area code length * A-Netz: 5 or 7 digits; number is truncated to last 5 digits. * IMTS/MTS: 5 or 7 digits, depending on phone's selector switch.
This commit is contained in:
@@ -893,30 +893,8 @@ int call_down_setup(int callref, const char __attribute__((unused)) *caller_id,
|
||||
transaction_t *trans;
|
||||
uint32_t min1;
|
||||
uint16_t min2;
|
||||
int i;
|
||||
|
||||
/* 1. check if number is invalid, return INVALNUMBER */
|
||||
if (!tacs) {
|
||||
if (strlen(dialing) == 12 && !strncmp(dialing, "+1", 2))
|
||||
dialing += 2;
|
||||
if (strlen(dialing) == 11 && !strncmp(dialing, "1", 1))
|
||||
dialing += 1;
|
||||
} else if (!jtacs) {
|
||||
if (strlen(dialing) == 14 && !strncmp(dialing, "+44", 3))
|
||||
dialing += 3;
|
||||
if (strlen(dialing) == 11 && !strncmp(dialing, "0", 1))
|
||||
dialing += 1;
|
||||
}
|
||||
if (strlen(dialing) != 10) {
|
||||
inval:
|
||||
PDEBUG(DAMPS, DEBUG_NOTICE, "Outgoing call to invalid number '%s', rejecting!\n", dialing);
|
||||
return -CAUSE_INVALNUMBER;
|
||||
}
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (dialing[i] < '0' || dialing[i] > '9')
|
||||
goto inval;
|
||||
}
|
||||
|
||||
/* 1. split number into area code and number */
|
||||
amps_number2min(dialing, &min1, &min2);
|
||||
|
||||
/* 2. check if the subscriber is attached */
|
||||
|
Reference in New Issue
Block a user