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:
@@ -1712,22 +1712,16 @@ int _out_setup(int callref, const char *caller_id, enum number_type caller_type,
|
||||
{
|
||||
sender_t *sender;
|
||||
nmt_t *nmt;
|
||||
int i;
|
||||
nmt_subscriber_t subscr;
|
||||
transaction_t *trans;
|
||||
|
||||
memset(&subscr, 0, sizeof(subscr));
|
||||
|
||||
/* 1. check if number is invalid, return INVALNUMBER */
|
||||
/* 1. split number into country and subscriber parts */
|
||||
if (dialstring2number(dialing, &subscr.country, subscr.number)) {
|
||||
inval:
|
||||
PDEBUG(DNMT, DEBUG_NOTICE, "Outgoing call to invalid number '%s', rejecting!\n", dialing);
|
||||
return -CAUSE_INVALNUMBER;
|
||||
}
|
||||
for (i = 0; i < 6; i++) {
|
||||
if (subscr.number[i] < '0' || subscr.number[i] > '9')
|
||||
goto inval;
|
||||
}
|
||||
|
||||
/* 2. check if given number is already in a call, return BUSY */
|
||||
trans = get_transaction_by_number(&subscr);
|
||||
|
Reference in New Issue
Block a user