Added support of Talker Alias
This commit is contained in:
parent
1c8eaa89e7
commit
262463046e
4 changed files with 38 additions and 20 deletions
|
@ -11,6 +11,8 @@
|
|||
#define DEFAULT_USER_NUMBER 1
|
||||
#define DEFAULT_LINK_NUMBER 10
|
||||
|
||||
#define EMPTY_STRING ""
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
printf("\n");
|
||||
|
@ -81,13 +83,16 @@ int main(int argc, const char* argv[])
|
|||
(file == NULL))
|
||||
{
|
||||
printf(
|
||||
"Usage: %s"
|
||||
" --expression <regular expression>"
|
||||
" --connection <path to configuration file>"
|
||||
" [--unknown <ID for unknown call-signs>]"
|
||||
" --network <network number>"
|
||||
" --link <link number>"
|
||||
" [--identity <identity>]"
|
||||
"Usage: %s\n"
|
||||
" --expression <regular expression>\n"
|
||||
" --connection <path to configuration file>\n"
|
||||
" [--unknown <ID for unknown call-signs>]\n"
|
||||
" --network <network number>\n"
|
||||
" --link <link number>\n"
|
||||
" [--identity <identity>]\n"
|
||||
"\n"
|
||||
"Expression example:\n"
|
||||
" (?<alias>(?<call>[RU][A-Z]?[0-9][A-Z]{1,4})[^;])\n"
|
||||
"\n",
|
||||
argv[0]);
|
||||
return EXIT_FAILURE;
|
||||
|
@ -110,15 +115,21 @@ int main(int argc, const char* argv[])
|
|||
int count = pcre_exec(expression, NULL, line, length, 0, 0, vectors, VECTORS_COUNT);
|
||||
if (count > 0)
|
||||
{
|
||||
const char* call;
|
||||
pcre_get_substring(line, vectors, count, 1, &call);
|
||||
const char* call = EMPTY_STRING;
|
||||
const char* alias = EMPTY_STRING;
|
||||
|
||||
pcre_get_named_substring(expression, line, vectors, count, "call", &call);
|
||||
pcre_get_named_substring(expression, line, vectors, count, "alias", &alias);
|
||||
|
||||
uint32_t number = store.getPrivateIDForCall(call);
|
||||
|
||||
if (number == 0)
|
||||
number = unknown;
|
||||
|
||||
proxy.setTalkerID(number);
|
||||
proxy.setTalkerAlias(call);
|
||||
syslog(LOG_INFO, "*** Found call-sign: %s (ID: %d)", call, number);
|
||||
proxy.setTalkerAlias(alias);
|
||||
|
||||
syslog(LOG_INFO, "*** Found call-sign: %s (ID: %d, Alias: \"%s\")", call, number, alias);
|
||||
|
||||
pcre_free_substring(call);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue