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:
Andreas Eversberg
2021-10-07 19:35:56 +02:00
parent 3a73f31d7e
commit 423bc42429
41 changed files with 662 additions and 429 deletions

View File

@@ -69,6 +69,12 @@ static int handle_options(int short_option, int argi, char **argv)
return 1;
}
static const struct number_lengths number_lengths[] = {
{ 0, "no number" },
{ 4, "number '1191'" },
{ 0, NULL },
};
int main(int argc, char *argv[])
{
int rc, argi;
@@ -78,7 +84,8 @@ int main(int argc, char *argv[])
/* init system specific tones */
init_samples();
main_mobile_init();
/* init mobile interface */
main_mobile_init("0123456789", number_lengths, NULL, NULL);
/* handle options / config file */
add_options();
@@ -93,7 +100,7 @@ int main(int argc, char *argv[])
fm_init(fast_math);
zeit_init(audio_level_dBm, alerting);
main_mobile("zeitansage", &quit, NULL, "1191", 4);
main_mobile_loop("zeitansage", &quit, NULL, "1191");
//fail:
/* exits */