different way to qnvoice

pull/5/head
Tom Early 8 years ago
parent 1feb7cd1bf
commit ccb31872f7

@ -41,6 +41,8 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#include <iostream>
#include <fstream>
#include <future> #include <future>
#include <exception> #include <exception>
#include <atomic> #include <atomic>
@ -682,6 +684,8 @@ bool CQnetLink::read_config(const char *cfgFile)
if (! get_value(cfg, "file.status", status_file, 2, FILENAME_MAX, "/usr/local/etc/RPTR_STATUS.txt")) if (! get_value(cfg, "file.status", status_file, 2, FILENAME_MAX, "/usr/local/etc/RPTR_STATUS.txt"))
return true; return true;
get_value(cfg, "file.qnvoicefile", qnvoice_file, 2, FILENAME_MAX, "/tmp/qnvoice.txt");
get_value(cfg, "timing.play.delay", delay_between, 9, 25, 19); get_value(cfg, "timing.play.delay", delay_between, 9, 25, 19);
get_value(cfg, "link.acknowledge", bool_rptr_ack, true); get_value(cfg, "link.acknowledge", bool_rptr_ack, true);
@ -1254,6 +1258,26 @@ void CQnetLink::Process()
time(&hb); time(&hb);
} }
// play a qnvoice file if it is specified
std::ifstream voicefile(qnvoice_file.c_str(), std::ifstream::in);
if (voicefile) {
char line[FILENAME_MAX];
voicefile.getline(line, FILENAME_MAX);
// trim whitespace
char *start = line;
while (isspace(*start))
start++;
char *end = start + strlen(start) - 1;
while (isspace(*end))
*end-- = (char)0;
// anthing reasonable left?
if (strlen(start) > 2)
audio_notify(start);
//clean-up
voicefile.close();
remove(qnvoice_file.c_str());
}
FD_ZERO(&fdset); FD_ZERO(&fdset);
FD_SET(xrf_g2_sock,&fdset); FD_SET(xrf_g2_sock,&fdset);
FD_SET(dcs_g2_sock,&fdset); FD_SET(dcs_g2_sock,&fdset);

@ -81,7 +81,7 @@ private:
bool get_value(const Config &cfg, const char *path, std::string &value, int min, int max, const char *default_value); bool get_value(const Config &cfg, const char *path, std::string &value, int min, int max, const char *default_value);
/* configuration data */ /* configuration data */
std::string login_call, owner, to_g2_external_ip, my_g2_link_ip, gwys, status_file, announce_dir; std::string login_call, owner, to_g2_external_ip, my_g2_link_ip, gwys, status_file, qnvoice_file, announce_dir;
bool only_admin_login, only_link_unlink, qso_details, bool_rptr_ack, announce; bool only_admin_login, only_link_unlink, qso_details, bool_rptr_ack, announce;
int rmt_xrf_port, rmt_ref_port, rmt_dcs_port, my_g2_link_port, to_g2_external_port, delay_between, delay_before; int rmt_xrf_port, rmt_ref_port, rmt_dcs_port, my_g2_link_port, to_g2_external_port, delay_between, delay_before;
char link_at_startup[CALL_SIZE+1]; char link_at_startup[CALL_SIZE+1];

@ -285,6 +285,7 @@ file = {
# status = "/usr/local/etc/rptr_status" # where repeater status info is passed between services # status = "/usr/local/etc/rptr_status" # where repeater status info is passed between services
# DTMF = "/tmp" # # DTMF = "/tmp" #
# echotest = "/tmp" # echo dat files will end up here # echotest = "/tmp" # echo dat files will end up here
# qnvoicefile = /tmp/qnvoice.txt # where qnvoice will create the play command
# gwys = "/usr/local/etc/gwys.txt" # where the list of gateways and reflectors (with ports) is. # gwys = "/usr/local/etc/gwys.txt" # where the list of gateways and reflectors (with ports) is.
# announce_dir = "/usr/local/etc" # where are the *.dat files for the verbal link, unlink, etc. announcements # announce_dir = "/usr/local/etc" # where are the *.dat files for the verbal link, unlink, etc. announcements
} }

@ -31,7 +31,7 @@ module = {
# 23 cm module will use "a" # 23 cm module will use "a"
# 70 cm module will use "b" # 70 cm module will use "b"
# 2 M module will use "c" # 2 M module will use "c"
# type = "icom" # you must define at least one module by uncommenting the type # type = "icom" # you must define at least one module by uncommenting the type
# ip = "172.16.0.20" # all icom modules should have the same IP address # ip = "172.16.0.20" # all icom modules should have the same IP address
# port = 20000 # all icom modules should have the same UDP port # port = 20000 # all icom modules should have the same UDP port
# frequency = 0 # in MHz, if you specify here, this frequency will show up on the QuadNet USER GATEWAYS webpage # frequency = 0 # in MHz, if you specify here, this frequency will show up on the QuadNet USER GATEWAYS webpage
@ -114,6 +114,7 @@ file = {
# status = "/usr/local/etc/rptr_status" # where repeater status info is passed between services # status = "/usr/local/etc/rptr_status" # where repeater status info is passed between services
# DTMF = "/tmp" # # DTMF = "/tmp" #
# echotest = "/tmp" # echo dat files will end up here # echotest = "/tmp" # echo dat files will end up here
# qnvoicefile = /tmp/qnvoice.txt # where qnvoice will create the play command
# gwys = "/usr/local/etc/gwys.txt" # where the list of gateways and reflectors (with ports) is. # gwys = "/usr/local/etc/gwys.txt" # where the list of gateways and reflectors (with ports) is.
# announce_dir = "/usr/local/etc" # where are the *.dat files for the verbal link, unlink, etc. announcements # announce_dir = "/usr/local/etc" # where are the *.dat files for the verbal link, unlink, etc. announcements
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.