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 <netdb.h>
#include <iostream>
#include <fstream>
#include <future>
#include <exception>
#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"))
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);

@ -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];

@ -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
}

@ -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
}

Loading…
Cancel
Save

Powered by TurnKey Linux.