diff --git a/QnetLink.cpp b/QnetLink.cpp index fab70d6..402a414 100644 --- a/QnetLink.cpp +++ b/QnetLink.cpp @@ -41,6 +41,8 @@ #include #include +#include +#include #include #include #include @@ -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")) 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, "link.acknowledge", bool_rptr_ack, true); @@ -1254,6 +1258,26 @@ void CQnetLink::Process() 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_SET(xrf_g2_sock,&fdset); FD_SET(dcs_g2_sock,&fdset); diff --git a/QnetLink.h b/QnetLink.h index 51a057a..1f6ef3b 100644 --- a/QnetLink.h +++ b/QnetLink.h @@ -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); /* 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; 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]; diff --git a/qn.everything.cfg b/qn.everything.cfg index ca3cc03..4408baf 100644 --- a/qn.everything.cfg +++ b/qn.everything.cfg @@ -285,6 +285,7 @@ file = { # status = "/usr/local/etc/rptr_status" # where repeater status info is passed between services # DTMF = "/tmp" # # 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. # announce_dir = "/usr/local/etc" # where are the *.dat files for the verbal link, unlink, etc. announcements } diff --git a/qn.icom.cfg b/qn.icom.cfg index 3fe812b..a80488c 100644 --- a/qn.icom.cfg +++ b/qn.icom.cfg @@ -31,7 +31,7 @@ module = { # 23 cm module will use "a" # 70 cm module will use "b" # 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 # 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 @@ -114,6 +114,7 @@ file = { # status = "/usr/local/etc/rptr_status" # where repeater status info is passed between services # DTMF = "/tmp" # # 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. # announce_dir = "/usr/local/etc" # where are the *.dat files for the verbal link, unlink, etc. announcements }