3
Fork 0

Initial import

This commit is contained in:
R3ABM Artem 2016-03-23 20:08:20 +03:00
commit 660133c812
28 changed files with 3983 additions and 0 deletions

View file

@ -0,0 +1,90 @@
// Copyright 2015 by Artem Prilutskiy
#include "BrandMeisterBridge.h"
#include <string.h>
#include <stdlib.h>
#include <syslog.h>
#include <stdio.h>
#define ECHOLINK_DEFAULT_USER_NUMBER 1
#define ECHOLINK_DEFAULT_CORD_NUMBER 10
#define REGISTRY_CONFIGURATION_FILE "/opt/BrandMeister/Registry.cnf"
BrandMeisterBridge::BrandMeisterBridge() :
proxy(ECHOLINK_DEFAULT_CORD_NUMBER),
store(REGISTRY_CONFIGURATION_FILE),
talker(NULL)
{
}
BrandMeisterBridge::~BrandMeisterBridge()
{
free(talker);
}
// Interface methods for ModuleEchoLink
const char* BrandMeisterBridge::getTalker()
{
free(talker);
uint32_t number = proxy.getTalkerID();
char call[LONG_CALLSIGN_LENGTH];
char text[SLOW_DATA_TEXT_LENGTH];
if ((number != 0) &&
(store.getCredentialsForID(number, call, text)))
{
asprintf(&talker, "%s %s", call, text);
return talker;
}
asprintf(&talker, "DMR ID: %d", number);
return talker;
}
void BrandMeisterBridge::setTalker(const char* call, const char* name)
{
if (*call == '*')
{
// Do not process conference call-sign
return;
}
const char* delimiter = strpbrk(call, " -\n");
if (delimiter != NULL)
{
// Remove characters after call-sign
size_t length = delimiter - call;
char* buffer = (char*)alloca(length + 1);
strncpy(buffer, call, length);
call = buffer;
}
uint32_t number = store.getPrivateIDForCall(call);
if (number == 0)
{
syslog(LOG_INFO, "DMR ID for call-sign %s not found", call);
number = ECHOLINK_DEFAULT_USER_NUMBER;
}
syslog(LOG_DEBUG, "Set talker DMR ID to %d", number);
proxy.setTalkerID(number);
}
void BrandMeisterBridge::handleChatMessage(const char* text)
{
// CONF Russian Reflector, Open 24/7, Contacts: rv3dhc.link@qip.ru * Call CQ / Use pauses 2sec * [28/500]
// R3ABM-L *DSTAR.SU DMR Bridge*
// UB3AMO Moscow T I N A O
// ->UA0LQE-L USSURIISK
const char* delimiter;
if ((strncmp(text, "CONF ", 5) == 0) &&
((delimiter = strstr(text, "\n->")) != NULL))
{
const char* call = delimiter + 3;
setTalker(call, NULL);
}
}

View file

@ -0,0 +1,28 @@
// Copyright 2015 by Artem Prilutskiy
#ifndef BRANDMEISTERBRIDGE_H
#define BRANDMEISTERBRIDGE_H
#include "PatchCordProxy.h"
#include "UserDataStore.h"
class BrandMeisterBridge
{
public:
BrandMeisterBridge();
~BrandMeisterBridge();
const char* getTalker();
void setTalker(const char* call, const char* name);
void handleChatMessage(const char* text);
private:
PatchCordProxy proxy;
UserDataStore store;
char* talker;
};
#endif

113
CallCapture/CallCapture.cpp Normal file
View file

@ -0,0 +1,113 @@
#include <stdlib.h>
#include <getopt.h>
#include <syslog.h>
#include <stdio.h>
#include <pcre.h>
#include "PatchCordProxy.h"
#include "UserDataStore.h"
#define VECTORS_COUNT 8
#define DEFAULT_USER_NUMBER 1
int main(int argc, const char* argv[])
{
printf("\n");
printf("CallCapture for BrandMeister DMR Master Server\n");
printf("Copyright 2015 Artem Prilutskiy (R3ABM, cyanide.burnout@gmail.com)\n");
printf("\n");
// Start up
struct option options[] =
{
{ "expression", required_argument, NULL, 'e' },
{ "connection", required_argument, NULL, 'c' },
{ "identity", required_argument, NULL, 'i' },
{ "link", required_argument, NULL, 'l' },
{ NULL, 0, NULL, 0 }
};
pcre* expression = NULL;
const char* file = NULL;
uint32_t number = 10;
int position = 0;
const char* error = NULL;
int selection = 0;
while ((selection = getopt_long(argc, const_cast<char* const*>(argv), "e:c:l:", options, NULL)) != EOF)
switch (selection)
{
case 'e':
expression = pcre_compile(optarg, 0, &error, &position, NULL);
break;
case 'c':
file = optarg;
break;
case 'i':
openlog(optarg, 0, LOG_USER);
break;
case 'l':
number = atoi(optarg);
break;
}
if ((expression == NULL) &&
(error != NULL))
{
printf("Error compiling regular expression: %s (at %d)\n", error, position);
return EXIT_FAILURE;
}
if ((expression == NULL) ||
(file == NULL))
{
printf(
"Usage: %s"
" --expression <regular expression>"
" --connection <path to configuration file>"
" --link <link number>"
" [--identity <identity>]"
"\n",
argv[0]);
return EXIT_FAILURE;
}
// Main
UserDataStore store(file);
PatchCordProxy proxy(number);
char* line = NULL;
size_t length = 0;
ssize_t read;
while ((read = getline(&line, &length, stdin)) != EOF)
{
syslog(LOG_DEBUG, "%s", line);
int vectors[VECTORS_COUNT];
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);
uint32_t number = store.getPrivateIDForCall(call);
if (number == 0)
number = DEFAULT_USER_NUMBER;
proxy.setTalkerID(number);
syslog(LOG_INFO, "*** Found call-sign: %s (ID: %d)", call, number);
pcre_free_substring(call);
}
}
pcre_free(expression);
return EXIT_SUCCESS;
};

40
CallCapture/Makefile Normal file
View file

@ -0,0 +1,40 @@
OBJECTS = \
PatchCordProxy.o \
UserDataStore.o \
CallCapture.o
LIBRARIES = \
mysqlclient \
pcre
DEPENDENCIES = \
dbus-1
CXXFLAGS := -fno-implicit-templates -D__STDC_CONSTANT_MACROS
FLAGS := -g -rdynamic -fno-omit-frame-pointer -O3 -MMD $(foreach directory, $(DIRECTORIES), -I$(directory)) $(shell pkg-config --cflags $(DEPENDENCIES)) -DBUILD=\"$(BUILD)\" -DVERSION=$(VERSION)
LIBS := -lstdc++ $(foreach library, $(LIBRARIES), -l$(library)) $(shell pkg-config --libs $(DEPENDENCIES))
# PREREQUISITES =
CC = gcc
CXX = g++
COMPILER_VERSION_FLAG := $(shell expr `${CXX} -dumpversion | cut -f1-2 -d.` \>= 4.9)
CFLAGS += $(FLAGS) -std=gnu99
ifeq ($(COMPILER_VERSION_FLAG), 1)
CXXFLAGS += $(FLAGS) -std=gnu++11
else
CXXFLAGS += $(FLAGS) -std=gnu++0x
endif
all: build
build: $(PREREQUISITES) $(OBJECTS)
$(CC) $(OBJECTS) $(FLAGS) $(LIBS) -o callcapture
clean:
rm -f $(PREREQUISITES) $(OBJECTS) callcapture
rm -f *.d */*.d
.PHONY: all build clean install

View file

@ -0,0 +1,154 @@
// Copyright 2015 by Artem Prilutskiy
#include "PatchCordProxy.h"
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <stdio.h>
#define INTERFACE_NAME "me.burnaway.BrandMeister"
#define SERVICE_NAME INTERFACE_NAME
#define OBJECT_PATH "/me/burnaway/BrandMeister"
// From AutoPatch.cpp
#define AUTOPATCH_LINK_NAME "AutoPatch"
// From PatchCord.h
#define VALUE_CORD_OUTGOING_SOURCE_ID 1
#define VALUE_CORD_INCOMING_SOURCE_ID 4
PatchCordProxy::PatchCordProxy(uint32_t number) :
number(number),
banner(NULL)
{
connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
}
PatchCordProxy::~PatchCordProxy()
{
free(banner);
dbus_connection_unref(connection);
}
void PatchCordProxy::setTalkerID(uint32_t value)
{
getContextBanner();
setVendorSpecificValue(VALUE_CORD_OUTGOING_SOURCE_ID, value);
}
uint32_t PatchCordProxy::getTalkerID()
{
getContextBanner();
return getVendorSpecificValue(VALUE_CORD_INCOMING_SOURCE_ID);
}
void PatchCordProxy::getContextBanner()
{
DBusMessage* message = dbus_message_new_method_call(
SERVICE_NAME, OBJECT_PATH,
INTERFACE_NAME, "getContextList");
const char* name = AUTOPATCH_LINK_NAME;
dbus_message_append_args(message,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_UINT32, &number,
DBUS_TYPE_INVALID);
DBusPendingCall* pending;
if (dbus_connection_send_with_reply(connection, message, &pending, -1))
{
dbus_connection_flush(connection);
dbus_message_unref(message);
dbus_pending_call_block(pending);
message = dbus_pending_call_steal_reply(pending);
char** array;
int count;
if ((dbus_message_get_args(message, NULL,
DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &array, &count,
DBUS_TYPE_INVALID)) &&
(count > 0))
{
free(banner);
banner = strdup(*array);
dbus_free_string_array(array);
}
dbus_pending_call_unref(pending);
}
dbus_message_unref(message);
}
void PatchCordProxy::setVendorSpecificValue(uint32_t key, uint32_t value)
{
DBusMessage* message = dbus_message_new_method_call(
SERVICE_NAME, OBJECT_PATH,
INTERFACE_NAME, "setVendorSpecificValue");
dbus_message_append_args(message,
DBUS_TYPE_STRING, &banner,
DBUS_TYPE_UINT32, &key,
DBUS_TYPE_UINT32, &value,
DBUS_TYPE_INVALID);
DBusPendingCall* pending;
if (dbus_connection_send_with_reply(connection, message, &pending, -1))
{
dbus_connection_flush(connection);
dbus_message_unref(message);
dbus_pending_call_block(pending);
message = dbus_pending_call_steal_reply(pending);
dbus_pending_call_unref(pending);
}
dbus_message_unref(message);
// Each call of dbus_message_unref removes banner from the heap
banner = NULL;
}
uint32_t PatchCordProxy::getVendorSpecificValue(uint32_t key)
{
DBusMessage* message = dbus_message_new_method_call(
SERVICE_NAME, OBJECT_PATH,
INTERFACE_NAME, "getContextData");
dbus_message_append_args(message,
DBUS_TYPE_STRING, &banner,
DBUS_TYPE_INVALID);
uint32_t value = 0;
DBusPendingCall* pending;
if (dbus_connection_send_with_reply(connection, message, &pending, -1))
{
dbus_connection_flush(connection);
dbus_message_unref(message);
dbus_pending_call_block(pending);
message = dbus_pending_call_steal_reply(pending);
const char* name;
const char* address;
dbus_uint32_t type;
dbus_uint32_t state;
dbus_uint32_t number;
dbus_uint32_t* values;
int count;
if (dbus_message_get_args(message, NULL,
DBUS_TYPE_STRING, &banner,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_UINT32, &type,
DBUS_TYPE_UINT32, &number,
DBUS_TYPE_STRING, &address,
DBUS_TYPE_UINT32, &state,
DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &values, &count,
DBUS_TYPE_INVALID))
value = values[key];
dbus_pending_call_unref(pending);
}
dbus_message_unref(message);
// Each call of dbus_message_unref removes banner from the heap
banner = NULL;
return value;
}

View file

@ -0,0 +1,31 @@
// Copyright 2015 by Artem Prilutskiy
#ifndef PATCHCORDPROXY_H
#define PATCHCORDPROXY_H
#include <stdint.h>
#include <dbus/dbus.h>
class PatchCordProxy
{
public:
PatchCordProxy(uint32_t number);
~PatchCordProxy();
void setTalkerID(uint32_t value);
uint32_t getTalkerID();
private:
DBusConnection* connection;
uint32_t number;
char* banner;
void getContextBanner();
void setVendorSpecificValue(uint32_t key, uint32_t value);
uint32_t getVendorSpecificValue(uint32_t key);
};
#endif

View file

@ -0,0 +1,137 @@
// Copyright 2015 by Artem Prilutskiy
#include "UserDataStore.h"
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <syslog.h>
#define GET_ID_FOR_CALL 0
#define GET_CREDENTIALS_FOR_ID 1
UserDataStore::UserDataStore(const char* file) :
connection(NULL)
{
const char* queries[] =
{
// GET_ID_FOR_CALL
"SELECT `ID`"
" FROM Users"
" WHERE `Call` = ?"
" ORDER BY `Priority`"
" LIMIT 1",
// GET_CREDENTIALS_FOR_ID
"SELECT `Call`, `Text`"
" FROM Users"
" WHERE `ID` = ?",
};
connection = mysql_init(NULL);
mysql_options(connection, MYSQL_READ_DEFAULT_FILE, realpath(file, NULL));
mysql_real_connect(connection, NULL, NULL, NULL, NULL, 0, NULL, CLIENT_REMEMBER_OPTIONS);
my_bool active = true;
mysql_options(connection, MYSQL_OPT_RECONNECT, &active);
for (size_t index = 0; index < PREPARED_STATEMENT_COUNT; index ++)
{
const char* query = queries[index];
statements[index] = mysql_stmt_init(connection);
mysql_stmt_prepare(statements[index], query, strlen(query));
}
const char* error = mysql_error(connection);
if ((error != NULL) && (*error != '\0'))
syslog(LOG_CRIT, "MySQL error: %s\n", error);
}
UserDataStore::~UserDataStore()
{
for (size_t index = 0; index < PREPARED_STATEMENT_COUNT; index ++)
mysql_stmt_close(statements[index]);
mysql_close(connection);
}
// Public methods
uint32_t UserDataStore::getPrivateIDForCall(const char* call)
{
uint32_t number;
size_t length = strlen(call);
return
execute(GET_ID_FOR_CALL, 1, 1,
MYSQL_TYPE_STRING, call, length,
MYSQL_TYPE_LONG, &number) *
number;
}
bool UserDataStore::getCredentialsForID(uint32_t number, char* call, char* text)
{
return
execute(GET_CREDENTIALS_FOR_ID, 1, 2,
MYSQL_TYPE_LONG, &number,
MYSQL_TYPE_STRING, call, LONG_CALLSIGN_LENGTH + 1,
MYSQL_TYPE_STRING, text, SLOW_DATA_TEXT_LENGTH + 1);
}
// Internals
MYSQL_BIND* UserDataStore::bind(int count, va_list* arguments)
{
MYSQL_BIND* bindings = NULL;
if (count > 0)
{
bindings = (MYSQL_BIND*)calloc(count, sizeof(MYSQL_BIND));
for (int index = 0; index < count; index ++)
{
int type = va_arg(*arguments, int);
bindings[index].buffer_type = (enum_field_types)type;
bindings[index].buffer = va_arg(*arguments, void*);
if ((type == MYSQL_TYPE_STRING) ||
(type == MYSQL_TYPE_DATETIME))
{
bindings[index].buffer_length = va_arg(*arguments, int);
bindings[index].length = &bindings[index].buffer_length;
}
}
}
return bindings;
}
bool UserDataStore::execute(int index, int count1, int count2, ...)
{
bool result = true;
MYSQL_STMT* statement = statements[index];
va_list arguments;
va_start(arguments, count2);
MYSQL_BIND* parameters = bind(count1, &arguments);
MYSQL_BIND* columns = bind(count2, &arguments);
va_end(arguments);
if ((parameters && mysql_stmt_bind_param(statement, parameters)) ||
(columns && mysql_stmt_bind_result(statement, columns)) ||
mysql_stmt_execute(statement) ||
(columns && mysql_stmt_store_result(statement)))
{
const char* error = mysql_stmt_error(statement);
syslog(LOG_CRIT, "MySQL error while processing statement %d: %s\n", index, error);
result = false;
}
if (result && columns)
{
result = !mysql_stmt_fetch(statement);
mysql_stmt_free_result(statement);
}
free(columns);
free(parameters);
return result;
}

View file

@ -0,0 +1,35 @@
// Copyright 2015 by Artem Prilutskiy
#ifndef USERDATASTORE_H
#define USERDATASTORE_H
#include <stdint.h>
#include <stdarg.h>
#include <mysql/mysql.h>
#define PREPARED_STATEMENT_COUNT 2
#define LONG_CALLSIGN_LENGTH 8
#define SLOW_DATA_TEXT_LENGTH 20
class UserDataStore
{
public:
UserDataStore(const char* file);
~UserDataStore();
uint32_t getPrivateIDForCall(const char* call);
bool getCredentialsForID(uint32_t number, char* call, char* text);
protected:
MYSQL* connection;
MYSQL_STMT* statements[PREPARED_STATEMENT_COUNT];
MYSQL_BIND* bind(int count, va_list* arguments);
bool execute(int index, int count1, int count2, ...);
};
#endif

43
SVXLink/Makefile Normal file
View file

@ -0,0 +1,43 @@
DIRECTORIES = \
echolink
OBJECTS = \
echolink/UserDataStore.o \
echolink/PatchCordProxy.o \
echolink/BrandMeisterBridge.o \
Test.o
LIBRARIES = \
mysqlclient
DEPENDENCIES = \
dbus-1
CXXFLAGS := -fno-implicit-templates -D__STDC_CONSTANT_MACROS
FLAGS := -g -rdynamic -fno-omit-frame-pointer -O3 -MMD $(foreach directory, $(DIRECTORIES), -I$(directory)) $(shell pkg-config --cflags $(DEPENDENCIES)) -DBUILD=\"$(BUILD)\" -DVERSION=$(VERSION)
LIBS := -lstdc++ $(foreach library, $(LIBRARIES), -l$(library)) $(shell pkg-config --libs $(DEPENDENCIES))
# PREREQUISITES =
CC = gcc
CXX = g++
COMPILER_VERSION_FLAG := $(shell expr `${CXX} -dumpversion | cut -f1-2 -d.` \>= 4.9)
CFLAGS += $(FLAGS) -std=gnu99
ifeq ($(COMPILER_VERSION_FLAG), 1)
CXXFLAGS += $(FLAGS) -std=gnu++11
else
CXXFLAGS += $(FLAGS) -std=gnu++0x
endif
all: build
build: $(PREREQUISITES) $(OBJECTS)
$(CC) $(OBJECTS) $(FLAGS) $(LIBS) -o unit-test
clean:
rm -f $(PREREQUISITES) $(OBJECTS) unit-test
rm -f *.d */*.d
.PHONY: all build clean install config binary system

View file

@ -0,0 +1,21 @@
[ModuleEchoLink]
NAME=EchoLink
ID=2
TIMEOUT=0
#DROP_INCOMING=^()$
#REJECT_INCOMING=^(.*-[LR])$
#REJECT_INCOMING=^(.*)$
#ACCEPT_INCOMING=^(.*)$
#REJECT_OUTGOING=^()$
#ACCEPT_OUTGOING=^(.*)$
SERVERS=servers.echolink.org
CALLSIGN=MY0CALL-L
PASSWORD=password
SYSOPNAME=*DSTAR.SU DMR Bridge*
LOCATION=Moscow, Russia
MAX_QSOS=10
MAX_CONNECTIONS=11
LINK_IDLE_TIMEOUT=0
DESCRIPTION="You have connected to a DSTAR.SU DMR Bridge\n"
AUTOCON_ECHOLINK_ID=196189
AUTOCON_TIME=30

13
SVXLink/Test.cpp Normal file
View file

@ -0,0 +1,13 @@
#include <stdio.h>
#include "BrandMeisterBridge.h"
int main(int argc, const char* argv[])
{
BrandMeisterBridge bridge;
// Test 1
printf("Talker: %s\n", bridge.getTalker());
// Test 2
bridge.setTalker("R3ABM", "Artem");
return 0;
};

21
SVXLink/build.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
PREFIX=/opt/SVXLink
sudo apt-get install libsigc++-2.0-dev libpopt-dev libgcrypt11-dev libasound2-dev libgsm1-dev
sudo adduser svxlink --system --home $PREFIX --shell /bin/false --disabled-login --disabled-password
sudo addgroup svxlink
sudo adduser svxlink audio
sudo adduser svxlink master
sudo adduser svxlink svxlink
pushd .
mkdir src/build
cd src/build
cmake -DCMAKE_INSTALL_PREFIX=$PREFIX -DUSE_QT=NO -DUSE_OSS=NO ..
make
sudo make install
popd
sudo echo $PREFIX/lib > /etc/ld.so.conf.d/svxlink.conf
sudo ldconfig

View file

@ -0,0 +1,95 @@
// Copyright 2015 by Artem Prilutskiy
#include "BrandMeisterBridge.h"
#include <string.h>
#include <stdlib.h>
#include <syslog.h>
#include <stdio.h>
#define ECHOLINK_DEFAULT_USER_NUMBER 1
#define ECHOLINK_DEFAULT_CORD_NUMBER 10
#define REGISTRY_CONFIGURATION_FILE "/opt/BrandMeister/Registry.cnf"
BrandMeisterBridge::BrandMeisterBridge() :
proxy(ECHOLINK_DEFAULT_CORD_NUMBER),
store(REGISTRY_CONFIGURATION_FILE),
talker(NULL)
{
}
BrandMeisterBridge::~BrandMeisterBridge()
{
free(talker);
}
// Interface methods for ModuleEchoLink
const char* BrandMeisterBridge::getTalker()
{
free(talker);
uint32_t number = proxy.getTalkerID();
char call[LONG_CALLSIGN_LENGTH];
char text[SLOW_DATA_TEXT_LENGTH];
if ((number != 0) &&
(store.getCredentialsForID(number, call, text)))
{
asprintf(&talker, "%s %s", call, text);
return talker;
}
asprintf(&talker, "DMR ID: %d", number);
return talker;
}
void BrandMeisterBridge::setTalker(const char* call, const char* name)
{
if (*call == '*')
{
// Do not process conference call-sign
return;
}
const char* delimiter = strpbrk(call, " -\n");
if (delimiter != NULL)
{
// Remove characters after call-sign
size_t length = delimiter - call;
char* buffer = (char*)alloca(length + 1);
strncpy(buffer, call, length);
call = buffer;
}
uint32_t number = store.getPrivateIDForCall(call);
if (number == 0)
number = ECHOLINK_DEFAULT_USER_NUMBER;
syslog(LOG_INFO, "Set talker ID to %d for call-sign %s", number, call);
proxy.setTalkerID(number);
}
void BrandMeisterBridge::handleChatMessage(const char* text)
{
// CONF Russian Reflector, Open 24/7, Contacts: rv3dhc.link@qip.ru * Call CQ / Use pauses 2sec * [28/500]
// R3ABM-L *DSTAR.SU DMR Bridge*
// UB3AMO Moscow T I N A O
// ->UA0LQE-L USSURIISK
if (strncmp(text, "CONF ", 5) == 0)
{
const char* delimiter = strstr(text, "\n->");
if (delimiter != NULL)
{
const char* call = delimiter + 3;
setTalker(call, NULL);
}
else
{
uint32_t number = ECHOLINK_DEFAULT_USER_NUMBER;
syslog(LOG_INFO, "Set talker ID to %d (call-sign was not fit into chat message)", number);
proxy.setTalkerID(number);
}
}
}

View file

@ -0,0 +1,28 @@
// Copyright 2015 by Artem Prilutskiy
#ifndef BRANDMEISTERBRIDGE_H
#define BRANDMEISTERBRIDGE_H
#include "PatchCordProxy.h"
#include "UserDataStore.h"
class BrandMeisterBridge
{
public:
BrandMeisterBridge();
~BrandMeisterBridge();
const char* getTalker();
void setTalker(const char* call, const char* name);
void handleChatMessage(const char* text);
private:
PatchCordProxy proxy;
UserDataStore store;
char* talker;
};
#endif

View file

@ -0,0 +1,59 @@
# The name of the module without the Module prefix
set(MODNAME EchoLink)
# Module source code
set(MODSRC QsoImpl.cpp)
# ***
pkg_check_modules(DBUS dbus-1)
include_directories(${DBUS_INCLUDE_DIRS})
set(LIBS ${LIBS} ${DBUS_LIBRARIES} mysqlclient)
set(MODSRC ${MODSRC} PatchCordProxy.cpp UserDataStore.cpp BrandMeisterBridge.cpp)
# ***
# Project libraries to link to
set(LIBS ${LIBS} echolib)
# Find the TCL library
if(TCL_LIBRARY)
set(TCL_LIBRARY_CACHED TRUE)
endif(TCL_LIBRARY)
find_package(TCL QUIET)
if(TCL_FOUND)
if (NOT TCL_LIBRARY_CACHED)
message("-- Found TCL: ${TCL_LIBRARY}")
endif(NOT TCL_LIBRARY_CACHED)
else(TCL_FOUND)
message(FATAL_ERROR "-- Could NOT find the TCL scripting language")
endif(TCL_FOUND)
set(LIBS ${LIBS} ${TCL_LIBRARY})
include_directories(${TCL_INCLUDE_PATH})
# Find the GSM codec library and include directory
find_package(GSM REQUIRED)
if(NOT GSM_FOUND)
message(FATAL_ERROR "libgsm not found")
endif(NOT GSM_FOUND)
include_directories(${GSM_INCLUDE_DIR})
set(LIBS ${LIBS} ${GSM_LIBRARY})
string(TOUPPER MODULE_${MODNAME} VERNAME)
# Add targets for version files
set(VERSION_DEPENDS)
add_version_target(${VERNAME} VERSION_DEPENDS)
add_version_target(SVXLINK VERSION_DEPENDS)
# Build the plugin
add_library(Module${MODNAME} MODULE Module${MODNAME}.cpp ${MODSRC}
${VERSION_DEPENDS}
)
set_target_properties(Module${MODNAME} PROPERTIES PREFIX "")
target_link_libraries(Module${MODNAME} ${LIBS})
# Install targets
install(TARGETS Module${MODNAME} DESTINATION ${SVX_MODULE_INSTALL_DIR})
install(FILES ${MODNAME}.tcl DESTINATION ${SVX_SHARE_INSTALL_DIR}/events.d)
install_if_not_exists(Module${MODNAME}.conf
${SVX_SYSCONF_INSTALL_DIR}/svxlink.d
)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,276 @@
/**
@file ModuleEchoLink.h
@brief A module that provides EchoLink connection possibility
@author Tobias Blomberg / SM0SVX
@date 2004-03-07
\verbatim
A module (plugin) for the multi purpose tranciever frontend system.
Copyright (C) 2004-2014 Tobias Blomberg / SM0SVX
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\endverbatim
*/
#ifndef MODULE_ECHOLINK_INCLUDED
#define MODULE_ECHOLINK_INCLUDED
/****************************************************************************
*
* System Includes
*
****************************************************************************/
#include <string>
#include <vector>
#include <sys/types.h>
#include <regex.h>
/****************************************************************************
*
* Project Includes
*
****************************************************************************/
#include <Module.h>
#include <EchoLinkQso.h>
#include <EchoLinkStationData.h>
/****************************************************************************
*
* Local Includes
*
****************************************************************************/
#include "version/SVXLINK.h"
#include "BrandMeisterBridge.h"
/****************************************************************************
*
* Forward declarations
*
****************************************************************************/
namespace Async
{
class Timer;
class AudioSplitter;
class AudioValve;
class AudioSelector;
};
namespace EchoLink
{
class Directory;
class StationData;
class Proxy;
};
/****************************************************************************
*
* Namespace
*
****************************************************************************/
//namespace MyNameSpace
//{
/****************************************************************************
*
* Forward declarations of classes inside of the declared namespace
*
****************************************************************************/
class MsgHandler;
class QsoImpl;
class LocationInfo;
/****************************************************************************
*
* Defines & typedefs
*
****************************************************************************/
/****************************************************************************
*
* Exported Global Variables
*
****************************************************************************/
/****************************************************************************
*
* Class definitions
*
****************************************************************************/
/**
@brief A module for providing EchoLink connections
@author Tobias Blomberg
@date 2004-03-07
*/
class ModuleEchoLink : public Module
{
public:
ModuleEchoLink(void *dl_handle, Logic *logic, const std::string& cfg_name);
~ModuleEchoLink(void);
bool initialize(void);
const char *compiledForVersion(void) const { return SVXLINK_VERSION; }
protected:
/**
* @brief Notify the module that the logic core idle state has changed
* @param is_idle Set to \em true if the logic core is idle or else
* \em false.
*
* This function is called by the logic core when the idle state changes.
*/
virtual void logicIdleStateChanged(bool is_idle);
private:
BrandMeisterBridge bridge;
typedef enum
{
STATE_NORMAL,
STATE_CONNECT_BY_CALL,
STATE_DISCONNECT_BY_CALL
} State;
typedef std::vector<EchoLink::StationData> StnList;
struct NumConStn
{
unsigned num_con;
struct timeval last_con;
NumConStn(unsigned num, struct timeval &t) : num_con(num), last_con(t) {}
};
typedef std::map<const std::string, NumConStn> NumConMap;
static const int DEFAULT_AUTOCON_TIME = 3*60*1000; // Three minutes
EchoLink::Directory *dir;
Async::Timer *dir_refresh_timer;
std::string mycall;
std::string location;
std::string sysop_name;
std::string description;
std::string allow_ip;
bool remote_activation;
int pending_connect_id;
std::string last_message;
std::vector<QsoImpl*> outgoing_con_pending;
std::vector<QsoImpl*> qsos;
unsigned max_connections;
unsigned max_qsos;
QsoImpl *talker;
bool squelch_is_open;
State state;
StnList cbc_stns;
Async::Timer *cbc_timer;
Async::Timer *dbc_timer;
regex_t *drop_incoming_regex;
regex_t *reject_incoming_regex;
regex_t *accept_incoming_regex;
regex_t *reject_outgoing_regex;
regex_t *accept_outgoing_regex;
EchoLink::StationData last_disc_stn;
Async::AudioSplitter *splitter;
Async::AudioValve *listen_only_valve;
Async::AudioSelector *selector;
unsigned num_con_max;
time_t num_con_ttl;
time_t num_con_block_time;
NumConMap num_con_map;
Async::Timer *num_con_update_timer;
bool reject_conf;
int autocon_echolink_id;
int autocon_time;
Async::Timer *autocon_timer;
EchoLink::Proxy *proxy;
void moduleCleanup(void);
void activateInit(void);
void deactivateCleanup(void);
//bool dtmfDigitReceived(char digit, int duration);
void dtmfCmdReceived(const std::string& cmd);
void dtmfCmdReceivedWhenIdle(const std::string &cmd);
void squelchOpen(bool is_open);
int audioFromRx(float *samples, int count);
void allMsgsWritten(void);
void onStatusChanged(EchoLink::StationData::Status status);
void onStationListUpdated(void);
void onError(const std::string& msg);
void onIncomingConnection(const Async::IpAddress& ip,
const std::string& callsign, const std::string& name,
const std::string& priv);
void onStateChange(QsoImpl *qso, EchoLink::Qso::State qso_state);
void onChatMsgReceived(QsoImpl *qso, const std::string& msg);
void onIsReceiving(bool is_receiving, QsoImpl *qso);
void destroyQsoObject(QsoImpl *qso);
void getDirectoryList(Async::Timer *timer=0);
void createOutgoingConnection(const EchoLink::StationData &station);
int audioFromRemote(float *samples, int count, QsoImpl *qso);
void audioFromRemoteRaw(EchoLink::Qso::RawPacket *packet,
QsoImpl *qso);
QsoImpl *findFirstTalker(void) const;
void broadcastTalkerStatus(void);
void updateDescription(void);
void updateEventVariables(void);
void connectByCallsign(std::string cmd);
void handleConnectByCall(const std::string& cmd);
void cbcTimeout(Async::Timer *t);
void disconnectByCallsign(const std::string &cmd);
void handleDisconnectByCall(const std::string& cmd);
void dbcTimeout(Async::Timer *t);
int numConnectedStations(void);
int listQsoCallsigns(std::list<std::string>& call_list);
void handleCommand(const std::string& cmd);
void commandFailed(const std::string& cmd);
void connectByNodeId(int node_id);
void checkIdle(void);
void checkAutoCon(Async::Timer *timer=0);
bool numConCheck(const std::string &callsign);
void numConUpdate(void);
void replaceAll(std::string &str, const std::string &from,
const std::string &to) const;
}; /* class ModuleEchoLink */
//} /* namespace */
#endif /* MODULE_ECHOLINK_INCLUDED */
/*
* This file has not been truncated
*/

View file

@ -0,0 +1,154 @@
// Copyright 2015 by Artem Prilutskiy
#include "PatchCordProxy.h"
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <stdio.h>
#define INTERFACE_NAME "me.burnaway.BrandMeister"
#define SERVICE_NAME INTERFACE_NAME
#define OBJECT_PATH "/me/burnaway/BrandMeister"
// From AutoPatch.cpp
#define AUTOPATCH_LINK_NAME "AutoPatch"
// From PatchCord.h
#define VALUE_CORD_OUTGOING_SOURCE_ID 1
#define VALUE_CORD_INCOMING_SOURCE_ID 4
PatchCordProxy::PatchCordProxy(uint32_t number) :
number(number),
banner(NULL)
{
connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
}
PatchCordProxy::~PatchCordProxy()
{
free(banner);
dbus_connection_unref(connection);
}
void PatchCordProxy::setTalkerID(uint32_t value)
{
getContextBanner();
setVendorSpecificValue(VALUE_CORD_OUTGOING_SOURCE_ID, value);
}
uint32_t PatchCordProxy::getTalkerID()
{
getContextBanner();
return getVendorSpecificValue(VALUE_CORD_INCOMING_SOURCE_ID);
}
void PatchCordProxy::getContextBanner()
{
DBusMessage* message = dbus_message_new_method_call(
SERVICE_NAME, OBJECT_PATH,
INTERFACE_NAME, "getContextList");
const char* name = AUTOPATCH_LINK_NAME;
dbus_message_append_args(message,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_UINT32, &number,
DBUS_TYPE_INVALID);
DBusPendingCall* pending;
if (dbus_connection_send_with_reply(connection, message, &pending, -1))
{
dbus_connection_flush(connection);
dbus_message_unref(message);
dbus_pending_call_block(pending);
message = dbus_pending_call_steal_reply(pending);
char** array;
int count;
if ((dbus_message_get_args(message, NULL,
DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &array, &count,
DBUS_TYPE_INVALID)) &&
(count > 0))
{
free(banner);
banner = strdup(*array);
dbus_free_string_array(array);
}
dbus_pending_call_unref(pending);
}
dbus_message_unref(message);
}
void PatchCordProxy::setVendorSpecificValue(uint32_t key, uint32_t value)
{
DBusMessage* message = dbus_message_new_method_call(
SERVICE_NAME, OBJECT_PATH,
INTERFACE_NAME, "setVendorSpecificValue");
dbus_message_append_args(message,
DBUS_TYPE_STRING, &banner,
DBUS_TYPE_UINT32, &key,
DBUS_TYPE_UINT32, &value,
DBUS_TYPE_INVALID);
DBusPendingCall* pending;
if (dbus_connection_send_with_reply(connection, message, &pending, -1))
{
dbus_connection_flush(connection);
dbus_message_unref(message);
dbus_pending_call_block(pending);
message = dbus_pending_call_steal_reply(pending);
dbus_pending_call_unref(pending);
}
dbus_message_unref(message);
// Each call of dbus_message_unref removes banner from the heap
banner = NULL;
}
uint32_t PatchCordProxy::getVendorSpecificValue(uint32_t key)
{
DBusMessage* message = dbus_message_new_method_call(
SERVICE_NAME, OBJECT_PATH,
INTERFACE_NAME, "getContextData");
dbus_message_append_args(message,
DBUS_TYPE_STRING, &banner,
DBUS_TYPE_INVALID);
uint32_t value = 0;
DBusPendingCall* pending;
if (dbus_connection_send_with_reply(connection, message, &pending, -1))
{
dbus_connection_flush(connection);
dbus_message_unref(message);
dbus_pending_call_block(pending);
message = dbus_pending_call_steal_reply(pending);
const char* name;
const char* address;
dbus_uint32_t type;
dbus_uint32_t state;
dbus_uint32_t number;
dbus_uint32_t* values;
int count;
if (dbus_message_get_args(message, NULL,
DBUS_TYPE_STRING, &banner,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_UINT32, &type,
DBUS_TYPE_UINT32, &number,
DBUS_TYPE_STRING, &address,
DBUS_TYPE_UINT32, &state,
DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &values, &count,
DBUS_TYPE_INVALID))
value = values[key];
dbus_pending_call_unref(pending);
}
dbus_message_unref(message);
// Each call of dbus_message_unref removes banner from the heap
banner = NULL;
return value;
}

View file

@ -0,0 +1,31 @@
// Copyright 2015 by Artem Prilutskiy
#ifndef PATCHCORDPROXY_H
#define PATCHCORDPROXY_H
#include <stdint.h>
#include <dbus/dbus.h>
class PatchCordProxy
{
public:
PatchCordProxy(uint32_t number);
~PatchCordProxy();
void setTalkerID(uint32_t value);
uint32_t getTalkerID();
private:
DBusConnection* connection;
uint32_t number;
char* banner;
void getContextBanner();
void setVendorSpecificValue(uint32_t key, uint32_t value);
uint32_t getVendorSpecificValue(uint32_t key);
};
#endif

View file

@ -0,0 +1,137 @@
// Copyright 2015 by Artem Prilutskiy
#include "UserDataStore.h"
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <syslog.h>
#define GET_ID_FOR_CALL 0
#define GET_CREDENTIALS_FOR_ID 1
UserDataStore::UserDataStore(const char* file) :
connection(NULL)
{
const char* queries[] =
{
// GET_ID_FOR_CALL
"SELECT `ID`"
" FROM Users"
" WHERE `Call` = ?"
" ORDER BY `Priority`"
" LIMIT 1",
// GET_CREDENTIALS_FOR_ID
"SELECT `Call`, `Text`"
" FROM Users"
" WHERE `ID` = ?",
};
connection = mysql_init(NULL);
mysql_options(connection, MYSQL_READ_DEFAULT_FILE, realpath(file, NULL));
mysql_real_connect(connection, NULL, NULL, NULL, NULL, 0, NULL, CLIENT_REMEMBER_OPTIONS);
my_bool active = true;
mysql_options(connection, MYSQL_OPT_RECONNECT, &active);
for (size_t index = 0; index < PREPARED_STATEMENT_COUNT; index ++)
{
const char* query = queries[index];
statements[index] = mysql_stmt_init(connection);
mysql_stmt_prepare(statements[index], query, strlen(query));
}
const char* error = mysql_error(connection);
if ((error != NULL) && (*error != '\0'))
syslog(LOG_CRIT, "MySQL error: %s\n", error);
}
UserDataStore::~UserDataStore()
{
for (size_t index = 0; index < PREPARED_STATEMENT_COUNT; index ++)
mysql_stmt_close(statements[index]);
mysql_close(connection);
}
// Public methods
uint32_t UserDataStore::getPrivateIDForCall(const char* call)
{
uint32_t number;
size_t length = strlen(call);
return
execute(GET_ID_FOR_CALL, 1, 1,
MYSQL_TYPE_STRING, call, length,
MYSQL_TYPE_LONG, &number) *
number;
}
bool UserDataStore::getCredentialsForID(uint32_t number, char* call, char* text)
{
return
execute(GET_CREDENTIALS_FOR_ID, 1, 2,
MYSQL_TYPE_LONG, &number,
MYSQL_TYPE_STRING, call, LONG_CALLSIGN_LENGTH + 1,
MYSQL_TYPE_STRING, text, SLOW_DATA_TEXT_LENGTH + 1);
}
// Internals
MYSQL_BIND* UserDataStore::bind(int count, va_list* arguments)
{
MYSQL_BIND* bindings = NULL;
if (count > 0)
{
bindings = (MYSQL_BIND*)calloc(count, sizeof(MYSQL_BIND));
for (int index = 0; index < count; index ++)
{
int type = va_arg(*arguments, int);
bindings[index].buffer_type = (enum_field_types)type;
bindings[index].buffer = va_arg(*arguments, void*);
if ((type == MYSQL_TYPE_STRING) ||
(type == MYSQL_TYPE_DATETIME))
{
bindings[index].buffer_length = va_arg(*arguments, int);
bindings[index].length = &bindings[index].buffer_length;
}
}
}
return bindings;
}
bool UserDataStore::execute(int index, int count1, int count2, ...)
{
bool result = true;
MYSQL_STMT* statement = statements[index];
va_list arguments;
va_start(arguments, count2);
MYSQL_BIND* parameters = bind(count1, &arguments);
MYSQL_BIND* columns = bind(count2, &arguments);
va_end(arguments);
if ((parameters && mysql_stmt_bind_param(statement, parameters)) ||
(columns && mysql_stmt_bind_result(statement, columns)) ||
mysql_stmt_execute(statement) ||
(columns && mysql_stmt_store_result(statement)))
{
const char* error = mysql_stmt_error(statement);
syslog(LOG_CRIT, "MySQL error while processing statement %d: %s\n", index, error);
result = false;
}
if (result && columns)
{
result = !mysql_stmt_fetch(statement);
mysql_stmt_free_result(statement);
}
free(columns);
free(parameters);
return result;
}

View file

@ -0,0 +1,35 @@
// Copyright 2015 by Artem Prilutskiy
#ifndef USERDATASTORE_H
#define USERDATASTORE_H
#include <stdint.h>
#include <stdarg.h>
#include <mysql/mysql.h>
#define PREPARED_STATEMENT_COUNT 2
#define LONG_CALLSIGN_LENGTH 8
#define SLOW_DATA_TEXT_LENGTH 20
class UserDataStore
{
public:
UserDataStore(const char* file);
~UserDataStore();
uint32_t getPrivateIDForCall(const char* call);
bool getCredentialsForID(uint32_t number, char* call, char* text);
protected:
MYSQL* connection;
MYSQL_STMT* statements[PREPARED_STATEMENT_COUNT];
MYSQL_BIND* bind(int count, va_list* arguments);
bool execute(int index, int count1, int count2, ...);
};
#endif

45
SVXLink/readme.txt Normal file
View file

@ -0,0 +1,45 @@
SVXLink patch to bridge with BrandMeister
Copyright 2015 by Artem Prilutskiy
-----------------------------------------
Put UserDataStore.*, PatchCordProxy.* and BrandMeisterBridge.* into src/modules/echolink
Add following lines to CMakeLists.txt after "set(MODSRC QsoImpl.cpp)":
pkg_check_modules(DBUS dbus-1)
include_directories(${DBUS_INCLUDE_DIRS})
set(LIBS ${LIBS} ${DBUS_LIBRARIES} mysqlclient)
set(MODSRC ${MODSRC} PatchCordProxy.cpp UserDataStore.cpp BrandMeisterBridge.cpp)
Add following lines to ModuleEchoLink.h:
[#include "BrandMeisterBridge.h"]
after
[#include "version/SVXLINK.h"]
[BrandMeisterBridge bridge;]
after
[private:]
Add following lines to method "ModuleEchoLink::broadcastTalkerStatus" of ModuleEchoLink.cpp:
[const char* sysop_name = bridge.getTalker();]
before
[msg << "> " << mycall << " " << sysop_name << "\n\n";]
[bridge.setTalker(talker->remoteCallsign().c_str(), talker->remoteName().c_str());]
before
[msg << "> " << talker->remoteCallsign() << " " << talker->remoteName() << "\n\n";]
Add following lines to method "ModuleEchoLink::onChatMsgReceived" of ModuleEchoLink.cpp:
[bridge.handleChatMessage(escaped.c_str());]
before
[processEvent(ss.str());]
Configuration of bridge are hand-coded inside BrandMeisterBridge.cpp:
Please configure PatchCord to number 10 in BrandMeister.conf
Configuration of MySQL connection should be placed in /opt/BrandMeister/Registry.cnf

58
SVXLink/svxlink.conf Normal file
View file

@ -0,0 +1,58 @@
###############################################################################
# #
# Configuration file for the SvxLink server #
# #
###############################################################################
[GLOBAL]
MODULE_PATH=/opt/SVXLink/lib/svxlink
CFG_DIR=/opt/SVXLink/etc/svxlink/svxlink.d
LOGICS=SimplexLogic
TIMESTAMP_FORMAT="%c"
CARD_SAMPLE_RATE=16000
[SimplexLogic]
TYPE=Simplex
RX=Rx1
TX=Tx1
MODULES=ModuleEchoLink
EVENT_HANDLER=/opt/SVXLink/share/svxlink/events.tcl
SQL_DET=VOX
SQL_START_DELAY=0
SQL_DELAY=0
SQL_HANGTIME=2000
VOX_FILTER_DEPTH=20
VOX_THRESH=1000
CALLSIGN=R3ABM-L
SHORT_IDENT_INTERVAL=60
LONG_IDENT_INTERVAL=60
EVENT_HANDLER=/opt/SVXLink/share/svxlink/events.tcl
DEFAULT_LANG=ru_RU
RGR_SOUND_DELAY=0
FX_GAIN_NORMAL=0
FX_GAIN_LOW=-12
[Rx1]
TYPE=Local
AUDIO_DEV=alsa:dsp0
AUDIO_CHANNEL=0
SQL_DET=VOX
SQL_START_DELAY=0
SQL_DELAY=0
SQL_HANGTIME=2000
VOX_FILTER_DEPTH=20
VOX_THRESH=1000
DTMF_DEC_TYPE=INTERNAL
DEEMPHASIS=0
PEAK_METER=1
[Tx1]
TYPE=Local
AUDIO_DEV=alsa:dsp1
AUDIO_CHANNEL=0
PTT_TYPE=NONE
TIMEOUT=300
TX_DELAY=500
PREEMPHASIS=0

17
SVXLink/svxlink.service Normal file
View file

@ -0,0 +1,17 @@
[Unit]
Description=SvxLink Server
After=network.target sound.target brandmeister.service
[Service]
Restart=always
KillMode=process
ExecStart=/opt/SVXLink/bin/svxlink config=/opt/SVXLink/etc/svxlink/svxlink.conf logfile=/opt/SVXLink/var/log/svxlink
RestartSec=5
TimeoutSec=5
User=svxlink
Group=svxlink
Environment="HOME=/opt/SVXLink"
[Install]
WantedBy=multi-user.target

17
Scripts/alterfrn.service Normal file
View file

@ -0,0 +1,17 @@
[Unit]
Description=AlterFRN Client
Afer=network.target sound.target
[Service]
; system.service
Type=simple
ExecStart=/opt/AlterFRN/alterfrn.sh
Restart=on-failure
; system.exec
User=frn
Group=frn
StandardOutput=null
WorkingDirectory=/opt/AlterFRN
[Install]
WantedBy=multi-user.target

2
Scripts/alterfrn.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/bash
./FRNClientConsole | ./callcapture --identity AlterFRN --expression "RX is started: ([A-Z0-9]{3,7})[-,]" --connection Registry.cnf --link 11

51
Scripts/asound.conf Normal file
View file

@ -0,0 +1,51 @@
# Record device for SVXLink
pcm.convert1 {
type rate
slave {
pcm "hw:Loopback,1,2"
rate 8000
}
}
pcm.dsp0 {
type plug
slave {
pcm "convert1"
rate 16000
}
}
# Playback device for SVXLink
pcm.convert2 {
type rate
slave {
pcm "hw:Loopback,0,0"
rate 8000
}
}
pcm.dsp1 {
type plug
slave {
pcm "convert2"
rate 16000
}
}
# Record device for AlterFRN
pcm.dsp2 {
type plug
slave.pcm "hw:Loopback,1,6"
}
# Playback device for AlterFRN
pcm.dsp3 {
type plug
slave.pcm "hw:Loopback,0,4"
}

168
Scripts/frnconsole.cfg.unix Normal file
View file

@ -0,0 +1,168 @@
# Конфигурационный файл программы FRN-линка (FRNClientConsole)
# Configuration for FRN-link (FRNClientConsole)
# основное руководство тут http://alterfrn.ucoz.ru/index/freebsd_manual_russian/0-5
# main manual here http://alterfrn.ucoz.ru/index/freebsd_manual_russian/0-5
#
# примечания для ARM/Linux тут http://alterfrn.ucoz.ru/index/linux_arm_manual_russian/0-6
# comments for ARM/Linux here http://alterfrn.ucoz.ru/index/linux_arm_manual_russian/0-6
# Ревизия(revision) r2781
[Auth]
Callsign=MY0CALL
OperatorName=Name
EMailAddress=my@email
City=N/A
CityPart=
Password=password
DynamicPassword=
Country=Russian Federation
Description=DSTAR.SU DMR Bridge
BandChannel=
ClientType=CROSSLINK
CharsetName=WINDOWS-1251
[Audio]
#### Имя устройства ввода звука в формате вывода по параметрам командной строки "audioconfig"
#### Input audio device name like output with command line parameter "audioconfig"
InDevice=ALSA:dsp2
## Частота дискретизации звука при ввода:
## 8000(рекомендуется, не требуется преобразования), 11025, 12000, 16000,
## 22050, 24000, 32000, 44100(по умолчанию), 48000
## Input (capture) sample rate:
## 8000(recommended, no need samplerate conversion), 11025, 12000, 16000,
## 22050, 24000, 32000, 44100(default), 48000
InSampleRate=8000
#### Качество преобразования частоты дискретизации в 8Кгц: 0/NONE/NO/N - совсем без качества(по умолчанию); 1/LOW/LO/L - низкое качество; 2/MEDIUM/MED/M - среднее качество; 3/HIGH/HI/H - высокое качество(высокая нагрузка процессора)
#### Quality for input(capture) audio samplerate conversion into 8KHz: 0/NONE/NO/N - no any quality(default); 1/LOW/LO/L - low quality; 2/MEDIUM/MED/M - medium quality; 3/HIGH/HI/H - high qualityо(highest CPU usage)
InQuality=L
InFactor=1
# Автоматическая регулировка усиления (АРУ) по входу с радиостанции
# Input (capture) Automatic Gain Control (AGC)
InAGCEnabled=no
# level after AGC in percents(%), range 50..100; default 90
InAGCLevel=99
# AGC maximal gain in decibells(dB), range 0..60; default 30
InAGCMaxGain=20
# Входной фильтр высоких частот Баттерворта, частота среза 300Гц; перед АРУ
# Input High Pass Filter, Butterworth, 300Hz; before AGC
InHPFEnabled=no
InHPFOrder=5
InHPFDouble=no
#### Имя устройства вывода звука в формате вывода по параметрам командной строки "audioconfig"
#### Output audio device name like output with command line parameter "audioconfig"
OutDevice=ALSA:dsp3
## Частота дискретизации звука при выводе:
## 8000(рекомендуется, не требуется преобразования), 11025, 12000, 16000,
## 22050, 24000, 32000, 44100(по умолчанию), 48000
## Output (playback) sample rate:
## 8000(recommended, no need samplerate conversion), 11025, 12000, 16000,
## 22050, 24000, 32000, 44100(default), 48000
OutSampleRate=8000
#### Качество преобразования частоты дискретизации из 8КГц: 0/NONE/NO/N - совсем без качества(по умолчанию); 1/LOW/LO/L - низкое качество; 2/MEDIUM/MED/M - среднее качество; 3/HIGH/HI/H - высокое качество(высокая нагрузка процессора)
#### Quality for output(playback) audio conversion from 8KHz: 0/NONE/NO/N - no any quality(default); 1/LOW/LO/L - low quality; 2/MEDIUM/MED/M - medium quality; 3/HIGH/HI/H - high qualityо(highest CPU usage)
OutQuality=L
OutFactor=1
# Автоматическая регулировка усиления (АРУ) по выходу на радиостанцию
# Output (playback) Automatic Gain Control (AGC)
OutAGCEnabled=no
# level after AGC in percents(%), range 50..100; default 90
OutAGCLevel=99
# AGC maximal gain in decibells(dB), range 0..60; default 30
OutAGCMaxGain=40
# Выходной фильтр высоких частот Баттерворта, частота среза 300Гц; перед АРУ
# Output High Pass Filter, Butterworth, 300Hz; before AGC
OutHPFEnabled=no
OutHPFOrder=5
OutHPFDouble=no
[Radio]
PTT=
COS=VOX:1200
LIGHT=
CTCSSWakeTime=500
CarrierCatchTime=100
CarrierLostTime=600
[Server]
ServerReconnectCount=3
ServerReconnectInterval=3000
ServerAddress=frn.radiocult.ru
ServerPort=10024
CharsetName=WINDOWS-1251
#### VisibleStatus: Visible status in server list of clients: AVAILABLE/AV (default), NOTAVAILABLE/NA, ABSENT/AB/AS
VisibleStatus=AV
Network=Radiocult
BackupServerMode=YES
ForcedBackupServerAddress=frn3.radiocult.ru
ForcedBackupServerPort=10027
[Manager]
ManagerAddress=sysman.freeradionetwork.eu
ManagerPort=10025
DynamicPasswordMode=YES
[Internet]
#### ProxyType: режим использования прокси-сервера: NONE/NO/N - прокси не используется (по умолчанию); SYSTEM/SYS/S - используется прокси в соответствии с настройками системы; HTTP/HT/H - используется конкретный прокси
## ProxyType: mode for proxy-server usage: NONE/NO/N - do not use proxy-server (default); SYSTEM/SYS/S - use system settings for proxy; HTTP/HT/H - use certain http-proxy
ProxyType=NONE
# ProxyAddress=192.168.1.1
# ProxyPort=3128
# CharsetName=UTF-8
[Message]
PrivateAutoResponse=
[Sounds]
SoundsDir=
SoundCourtesy=
EnableCourtesy=
SoundCourtesyEmptyNet=
EnableCourtesyEmptyNet=
SoundRoger=
EnableRoger=
SoundNoConnection=
EnableNoConnection=
SoundReject=
EnableReject=
SoundError=
EnableError=
[System]
CharsetName=UTF-8
[Hours]
Enabled=no
[Informer]
Enabled=no
Dir=informer
Interval=1200
Mode=SEQ
SilenceEnabled=no
SilenceInterval=300
SilenceTime=2000